From f0600917ff20b3304b6cf18c7185869e1df5e2ad Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Fri, 19 Apr 2024 11:37:48 +0200 Subject: [PATCH] wayland: add capabilities to jay_compositor --- src/ifs/jay_compositor.rs | 14 ++++++++++++++ src/it/test_ifs/test_jay_compositor.rs | 12 ++++++++++++ src/wl_usr/usr_ifs/usr_jay_compositor.rs | 13 +++++++++++++ wire/jay_compositor.txt | 4 ++++ 4 files changed, 43 insertions(+) diff --git a/src/ifs/jay_compositor.rs b/src/ifs/jay_compositor.rs index eb714db3..d529ebfc 100644 --- a/src/ifs/jay_compositor.rs +++ b/src/ifs/jay_compositor.rs @@ -44,6 +44,7 @@ impl JayCompositorGlobal { }); track!(client, obj); client.add_client_obj(&obj)?; + obj.send_capabilities(); Ok(()) } } @@ -72,7 +73,20 @@ pub struct JayCompositor { tracker: Tracker, } +pub struct Cap; + +impl Cap { + pub const NONE: u16 = 0; +} + impl JayCompositor { + fn send_capabilities(&self) { + self.client.event(Capabilities { + self_id: self.id, + cap: &[Cap::NONE], + }); + } + fn take_screenshot_impl( &self, id: JayScreenshotId, diff --git a/src/it/test_ifs/test_jay_compositor.rs b/src/it/test_ifs/test_jay_compositor.rs index bd0570db..53887664 100644 --- a/src/it/test_ifs/test_jay_compositor.rs +++ b/src/it/test_ifs/test_jay_compositor.rs @@ -74,12 +74,24 @@ impl TestJayCompositor { self.tran.client_id.set(ClientId::from_raw(ev.client_id)); Ok(()) } + + fn handle_seat(&self, parser: MsgParser<'_, '_>) -> Result<(), TestError> { + let _ev = Seat::parse_full(parser)?; + Ok(()) + } + + fn handle_capabilities(&self, parser: MsgParser<'_, '_>) -> Result<(), TestError> { + let _ev = Capabilities::parse_full(parser)?; + Ok(()) + } } test_object! { TestJayCompositor, JayCompositor; CLIENT_ID => handle_client_id, + SEAT => handle_seat, + CAPABILITIES => handle_capabilities, } impl TestObject for TestJayCompositor {} diff --git a/src/wl_usr/usr_ifs/usr_jay_compositor.rs b/src/wl_usr/usr_ifs/usr_jay_compositor.rs index b69ce0c9..2e1bdf35 100644 --- a/src/wl_usr/usr_ifs/usr_jay_compositor.rs +++ b/src/wl_usr/usr_ifs/usr_jay_compositor.rs @@ -1,5 +1,6 @@ use { crate::{ + ifs::jay_compositor::Cap, utils::{ buffd::{MsgParser, MsgParserError}, clonecell::CloneCell, @@ -126,6 +127,17 @@ impl UsrJayCompositor { } Ok(()) } + + fn capabilities(&self, parser: MsgParser<'_, '_>) -> Result<(), MsgParserError> { + let ev: Capabilities = self.con.parse(self, parser)?; + for &cap in ev.cap { + match cap { + Cap::NONE => {} + _ => {} + } + } + Ok(()) + } } usr_object_base! { @@ -133,6 +145,7 @@ usr_object_base! { CLIENT_ID => client_id, SEAT => seat, + CAPABILITIES => capabilities, } impl UsrObject for UsrJayCompositor { diff --git a/wire/jay_compositor.txt b/wire/jay_compositor.txt index c38e3d8c..bcafcef1 100644 --- a/wire/jay_compositor.txt +++ b/wire/jay_compositor.txt @@ -88,3 +88,7 @@ event seat { id: u32, name: str, } + +event capabilities { + cap: array(pod(u16)), +}