Skip to content

Commit

Permalink
wayland: add capabilities to jay_compositor
Browse files Browse the repository at this point in the history
  • Loading branch information
mahkoh committed Apr 19, 2024
1 parent c6b189b commit f060091
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/ifs/jay_compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ impl JayCompositorGlobal {
});
track!(client, obj);
client.add_client_obj(&obj)?;
obj.send_capabilities();
Ok(())
}
}
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 12 additions & 0 deletions src/it/test_ifs/test_jay_compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
13 changes: 13 additions & 0 deletions src/wl_usr/usr_ifs/usr_jay_compositor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use {
crate::{
ifs::jay_compositor::Cap,
utils::{
buffd::{MsgParser, MsgParserError},
clonecell::CloneCell,
Expand Down Expand Up @@ -126,13 +127,25 @@ 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! {
UsrJayCompositor, JayCompositor;

CLIENT_ID => client_id,
SEAT => seat,
CAPABILITIES => capabilities,
}

impl UsrObject for UsrJayCompositor {
Expand Down
4 changes: 4 additions & 0 deletions wire/jay_compositor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,7 @@ event seat {
id: u32,
name: str,
}

event capabilities {
cap: array(pod(u16)),
}

0 comments on commit f060091

Please sign in to comment.