Web lists-archives.com

[PATCH] Save Windows scancode inside GdkEvent




Scancode information is not saved inside GdkEvent.
Some application requires that information so provide a way
to retrieve it.
Note that added field in GdkEventKey is in a position to not change
ABI.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 gdk/gdkevents.h             | 3 +++
 gdk/win32/gdkevents-win32.c | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index 3e7824f..e92fa93 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -864,6 +864,9 @@ struct _GdkEventKey
   GdkEventType type;
   GdkWindow *window;
   gint8 send_event;
+#if defined(G_OS_WIN32)
+  guint16 hardware_scancode;
+#endif
   guint32 time;
   guint state;
   guint keyval;
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index c6f6a24..a01a9f0 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -2418,6 +2418,8 @@ gdk_event_translate (MSG  *msg,
       if (msg->wParam == VK_MENU)
 	event->key.state &= ~GDK_MOD1_MASK;
 
+      /* save original scancode */
+      event->key.hardware_scancode = msg->lParam >> 16;
       _gdk_win32_append_event (event);
 
       return_val = TRUE;
-- 
2.5.5

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-devel-list