diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index 9ec33b88ab..1261931b22 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -493,6 +493,7 @@ public: return m_paintContext; } void GTKSizeRevalidate(); + void GTKSendSizeEventIfNeeded(); #endif wxDECLARE_DYNAMIC_CLASS(wxWindowGTK); diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 999dfa580c..6060a7a3ac 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -1171,11 +1171,7 @@ bool wxTopLevelWindowGTK::Show( bool show ) GTKUpdateClientSizeIfNecessary(); } - if (m_needSizeEvent) - { - m_needSizeEvent = false; - SendSizeEvent(); - } + GTKSendSizeEventIfNeeded(); #endif if (change && !show) @@ -1514,13 +1510,8 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize) gtk_widget_show(m_widget); #ifdef __WXGTK3__ - if (m_needSizeEvent) - { - m_needSizeEvent = false; - SendSizeEvent(); - } + GTKSendSizeEventIfNeeded(); #endif - GTKDoAfterShow(); } #endif // GDK_WINDOWING_X11 diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 2497cf9344..f44bda99c3 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2335,6 +2335,11 @@ static void frame_clock_layout(GdkFrameClock*, wxWindow* win) { win->GTKSizeRevalidate(); } + +static void frame_clock_layout_after(GdkFrameClock*, wxWindowGTK* win) +{ + win->GTKSendSizeEventIfNeeded(); +} #endif // GTK_CHECK_VERSION(3,8,0) } // extern "C" @@ -2395,6 +2400,7 @@ void wxWindowGTK::GTKHandleRealized() !g_signal_handler_find(clock, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, this)) { g_signal_connect(clock, "layout", G_CALLBACK(frame_clock_layout), this); + g_signal_connect_after(clock, "layout", G_CALLBACK(frame_clock_layout_after), this); } } #endif @@ -5862,23 +5868,33 @@ void wxWindowGTK::GTKSizeRevalidate() { next = p->next; wxWindow* win = static_cast(p->data); - if (wxGetTopLevelParent(win) == this) + wxWindow* w = win; + while (w && w->IsShown() && !w->IsTopLevel()) + w = w->GetParent(); + if (w == this) { win->InvalidateBestSize(); gs_sizeRevalidateList = g_list_delete_link(gs_sizeRevalidateList, p); - for (;;) + do { win = win->m_parent; - if (win == NULL || win->m_needSizeEvent) + if (win->m_needSizeEvent) break; win->m_needSizeEvent = true; - if (win->IsTopLevel()) - break; - } + } while (win != this); } } } +void wxWindowGTK::GTKSendSizeEventIfNeeded() +{ + if (m_needSizeEvent) + { + m_needSizeEvent = false; + SendSizeEvent(); + } +} + extern "C" { static gboolean before_resize(void* data) {