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;
|
return m_paintContext;
|
||||||
}
|
}
|
||||||
void GTKSizeRevalidate();
|
void GTKSizeRevalidate();
|
||||||
|
void GTKSendSizeEventIfNeeded();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxDECLARE_DYNAMIC_CLASS(wxWindowGTK);
|
wxDECLARE_DYNAMIC_CLASS(wxWindowGTK);
|
||||||
|
@@ -1171,11 +1171,7 @@ bool wxTopLevelWindowGTK::Show( bool show )
|
|||||||
GTKUpdateClientSizeIfNecessary();
|
GTKUpdateClientSizeIfNecessary();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_needSizeEvent)
|
GTKSendSizeEventIfNeeded();
|
||||||
{
|
|
||||||
m_needSizeEvent = false;
|
|
||||||
SendSizeEvent();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (change && !show)
|
if (change && !show)
|
||||||
@@ -1514,13 +1510,8 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize)
|
|||||||
gtk_widget_show(m_widget);
|
gtk_widget_show(m_widget);
|
||||||
|
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
if (m_needSizeEvent)
|
GTKSendSizeEventIfNeeded();
|
||||||
{
|
|
||||||
m_needSizeEvent = false;
|
|
||||||
SendSizeEvent();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GTKDoAfterShow();
|
GTKDoAfterShow();
|
||||||
}
|
}
|
||||||
#endif // GDK_WINDOWING_X11
|
#endif // GDK_WINDOWING_X11
|
||||||
|
@@ -2335,6 +2335,11 @@ static void frame_clock_layout(GdkFrameClock*, wxWindow* win)
|
|||||||
{
|
{
|
||||||
win->GTKSizeRevalidate();
|
win->GTKSizeRevalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void frame_clock_layout_after(GdkFrameClock*, wxWindowGTK* win)
|
||||||
|
{
|
||||||
|
win->GTKSendSizeEventIfNeeded();
|
||||||
|
}
|
||||||
#endif // GTK_CHECK_VERSION(3,8,0)
|
#endif // GTK_CHECK_VERSION(3,8,0)
|
||||||
|
|
||||||
} // extern "C"
|
} // 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_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(clock, "layout", G_CALLBACK(frame_clock_layout), this);
|
||||||
|
g_signal_connect_after(clock, "layout", G_CALLBACK(frame_clock_layout_after), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -5862,20 +5868,30 @@ void wxWindowGTK::GTKSizeRevalidate()
|
|||||||
{
|
{
|
||||||
next = p->next;
|
next = p->next;
|
||||||
wxWindow* win = static_cast<wxWindow*>(p->data);
|
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();
|
win->InvalidateBestSize();
|
||||||
gs_sizeRevalidateList = g_list_delete_link(gs_sizeRevalidateList, p);
|
gs_sizeRevalidateList = g_list_delete_link(gs_sizeRevalidateList, p);
|
||||||
for (;;)
|
do
|
||||||
{
|
{
|
||||||
win = win->m_parent;
|
win = win->m_parent;
|
||||||
if (win == NULL || win->m_needSizeEvent)
|
if (win->m_needSizeEvent)
|
||||||
break;
|
break;
|
||||||
win->m_needSizeEvent = true;
|
win->m_needSizeEvent = true;
|
||||||
if (win->IsTopLevel())
|
} while (win != this);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWindowGTK::GTKSendSizeEventIfNeeded()
|
||||||
|
{
|
||||||
|
if (m_needSizeEvent)
|
||||||
|
{
|
||||||
|
m_needSizeEvent = false;
|
||||||
|
SendSizeEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user