forked from AuroraMiddleware/gtk
gdkframeclock: Loop the layout phase if needed
In the case where the layout phase queued a layout we don't want to progress to the paint phase with invalid allocations, so we loop the layout. This shouldn't normally happen, but it may happen in some edge cases like if user/wm resizes clash with natural window size changes from a gtk widget. This should not generally loop though, so we detect this after 4 cycles and print a warning. This was detected because of an issue in GtkWindow where it seems to incorrectly handle the case of a user interactive resize. It seems gtk_window_move_resize() believes that configure_request_size_changed changed due to hitting some corner case so it calls gtk_widget_queue_resize_no_redraw(), marking the window as need_alloc after the layout phase. This commit fixes the issue, but we should also look into if we can fix that.
This commit is contained in:
parent
e0ca53ff7c
commit
c3bff30b50
@ -384,6 +384,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
case GDK_FRAME_CLOCK_PHASE_LAYOUT:
|
||||
if (priv->freeze_count == 0)
|
||||
{
|
||||
int iter;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
{
|
||||
@ -394,11 +395,20 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_LAYOUT;
|
||||
if (priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT)
|
||||
/* We loop in the layout phase, because we don't want to progress
|
||||
* into the paint phase with invalid size allocations. This may
|
||||
* happen in some situation like races between user window
|
||||
* resizes and natural size changes.
|
||||
*/
|
||||
iter = 0;
|
||||
while ((priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT) &&
|
||||
priv->freeze_count == 0 && iter++ < 4)
|
||||
{
|
||||
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT;
|
||||
g_signal_emit_by_name (G_OBJECT (clock), "layout");
|
||||
}
|
||||
if (iter == 5)
|
||||
g_warning ("gdk-frame-clock: layout continuously requested, giving up after 4 tries");
|
||||
}
|
||||
case GDK_FRAME_CLOCK_PHASE_PAINT:
|
||||
if (priv->freeze_count == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user