st: Use case-insensitive shortcuts

For shortcuts that involve a letter (like <ctrl>c), we currently only
accept the lower-case variant. This makes shortcuts awkward to use when
caps-lock is active, and is inconsistent with GTK+, so accept upper-case
variants as well.

https://bugzilla.gnome.org/show_bug.cgi?id=766325
This commit is contained in:
Florian Müllner 2016-05-12 15:08:21 +02:00
parent b7867fe44c
commit 387f5143f0

View File

@ -608,6 +608,8 @@ st_entry_key_press_event (ClutterActor *actor,
/* paste */ /* paste */
if (((event->modifier_state & CLUTTER_CONTROL_MASK) if (((event->modifier_state & CLUTTER_CONTROL_MASK)
&& event->keyval == CLUTTER_KEY_v) || && event->keyval == CLUTTER_KEY_v) ||
((event->modifier_state & CLUTTER_CONTROL_MASK)
&& event->keyval == CLUTTER_KEY_V) ||
((event->modifier_state & CLUTTER_SHIFT_MASK) ((event->modifier_state & CLUTTER_SHIFT_MASK)
&& event->keyval == CLUTTER_KEY_Insert)) && event->keyval == CLUTTER_KEY_Insert))
{ {
@ -625,7 +627,7 @@ st_entry_key_press_event (ClutterActor *actor,
/* copy */ /* copy */
if ((event->modifier_state & CLUTTER_CONTROL_MASK) if ((event->modifier_state & CLUTTER_CONTROL_MASK)
&& event->keyval == CLUTTER_KEY_c && && (event->keyval == CLUTTER_KEY_c || event->keyval == CLUTTER_KEY_C) &&
clutter_text_get_password_char ((ClutterText*) priv->entry) == 0) clutter_text_get_password_char ((ClutterText*) priv->entry) == 0)
{ {
StClipboard *clipboard; StClipboard *clipboard;
@ -646,7 +648,7 @@ st_entry_key_press_event (ClutterActor *actor,
/* cut */ /* cut */
if ((event->modifier_state & CLUTTER_CONTROL_MASK) if ((event->modifier_state & CLUTTER_CONTROL_MASK)
&& event->keyval == CLUTTER_KEY_x && && (event->keyval == CLUTTER_KEY_x || event->keyval == CLUTTER_KEY_X) &&
clutter_text_get_password_char ((ClutterText*) priv->entry) == 0) clutter_text_get_password_char ((ClutterText*) priv->entry) == 0)
{ {
StClipboard *clipboard; StClipboard *clipboard;
@ -671,8 +673,8 @@ st_entry_key_press_event (ClutterActor *actor,
/* delete to beginning of line */ /* delete to beginning of line */
if ((event->modifier_state & CLUTTER_CONTROL_MASK) if ((event->modifier_state & CLUTTER_CONTROL_MASK) &&
&& event->keyval == CLUTTER_KEY_u) (event->keyval == CLUTTER_KEY_u || event->keyval == CLUTTER_KEY_U))
{ {
int pos = clutter_text_get_cursor_position ((ClutterText *)priv->entry); int pos = clutter_text_get_cursor_position ((ClutterText *)priv->entry);
clutter_text_delete_text ((ClutterText *)priv->entry, 0, pos); clutter_text_delete_text ((ClutterText *)priv->entry, 0, pos);
@ -682,8 +684,8 @@ st_entry_key_press_event (ClutterActor *actor,
/* delete to end of line */ /* delete to end of line */
if ((event->modifier_state & CLUTTER_CONTROL_MASK) if ((event->modifier_state & CLUTTER_CONTROL_MASK) &&
&& event->keyval == CLUTTER_KEY_k) (event->keyval == CLUTTER_KEY_k || event->keyval == CLUTTER_KEY_K))
{ {
ClutterTextBuffer *buffer = clutter_text_get_buffer ((ClutterText *)priv->entry); ClutterTextBuffer *buffer = clutter_text_get_buffer ((ClutterText *)priv->entry);
int pos = clutter_text_get_cursor_position ((ClutterText *)priv->entry); int pos = clutter_text_get_cursor_position ((ClutterText *)priv->entry);