From 7420ab1b2634a5c5a78d0c32af0ac6768a849892 Mon Sep 17 00:00:00 2001 From: Bill Su Date: Sun, 11 Jun 2023 01:50:01 -0400 Subject: [PATCH] wxMFCApp::PreTranslateMessage: Give msg to MFC before wxWidgets because wxWidgets wxGUIEventLoop::PreProcessMessage() seems to always report that it has consumed msg. fix #23574 --- include/wx/msw/mfc.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/wx/msw/mfc.h b/include/wx/msw/mfc.h index e76701c5a3..b3e4636c35 100644 --- a/include/wx/msw/mfc.h +++ b/include/wx/msw/mfc.h @@ -94,6 +94,12 @@ public: // Override this to provide messages pre-processing for wxWidgets windows. BOOL PreTranslateMessage(MSG *msg) override { + // As reported in issue #23574, wxGUIEventLoop::PreProcessMessage() + // is always returning true, so try BaseApp::PreTranslateMessage() + // and hope it doesn't always report true + if (BaseApp::PreTranslateMessage(msg)) + return TRUE; + // Use the current event loop if there is one, or just fall back to the // standard one otherwise, but make sure we pre-process messages in any // case as otherwise many things would break (e.g. keyboard @@ -103,10 +109,7 @@ public: wxGUIEventLoop evtLoopStd; if ( !evtLoop ) evtLoop = &evtLoopStd; - if ( evtLoop->PreProcessMessage(msg) ) - return TRUE; - - return BaseApp::PreTranslateMessage(msg); + return evtLoop->PreProcessMessage(msg); } BOOL OnIdle(LONG lCount) override