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:
@@ -306,7 +306,6 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
|
||||
|
||||
UInt32 keyCode ;
|
||||
UInt32 modifiers ;
|
||||
Point point ;
|
||||
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
@@ -334,7 +333,6 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
|
||||
GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode );
|
||||
GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
|
||||
GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
|
||||
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point );
|
||||
|
||||
UInt32 message = (keyCode << 8) + charCode;
|
||||
switch ( GetEventKind( event ) )
|
||||
@@ -346,7 +344,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
|
||||
WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ;
|
||||
wxTheApp->MacSetCurrentEvent( event , handler ) ;
|
||||
if ( /* focus && */ wxTheApp->MacSendKeyDownEvent(
|
||||
focus , message , modifiers , when , point.h , point.v , uniChar[0] ) )
|
||||
focus , message , modifiers , when , uniChar[0] ) )
|
||||
{
|
||||
result = noErr ;
|
||||
}
|
||||
@@ -356,7 +354,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
|
||||
|
||||
case kEventRawKeyUp :
|
||||
if ( /* focus && */ wxTheApp->MacSendKeyUpEvent(
|
||||
focus , message , modifiers , when , point.h , point.v , uniChar[0] ) )
|
||||
focus , message , modifiers , when , uniChar[0] ) )
|
||||
{
|
||||
result = noErr ;
|
||||
}
|
||||
@@ -370,8 +368,6 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
|
||||
event.m_rawControlDown = modifiers & controlKey;
|
||||
event.m_altDown = modifiers & optionKey;
|
||||
event.m_controlDown = event.m_metaDown = modifiers & cmdKey;
|
||||
event.m_x = point.h;
|
||||
event.m_y = point.v;
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
event.m_uniChar = uniChar[0] ;
|
||||
|
||||
Reference in New Issue
Block a user