wayland: When resizing only trigger a redraw if the stage has been shown

This is necessary to avoid a deadlock with the compositor. When setting
a stage size before the stage was shown this would trigger a redraw
inside clutter_stage_wayland_resize. This redraw would result
in a call into eglSwapBuffers which would attach a buffer to the surface
and commit. Unfortunately this would happen before the role for the
surface was set. This would result in the compositor not relaying to the
client that the desired frame was shown.

With this change the call to wl_shell_surface_set_toplevel is always
made before the first redraw.

https://bugzilla.gnome.org/show_bug.cgi?id=704457
This commit is contained in:
Rob Bradford 2013-08-12 17:29:28 +01:00
parent d63632fe2e
commit 1afe757109
2 changed files with 8 additions and 1 deletions

View File

@ -143,6 +143,8 @@ clutter_stage_wayland_show (ClutterStageWindow *stage_window,
if (stage_wayland->wayland_shell_surface) if (stage_wayland->wayland_shell_surface)
wl_shell_surface_set_toplevel (stage_wayland->wayland_shell_surface); wl_shell_surface_set_toplevel (stage_wayland->wayland_shell_surface);
stage_wayland->shown = TRUE;
/* We need to queue a redraw after the stage is shown because all of /* We need to queue a redraw after the stage is shown because all of
* the other queue redraws up to this point will have been ignored * the other queue redraws up to this point will have been ignored
* because the actor was not visible. The other backends do not need * because the actor was not visible. The other backends do not need
@ -205,11 +207,15 @@ clutter_stage_wayland_resize (ClutterStageWindow *stage_window,
gint height) gint height)
{ {
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window); ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
ClutterStageWayland *stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window);
/* Resize preserving top left */ /* Resize preserving top left */
if (stage_cogl->onscreen) if (stage_cogl->onscreen)
{ {
cogl_wayland_onscreen_resize (stage_cogl->onscreen, width, height, 0, 0); cogl_wayland_onscreen_resize (stage_cogl->onscreen, width, height, 0, 0);
/* Only trigger a redraw if the stage window has been shown */
if (stage_wayland->shown)
_clutter_stage_window_redraw (stage_window); _clutter_stage_window_redraw (stage_window);
} }
} }

View File

@ -54,6 +54,7 @@ struct _ClutterStageWayland
struct wl_shell_surface *wayland_shell_surface; struct wl_shell_surface *wayland_shell_surface;
gboolean fullscreen; gboolean fullscreen;
gboolean foreign_wl_surface; gboolean foreign_wl_surface;
gboolean shown;
}; };
struct _ClutterStageWaylandClass struct _ClutterStageWaylandClass