Differentiate KP keys in shortcut window better

Resolves: RHEL-4098
This commit is contained in:
Matthias Clasen 2025-07-02 13:07:35 -04:00
parent ee5ec126d3
commit 3e2d217dbe
3 changed files with 83 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From bbf893ba560462ec60255badea9098c759598dc7 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Wed, 2 Jul 2025 10:06:38 -0400
Subject: [PATCH 2/3] accellabel: Differentiate keypad better
Arrange for all keypad keysyms to get a "KP" prefix, including +-*/.
Part-of: <https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/8743>
---
gtk/gtkaccellabel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 75b27a8726..2f6e901392 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -884,7 +884,7 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
g_string_append (gstring, klass->mod_separator);
if (accelerator_key >= GDK_KEY_KP_Space &&
- accelerator_key <= GDK_KEY_KP_Equal)
+ accelerator_key <= GDK_KEY_KP_9)
{
/* Translators: "KP" means "numeric key pad". This string will
* be used in accelerators such as "Ctrl+Shift+KP 1" in menus,
--
2.50.0

View File

@ -0,0 +1,49 @@
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

View File

@ -19,7 +19,7 @@
Name: gtk3
Version: 3.24.31
Release: 7%{?dist}
Release: 8%{?dist}
Summary: GTK+ graphical user interface library
License: LGPLv2+
@ -45,6 +45,8 @@ Patch6: 0001-dnd-Prevent-a-possible-segfault.patch
Patch7: remove-size-allocation-critical.patch
# https://issues.redhat.com/browse/RHEL-4098
Patch8: 0001-Differentiate-keypad-keysyms-in-accelerators.patch
Patch9: 0002-accellabel-Differentiate-keypad-better.patch
Path10: 0003-shortcutwindow-Differentiate-keypad-better.patch
BuildRequires: pkgconfig(atk) >= %{atk_version}
BuildRequires: pkgconfig(atk-bridge-2.0)
@ -312,6 +314,9 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache &>/dev/null || :
%{_datadir}/installed-tests/
%changelog
* Tue Jul 2 2025 Matthias Clasen <mclasen@redhat.com> - 3.24.31-8
- Resolves: RHEL-4098
* Tue Jun 10 2025 Matthias Clasen <mclasen@redhat.com> - 3.24.31-7
- Dummy commit to get ci to rerun
- Related: RHEL-4098