From 5995a84fcf90abb057c9bb92f80f79e8e66a6ad0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 Oct 2010 14:34:45 +0000 Subject: [PATCH] Set wxKeyEvent::m_rawFlags to hardware key code in wxGTK. The raw flags were previously unused in wxGTK but hardware key code is an important information which may be useful to the application, so pass it in the flags (this is rather symmetric with passing lParam in it under MSW as lParam contains the scan code, among other things). Also document the meaning of raw key code and flags in all the major ports. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- interface/wx/event.h | 29 +++++++++++++++++++++++++---- src/gtk/window.cpp | 2 +- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/interface/wx/event.h b/interface/wx/event.h index 47b779a..64adc98 100644 --- a/interface/wx/event.h +++ b/interface/wx/event.h @@ -1386,8 +1386,19 @@ public: //@} /** - Returns the raw key code for this event. This is a platform-dependent scan code - which should only be used in advanced applications. + Returns the raw key code for this event. + + The flags are platform-dependent and should only be used if the + functionality provided by other wxKeyEvent methods is insufficient. + + Under MSW, the raw key code is the value of @c wParam parameter of the + corresponding message. + + Under GTK, the raw key code is the @c keyval field of the corresponding + GDK event. + + Under OS X, the raw key code is the @c keyCode field of the + corresponding NSEvent. @note Currently the raw key codes are not supported by all ports, use @ifdef_ wxHAS_RAW_KEY_CODES to determine if this feature is available. @@ -1395,8 +1406,18 @@ public: wxUint32 GetRawKeyCode() const; /** - Returns the low level key flags for this event. The flags are - platform-dependent and should only be used in advanced applications. + Returns the low level key flags for this event. + + The flags are platform-dependent and should only be used if the + functionality provided by other wxKeyEvent methods is insufficient. + + Under MSW, the raw flags are just the value of @c lParam parameter of + the corresponding message. + + Under GTK, the raw flags contain the @c hardware_keycode field of the + corresponding GDK event. + + Under OS X, the raw flags contain the modifiers state. @note Currently the raw key flags are not supported by all ports, use @ifdef_ wxHAS_RAW_KEY_CODES to determine if this feature is available. diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index fa02dbc..1e4523f 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -729,7 +729,7 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event, } event.m_rawCode = (wxUint32) gdk_event->keyval; - event.m_rawFlags = 0; + event.m_rawFlags = gdk_event->hardware_keycode; wxGetMousePosition( &x, &y ); win->ScreenToClient( &x, &y ); -- 2.7.4