Hi<br><br>This patch solves keyboard layout issues on Windows. It doesn't seem to introduce regression. There is no better solution atm, I explained in previous mail that the original problem could be rooted in Gtk-Win32 backend, which doesn't pass hw scancode. Since we are using it for Windows build, I propose we apply it upstream too.<br>
<div class="gmail_extra"><br>cheers<br><br><br><div class="gmail_quote">
On Wed, Oct 31, 2012 at 4:51 PM, Marc-André Lureau <span dir="ltr"><<a href="mailto:marcandre.lureau@gmail.com" target="_blank">marcandre.lureau@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Local client keyboard layout shouldn't affect hardware scancode sent<br>
to guest, so that guest keyboard layout configuration can map it<br>
properly.<br>
<br>
Unfortunately, the Win32 GdkEventKey.hardware_keycode isn't a hardware<br>
scancode, but the Windows virtual-key code. We could modify Gdk to<br>
return the scancode (available in MSG.lParam or via global hook), but<br>
that would mean some Gdk breakage, or some unnecessary complexity.<br>
Instead, we can rely on MapVirtualKey(), which translates the<br>
vitual-key code into a scan code using current keyboard layout.<br>
<br>
This solves the following bug:<br>
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=871125" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=871125</a><br>
---<br>
gtk/spice-widget.c | 6 ++++++<br>
1 file changed, 6 insertions(+)<br>
<br>
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c<br>
index 3febb66..0df610b 100644<br>
--- a/gtk/spice-widget.c<br>
+++ b/gtk/spice-widget.c<br>
@@ -1001,6 +1001,12 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)<br>
<br>
scancode = vnc_display_keymap_gdk2xtkbd(d->keycode_map, d->keycode_maplen,<br>
key->hardware_keycode);<br>
+#ifdef WIN32<br>
+ /* MapVirtualKey doesn't return scancode with needed higher byte */<br>
+ scancode = MapVirtualKey(key->hardware_keycode, MAPVK_VK_TO_VSC) |<br>
+ (scancode & 0xff00);<br>
+#endif<br>
+<br>
switch (key->type) {<br>
case GDK_KEY_PRESS:<br>
send_key(display, scancode, 1);<br>
<span><font color="#888888">--<br>
1.7.11.7<br>
<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Marc-André Lureau<br>
</div>