From 8dfd894160db58a1e840799715341ef6cd1ca235 Mon Sep 17 00:00:00 2001 From: Surfoo Date: Sat, 21 Nov 2026 17:05:50 +0100 Subject: [PATCH] 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 97e2d0a6e687317efb871a3a142402ee8240286b) --- src/slic3r/GUI/Notebook.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Notebook.hpp b/src/slic3r/GUI/Notebook.hpp index b7774c84e0..c301b06cfe 100644 --- a/src/slic3r/GUI/Notebook.hpp +++ b/src/slic3r/GUI/Notebook.hpp @@ -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 m_pageNames; // index-parallel to wxBookCtrlBase::m_pages wxShowEffect m_showEffect,