Fix a sizing/layout problem with GTK3
Relying on "check-resize" to detect when a "size-allocate" is in progess is insufficient, resulting in the possibility of a window ending up with the wrong size or position after inital layout. Using our existing "size-allocate" handlers should be enough to detect the cases we care about. See #18865
This commit is contained in:
@@ -57,6 +57,7 @@ static wxTopLevelWindowGTK *g_activeFrame = NULL;
|
||||
|
||||
extern wxCursor g_globalCursor;
|
||||
extern wxCursor g_busyCursor;
|
||||
extern bool g_inSizeAllocate;
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
// Whether _NET_REQUEST_FRAME_EXTENTS support is working
|
||||
@@ -240,6 +241,9 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxTopLevelWindowGTK* win)
|
||||
if (win->m_clientWidth != alloc->width ||
|
||||
win->m_clientHeight != alloc->height)
|
||||
{
|
||||
const bool save_inSizeAllocate = g_inSizeAllocate;
|
||||
g_inSizeAllocate = true;
|
||||
|
||||
win->m_clientWidth = alloc->width;
|
||||
win->m_clientHeight = alloc->height;
|
||||
|
||||
@@ -272,6 +276,8 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxTopLevelWindowGTK* win)
|
||||
win->HandleWindowEvent(event);
|
||||
}
|
||||
// else the window is currently unmapped, don't generate size events
|
||||
|
||||
g_inSizeAllocate = save_inSizeAllocate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user