Keyboard: don't send enter before keymap event
It's unclear if this is technically a violation of the protocol or not, but it makes little sense to do this and many clients in the wild crash if wl_keyboard.enter is sent before wl_keyboard.keymap.
This commit is contained in:
parent
ec8f57e704
commit
c9838c31b6
@ -75,8 +75,24 @@ pub fn deinit(self: *Self) void {
|
||||
self.key.link.remove();
|
||||
self.modifiers.link.remove();
|
||||
|
||||
const seat = self.device.seat;
|
||||
const wlr_keyboard = self.device.wlr_device.toKeyboard();
|
||||
|
||||
self.device.deinit();
|
||||
|
||||
// If the currently active keyboard of a seat is destroyed we need to set
|
||||
// a new active keyboard. Otherwise wlroots may send an enter event without
|
||||
// first having sent a keymap event if Seat.keyboardNotifyEnter() is called
|
||||
// before a new active keyboard is set.
|
||||
if (seat.wlr_seat.getKeyboard() == wlr_keyboard) {
|
||||
var it = server.input_manager.devices.iterator(.forward);
|
||||
while (it.next()) |device| {
|
||||
if (device.seat == seat and device.wlr_device.type == .keyboard) {
|
||||
seat.wlr_seat.setKeyboard(device.wlr_device.toKeyboard());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.* = undefined;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user