Make wxEVT_CHAR_HOOK propagate upwards and send it to the window itself.
Send wxEVT_CHAR_HOOK events to the focused window itself but make them propagatable to ensure that the parent windows (including the top level parent) still get it. This still allows the TLW parent to intercept keyboard handling in its child but allows the child (or an intermediate parent window) to have some say in the matter. See #9102. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -6622,7 +6622,14 @@ wxKeyboardHook(int nCode, WORD wParam, DWORD lParam)
|
||||
#endif // wxUSE_UNICODE
|
||||
)
|
||||
{
|
||||
const wxWindow * const win = wxGetActiveWindow();
|
||||
wxWindow const* win = wxWindow::DoFindFocus();
|
||||
if ( !win )
|
||||
{
|
||||
// Even if the focus got lost somehow, still send the event
|
||||
// to the top level parent to allow a wxDialog to always
|
||||
// close on Escape.
|
||||
win = wxGetActiveWindow();
|
||||
}
|
||||
|
||||
wxKeyEvent event(wxEVT_CHAR_HOOK);
|
||||
MSWInitAnyKeyEvent(event, wParam, lParam, win);
|
||||
|
Reference in New Issue
Block a user