seat: keep track of serials that are allowed to steal keyboard focus
This commit is contained in:
parent
324540c41e
commit
18bddbc987
4 changed files with 21 additions and 1 deletions
|
|
@ -1041,6 +1041,18 @@ impl WlSeatGlobal {
|
|||
ei_seat.regions_changed();
|
||||
});
|
||||
}
|
||||
|
||||
#[expect(dead_code)]
|
||||
pub fn handle_focus_request(self: &Rc<Self>, client: &Client, node: Rc<dyn Node>, serial: u64) {
|
||||
let Some(max_serial) = client.focus_stealing_serial.get() else {
|
||||
return;
|
||||
};
|
||||
let serial = serial.min(max_serial);
|
||||
if serial <= self.keyboard_node_serial.get() {
|
||||
return;
|
||||
}
|
||||
self.focus_node_with_serial(node, serial);
|
||||
}
|
||||
}
|
||||
|
||||
impl CursorUserOwner for WlSeatGlobal {
|
||||
|
|
|
|||
|
|
@ -1150,7 +1150,10 @@ impl WlSeatGlobal {
|
|||
) {
|
||||
let (state, pressed) = match state {
|
||||
KeyState::Released => (wl_pointer::RELEASED, false),
|
||||
KeyState::Pressed => (wl_pointer::PRESSED, true),
|
||||
KeyState::Pressed => {
|
||||
surface.client.focus_stealing_serial.set(Some(serial));
|
||||
(wl_pointer::PRESSED, true)
|
||||
}
|
||||
};
|
||||
let time = (time_usec / 1000) as u32;
|
||||
self.surface_pointer_event(Version::ALL, surface, |p| {
|
||||
|
|
@ -1372,6 +1375,7 @@ impl WlSeatGlobal {
|
|||
y: Fixed,
|
||||
) {
|
||||
let serial = surface.client.next_serial();
|
||||
surface.client.focus_stealing_serial.set(Some(serial));
|
||||
let time = (time_usec / 1000) as _;
|
||||
self.surface_touch_event(Version::ALL, surface, |t| {
|
||||
t.send_down(serial, time, surface.id, id, x, y)
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ impl TabletTool {
|
|||
tool.send_frame(time);
|
||||
});
|
||||
if state == ToolButtonState::Pressed {
|
||||
n.client.focus_stealing_serial.set(Some(serial.get()));
|
||||
if let Some(node) = n.get_focus_node(self.tablet.seat.id) {
|
||||
self.tablet.seat.focus_node_with_serial(node, serial.get());
|
||||
}
|
||||
|
|
@ -259,6 +260,7 @@ impl TabletTool {
|
|||
});
|
||||
if let Some(changes) = changes {
|
||||
if changes.down == Some(true) {
|
||||
n.client.focus_stealing_serial.set(Some(serial.get()));
|
||||
if let Some(node) = n.get_focus_node(self.tablet.seat.id) {
|
||||
self.tablet.seat.focus_node_with_serial(node, serial.get());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue