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:
@@ -17,8 +17,8 @@
|
|||||||
.hash = "wayland-0.4.0-lQa1khbMAQAsLS2eBR7M5lofyEGPIbu2iFDmoz8lPC27",
|
.hash = "wayland-0.4.0-lQa1khbMAQAsLS2eBR7M5lofyEGPIbu2iFDmoz8lPC27",
|
||||||
},
|
},
|
||||||
.wlroots = .{
|
.wlroots = .{
|
||||||
.url = "git+https://codeberg.org/ifreund/zig-wlroots?ref=master#6ffee8b21d24e0e4aadcf204f65ebe7ad3c3bacf",
|
.url = "git+https://codeberg.org/ifreund/zig-wlroots?ref=master#149c17476ccec90b9904d6a1a8d38858d4ac925f",
|
||||||
.hash = "wlroots-0.20.0-dev-jmOlclseBABjKSxVH4TVkN4Fm-moidbybTStGsujJU_m",
|
.hash = "wlroots-0.20.0-dev-jmOlckAeBACoYWj_Hs3JdREUrmKQDTj3d_P76C1HAHgz",
|
||||||
},
|
},
|
||||||
.xkbcommon = .{
|
.xkbcommon = .{
|
||||||
.url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.3.0.tar.gz",
|
.url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.3.0.tar.gz",
|
||||||
|
|||||||
@@ -47,14 +47,11 @@ input_popups: wl.list.Head(InputPopup, .link),
|
|||||||
text_input: ?*TextInput = null,
|
text_input: ?*TextInput = null,
|
||||||
|
|
||||||
input_method_commit: wl.Listener(void) = .init(handleInputMethodCommit),
|
input_method_commit: wl.Listener(void) = .init(handleInputMethodCommit),
|
||||||
grab_keyboard: wl.Listener(*wlr.InputMethodV2.KeyboardGrab) =
|
grab_keyboard: wl.Listener(*wlr.InputMethodV2.KeyboardGrab) = .init(handleInputMethodGrabKeyboard),
|
||||||
wl.Listener(*wlr.InputMethodV2.KeyboardGrab).init(handleInputMethodGrabKeyboard),
|
|
||||||
input_method_destroy: wl.Listener(void) = .init(handleInputMethodDestroy),
|
input_method_destroy: wl.Listener(void) = .init(handleInputMethodDestroy),
|
||||||
input_method_new_popup: wl.Listener(*wlr.InputPopupSurfaceV2) =
|
input_method_new_popup: wl.Listener(*wlr.InputPopupSurfaceV2) = .init(handleInputMethodNewPopup),
|
||||||
wl.Listener(*wlr.InputPopupSurfaceV2).init(handleInputMethodNewPopup),
|
|
||||||
|
|
||||||
grab_keyboard_destroy: wl.Listener(*wlr.InputMethodV2.KeyboardGrab) =
|
grab_keyboard_destroy: wl.Listener(void) = .init(handleInputMethodGrabKeyboardDestroy),
|
||||||
wl.Listener(*wlr.InputMethodV2.KeyboardGrab).init(handleInputMethodGrabKeyboardDestroy),
|
|
||||||
|
|
||||||
pub fn init(relay: *InputRelay) void {
|
pub fn init(relay: *InputRelay) void {
|
||||||
relay.* = .{ .text_inputs = undefined, .input_popups = undefined };
|
relay.* = .{ .text_inputs = undefined, .input_popups = undefined };
|
||||||
@@ -157,15 +154,15 @@ fn handleInputMethodNewPopup(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handleInputMethodGrabKeyboardDestroy(
|
fn handleInputMethodGrabKeyboardDestroy(listener: *wl.Listener(void)) void {
|
||||||
listener: *wl.Listener(*wlr.InputMethodV2.KeyboardGrab),
|
|
||||||
keyboard_grab: *wlr.InputMethodV2.KeyboardGrab,
|
|
||||||
) void {
|
|
||||||
const relay: *InputRelay = @fieldParentPtr("grab_keyboard_destroy", listener);
|
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();
|
relay.grab_keyboard_destroy.link.remove();
|
||||||
|
|
||||||
if (keyboard_grab.keyboard) |keyboard| {
|
if (keyboard_grab.keyboard) |keyboard| {
|
||||||
keyboard_grab.input_method.seat.keyboardNotifyModifiers(&keyboard.modifiers);
|
input_method.seat.keyboardNotifyModifiers(&keyboard.modifiers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user