<div dir="ltr"><div style>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).</div><div style><br></div><div style>
I suspect that this is a variant of <a href="https://bugzilla.redhat.com/show_bug.cgi?id=904092">https://bugzilla.redhat.com/show_bug.cgi?id=904092</a>.</div><div style><br></div><div style>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.</div>
<div style><br></div><div style>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.</div>
<div style><br></div><div style>So I just made sure that keyboard_hook_cb(), silently dropped these strange VK_LCONTROL events, which seems to work for me.</div><div style><br></div><div style><br></div><div style><div>         case VK_NUMLOCK:<br>
</div><div>         case VK_LSHIFT:</div><div>         case VK_RSHIFT:</div><div>-        case VK_LCONTROL:</div><div>         case VK_RCONTROL:</div><div>         case VK_LMENU:</div><div>         case VK_RMENU:</div><div>
             break;</div><div>+        case VK_LCONTROL:</div><div>+            // When pressing AltGr, an extra VK_LCONTROL with a special scancode with bit 9 set is sent.</div><div>+            // Lets ignore the extra VK_LCONTROL, as that will make AltGr missbehave.</div>
<div>+            if (hooked->scanCode & 0x200)</div><div>+                return 1;</div><div>+            break;</div><div>         default:</div><div>             SendMessage(win32_window, wparam, hooked->vkCode, dwmsg);<br>
</div><div>             return 1;</div><div>         }</div><div><br></div><div><br></div><div style>/Mattias</div></div></div>