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



commit 2b8fcfd75b0500156e41f303d803116f82769eaf
Author: Rob Bradford <rob linux intel com>
Date:   Mon Aug 12 17:29:28 2013 +0100

    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

 clutter/wayland/clutter-stage-wayland.c |    8 +++++++-
 clutter/wayland/clutter-stage-wayland.h |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/clutter/wayland/clutter-stage-wayland.c b/clutter/wayland/clutter-stage-wayland.c
index 10ad352..33e3fc5 100644
--- a/clutter/wayland/clutter-stage-wayland.c
+++ b/clutter/wayland/clutter-stage-wayland.c
@@ -143,6 +143,8 @@ clutter_stage_wayland_show (ClutterStageWindow *stage_window,
   if (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
    * the other queue redraws up to this point will have been ignored
    * because the actor was not visible. The other backends do not need
@@ -205,12 +207,16 @@ clutter_stage_wayland_resize (ClutterStageWindow *stage_window,
                               gint                height)
 {
   ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
+  ClutterStageWayland *stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window);
 
   /* Resize preserving top left */
   if (stage_cogl->onscreen)
     {
       cogl_wayland_onscreen_resize (stage_cogl->onscreen, width, height, 0, 0);
-      _clutter_stage_window_redraw (stage_window);
+
+      /* Only trigger a redraw if the stage window has been shown */
+      if (stage_wayland->shown)
+        _clutter_stage_window_redraw (stage_window);
     }
 }
 
diff --git a/clutter/wayland/clutter-stage-wayland.h b/clutter/wayland/clutter-stage-wayland.h
index a8124b5..3b041c1 100644
--- a/clutter/wayland/clutter-stage-wayland.h
+++ b/clutter/wayland/clutter-stage-wayland.h
@@ -54,6 +54,7 @@ struct _ClutterStageWayland
   struct wl_shell_surface *wayland_shell_surface;
   gboolean fullscreen;
   gboolean foreign_wl_surface;
+  gboolean shown;
 };
 
 struct _ClutterStageWaylandClass


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]