From 724621929d4f061d2a35dfcb0f92f7e5c8b6594e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 20 Jan 2020 12:42:18 +0100 Subject: [PATCH] Improve the check for TLW in focus handling code Use IsTopNavigationDomain() instead of IsTopLevel() to do the right thing for MDI child frames too. --- src/common/containr.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/containr.cpp b/src/common/containr.cpp index 110cbd2687..b418a3b8c2 100644 --- a/src/common/containr.cpp +++ b/src/common/containr.cpp @@ -711,8 +711,15 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) else deepestVisibleWindow = NULL; - if ( (*childLastFocused)->IsTopLevel() ) + // We shouldn't be looking for the child to focus beyond the + // TLW boundary. And we use IsTopNavigationDomain() here + // instead of IsTopLevel() because wxMDIChildFrame is also TLW + // from this point of view. + if ( (*childLastFocused)-> + IsTopNavigationDomain(wxWindow::Navigation_Tab) ) + { break; + } *childLastFocused = (*childLastFocused)->GetParent(); }