<div dir="ltr"><div>ack,<br><br></div>although it still needs the gdk patch, since this solution only work when the widget has the keyboard focus, as explained in original thread.<br></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Wed, May 15, 2013 at 11:34 AM, Christophe Fergeau <span dir="ltr"><<a href="mailto:cfergeau@redhat.com" target="_blank">cfergeau@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Mattias Grönlund <<a href="mailto:mattias@gronlund.se">mattias@gronlund.se</a>><br>
<br>
Running virt-viewer-x64-0.5.6.msi, on Windows 7, connecting to QEMU using<br>
spice, AltGR key combinations fails (using Swedish keyboard layout both at<br>
server and client).<br>
<br>
I suspect that this is a variant of<br>
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=904092" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=904092</a>.<br>
<br>
After some debugging, I realized that there is an extra VK_LCONTROL<br>
keypress sent by Windows. This extra VK_LCONTROL will then make the key<br>
e.g. AltGr-< actually be Control-AltGr-<, which is not interpreted as a |<br>
sign.<br>
<br>
So in spice-widget.c : keyboard_hook_cb(), I added SPICE_DEBUG lines which<br>
printed out the hooked->scanCode, and realized that this extra VK_LCONTROL<br>
has a very suspect scanCode with bit 9 set. If I instead press the left<br>
Ctrl key, it will also emit VK_LCONTROL, but with bit 9 cleared.<br>
<br>
So I just made sure that keyboard_hook_cb(), silently dropped these strange<br>
VK_LCONTROL events, which seems to work for me.<br>
---<br>
 gtk/spice-widget.c | 8 +++++++-<br>
 1 file changed, 7 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c<br>
index 7eb9e64..4f74380 100644<br>
--- a/gtk/spice-widget.c<br>
+++ b/gtk/spice-widget.c<br>
@@ -672,11 +672,17 @@ static LRESULT CALLBACK keyboard_hook_cb(int code, WPARAM wparam, LPARAM lparam)<br>
         case VK_NUMLOCK:<br>
         case VK_LSHIFT:<br>
         case VK_RSHIFT:<br>
-        case VK_LCONTROL:<br>
         case VK_RCONTROL:<br>
         case VK_LMENU:<br>
         case VK_RMENU:<br>
             break;<br>
+        case VK_LCONTROL:<br>
+            /* When pressing AltGr, an extra VK_LCONTROL with a special<br>
+             * scancode with bit 9 set is sent. Let's ignore the extra<br>
+             * VK_LCONTROL, as that will make AltGr misbehave. */<br>
+            if (hooked->scanCode & 0x200)<br>
+                return 1;<br>
+            break;<br>
         default:<br>
             SendMessage(win32_window, wparam, hooked->vkCode, dwmsg);<br>
             return 1;<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.2.1<br>
<br>
_______________________________________________<br>
Spice-devel mailing list<br>
<a href="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/spice-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/spice-devel</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Marc-André Lureau
</div>