InputRelay: adapt to wlroots breaking change

This wlroots breaking change wasn't mentioned in the changelog :/

Fixes a crash when doing pretty much anything with an input method.
This commit is contained in:
Isaac Freund
2026-03-28 11:03:42 +01:00
parent 47b64bda73
commit f1230e8ec9
2 changed files with 10 additions and 13 deletions

View File

@@ -17,8 +17,8 @@
.hash = "wayland-0.4.0-lQa1khbMAQAsLS2eBR7M5lofyEGPIbu2iFDmoz8lPC27",
},
.wlroots = .{
.url = "git+https://codeberg.org/ifreund/zig-wlroots?ref=master#6ffee8b21d24e0e4aadcf204f65ebe7ad3c3bacf",
.hash = "wlroots-0.20.0-dev-jmOlclseBABjKSxVH4TVkN4Fm-moidbybTStGsujJU_m",
.url = "git+https://codeberg.org/ifreund/zig-wlroots?ref=master#149c17476ccec90b9904d6a1a8d38858d4ac925f",
.hash = "wlroots-0.20.0-dev-jmOlckAeBACoYWj_Hs3JdREUrmKQDTj3d_P76C1HAHgz",
},
.xkbcommon = .{
.url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.3.0.tar.gz",

View File

@@ -47,14 +47,11 @@ input_popups: wl.list.Head(InputPopup, .link),
text_input: ?*TextInput = null,
input_method_commit: wl.Listener(void) = .init(handleInputMethodCommit),
grab_keyboard: wl.Listener(*wlr.InputMethodV2.KeyboardGrab) =
wl.Listener(*wlr.InputMethodV2.KeyboardGrab).init(handleInputMethodGrabKeyboard),
grab_keyboard: wl.Listener(*wlr.InputMethodV2.KeyboardGrab) = .init(handleInputMethodGrabKeyboard),
input_method_destroy: wl.Listener(void) = .init(handleInputMethodDestroy),
input_method_new_popup: wl.Listener(*wlr.InputPopupSurfaceV2) =
wl.Listener(*wlr.InputPopupSurfaceV2).init(handleInputMethodNewPopup),
input_method_new_popup: wl.Listener(*wlr.InputPopupSurfaceV2) = .init(handleInputMethodNewPopup),
grab_keyboard_destroy: wl.Listener(*wlr.InputMethodV2.KeyboardGrab) =
wl.Listener(*wlr.InputMethodV2.KeyboardGrab).init(handleInputMethodGrabKeyboardDestroy),
grab_keyboard_destroy: wl.Listener(void) = .init(handleInputMethodGrabKeyboardDestroy),
pub fn init(relay: *InputRelay) void {
relay.* = .{ .text_inputs = undefined, .input_popups = undefined };
@@ -157,15 +154,15 @@ fn handleInputMethodNewPopup(
};
}
fn handleInputMethodGrabKeyboardDestroy(
listener: *wl.Listener(*wlr.InputMethodV2.KeyboardGrab),
keyboard_grab: *wlr.InputMethodV2.KeyboardGrab,
) void {
fn handleInputMethodGrabKeyboardDestroy(listener: *wl.Listener(void)) void {
const relay: *InputRelay = @fieldParentPtr("grab_keyboard_destroy", listener);
const input_method = relay.input_method.?;
const keyboard_grab = input_method.keyboard_grab.?;
relay.grab_keyboard_destroy.link.remove();
if (keyboard_grab.keyboard) |keyboard| {
keyboard_grab.input_method.seat.keyboardNotifyModifiers(&keyboard.modifiers);
input_method.seat.keyboardNotifyModifiers(&keyboard.modifiers);
}
}