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
This commit is contained in:
Vadim Zeitlin
2010-10-24 14:34:45 +00:00
parent 21567b0960
commit 5995a84fcf
2 changed files with 26 additions and 5 deletions

View File

@@ -1386,8 +1386,19 @@ public:
//@} //@}
/** /**
Returns the raw key code for this event. This is a platform-dependent scan code Returns the raw key code for this event.
which should only be used in advanced applications.
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 @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. @ifdef_ wxHAS_RAW_KEY_CODES to determine if this feature is available.
@@ -1395,8 +1406,18 @@ public:
wxUint32 GetRawKeyCode() const; wxUint32 GetRawKeyCode() const;
/** /**
Returns the low level key flags for this event. The flags are Returns the low level key flags for this event.
platform-dependent and should only be used in advanced applications.
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 @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. @ifdef_ wxHAS_RAW_KEY_CODES to determine if this feature is available.

View File

@@ -729,7 +729,7 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event,
} }
event.m_rawCode = (wxUint32) gdk_event->keyval; event.m_rawCode = (wxUint32) gdk_event->keyval;
event.m_rawFlags = 0; event.m_rawFlags = gdk_event->hardware_keycode;
wxGetMousePosition( &x, &y ); wxGetMousePosition( &x, &y );
win->ScreenToClient( &x, &y ); win->ScreenToClient( &x, &y );