From 6b7dd1479df769a84e407759e73d137a0f444605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlad=20P=C4=83n=C4=83zan?= Date: Sat, 28 Oct 2023 14:59:54 +0200 Subject: [PATCH 1/2] apprt/gtk: handle non-unicode keyvals --- src/apprt/gtk/Surface.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index 054c736e5..a4cf91860 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -14,6 +14,7 @@ const CoreSurface = @import("../../Surface.zig"); const App = @import("App.zig"); const Window = @import("Window.zig"); const inspector = @import("inspector.zig"); +const gtk_key = @import("key.zig"); const c = @import("c.zig"); const log = std.log.scoped(.gtk); @@ -905,6 +906,10 @@ fn keyEvent( } } + if (gtk_key.keyFromKeyval(keyval)) |key| { + break :key key; + } + break :key physical_key; } else .invalid; From c2adf2285825faa723bccb9cca29658ac210ea37 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 28 Oct 2023 08:42:35 -0700 Subject: [PATCH 2/2] apprt/gtk: comment on what is going on with keyval mapping --- 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 a4cf91860..60296d7e8 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -906,6 +906,8 @@ fn keyEvent( } } + // Before using the physical key, try to convert the keyval + // directly to a key. This allows the use of key remapping. if (gtk_key.keyFromKeyval(keyval)) |key| { break :key key; }