Don't eagerly set wxKeyEvent position fields.

This results in a noticeable delay when using wxGTK via a remote X11
connection for every key event as a round trip to server is needed to get the
mouse pointer position every time a key is pressed or released.

Only provide the position on demand. And explain that it's actually not very
useful as it's simply the same as the current mouse position.

Closes #14361.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72207 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-07-24 20:45:52 +00:00
parent 7ce6da52a1
commit 2f7baaeccf
10 changed files with 78 additions and 49 deletions

View File

@@ -162,7 +162,7 @@ MyFrame::MyFrame(const wxString& title)
wxTE_READONLY);
headerText->SetValue(
" event key KeyCode mod UnicodeKey "
" RawKeyCode RawKeyFlags");
" RawKeyCode RawKeyFlags Position");
m_logText = new wxTextCtrl(this, wxID_ANY, "",
@@ -404,7 +404,7 @@ wxString GetKeyName(const wxKeyEvent &event)
void MyFrame::LogEvent(const wxString& name, wxKeyEvent& event)
{
wxString msg;
// event key_name KeyCode modifiers Unicode raw_code raw_flags
// event key_name KeyCode modifiers Unicode raw_code raw_flags pos
msg.Printf("%7s %15s %5d %c%c%c%c"
#if wxUSE_UNICODE
"%5d (U+%04x)"
@@ -416,6 +416,7 @@ void MyFrame::LogEvent(const wxString& name, wxKeyEvent& event)
#else
" not-set not-set"
#endif
" (%5d,%5d)"
"\n",
name,
GetKeyName(event),
@@ -432,6 +433,8 @@ void MyFrame::LogEvent(const wxString& name, wxKeyEvent& event)
, (unsigned long) event.GetRawKeyCode()
, (unsigned long) event.GetRawKeyFlags()
#endif
, event.GetX()
, event.GetY()
);
m_logText->AppendText(msg);