xwayland: Allow eavesdropping on certain keyboard/pointer events
This commit is contained in:
parent
23f51eb150
commit
cbc4ad6fc2
6 changed files with 330 additions and 24 deletions
|
|
@ -274,12 +274,12 @@ fn update_focus_state(
|
|||
}
|
||||
}
|
||||
|
||||
let serial = serial.unwrap_or_else(|| SERIAL_COUNTER.next_serial());
|
||||
state
|
||||
.common
|
||||
.xwayland_notify_focus_change(target.cloned(), serial);
|
||||
ActiveFocus::set(seat, target.cloned());
|
||||
keyboard.set_focus(
|
||||
state,
|
||||
target.cloned(),
|
||||
serial.unwrap_or_else(|| SERIAL_COUNTER.next_serial()),
|
||||
);
|
||||
keyboard.set_focus(state, target.cloned(), serial);
|
||||
std::mem::drop(keyboard);
|
||||
|
||||
//update the focused output or set it to the active output
|
||||
|
|
|
|||
|
|
@ -28,9 +28,12 @@ use smithay::{
|
|||
},
|
||||
Seat,
|
||||
},
|
||||
reexports::wayland_server::{backend::ObjectId, protocol::wl_surface::WlSurface, Resource},
|
||||
reexports::wayland_server::{
|
||||
backend::ObjectId, protocol::wl_surface::WlSurface, Client, Resource,
|
||||
},
|
||||
utils::{IsAlive, Logical, Point, Serial, Transform},
|
||||
wayland::{seat::WaylandFocus, session_lock::LockSurface},
|
||||
xwayland::xwm::XwmId,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
|
|
@ -155,6 +158,15 @@ impl PointerFocusTarget {
|
|||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_client(&self, client: &Client) -> bool {
|
||||
match self {
|
||||
PointerFocusTarget::WlSurface { surface, .. } => {
|
||||
surface.client().is_some_and(|c| c == *client)
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl KeyboardFocusTarget {
|
||||
|
|
@ -167,6 +179,24 @@ impl KeyboardFocusTarget {
|
|||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_xwm(&self, xwm: XwmId) -> bool {
|
||||
match self {
|
||||
KeyboardFocusTarget::Element(mapped) => {
|
||||
if let Some(surface) = mapped.active_window().x11_surface() {
|
||||
return surface.xwm_id().unwrap() == xwm;
|
||||
}
|
||||
}
|
||||
KeyboardFocusTarget::Fullscreen(surface) => {
|
||||
if let Some(surface) = surface.x11_surface() {
|
||||
return surface.xwm_id().unwrap() == xwm;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue