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

@@ -5682,21 +5682,6 @@ MSWInitAnyKeyEvent(wxKeyEvent& event,
#ifndef __WXWINCE__
event.SetTimestamp(::GetMessageTime());
#endif
// Event coordinates must be in window client coordinates system which
// doesn't make sense if there is no window.
//
// We could use screen coordinates for such events but this would make the
// logic of the event handlers more complicated: you'd need to test for the
// event object and interpret the coordinates differently according to
// whether it's NULL or not so unless somebody really asks for this let's
// just avoid the issue.
if ( win )
{
const wxPoint mousePos = win->ScreenToClient(wxGetMousePosition());
event.m_x = mousePos.x;
event.m_y = mousePos.y;
}
}
} // anonymous namespace