[mutter] wayland: Make synchronous subsurface a very special case in commit



commit e1b0c9c756fb19a2f1c2e037aeb07e81adb31f07
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Apr 11 23:40:36 2014 -0700

    wayland: Make synchronous subsurface a very special case in commit
    
    Really, it is a special case. When the subsurface is synchronous,
    commit changes meaning from being applied immediately to being
    queued up for replay later. Handle this explicit special case
    with an explicit special case in the code.
    
    This means that in all other paths, we can unconditionally
    apply the actor immediately.

 src/wayland/meta-wayland-surface.c |   61 ++++++++++++++++--------------------
 1 files changed, 27 insertions(+), 34 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 75a1f66..fc3b4d1 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -290,42 +290,23 @@ static void
 subsurface_surface_commit (MetaWaylandSurface             *surface,
                            MetaWaylandDoubleBufferedState *pending)
 {
-  /*
-   * If the sub-surface is in synchronous mode, post-pone the commit of its
-   * state until the sub-surface parent commits.
-   *
-   * This is done by moving the various states (damage, input region, buffer
-   * etc.) from the buffered state pending commit to the sub-surface's pending
-   * buffered state.
-   *
-   * The sub-surface's pending buffered state will be committed to the
-   * associated surface when its parent surface is committed, or if the user
-   * issues a wl_subsurface.set_desync request.
-   */
-  if (surface->sub.synchronous)
-    {
-      move_double_buffered_state (pending, &surface->sub.pending_surface_state);
-    }
-  else
+  actor_surface_commit (surface, pending);
+
+  if (pending->newly_attached)
     {
-      actor_surface_commit (surface, pending);
+      MetaSurfaceActor *surface_actor = surface->surface_actor;
+      MetaWaylandBuffer *buffer = pending->buffer;
+      float x, y;
 
-      if (pending->newly_attached)
-        {
-          MetaSurfaceActor *surface_actor = surface->surface_actor;
-          MetaWaylandBuffer *buffer = pending->buffer;
-          float x, y;
-
-          if (buffer != NULL)
-            clutter_actor_show (CLUTTER_ACTOR (surface_actor));
-          else
-            clutter_actor_hide (CLUTTER_ACTOR (surface_actor));
-
-          clutter_actor_get_position (CLUTTER_ACTOR (surface_actor), &x, &y);
-          x += pending->dx;
-          y += pending->dy;
-          clutter_actor_set_position (CLUTTER_ACTOR (surface_actor), x, y);
-        }
+      if (buffer != NULL)
+        clutter_actor_show (CLUTTER_ACTOR (surface_actor));
+      else
+        clutter_actor_hide (CLUTTER_ACTOR (surface_actor));
+
+      clutter_actor_get_position (CLUTTER_ACTOR (surface_actor), &x, &y);
+      x += pending->dx;
+      y += pending->dy;
+      clutter_actor_set_position (CLUTTER_ACTOR (surface_actor), x, y);
     }
 }
 
@@ -344,6 +325,18 @@ commit_double_buffered_state (MetaWaylandSurface             *surface,
 {
   MetaWaylandCompositor *compositor = surface->compositor;
 
+  /* If this surface is a subsurface in in synchronous mode, commit
+   * has a special-case and should not apply the pending state immediately.
+   *
+   * Instead, we move it to another pending state, which will be
+   * actually committed when the parent commits.
+   */
+  if (surface->sub.synchronous)
+    {
+      move_double_buffered_state (pending, &surface->sub.pending_surface_state);
+      return;
+    }
+
   if (pending->newly_attached)
     surface_set_buffer (surface, pending->buffer);
 


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