[mutter] window: Inform the compositor when a window effectively changes size



commit 1d280d8fa18859be43fd7633ca827855e70df049
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Sep 26 16:30:54 2016 +0200

    window: Inform the compositor when a window effectively changes size
    
    In order for the compositor plugin to be able to animate window size
    changes properly we need to let it know of the starting and final
    window sizes.
    
    For X clients this can be done synchronously and thus with a single
    call into the compositor plugin since it's us (the window manager)
    who's in charge of the final window size.
    
    Wayland clients though, have the final say over their window size
    since it's determined from the client allocated buffer.
    
    This patch moves the meta_compositor_size_change_window() calls before
    move_resize_internal() which lets the compositor plugin know the old
    window size and freezes the MetaWindowActor.
    
    Then we get rid of the META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR flag
    since it's not needed anymore as the window actor is frozen and that
    means we can use meta_compositor_sync_window_geometry() as the point
    where we inform the compositor plugin of the final window size.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770345

 src/compositor/compositor.c |    1 +
 src/core/window-private.h   |    1 -
 src/core/window.c           |   51 ++++++++++++++++++------------------------
 3 files changed, 23 insertions(+), 30 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index f001dfd..1d25b87 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -1013,6 +1013,7 @@ meta_compositor_sync_window_geometry (MetaCompositor *compositor,
 {
   MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
   meta_window_actor_sync_actor_geometry (window_actor, did_placement);
+  meta_plugin_manager_event_size_changed (compositor->plugin_mgr, window_actor);
 }
 
 static void
diff --git a/src/core/window-private.h b/src/core/window-private.h
index c7d6934..711097c 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -78,7 +78,6 @@ typedef enum
   META_MOVE_RESIZE_RESIZE_ACTION     = 1 << 3,
   META_MOVE_RESIZE_WAYLAND_RESIZE    = 1 << 4,
   META_MOVE_RESIZE_STATE_CHANGED     = 1 << 5,
-  META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR = 1 << 6,
 } MetaMoveResizeFlags;
 
 typedef enum
diff --git a/src/core/window.c b/src/core/window.c
index e3e15cf..6cef635 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -2741,23 +2741,21 @@ meta_window_maximize (MetaWindow        *window,
                                      directions,
                                      saved_rect);
 
-      MetaRectangle old_frame_rect, old_buffer_rect, new_rect;
+      MetaRectangle old_frame_rect, old_buffer_rect;
 
       meta_window_get_frame_rect (window, &old_frame_rect);
       meta_window_get_buffer_rect (window, &old_buffer_rect);
 
+      meta_compositor_size_change_window (window->display->compositor, window,
+                                          META_SIZE_CHANGE_MAXIMIZE,
+                                          &old_frame_rect, &old_buffer_rect);
+
       meta_window_move_resize_internal (window,
                                         (META_MOVE_RESIZE_MOVE_ACTION |
                                          META_MOVE_RESIZE_RESIZE_ACTION |
-                                         META_MOVE_RESIZE_STATE_CHANGED |
-                                         META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR),
+                                         META_MOVE_RESIZE_STATE_CHANGED),
                                         NorthWestGravity,
                                         window->unconstrained_rect);
-      meta_window_get_frame_rect (window, &new_rect);
-
-      meta_compositor_size_change_window (window->display->compositor, window,
-                                          META_SIZE_CHANGE_MAXIMIZE,
-                                          &old_frame_rect, &old_buffer_rect);
     }
 }
 
@@ -3004,7 +3002,6 @@ meta_window_unmaximize (MetaWindow        *window,
                         MetaMaximizeFlags  directions)
 {
   gboolean unmaximize_horizontally, unmaximize_vertically;
-  MetaRectangle new_rect;
 
   g_return_if_fail (!window->override_redirect);
 
@@ -3095,19 +3092,17 @@ meta_window_unmaximize (MetaWindow        *window,
       ensure_size_hints_satisfied (&target_rect, &window->size_hints);
       meta_window_client_rect_to_frame_rect (window, &target_rect, &target_rect);
 
+      meta_compositor_size_change_window (window->display->compositor, window,
+                                          META_SIZE_CHANGE_UNMAXIMIZE,
+                                          &old_frame_rect, &old_buffer_rect);
+
       meta_window_move_resize_internal (window,
                                         (META_MOVE_RESIZE_MOVE_ACTION |
                                          META_MOVE_RESIZE_RESIZE_ACTION |
-                                         META_MOVE_RESIZE_STATE_CHANGED |
-                                         META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR),
+                                         META_MOVE_RESIZE_STATE_CHANGED),
                                         NorthWestGravity,
                                         target_rect);
 
-      meta_window_get_frame_rect (window, &new_rect);
-      meta_compositor_size_change_window (window->display->compositor, window,
-                                          META_SIZE_CHANGE_UNMAXIMIZE,
-                                          &old_frame_rect, &old_buffer_rect);
-
       /* When we unmaximize, if we're doing a mouse move also we could
        * get the window suddenly jumping to the upper left corner of
        * the workspace, since that's where it was when the grab op
@@ -3215,18 +3210,17 @@ meta_window_make_fullscreen (MetaWindow  *window)
       meta_window_get_frame_rect (window, &old_frame_rect);
       meta_window_get_buffer_rect (window, &old_buffer_rect);
 
+      meta_compositor_size_change_window (window->display->compositor,
+                                          window, META_SIZE_CHANGE_FULLSCREEN,
+                                          &old_frame_rect, &old_buffer_rect);
+
       meta_window_make_fullscreen_internal (window);
       meta_window_move_resize_internal (window,
                                         (META_MOVE_RESIZE_MOVE_ACTION |
                                          META_MOVE_RESIZE_RESIZE_ACTION |
-                                         META_MOVE_RESIZE_STATE_CHANGED |
-                                         META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR),
+                                         META_MOVE_RESIZE_STATE_CHANGED),
                                         NorthWestGravity,
                                         window->unconstrained_rect);
-
-      meta_compositor_size_change_window (window->display->compositor,
-                                          window, META_SIZE_CHANGE_FULLSCREEN,
-                                          &old_frame_rect, &old_buffer_rect);
     }
 }
 
@@ -3261,18 +3255,17 @@ meta_window_unmake_fullscreen (MetaWindow  *window)
       meta_window_recalc_features (window);
       set_net_wm_state (window);
 
+      meta_compositor_size_change_window (window->display->compositor,
+                                          window, META_SIZE_CHANGE_UNFULLSCREEN,
+                                          &old_frame_rect, &old_buffer_rect);
+
       meta_window_move_resize_internal (window,
                                         (META_MOVE_RESIZE_MOVE_ACTION |
                                          META_MOVE_RESIZE_RESIZE_ACTION |
-                                         META_MOVE_RESIZE_STATE_CHANGED |
-                                         META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR),
+                                         META_MOVE_RESIZE_STATE_CHANGED),
                                         NorthWestGravity,
                                         target_rect);
 
-      meta_compositor_size_change_window (window->display->compositor,
-                                          window, META_SIZE_CHANGE_UNFULLSCREEN,
-                                          &old_frame_rect, &old_buffer_rect);
-
       meta_screen_queue_check_fullscreen (window->screen);
 
       g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_FULLSCREEN]);
@@ -3731,7 +3724,7 @@ meta_window_move_resize_internal (MetaWindow          *window,
     {
       window->unconstrained_rect = unconstrained_rect;
 
-      if (window->known_to_compositor && !(flags & META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR))
+      if (window->known_to_compositor)
         meta_compositor_sync_window_geometry (window->display->compositor,
                                               window,
                                               did_placement);


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