Blob Blame History Raw
From 0c7e70e4d9b57bcaa26922051d9fc49ebed20af8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@gmail.com>
Date: Thu, 26 Sep 2013 16:29:51 +0200
Subject: [PATCH] hotkeys: send modifiers before non-modifier key

This fixes the "send menu" for hotkeys set with non-modifiers keys. The
current order of press events is wrong, as it sends first non-modifiers
keys, and in general ctrl+t will work, t+ctrl will not.

https://bugzilla.redhat.com/show_bug.cgi?id=922716
(cherry picked from commit b80e7f0f2d59dabc6d0e969e8d481e624fa8f67c)
---
 src/virt-viewer-window.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index abe3aa9..2a91fba 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -629,12 +629,10 @@ accel_key_to_keys(const GtkAccelKey *key)
     guint val;
     GArray *a = g_array_new(FALSE, FALSE, sizeof(guint));
 
-    val = key->accel_key;
-    g_array_append_val(a, val);
-
     g_warn_if_fail((key->accel_mods &
                     ~(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)) == 0);
 
+    /* first, send the modifiers */
     if (key->accel_mods & GDK_SHIFT_MASK) {
         val = GDK_Shift_L;
         g_array_append_val(a, val);
@@ -650,6 +648,10 @@ accel_key_to_keys(const GtkAccelKey *key)
         g_array_append_val(a, val);
     }
 
+    /* only after, the non-modifier key (ctrl-t, not t-ctrl) */
+    val = key->accel_key;
+    g_array_append_val(a, val);
+
     val = GDK_VoidSymbol;
     g_array_append_val(a, val);