Support XDG Activation

Test XDG Activation
This commit is contained in:
bbb651 2025-03-03 00:18:27 +02:00 committed by Shawn Wallace
parent b34b08f004
commit 180efb0ba9
10 changed files with 413 additions and 27 deletions

View file

@ -540,7 +540,12 @@ impl HandleEvent for Pointer {
}
}
pub type Keyboard = GenericObject<WlKeyboard, client::wl_keyboard::WlKeyboard>;
pub struct Keyboard {
pub server: WlKeyboard,
pub client: client::wl_keyboard::WlKeyboard,
pub seat: client::wl_seat::WlSeat,
}
impl HandleEvent for Keyboard {
type Event = client::wl_keyboard::Event;
@ -557,7 +562,14 @@ impl HandleEvent for Keyboard {
.get(key)
.map(<_ as AsRef<SurfaceData>>::as_ref)
}) {
state.last_kb_serial = Some(serial);
state.last_kb_serial = Some((
state
.last_kb_serial
.take()
.and_then(|(seat, _)| (seat == self.seat).then_some(seat))
.unwrap_or_else(|| self.seat.clone()),
serial,
));
let output_name = data.get_output_name(state);
state.to_focus = Some(FocusData {
window: data.window.unwrap(),
@ -584,6 +596,22 @@ impl HandleEvent for Keyboard {
self.server.leave(serial, &data.server);
}
}
client::wl_keyboard::Event::Key {
serial,
time,
key,
state: key_state,
} => {
state.last_kb_serial = Some((
state
.last_kb_serial
.take()
.and_then(|(seat, _)| (seat == self.seat).then_some(seat))
.unwrap_or_else(|| self.seat.clone()),
serial,
));
self.server.key(serial, time, key, convert_wenum(key_state));
}
_ => simple_event_shunt! {
self.server, event: client::wl_keyboard::Event => [
Keymap {
@ -591,12 +619,6 @@ impl HandleEvent for Keyboard {
|fd| fd.as_fd(),
size
},
Key {
serial,
time,
key,
|state| convert_wenum(state)
},
Modifiers {
serial,
mods_depressed,