Differentiate keypad keysyms in accelerators
When displaying accelerators, differentiate keypad symbols with a 'KP' prefix. Fixing a 17 year old bug. Backport of c58d9446f40b36136f25baf.
This commit is contained in:
parent
4c77925af6
commit
6cc0552ab8
@ -883,6 +883,17 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
|
|||||||
if (seen_mod)
|
if (seen_mod)
|
||||||
g_string_append (gstring, klass->mod_separator);
|
g_string_append (gstring, klass->mod_separator);
|
||||||
|
|
||||||
|
if (accelerator_key >= GDK_KEY_KP_Space &&
|
||||||
|
accelerator_key <= GDK_KEY_KP_Equal)
|
||||||
|
{
|
||||||
|
/* Translators: "KP" means "numeric key pad". This string will
|
||||||
|
* be used in accelerators such as "Ctrl+Shift+KP 1" in menus,
|
||||||
|
* and therefore the translation needs to be very short.
|
||||||
|
*/
|
||||||
|
g_string_append (gstring, C_("keyboard label", "KP"));
|
||||||
|
g_string_append (gstring, " ");
|
||||||
|
}
|
||||||
|
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
case ' ':
|
case ' ':
|
||||||
|
@ -55,6 +55,8 @@ test_one_accel (const char *accel,
|
|||||||
*keycodes,
|
*keycodes,
|
||||||
mods);
|
mods);
|
||||||
|
|
||||||
|
g_print ("accel %s, label %s\n", accel, label);
|
||||||
|
|
||||||
g_assert_cmpstr (label, ==, exp_label);
|
g_assert_cmpstr (label, ==, exp_label);
|
||||||
|
|
||||||
name = gtk_accelerator_name_with_keycode (NULL,
|
name = gtk_accelerator_name_with_keycode (NULL,
|
||||||
@ -83,13 +85,13 @@ accel2 (void)
|
|||||||
static void
|
static void
|
||||||
accel3 (void)
|
accel3 (void)
|
||||||
{
|
{
|
||||||
test_one_accel ("KP_7", "7", TRUE);
|
test_one_accel ("KP_7", "KP 7", TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
accel4 (void)
|
accel4 (void)
|
||||||
{
|
{
|
||||||
test_one_accel ("<Primary>KP_7", "Ctrl+7", TRUE);
|
test_one_accel ("<Primary>KP_7", "Ctrl+KP 7", TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user