[mutter/wip/fullscreen: 150/150] compositor: add hooks for fullscreen and unfullscreen animations



commit 88e466f8a8b6c80dc488cae6cb67064ea3893c59
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Sep 1 13:04:19 2013 -0700

    compositor: add hooks for fullscreen and unfullscreen animations
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707248

 src/core/window.c     |   28 ++++++++++++++++++++++++----
 src/meta/compositor.h |    2 ++
 src/x11/window-x11.c  |   24 ++++++++++++++++++------
 3 files changed, 44 insertions(+), 10 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index d075cab..a3973ca 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3195,12 +3195,23 @@ meta_window_make_fullscreen (MetaWindow  *window)
 
   if (!window->fullscreen)
     {
-      meta_window_make_fullscreen_internal (window);
+      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_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_MOVE_ACTION |
+                                         META_MOVE_RESIZE_RESIZE_ACTION |
+                                         META_MOVE_RESIZE_STATE_CHANGED |
+                                         META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR),
                                         NorthWestGravity,
                                         window->unconstrained_rect);
+
+      meta_compositor_size_change_window (window->display->compositor,
+                                          window, META_SIZE_CHANGE_FULLSCREEN,
+                                          &old_frame_rect, &old_buffer_rect);
     }
 }
 
@@ -3211,7 +3222,7 @@ meta_window_unmake_fullscreen (MetaWindow  *window)
 
   if (window->fullscreen)
     {
-      MetaRectangle target_rect;
+      MetaRectangle old_frame_rect, old_buffer_rect, target_rect;
 
       meta_topic (META_DEBUG_WINDOW_OPS,
                   "Unfullscreening %s\n", window->desc);
@@ -3220,6 +3231,8 @@ meta_window_unmake_fullscreen (MetaWindow  *window)
       target_rect = window->saved_rect;
 
       meta_window_frame_size_changed (window);
+      meta_window_get_frame_rect (window, &old_frame_rect);
+      meta_window_get_buffer_rect (window, &old_buffer_rect);
 
       /* Window's size hints may have changed while maximized, making
        * saved_rect invalid.  #329152
@@ -3234,10 +3247,17 @@ meta_window_unmake_fullscreen (MetaWindow  *window)
       set_net_wm_state (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_MOVE_ACTION |
+                                         META_MOVE_RESIZE_RESIZE_ACTION |
+                                         META_MOVE_RESIZE_STATE_CHANGED |
+                                         META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR),
                                         NorthWestGravity,
                                         target_rect);
 
+      meta_compositor_size_change_window (window->display->compositor,
+                                          window, META_SIZE_CHANGE_UNFULLSCREEN,
+                                          &old_frame_rect, &old_buffer_rect);
+
       meta_window_update_layer (window);
 
       g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_FULLSCREEN]);
diff --git a/src/meta/compositor.h b/src/meta/compositor.h
index 52b4c77..2a538b2 100644
--- a/src/meta/compositor.h
+++ b/src/meta/compositor.h
@@ -57,6 +57,8 @@ typedef enum
 typedef enum {
   META_SIZE_CHANGE_MAXIMIZE,
   META_SIZE_CHANGE_UNMAXIMIZE,
+  META_SIZE_CHANGE_FULLSCREEN,
+  META_SIZE_CHANGE_UNFULLSCREEN
 } MetaSizeChange;
 
 MetaCompositor *meta_compositor_new     (MetaDisplay    *display);
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index b6e5621..1ffb7c2 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -2000,12 +2000,16 @@ meta_window_move_resize_request (MetaWindow *window,
   if (flags & (META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION))
     {
       MetaRectangle rect, monitor_rect;
+      MetaRectangle old_frame_rect, old_buffer_rect;
+      gboolean legacy_fullscreen;
 
       rect.x = x;
       rect.y = y;
       rect.width = width;
       rect.height = height;
 
+      meta_window_get_frame_rect (window, &old_frame_rect);
+      meta_window_get_buffer_rect (window, &old_buffer_rect);
       meta_screen_get_monitor_geometry (window->screen, window->monitor->number, &monitor_rect);
 
       /* Workaround braindead legacy apps that don't know how to
@@ -2015,12 +2019,14 @@ meta_window_move_resize_request (MetaWindow *window,
        * if there are no struts making the workarea smaller than
        * the monitor.
        */
-      if (meta_prefs_get_force_fullscreen() &&
-          !window->hide_titlebar_when_maximized &&
-          (window->decorated || !meta_window_is_client_decorated (window)) &&
-          meta_rectangle_equal (&rect, &monitor_rect) &&
-          window->has_fullscreen_func &&
-          !window->fullscreen)
+      legacy_fullscreen = (meta_prefs_get_force_fullscreen() &&
+                           !window->hide_titlebar_when_maximized &&
+                           (window->decorated || !meta_window_is_client_decorated (window)) &&
+                           meta_rectangle_equal (&rect, &monitor_rect) &&
+                           window->has_fullscreen_func &&
+                           !window->fullscreen);
+
+      if (legacy_fullscreen)
         {
           /*
           meta_topic (META_DEBUG_GEOMETRY,
@@ -2030,11 +2036,17 @@ meta_window_move_resize_request (MetaWindow *window,
                       "fullscreen request\n",
                       window->desc);
           meta_window_make_fullscreen_internal (window);
+          flags |= META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR;
         }
 
       adjust_for_gravity (window, TRUE, gravity, &rect);
       meta_window_client_rect_to_frame_rect (window, &rect, &rect);
       meta_window_move_resize_internal (window, flags, gravity, rect);
+
+      if (legacy_fullscreen)
+        meta_compositor_size_change_window (window->display->compositor,
+                                            window, META_SIZE_CHANGE_FULLSCREEN,
+                                            &old_frame_rect, &old_buffer_rect);
     }
 }
 


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