1
0
Fork 0
forked from wry/wry

Merge pull request #39 from mahkoh/xdg-cap

This commit is contained in:
mahkoh 2022-07-11 10:35:04 +02:00 committed by GitHub
commit d4c4497043
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 2 deletions

View file

@ -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(())
}

View file

@ -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<Self>, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let _req: Destroy = self.xdg.surface.client.parse(self.deref(), parser)?;
self.tl_destroy();

View file

@ -117,7 +117,7 @@ impl Global for XdgWmBaseGlobal {
}
fn version(&self) -> u32 {
3
5
}
}

View file

@ -72,3 +72,7 @@ msg configure_bounds = 2 {
width: i32,
height: i32,
}
msg wm_capabilities = 3 {
capabilities: array(u32),
}