Tweak wxGTK keyboard handling to allow accelerators to work again.

Accelerators were broken by the changes of r72640 which were done to ensure
that the focused window gets the keyboard event first, before its top level
parent. Fix them now by still passing the events to the focused window first
but also passing them to the parent top level if it hasn't been handled by the
focused child.

Unfortunately this is still not fully compatible with wxMSW because in wxGTK
wxEVT_CHAR handler must skip the event in order to allow the accelerator using
the same key to work, while in wxMSW the accelerator can only be suppressed by
overriding wxWindow::MSWShouldPreProcessMessage(). We will need to make the
two ports behave in the same way when the event is not skipped in the future.

But for now, at least make them both behave correctly when the handler does
skip the event.

Closes #14553.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73692 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-03-21 22:36:57 +00:00
parent 98eb2e84e8
commit 819638a71f
2 changed files with 36 additions and 7 deletions

View File

@@ -53,7 +53,7 @@ private:
event.Skip();
}
void OnKeyUp(wxKeyEvent& event) { LogEvent("KeyUp", event); }
void OnChar(wxKeyEvent& event) { LogEvent("Char", event); }
void OnChar(wxKeyEvent& event) { LogEvent("Char", event); event.Skip(); }
void OnCharHook(wxKeyEvent& event)
{
// The logged messages can be confusing if the input window doesn't