From 1500dc8dc82f809dcdcea900c3de86303e93f2e5 Mon Sep 17 00:00:00 2001 From: Daniel De Graaf Date: Wed, 18 Oct 2023 20:05:21 -0400 Subject: [PATCH] Properly bump the XdgWmBase protocol version Version 5 added a new event (wm_capabilities) to xdg_toplevel, making an API break from version 4 for anyone implementing event handlers on a toplevel. --- src/shell/xdg/mod.rs | 14 ++++++++++---- src/shell/xdg/popup.rs | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/shell/xdg/mod.rs b/src/shell/xdg/mod.rs index c1a442e63..45e4a8221 100644 --- a/src/shell/xdg/mod.rs +++ b/src/shell/xdg/mod.rs @@ -168,7 +168,7 @@ pub struct XdgPositioner(xdg_positioner::XdgPositioner); impl XdgPositioner { pub fn new( - wm_base: &impl ProvidesBoundGlobal, + wm_base: &impl ProvidesBoundGlobal, ) -> Result { wm_base .bound_global() @@ -240,7 +240,7 @@ impl XdgShellSurface { /// [`XdgSurface`]: xdg_surface::XdgSurface /// [`WlSurface`]: wl_surface::WlSurface pub fn new( - wm_base: &impl ProvidesBoundGlobal, + wm_base: &impl ProvidesBoundGlobal, qh: &QueueHandle, surface: impl Into, udata: U, @@ -307,8 +307,14 @@ impl Drop for XdgShellSurface { } } -// Version 4 adds the configure_bounds event, which is a break -impl ProvidesBoundGlobal for XdgShell { +// Version 5 adds the wm_capabilities event, which is a break +impl ProvidesBoundGlobal for XdgShell { + fn bound_global(&self) -> Result { + Ok(self.xdg_wm_base.clone()) + } +} + +impl ProvidesBoundGlobal for XdgShell { fn bound_global(&self) -> Result { Ok(self.xdg_wm_base.clone()) } diff --git a/src/shell/xdg/popup.rs b/src/shell/xdg/popup.rs index 2069b57cd..ef78c40b7 100644 --- a/src/shell/xdg/popup.rs +++ b/src/shell/xdg/popup.rs @@ -51,7 +51,7 @@ impl Popup { position: &xdg_positioner::XdgPositioner, qh: &QueueHandle, compositor: &impl ProvidesBoundGlobal, - wm_base: &impl ProvidesBoundGlobal, + wm_base: &impl ProvidesBoundGlobal, ) -> Result where D: Dispatch @@ -78,7 +78,7 @@ impl Popup { position: &xdg_positioner::XdgPositioner, qh: &QueueHandle, surface: impl Into, - wm_base: &impl ProvidesBoundGlobal, + wm_base: &impl ProvidesBoundGlobal, ) -> Result where D: Dispatch