diff --git a/src/ifs/wl_surface/xdg_surface.rs b/src/ifs/wl_surface/xdg_surface.rs index 55580ab3..a24da62d 100644 --- a/src/ifs/wl_surface/xdg_surface.rs +++ b/src/ifs/wl_surface/xdg_surface.rs @@ -8,7 +8,7 @@ use { wl_surface::{ xdg_surface::{ xdg_popup::{XdgPopup, XdgPopupError}, - xdg_toplevel::XdgToplevel, + xdg_toplevel::{XdgToplevel, WM_CAPABILITIES_SINCE}, }, CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError, }, @@ -217,6 +217,9 @@ impl XdgSurface { track!(self.surface.client, toplevel); self.surface.client.add_client_obj(&toplevel)?; self.ext.set(Some(toplevel.clone())); + if self.base.version >= WM_CAPABILITIES_SINCE { + toplevel.send_wm_capabilities(); + } self.surface.set_toplevel(Some(toplevel)); Ok(()) } diff --git a/src/ifs/wl_surface/xdg_surface/xdg_toplevel.rs b/src/ifs/wl_surface/xdg_surface/xdg_toplevel.rs index 4fec5444..7ed7f77d 100644 --- a/src/ifs/wl_surface/xdg_surface/xdg_toplevel.rs +++ b/src/ifs/wl_surface/xdg_surface/xdg_toplevel.rs @@ -61,6 +61,16 @@ const STATE_TILED_RIGHT: u32 = 6; const STATE_TILED_TOP: u32 = 7; const STATE_TILED_BOTTOM: u32 = 8; +#[allow(dead_code)] +const CAP_WINDOW_MENU: u32 = 1; +#[allow(dead_code)] +const CAP_MAXIMIZE: u32 = 2; +const CAP_FULLSCREEN: u32 = 3; +#[allow(dead_code)] +const CAP_MINIMIZE: u32 = 4; + +pub const WM_CAPABILITIES_SINCE: u32 = 5; + #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum Decoration { #[allow(dead_code)] @@ -164,6 +174,13 @@ impl XdgToplevel { }) } + pub fn send_wm_capabilities(&self) { + self.xdg.surface.client.event(WmCapabilities { + self_id: self.id, + capabilities: &[CAP_FULLSCREEN], + }) + } + fn destroy(self: &Rc, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> { let _req: Destroy = self.xdg.surface.client.parse(self.deref(), parser)?; self.tl_destroy(); diff --git a/src/ifs/xdg_wm_base.rs b/src/ifs/xdg_wm_base.rs index b4fd8160..551b7514 100644 --- a/src/ifs/xdg_wm_base.rs +++ b/src/ifs/xdg_wm_base.rs @@ -117,7 +117,7 @@ impl Global for XdgWmBaseGlobal { } fn version(&self) -> u32 { - 3 + 5 } } diff --git a/wire/xdg_toplevel.txt b/wire/xdg_toplevel.txt index 82140b09..fdbbd70f 100644 --- a/wire/xdg_toplevel.txt +++ b/wire/xdg_toplevel.txt @@ -72,3 +72,7 @@ msg configure_bounds = 2 { width: i32, height: i32, } + +msg wm_capabilities = 3 { + capabilities: array(u32), +}