portal: implement window capture
This commit is contained in:
parent
f0600917ff
commit
4e10415e5c
27 changed files with 840 additions and 136 deletions
|
|
@ -10,6 +10,7 @@ use {
|
|||
usr_ifs::{
|
||||
usr_jay_output::UsrJayOutput, usr_jay_pointer::UsrJayPointer,
|
||||
usr_jay_render_ctx::UsrJayRenderCtx, usr_jay_screencast::UsrJayScreencast,
|
||||
usr_jay_select_toplevel::UsrJaySelectToplevel,
|
||||
usr_jay_workspace_watcher::UsrJayWorkspaceWatcher, usr_wl_output::UsrWlOutput,
|
||||
usr_wl_seat::UsrWlSeat,
|
||||
},
|
||||
|
|
@ -17,13 +18,14 @@ use {
|
|||
UsrCon,
|
||||
},
|
||||
},
|
||||
std::rc::Rc,
|
||||
std::{cell::Cell, rc::Rc},
|
||||
};
|
||||
|
||||
pub struct UsrJayCompositor {
|
||||
pub id: JayCompositorId,
|
||||
pub con: Rc<UsrCon>,
|
||||
pub owner: CloneCell<Option<Rc<dyn UsrJayCompositorOwner>>>,
|
||||
pub window_capture: Cell<bool>,
|
||||
}
|
||||
|
||||
pub trait UsrJayCompositorOwner {
|
||||
|
|
@ -112,6 +114,21 @@ impl UsrJayCompositor {
|
|||
jp
|
||||
}
|
||||
|
||||
pub fn select_toplevel(&self, seat: &UsrWlSeat) -> Rc<UsrJaySelectToplevel> {
|
||||
let sc = Rc::new(UsrJaySelectToplevel {
|
||||
id: self.con.id(),
|
||||
con: self.con.clone(),
|
||||
owner: Default::default(),
|
||||
});
|
||||
self.con.request(SelectToplevel {
|
||||
self_id: self.id,
|
||||
id: sc.id,
|
||||
seat: seat.id,
|
||||
});
|
||||
self.con.add_object(sc.clone());
|
||||
sc
|
||||
}
|
||||
|
||||
fn client_id(&self, parser: MsgParser<'_, '_>) -> Result<(), MsgParserError> {
|
||||
let ev: ClientId = self.con.parse(self, parser)?;
|
||||
if let Some(owner) = self.owner.get() {
|
||||
|
|
@ -133,6 +150,7 @@ impl UsrJayCompositor {
|
|||
for &cap in ev.cap {
|
||||
match cap {
|
||||
Cap::NONE => {}
|
||||
Cap::WINDOW_CAPTURE => self.window_capture.set(true),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue