Fix best size for windows which are hidden when TLW is shown with GTK3
GTK3's style cache is not updated for hidden windows until after they are shown See #16088
This commit is contained in:
@@ -493,6 +493,7 @@ public:
|
||||
return m_paintContext;
|
||||
}
|
||||
void GTKSizeRevalidate();
|
||||
void GTKSendSizeEventIfNeeded();
|
||||
#endif
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxWindowGTK);
|
||||
|
@@ -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
|
||||
|
@@ -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,20 +5868,30 @@ void wxWindowGTK::GTKSizeRevalidate()
|
||||
{
|
||||
next = p->next;
|
||||
wxWindow* win = static_cast<wxWindow*>(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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user