From: Takao Fujiwara <tfujiwar@xxxxxxxxxx> Some of the keys in JP keyboard do no send WM_KEYUP and it causes unlimited key events on Linux desktop. This sends the virtual key release events to avoid the desktop hangup. --- src/spice-widget.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/spice-widget.c b/src/spice-widget.c index 4e026f3..5e71d1b 100644 --- a/src/spice-widget.c +++ b/src/spice-widget.c @@ -1422,6 +1422,7 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key) SpiceDisplayPrivate *d = display->priv; int scancode; int native_scancode; + gboolean no_key_release = FALSE; #ifdef G_OS_WIN32 /* on windows, we ought to ignore the reserved key event? */ @@ -1500,11 +1501,28 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key) got_scancode: + /* Some keys do not send WM_KEYUP */ + switch (HIWORD(d->keyboard_layout)) { + case 0x411: /* JP keyboard */ + switch (key->hardware_keycode) { + case VK_KANJI: /* Alt + Zenkaku_Hankaku */ + case VK_OEM_ATTN: /* Eisu_toggle */ + case VK_OEM_COPY: /* Hiragana_Katakana */ + case VK_OEM_BACKTAB: /* Alt + Hiragana_Katakana */ + no_key_release = TRUE; + break; + default:; + } + break; + default:; + } #endif switch (key->type) { case GDK_KEY_PRESS: send_key(display, scancode, SEND_KEY_PRESS, !key->is_modifier); + if (no_key_release) + send_key(display, scancode, SEND_KEY_RELEASE, !key->is_modifier); break; case GDK_KEY_RELEASE: send_key(display, scancode, SEND_KEY_RELEASE, !key->is_modifier); -- 2.7.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel