Ignore case in key event
If a new accelerator that involves the shift + another key (such as "<Shift>A") is added, key press event will never match that accelerator, because the key value will be the one corresponding capital letter, while the stored value will be the lowercase letter, as a result of the call to gkt_accelerator_parse(). Signed-off-by: Eduardo Lima (Etrunko) <eblima@gmail.com>
This commit is contained in:
committed by
Eduardo Lima (Etrunko)
parent
5c5aacd9da
commit
2a3e66a764
@@ -305,6 +305,7 @@ key_handle_key_press (GtkWidget *wid, GdkEventKey *evt, session *sess)
|
|||||||
struct key_binding *kb;
|
struct key_binding *kb;
|
||||||
int n;
|
int n;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
guint upper, lower;
|
||||||
|
|
||||||
/* where did this event come from? */
|
/* where did this event come from? */
|
||||||
list = sess_list;
|
list = sess_list;
|
||||||
@@ -333,9 +334,12 @@ key_handle_key_press (GtkWidget *wid, GdkEventKey *evt, session *sess)
|
|||||||
list = keybind_list;
|
list = keybind_list;
|
||||||
while (list)
|
while (list)
|
||||||
{
|
{
|
||||||
|
upper = lower = 0;
|
||||||
|
gdk_keyval_convert_case(evt->keyval, &upper, &lower);
|
||||||
kb = (struct key_binding*)list->data;
|
kb = (struct key_binding*)list->data;
|
||||||
|
|
||||||
if (kb->keyval == evt->keyval && kb->mod == key_modifier_get_valid (evt->state))
|
if ((kb->keyval == evt->keyval || kb->keyval == upper || kb->keyval == lower) &&
|
||||||
|
kb->mod == key_modifier_get_valid (evt->state))
|
||||||
{
|
{
|
||||||
if (kb->action < 0 || kb->action > KEY_MAX_ACTIONS)
|
if (kb->action < 0 || kb->action > KEY_MAX_ACTIONS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user