Partial workaround for stale styling information with GTK3
We can trigger size events when we know the style cache has been updated. See #16088
This commit is contained in:
parent
3b4ee5a031
commit
101c43d0aa
@ -443,6 +443,8 @@ protected:
|
||||
#ifdef __WXGTK3__
|
||||
static GdkWindow* GTKFindWindow(GtkWidget* widget);
|
||||
static void GTKFindWindow(GtkWidget* widget, wxArrayGdkWindows& windows);
|
||||
|
||||
bool m_needSizeEvent;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -1020,9 +1020,7 @@ bool wxTopLevelWindowGTK::Show( bool show )
|
||||
// size_allocate signals occur in reverse order (bottom to top).
|
||||
// Things work better if the initial wxSizeEvents are sent (from the
|
||||
// top down), before the initial size_allocate signals occur.
|
||||
wxSizeEvent event(GetSize(), GetId());
|
||||
event.SetEventObject(this);
|
||||
HandleWindowEvent(event);
|
||||
SendSizeEvent();
|
||||
|
||||
#ifdef __WXGTK3__
|
||||
GTKSizeRevalidate();
|
||||
@ -1031,6 +1029,14 @@ bool wxTopLevelWindowGTK::Show( bool show )
|
||||
|
||||
bool change = base_type::Show(show);
|
||||
|
||||
#ifdef __WXGTK3__
|
||||
if (m_needSizeEvent)
|
||||
{
|
||||
m_needSizeEvent = false;
|
||||
SendSizeEvent();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (change && !show)
|
||||
{
|
||||
// make sure window has a non-default position, so when it is shown
|
||||
@ -1325,15 +1331,20 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize)
|
||||
// gtk_widget_show() was deferred, do it now
|
||||
m_deferShow = false;
|
||||
DoGetClientSize(&m_clientWidth, &m_clientHeight);
|
||||
wxSizeEvent sizeEvent(GetSize(), GetId());
|
||||
sizeEvent.SetEventObject(this);
|
||||
HandleWindowEvent(sizeEvent);
|
||||
SendSizeEvent();
|
||||
|
||||
#ifdef __WXGTK3__
|
||||
GTKSizeRevalidate();
|
||||
#endif
|
||||
gtk_widget_show(m_widget);
|
||||
|
||||
#ifdef __WXGTK3__
|
||||
if (m_needSizeEvent)
|
||||
{
|
||||
m_needSizeEvent = false;
|
||||
SendSizeEvent();
|
||||
}
|
||||
#endif
|
||||
wxShowEvent showEvent(GetId(), true);
|
||||
showEvent.SetEventObject(this);
|
||||
HandleWindowEvent(showEvent);
|
||||
|
@ -2472,6 +2472,7 @@ void wxWindowGTK::Init()
|
||||
#ifdef __WXGTK3__
|
||||
m_paintContext = NULL;
|
||||
m_styleProvider = NULL;
|
||||
m_needSizeEvent = false;
|
||||
#endif
|
||||
|
||||
m_isScrolling = false;
|
||||
@ -3059,8 +3060,15 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
|
||||
DoMoveWindow(x, y, width, height);
|
||||
}
|
||||
|
||||
if ((sizeChange && !m_nativeSizeEvent) || (sizeFlags & wxSIZE_FORCE_EVENT))
|
||||
if (((sizeChange
|
||||
#ifdef __WXGTK3__
|
||||
|| m_needSizeEvent
|
||||
#endif
|
||||
) && !m_nativeSizeEvent) || (sizeFlags & wxSIZE_FORCE_EVENT))
|
||||
{
|
||||
#ifdef __WXGTK3__
|
||||
m_needSizeEvent = false;
|
||||
#endif
|
||||
// update these variables to keep size_allocate handler
|
||||
// from sending another size event for this change
|
||||
DoGetClientSize(&m_clientWidth, &m_clientHeight);
|
||||
@ -4865,6 +4873,15 @@ void wxWindowGTK::GTKSizeRevalidate()
|
||||
{
|
||||
win->InvalidateBestSize();
|
||||
gs_sizeRevalidateList = g_list_delete_link(gs_sizeRevalidateList, p);
|
||||
for (;;)
|
||||
{
|
||||
win = win->m_parent;
|
||||
if (win == NULL || win->m_needSizeEvent)
|
||||
break;
|
||||
win->m_needSizeEvent = true;
|
||||
if (win->IsTopLevel())
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user