1
0
Fork 0
forked from wry/wry

wayland: implement xdg_toplevel.wm_capabilities

This commit is contained in:
Julian Orth 2022-06-01 23:32:56 +02:00
parent 6e244a08ab
commit 615d1953aa
4 changed files with 26 additions and 2 deletions

View file

@ -8,7 +8,7 @@ use {
wl_surface::{ wl_surface::{
xdg_surface::{ xdg_surface::{
xdg_popup::{XdgPopup, XdgPopupError}, xdg_popup::{XdgPopup, XdgPopupError},
xdg_toplevel::XdgToplevel, xdg_toplevel::{XdgToplevel, WM_CAPABILITIES_SINCE},
}, },
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError, CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
}, },
@ -217,6 +217,9 @@ impl XdgSurface {
track!(self.surface.client, toplevel); track!(self.surface.client, toplevel);
self.surface.client.add_client_obj(&toplevel)?; self.surface.client.add_client_obj(&toplevel)?;
self.ext.set(Some(toplevel.clone())); self.ext.set(Some(toplevel.clone()));
if self.base.version >= WM_CAPABILITIES_SINCE {
toplevel.send_wm_capabilities();
}
self.surface.set_toplevel(Some(toplevel)); self.surface.set_toplevel(Some(toplevel));
Ok(()) Ok(())
} }

View file

@ -61,6 +61,16 @@ const STATE_TILED_RIGHT: u32 = 6;
const STATE_TILED_TOP: u32 = 7; const STATE_TILED_TOP: u32 = 7;
const STATE_TILED_BOTTOM: u32 = 8; 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)] #[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum Decoration { pub enum Decoration {
#[allow(dead_code)] #[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> { fn destroy(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let _req: Destroy = self.xdg.surface.client.parse(self.deref(), parser)?; let _req: Destroy = self.xdg.surface.client.parse(self.deref(), parser)?;
self.tl_destroy(); self.tl_destroy();

View file

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

View file

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