[Spice-commits] 2 commits - gtk/channel-display.c gtk/spice-widget.c

Christophe Fergau teuf at kemper.freedesktop.org
Wed May 15 04:47:26 PDT 2013


 gtk/channel-display.c |    4 ++--
 gtk/spice-widget.c    |    8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 6e180217428ffd6e8c0f835fb9c97e6e49998630
Author: Mattias Grönlund <mattias at gronlund.se>
Date:   Wed May 15 11:30:02 2013 +0200

    mingw: Fix non-working AltGr with some layouts
    
    Running virt-viewer-x64-0.5.6.msi, on Windows 7, connecting to QEMU using
    spice, AltGR key combinations fails (using Swedish keyboard layout both at
    server and client).
    
    I suspect that this is a variant of
    https://bugzilla.redhat.com/show_bug.cgi?id=904092.
    
    After some debugging, I realized that there is an extra VK_LCONTROL
    keypress sent by Windows. This extra VK_LCONTROL will then make the key
    e.g. AltGr-< actually be Control-AltGr-<, which is not interpreted as a |
    sign.
    
    So in spice-widget.c : keyboard_hook_cb(), I added SPICE_DEBUG lines which
    printed out the hooked->scanCode, and realized that this extra VK_LCONTROL
    has a very suspect scanCode with bit 9 set. If I instead press the left
    Ctrl key, it will also emit VK_LCONTROL, but with bit 9 cleared.
    
    So I just made sure that keyboard_hook_cb(), silently dropped these strange
    VK_LCONTROL events, which seems to work for me.

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 7eb9e64..4f74380 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -672,11 +672,17 @@ static LRESULT CALLBACK keyboard_hook_cb(int code, WPARAM wparam, LPARAM lparam)
         case VK_NUMLOCK:
         case VK_LSHIFT:
         case VK_RSHIFT:
-        case VK_LCONTROL:
         case VK_RCONTROL:
         case VK_LMENU:
         case VK_RMENU:
             break;
+        case VK_LCONTROL:
+            /* When pressing AltGr, an extra VK_LCONTROL with a special
+             * scancode with bit 9 set is sent. Let's ignore the extra
+             * VK_LCONTROL, as that will make AltGr misbehave. */
+            if (hooked->scanCode & 0x200)
+                return 1;
+            break;
         default:
             SendMessage(win32_window, wparam, hooked->vkCode, dwmsg);
             return 1;
commit d1a1df640c9b9fea5390996c6d2069cc6710dcf0
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed May 15 11:32:09 2013 +0200

    Fix printf format string warning
    
    When doing a mingw32 build, I hit the following warning (which became an
    error because of -Werror):
    
    channel-display.c: In function 'destroy_stream':
    channel-display.c:1546:9: error: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'uint64_t' [-Werror=format=]
             CHANNEL_DEBUG(channel, "%s: drops total duration %lu ==>", __FUNCTION__, drops_duration_total);
             ^

diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index 5fb3cac..bc6fc08 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -1510,7 +1510,7 @@ static void destroy_stream(SpiceChannel *channel, int id)
 {
     SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv;
     display_stream *st;
-    uint64_t drops_duration_total = 0;
+    guint64 drops_duration_total = 0;
     int i;
 
     g_return_if_fail(c != NULL);
@@ -1543,7 +1543,7 @@ static void destroy_stream(SpiceChannel *channel, int id)
                                    stats->duration);
     }
     if (st->num_drops_seqs) {
-        CHANNEL_DEBUG(channel, "%s: drops total duration %lu ==>", __FUNCTION__, drops_duration_total);
+        CHANNEL_DEBUG(channel, "%s: drops total duration %"G_GUINT64_FORMAT" ==>", __FUNCTION__, drops_duration_total);
     }
 
     g_array_free(st->drops_seqs_stats_arr, TRUE);


More information about the Spice-commits mailing list