summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-02-25 14:46:54 +0100
committerCarlos Garnacho <carlosg@gnome.org>2015-03-02 12:11:59 +0100
commitc55fcd35fe4e346ee35a85b925b07981057bb98e (patch)
tree6da34da2cc1a5018940504aa764f468e10fe6617 /gdk
parent13e22e20300b7312e52bba7d077fc7e231695fc1 (diff)
downloadgtk+-c55fcd35fe4e346ee35a85b925b07981057bb98e.tar.gz
wayland: Thaw the clock if we hide a GdkWindow mid-frame
When a window is hidden, its surface and all its roles are destroyed, if this happens when we already issued a wl_surface_commit and are awaiting for a frame callback, the clock will remain frozen for the next time the window is shown. To avoid this, keep track of the wl_surface_frame() calls issued, and ensure the clock is thawed after hiding. If we happen to receive the frame callback, it is just ignored. https://bugzilla.gnome.org/show_bug.cgi?id=743427
Diffstat (limited to 'gdk')
-rw-r--r--gdk/wayland/gdkwindow-wayland.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index bcfff714f8..3bfbea1a17 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -109,6 +109,7 @@ struct _GdkWindowImplWayland
unsigned int mapped : 1;
unsigned int use_custom_surface : 1;
unsigned int pending_commit : 1;
+ unsigned int awaiting_frame : 1;
GdkWindowTypeHint hint;
GdkWindow *transient_for;
@@ -324,6 +325,10 @@ frame_callback (void *data,
if (GDK_WINDOW_DESTROYED (window))
return;
+ if (!impl->awaiting_frame)
+ return;
+
+ impl->awaiting_frame = FALSE;
_gdk_frame_clock_thaw (clock);
timings = gdk_frame_clock_get_timings (clock, impl->pending_frame_counter);
@@ -401,6 +406,7 @@ on_frame_clock_after_paint (GdkFrameClock *clock,
impl->pending_commit = FALSE;
impl->pending_frame_counter = gdk_frame_clock_get_frame_counter (clock);
+ impl->awaiting_frame = TRUE;
callback = wl_surface_frame (impl->surface);
wl_callback_add_listener (callback, &frame_listener, window);
@@ -1265,6 +1271,12 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->subsurface = NULL;
}
+ if (impl->awaiting_frame)
+ {
+ impl->awaiting_frame = FALSE;
+ _gdk_frame_clock_thaw (gdk_window_get_frame_clock (window));
+ }
+
wl_surface_destroy (impl->surface);
impl->surface = NULL;