Explicitly send events for modifier keys in wxUIActionSimulator.
Key down/up events for the modifiers were already explicitly sent under wxMSW and wxOSX but not under wxGTK where, as the result, the corresponding events were not generated at all. Do send these events explicitly to make the events generation consistent under all platforms now. This means that wxUIActionSimulator::DoKey() now generates exactly one event everywhere. Notice that the modifiers for the key events generated by the modifier keys are also the same under all platforms now which is not the case for the events actually generated by the user (wxMSW sets the corresponding bit for the modifier key down event but not the key up one while wxGTK does exactly the contrary). This should be fixed in the future so that wxUIActionSimulator generates the same sequence of events as the user would and that it's still the same for all platforms. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65516 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -57,10 +57,28 @@ wxUIActionSimulator::Key(int keycode, int modifiers, bool isDown)
|
||||
wxASSERT_MSG( !(modifiers & wxMOD_WIN ),
|
||||
"wxMOD_WIN is not implemented" );
|
||||
|
||||
return DoKey(keycode, modifiers, isDown);
|
||||
if ( isDown )
|
||||
SimulateModifiers(modifiers, true);
|
||||
|
||||
bool rc = DoKey(keycode, modifiers, isDown);
|
||||
|
||||
if ( !isDown )
|
||||
SimulateModifiers(modifiers, false);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool wxUIActionSimulator::Char(int keycode, int modifiers)
|
||||
void wxUIActionSimulator::SimulateModifiers(int modifiers, bool isDown)
|
||||
{
|
||||
if ( modifiers & wxMOD_SHIFT )
|
||||
DoKey(WXK_SHIFT, modifiers, isDown);
|
||||
if ( modifiers & wxMOD_ALT )
|
||||
DoKey(WXK_ALT, modifiers, isDown);
|
||||
if ( modifiers & wxMOD_CONTROL )
|
||||
DoKey(WXK_CONTROL, modifiers, isDown);
|
||||
}
|
||||
|
||||
bool wxUIActionSimulator::Char(int keycode, int modifiers)
|
||||
{
|
||||
Key(keycode, modifiers, true);
|
||||
Key(keycode, modifiers, false);
|
||||
|
||||
Reference in New Issue
Block a user