[gtk+/gtk-2-24] Handle emulated keyboard input that arrives as VK_PACKET



commit af9174693198d8263df8b20dc32a869a3b57d222
Author: Tor Lillqvist <tml iki fi>
Date:   Sun Feb 20 01:33:00 2011 +0200

    Handle emulated keyboard input that arrives as VK_PACKET
    
    Fixes bug #642772. Thanks to the anonymous bug reporter for providing
    a test program.

 gdk/win32/gdkevents-win32.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index fced45e..e368e89 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -2131,12 +2131,16 @@ gdk_event_translate (MSG  *msg,
       
       build_key_event_state (event, key_state);
 
-      gdk_keymap_translate_keyboard_state (NULL,
-					   event->key.hardware_keycode,
-					   event->key.state,
-					   event->key.group,
-					   &event->key.keyval,
-					   NULL, NULL, NULL);
+      if (msg->wParam == VK_PACKET &&
+	  ToUnicode (VK_PACKET, HIWORD (msg->lParam), key_state, wbuf, 1, 0) == 1)
+	event->key.keyval = gdk_unicode_to_keyval (wbuf[0]);
+      else
+	gdk_keymap_translate_keyboard_state (NULL,
+					     event->key.hardware_keycode,
+					     event->key.state,
+					     event->key.group,
+					     &event->key.keyval,
+					     NULL, NULL, NULL);
 
       fill_key_event_string (event);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]