Notebook: don't hide a page that is also the page being selected #17189 (#17739)

Prepare and Preview share one page window, the Plater. On every switch between them, wx hid that window and showed it again right away. On GNOME Wayland this unmapped and remapped the GL canvases and triggered a mutter subsurface bug, which left a frozen copy of the Prepare view at the top-left of the window (#17189). Notebook no longer hides the page that is being selected, and switches between other tabs are unchanged.

(cherry picked from commit 97e2d0a6e6)
This commit is contained in:
Surfoo authored and raistlin7447 committed 2026-11-21 10:08:29 -06:00
1 parent 2c01dd1cf5
commit 8dfd894160
1 file changed
+12 -1
+12 -1
View File
@@ -490,17 +490,28 @@ protected:
page->SetSize(GetPageRect());
}
virtual int DoSetSelection(size_t n, int flags = 0) override
{
m_target_page = GetPage(n);
const int ret = wxBookCtrlBase::DoSetSelection(n, flags);
m_target_page = nullptr;
return ret;
}
virtual void DoShowPage(wxWindow * page, bool show) override
{
if (show)
page->ShowWithEffect(m_showEffect, m_showTimeout);
else
// Tabs may share one page window (Prepare/Preview -> m_plater). Hiding it just to re-show it
// unmaps and remaps its GL canvases, which triggers a mutter subsurface bug on Wayland.
else if (page != m_target_page)
page->HideWithEffect(m_hideEffect, m_hideTimeout);
}
private:
void Init();
wxWindow* m_target_page{nullptr}; // page being selected; DoShowPage must not hide it
std::vector<wxString> m_pageNames; // index-parallel to wxBookCtrlBase::m_pages
wxShowEffect m_showEffect,