From 359b23a58b3ac2d0137b756989ebebbf9aef4b4f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 28 Jan 2019 18:51:02 +0100 Subject: [PATCH] Avoid events on first page insertion in wxGTK wxNotebook Make wxGTK consistent with wxMSW and wxOSX and also make it pass the unit test added in the previous commit by suppressing events generated by gtk_notebook_insert_page() when adding the first page (but not any subsequent ones). --- src/gtk/notebook.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 71bd4d8ec2..4e86999f34 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -464,7 +464,12 @@ bool wxNotebook::InsertPage( size_t position, pageData->m_label, false, false, m_padding); gtk_widget_show_all(pageData->m_box); + + // Inserting the page may generate selection changing events that are not + // expected here: we will send them ourselves below if necessary. + g_signal_handlers_block_by_func(m_widget, (void*)switch_page, this); gtk_notebook_insert_page(notebook, win->m_widget, pageData->m_box, position); + g_signal_handlers_unblock_by_func(m_widget, (void*)switch_page, this); /* apply current style */ #ifdef __WXGTK3__