wayland: implement xdg_toplevel.wm_capabilities
This commit is contained in:
parent
6e244a08ab
commit
615d1953aa
4 changed files with 26 additions and 2 deletions
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue