[mutter] MetaWindowActor: Go back to freezing affecting actor geometry



commit d900d835228874f7dd2015a85ba25b6dc17499f9
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Fri Feb 15 21:27:00 2013 -0500

    MetaWindowActor: Go back to freezing affecting actor geometry
    
    We do, in fact, need freezing to affect window geometry, so that
    move-resize operations (such as an interactive resize from the
    left, or a resize of a popup centered by the application) occur
    atomically.
    
    So to make map effects work properly, only exclude the initial
    placement of a window from freezing. (In the future, we may want
    to consider whether pure moves of a window being done in response
    to a user drag should also be excluded from freezing.)
    
    Rename meta_window_sync_actor_position() to
    meta_window_sync_actor_geometry() for clarity.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693922

 src/compositor/compositor.c                |    5 +++--
 src/compositor/meta-window-actor-private.h |    3 ++-
 src/compositor/meta-window-actor.c         |   21 ++++++++++++++++-----
 src/core/window.c                          |   11 ++++++++---
 src/meta/compositor.h                      |    3 ++-
 5 files changed, 31 insertions(+), 12 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index cf9e05b..fcee450 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -1198,7 +1198,8 @@ meta_compositor_window_unmapped (MetaCompositor *compositor,
 
 void
 meta_compositor_sync_window_geometry (MetaCompositor *compositor,
-                                     MetaWindow *window)
+                                     MetaWindow *window,
+                                      gboolean did_placement)
 {
   MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
   MetaScreen      *screen = meta_window_get_screen (window);
@@ -1210,7 +1211,7 @@ meta_compositor_sync_window_geometry (MetaCompositor *compositor,
   if (!window_actor)
     return;
 
-  meta_window_actor_sync_actor_position (window_actor);
+  meta_window_actor_sync_actor_geometry (window_actor, did_placement);
 }
 
 void
diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h
index e2eec5c..90a9e35 100644
--- a/src/compositor/meta-window-actor-private.h
+++ b/src/compositor/meta-window-actor-private.h
@@ -43,7 +43,8 @@ void meta_window_actor_get_shape_bounds (MetaWindowActor       *self,
                                           cairo_rectangle_int_t *bounds);
 
 gboolean meta_window_actor_effect_in_progress  (MetaWindowActor *self);
-void     meta_window_actor_sync_actor_position (MetaWindowActor *self);
+void     meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
+                                                gboolean         did_placement);
 void     meta_window_actor_sync_visibility     (MetaWindowActor *self);
 void     meta_window_actor_update_shape        (MetaWindowActor *self);
 void     meta_window_actor_update_opacity      (MetaWindowActor *self);
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index eec18c9..09c88a1 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -951,8 +951,8 @@ meta_window_actor_thaw (MetaWindowActor *self)
   if (self->priv->freeze_count)
     return;
 
-  /* We ignore moves and resizes on frozen windows */
-  meta_window_actor_sync_actor_position (self);
+  /* We sometimes ignore moves and resizes on frozen windows */
+  meta_window_actor_sync_actor_geometry (self, FALSE);
 
   /* We do this now since we might be going right back into the
    * frozen state */
@@ -1121,7 +1121,7 @@ meta_window_actor_after_effects (MetaWindowActor *self)
     }
 
   meta_window_actor_sync_visibility (self);
-  meta_window_actor_sync_actor_position (self);
+  meta_window_actor_sync_actor_geometry (self, FALSE);
 
   if (!meta_window_is_mapped (priv->window))
     meta_window_actor_detach (self);
@@ -1370,11 +1370,22 @@ meta_window_actor_destroy (MetaWindowActor *self)
 }
 
 void
-meta_window_actor_sync_actor_position (MetaWindowActor *self)
+meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
+                                       gboolean         did_placement)
 {
   MetaWindowActorPrivate *priv = self->priv;
   MetaRectangle window_rect;
 
+  /* Normally we want freezing a window to also freeze its position; this allows
+   * windows to atomically move and resize together, either under app control,
+   * or because the user is resizing from the left/top. But on initial placement
+   * we need to assign a position, since immediately after the window
+   * is shown, the map effect will go into effect and prevent further geometry
+   * updates.
+   */
+  if (is_frozen (self) && !did_placement)
+    return;
+
   meta_window_get_input_rect (priv->window, &window_rect);
 
   if (priv->last_width != window_rect.width ||
@@ -1578,7 +1589,7 @@ meta_window_actor_new (MetaWindow *window)
   meta_window_actor_set_updates_frozen (self,
                                         meta_window_updates_are_frozen (priv->window));
 
-  meta_window_actor_sync_actor_position (self);
+  meta_window_actor_sync_actor_geometry (self, priv->window->placed);
 
   /* Hang our compositor window state off the MetaWindow for fast retrieval */
   meta_window_set_compositor_private (window, G_OBJECT (self));
diff --git a/src/core/window.c b/src/core/window.c
index e7c42fe..b12b1f7 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4775,6 +4775,7 @@ meta_window_move_resize_internal (MetaWindow          *window,
   gboolean is_configure_request;
   gboolean do_gravity_adjust;
   gboolean is_user_action;
+  gboolean did_placement;
   gboolean configure_frame_first;
   gboolean use_static_gravity;
   /* used for the configure request, but may not be final
@@ -4848,6 +4849,8 @@ meta_window_move_resize_internal (MetaWindow          *window,
                   new_rect.x, new_rect.y);
     }
 
+  did_placement = !window->placed && window->calc_placement;
+
   meta_window_constrain (window,
                          window->frame ? &borders : NULL,
                          flags,
@@ -5161,7 +5164,8 @@ meta_window_move_resize_internal (MetaWindow          *window,
     save_user_window_placement (window);
 
   if (need_move_frame || need_resize_frame ||
-      need_move_client || need_resize_client)
+      need_move_client || need_resize_client ||
+      did_placement)
     {
       int newx, newy;
       meta_window_get_position (window, &newx, &newy);
@@ -5172,7 +5176,8 @@ meta_window_move_resize_internal (MetaWindow          *window,
                   window->user_rect.width, window->user_rect.height);
       if (window->display->compositor)
         meta_compositor_sync_window_geometry (window->display->compositor,
-                                              window);
+                                              window,
+                                              did_placement);
     }
   else
     {
@@ -5506,7 +5511,7 @@ meta_window_configure_notify (MetaWindow      *window,
     meta_warning ("Unhandled change of windows override redirect status\n");
 
   if (window->display->compositor)
-    meta_compositor_sync_window_geometry (window->display->compositor, window);
+    meta_compositor_sync_window_geometry (window->display->compositor, window, FALSE);
 }
 
 void
diff --git a/src/meta/compositor.h b/src/meta/compositor.h
index d917caf..9e12870 100644
--- a/src/meta/compositor.h
+++ b/src/meta/compositor.h
@@ -152,7 +152,8 @@ void meta_compositor_window_mapped        (MetaCompositor *compositor,
 void meta_compositor_window_unmapped      (MetaCompositor *compositor,
                                            MetaWindow     *window);
 void meta_compositor_sync_window_geometry (MetaCompositor *compositor,
-                                           MetaWindow     *window);
+                                           MetaWindow     *window,
+                                           gboolean        did_placement);
 void meta_compositor_set_updates_frozen   (MetaCompositor *compositor,
                                            MetaWindow     *window,
                                            gboolean        updates_frozen);


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