From eb8fc910e05ef780b5edfd542a7492288f92fa18 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Tue, 12 Dec 2023 16:43:55 -0600 Subject: [PATCH] gtk: get num_lock state for key events GTK doesn't expose the num_lock state via the key press event, this must be obtained directly from the device. Set the num_lock state in the modifier mask. This also will never show up as a `consumed_mod`, so we don't bother setting it there. Signed-off-by: Tim Culverhouse --- src/apprt/gtk/Surface.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index 80180b543..6eb4e73d1 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -1376,6 +1376,8 @@ fn keyEvent( else => {}, } + const device = c.gdk_event_get_device(event); + mods.num_lock = c.gdk_device_get_num_lock_state(device) == 1; break :mods mods; };