64 lines
1.6 KiB
Diff
64 lines
1.6 KiB
Diff
From 7e74e79da8ef92e1800fc451ac0b9bc5aaada184 Mon Sep 17 00:00:00 2001
|
|
From: meizhigang <meizhigang@kylinsec.com.cn>
|
|
Date: Fri, 9 Jun 2023 15:19:34 +0800
|
|
Subject: [PATCH] fix(media-keys):Fix grap keys while set capital letters
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
-兼容快捷键设置的大写字母
|
|
|
|
Related #I7C0TD
|
|
|
|
Signed-off-by: meizhigang <meizhigang@kylinsec.com.cn>
|
|
---
|
|
plugins/common/eggaccelerators.c | 25 ++++++++++++++++++++++++-
|
|
1 file changed, 24 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/plugins/common/eggaccelerators.c b/plugins/common/eggaccelerators.c
|
|
index 9662a3f..2099eca 100644
|
|
--- a/plugins/common/eggaccelerators.c
|
|
+++ b/plugins/common/eggaccelerators.c
|
|
@@ -197,6 +197,22 @@ is_keycode (const gchar *string)
|
|
(string[1] == 'x'));
|
|
}
|
|
|
|
+static guint
|
|
+get_single_letter_keyval(gchar ch)
|
|
+{
|
|
+ gchar str[2] = {0};
|
|
+ if (ch >= 'A' && ch <= 'Z')
|
|
+ {
|
|
+ snprintf(str, 2, "%c", tolower(ch));
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ snprintf(str, 2, "%c", ch);
|
|
+ }
|
|
+
|
|
+ return gdk_keyval_from_name (str);
|
|
+}
|
|
+
|
|
/**
|
|
* egg_accelerator_parse_virtual:
|
|
* @accelerator: string representing an accelerator
|
|
@@ -346,7 +362,14 @@ egg_accelerator_parse_virtual (const gchar *accelerator,
|
|
}
|
|
else
|
|
{
|
|
- keyval = gdk_keyval_from_name (accelerator);
|
|
+ if (len == 1)
|
|
+ {
|
|
+ keyval = get_single_letter_keyval(*accelerator);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ keyval = gdk_keyval_from_name (accelerator);
|
|
+ }
|
|
|
|
if (keyval == 0)
|
|
{
|
|
--
|
|
2.27.0
|
|
|