From e08cf4332a60299cf941ab855df1c9e7e86e692d Mon Sep 17 00:00:00 2001 From: Eran Ifrah Date: Sun, 3 Mar 2024 15:12:36 +0200 Subject: [PATCH] Reduce flicker when closing active tab in wxAuiNotebook Add `wxWindowUpdateLocker` to reduce flicker when closing the active tab. This is highly noticeable on Windows. Closes #24372. --- src/aui/auibook.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index 9297a71c6b..dcb8bf4f51 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -27,6 +27,7 @@ #endif #include "wx/aui/tabmdi.h" +#include "wx/wupdlock.h" #include "wx/dcbuffer.h" // just for wxALWAYS_NATIVE_DOUBLE_BUFFER @@ -2095,6 +2096,12 @@ bool wxAuiNotebook::DeletePage(size_t page_idx) // but does not destroy the window bool wxAuiNotebook::RemovePage(size_t page_idx) { + // Lock the window for changes to avoid flicker when + // removing the active page (there is a noticeable + // flicker from the active tab is closed and until a + // new one is selected) - this is noticeable on MSW + wxWindowUpdateLocker locker { this }; + // save active window pointer wxWindow* active_wnd = nullptr; if (m_curPage >= 0)