gtk3/SOURCES/0003-shortcutwindow-Differentiate-keypad-better.patch

50 lines
1.6 KiB
Diff

From 246e865d4d36612ee890327b723b224250d4e9fa Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Wed, 2 Jul 2025 10:09:33 -0400
Subject: [PATCH 3/3] shortcutwindow: Differentiate keypad better
Arrange for keypad +-/* to show up as "KP +", and so on.
Part-of: <https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/8743>
---
gtk/gtkshortcutlabel.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/gtk/gtkshortcutlabel.c b/gtk/gtkshortcutlabel.c
index bfacbd391e..e3fb13e877 100644
--- a/gtk/gtkshortcutlabel.c
+++ b/gtk/gtkshortcutlabel.c
@@ -128,7 +128,7 @@ get_labels (guint key, GdkModifierType modifier, guint *n_mods)
{
const gchar *labels[16];
GList *freeme = NULL;
- gchar key_label[6];
+ gchar key_label[16];
gchar *tmp;
gunichar ch;
gint i = 0;
@@ -181,8 +181,18 @@ get_labels (guint key, GdkModifierType modifier, guint *n_mods)
labels[i++] = C_("keyboard label", "Backslash");
break;
default:
- memset (key_label, 0, 6);
- g_unichar_to_utf8 (g_unichar_toupper (ch), key_label);
+ memset (key_label, 0, sizeof (key_label));
+ if (key >= GDK_KEY_KP_Space && key <= GDK_KEY_KP_9)
+ {
+ key_label[0] = 'K';
+ key_label[1] = 'P';
+ key_label[2] = ' ';
+ g_unichar_to_utf8 (g_unichar_toupper (ch), key_label + 3);
+ }
+ else
+ {
+ g_unichar_to_utf8 (g_unichar_toupper (ch), key_label);
+ }
labels[i++] = key_label;
break;
}
--
2.50.0