Replace screencopy with ext-image-copy-capture-v1
This commit is contained in:
parent
fec4b3c235
commit
2fe5897db0
10 changed files with 545 additions and 575 deletions
|
|
@ -4,10 +4,13 @@ use std::{collections::HashSet, sync::Mutex};
|
|||
|
||||
use smithay::{
|
||||
output::Output,
|
||||
reexports::wayland_server::{
|
||||
backend::{ClientId, GlobalId},
|
||||
protocol::{wl_output::WlOutput, wl_surface::WlSurface},
|
||||
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource, Weak,
|
||||
reexports::{
|
||||
wayland_protocols::ext::foreign_toplevel_list::v1::server::ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1,
|
||||
wayland_server::{
|
||||
backend::{ClientId, GlobalId},
|
||||
protocol::{wl_output::WlOutput, wl_surface::WlSurface},
|
||||
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource, Weak,
|
||||
},
|
||||
},
|
||||
utils::{user_data::UserDataMap, IsAlive, Logical, Rectangle},
|
||||
wayland::foreign_toplevel_list::{
|
||||
|
|
@ -633,6 +636,26 @@ pub fn window_from_handle<W: Window + 'static>(handle: ZcosmicToplevelHandleV1)
|
|||
.and_then(|state| state.lock().unwrap().window.clone())
|
||||
}
|
||||
|
||||
pub fn window_from_ext_handle<'a, W: Window + 'static, D>(
|
||||
state: &'a D,
|
||||
foreign_toplevel: &ExtForeignToplevelHandleV1,
|
||||
) -> Option<&'a W>
|
||||
where
|
||||
D: ToplevelInfoHandler<Window = W>,
|
||||
{
|
||||
let handle = ForeignToplevelHandle::from_resource(foreign_toplevel)?;
|
||||
state.toplevel_info_state().toplevels.iter().find(|w| {
|
||||
w.user_data().get::<ToplevelState>().and_then(|inner| {
|
||||
inner
|
||||
.lock()
|
||||
.unwrap()
|
||||
.foreign_handle
|
||||
.as_ref()
|
||||
.map(|handle| handle.identifier())
|
||||
}) == Some(handle.identifier())
|
||||
})
|
||||
}
|
||||
|
||||
macro_rules! delegate_toplevel_info {
|
||||
($(@<$( $lt:tt $( : $clt:tt $(+ $dlt:tt )* )? ),+>)? $ty: ty, $window: ty) => {
|
||||
smithay::reexports::wayland_server::delegate_global_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue