1
0
Fork 0
forked from wry/wry

wayland: add capabilities to jay_compositor

This commit is contained in:
Julian Orth 2024-04-19 11:37:48 +02:00
parent c6b189b07d
commit f0600917ff
4 changed files with 43 additions and 0 deletions

View file

@ -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<Self>,
}
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,

View file

@ -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 {}

View file

@ -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 {

View file

@ -88,3 +88,7 @@ event seat {
id: u32,
name: str,
}
event capabilities {
cap: array(pod(u16)),
}