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).
This commit is contained in:
Vadim Zeitlin
2019-01-28 18:51:02 +01:00
parent da96ab179f
commit 359b23a58b

View File

@@ -464,7 +464,12 @@ bool wxNotebook::InsertPage( size_t position,
pageData->m_label, false, false, m_padding); pageData->m_label, false, false, m_padding);
gtk_widget_show_all(pageData->m_box); 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); 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 */ /* apply current style */
#ifdef __WXGTK3__ #ifdef __WXGTK3__