[Spice-devel] [PATCH 1/3] inputs: Fix key_up/key_down naming mismatch

Christophe Fergeau cfergeau at redhat.com
Fri Dec 12 08:19:25 PST 2014


When handling a KEY_UP message, the various variables were called
'key_down', and they were called 'key_up' when handling KEY_DOWN
messages. This commit makes the naming consistent.
---
 server/inputs_channel.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index 395b81f..3c64626 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -331,16 +331,16 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
     spice_assert(g_inputs_channel == inputs_channel);
     switch (type) {
     case SPICE_MSGC_INPUTS_KEY_DOWN: {
-        SpiceMsgcKeyDown *key_up = (SpiceMsgcKeyDown *)buf;
-        if (key_up->code == CAPS_LOCK_SCAN_CODE || key_up->code == NUM_LOCK_SCAN_CODE ||
-            key_up->code == SCROLL_LOCK_SCAN_CODE) {
+        SpiceMsgcKeyDown *key_down = (SpiceMsgcKeyDown *)buf;
+        if (key_down->code == CAPS_LOCK_SCAN_CODE || key_down->code == NUM_LOCK_SCAN_CODE ||
+            key_down->code == SCROLL_LOCK_SCAN_CODE) {
             activate_modifiers_watch();
         }
     }
     case SPICE_MSGC_INPUTS_KEY_UP: {
-        SpiceMsgcKeyDown *key_down = (SpiceMsgcKeyDown *)buf;
+        SpiceMsgcKeyUp *key_up = (SpiceMsgcKeyUp *)buf;
         for (i = 0; i < 4; i++) {
-            uint8_t code = (key_down->code >> (i * 8)) & 0xff;
+            uint8_t code = (key_up->code >> (i * 8)) & 0xff;
             if (code == 0) {
                 break;
             }
-- 
2.1.0



More information about the Spice-devel mailing list