Skip to content

Commit

Permalink
Properly bump the XdgWmBase protocol version
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
danieldg authored and wash2 committed Oct 31, 2023
1 parent b8bdd4e commit 1500dc8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/shell/xdg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub struct XdgPositioner(xdg_positioner::XdgPositioner);

impl XdgPositioner {
pub fn new(
wm_base: &impl ProvidesBoundGlobal<xdg_wm_base::XdgWmBase, 4>,
wm_base: &impl ProvidesBoundGlobal<xdg_wm_base::XdgWmBase, 5>,
) -> Result<Self, GlobalError> {
wm_base
.bound_global()
Expand Down Expand Up @@ -240,7 +240,7 @@ impl XdgShellSurface {
/// [`XdgSurface`]: xdg_surface::XdgSurface
/// [`WlSurface`]: wl_surface::WlSurface
pub fn new<U, D>(
wm_base: &impl ProvidesBoundGlobal<xdg_wm_base::XdgWmBase, 4>,
wm_base: &impl ProvidesBoundGlobal<xdg_wm_base::XdgWmBase, 5>,
qh: &QueueHandle<D>,
surface: impl Into<Surface>,
udata: U,
Expand Down Expand Up @@ -307,8 +307,14 @@ impl Drop for XdgShellSurface {
}
}

// Version 4 adds the configure_bounds event, which is a break
impl ProvidesBoundGlobal<xdg_wm_base::XdgWmBase, 4> for XdgShell {
// Version 5 adds the wm_capabilities event, which is a break
impl ProvidesBoundGlobal<xdg_wm_base::XdgWmBase, 5> for XdgShell {
fn bound_global(&self) -> Result<xdg_wm_base::XdgWmBase, GlobalError> {
Ok(self.xdg_wm_base.clone())
}
}

impl ProvidesBoundGlobal<xdg_wm_base::XdgWmBase, 6> for XdgShell {
fn bound_global(&self) -> Result<xdg_wm_base::XdgWmBase, GlobalError> {
Ok(self.xdg_wm_base.clone())
}
Expand Down
4 changes: 2 additions & 2 deletions src/shell/xdg/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Popup {
position: &xdg_positioner::XdgPositioner,
qh: &QueueHandle<D>,
compositor: &impl ProvidesBoundGlobal<WlCompositor, 6>,
wm_base: &impl ProvidesBoundGlobal<xdg_wm_base::XdgWmBase, 4>,
wm_base: &impl ProvidesBoundGlobal<xdg_wm_base::XdgWmBase, 5>,
) -> Result<Popup, GlobalError>
where
D: Dispatch<wl_surface::WlSurface, SurfaceData>
Expand All @@ -78,7 +78,7 @@ impl Popup {
position: &xdg_positioner::XdgPositioner,
qh: &QueueHandle<D>,
surface: impl Into<Surface>,
wm_base: &impl ProvidesBoundGlobal<xdg_wm_base::XdgWmBase, 4>,
wm_base: &impl ProvidesBoundGlobal<xdg_wm_base::XdgWmBase, 5>,
) -> Result<Popup, GlobalError>
where
D: Dispatch<xdg_surface::XdgSurface, PopupData>
Expand Down

0 comments on commit 1500dc8

Please sign in to comment.