[Spice-devel] [spice-gtk 2/3] Send key release event for some keys in JP keyboard.
Fabiano FidĂȘncio
fidencio at redhat.com
Thu Mar 31 12:38:39 UTC 2016
From: Takao Fujiwara <tfujiwar at redhat.com>
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
More information about the Spice-devel
mailing list