- // to handle key events in all of its children.
- wxWindow * const parent = wxGetTopLevelParent(win);
- if ( parent )
- {
- // We need to make a copy of the event object because it is
- // modified while it's handled, notably its WasProcessed() flag
- // is set after it had been processed once.
- wxKeyEvent eventCharHook(event);
- eventCharHook.SetEventType(wxEVT_CHAR_HOOK);
- if ( parent->HandleWindowEvent(eventCharHook) )
- return true;
+ // to handle key events in all of its children unless the mouse is captured
+ // in which case we consider that the keyboard should be "captured" too.
+ if ( !g_captureWindow )
+ {
+ wxWindow * const parent = wxGetTopLevelParent(win);
+ if ( parent )
+ {
+ // We need to make a copy of the event object because it is
+ // modified while it's handled, notably its WasProcessed() flag
+ // is set after it had been processed once.
+ wxKeyEvent eventCharHook(event);
+ eventCharHook.SetEventType(wxEVT_CHAR_HOOK);
+ if ( parent->HandleWindowEvent(eventCharHook) )
+ return true;
+ }