[metacity] window: remove code for static gravity resizes



commit 12626b0b15853f7b9273aebf9491ecc2f420a37f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Mar 19 09:21:14 2014 -0400

    window: remove code for static gravity resizes
    
    It was never turned on for all the years it's been there.

 src/core/display-private.h |    2 -
 src/core/display.c         |    3 --
 src/core/window-private.h  |    3 --
 src/core/window.c          |   83 ++-----------------------------------------
 4 files changed, 4 insertions(+), 87 deletions(-)
---
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 03b1079..8cb66a8 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -128,8 +128,6 @@ struct _MetaDisplay
    */
   guint allow_terminal_deactivation : 1;
 
-  guint static_gravity_works : 1;
-
   /*< private-ish >*/
   guint error_trap_synced_at_last_pop : 1;
   MetaEventQueue *events;
diff --git a/src/core/display.c b/src/core/display.c
index e37171c..2abb425 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -352,9 +352,6 @@ meta_display_open (void)
   the_display->allow_terminal_deactivation = TRUE; /* Only relevant for when a
                                                   terminal has the focus */
 
-  /* FIXME copy the checks from GDK probably */
-  the_display->static_gravity_works = g_getenv ("METACITY_USE_STATIC_GRAVITY") != NULL;
-
   meta_bell_init (the_display);
 
   meta_display_init_keys (the_display);
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 75b847b..7a88988 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -612,9 +612,6 @@ void meta_window_show_menu (MetaWindow         *window,
 gboolean meta_window_titlebar_is_onscreen    (MetaWindow *window);
 void     meta_window_shove_titlebar_onscreen (MetaWindow *window);
 
-void meta_window_set_gravity (MetaWindow *window,
-                              int         gravity);
-
 void meta_window_update_sync_request_counter (MetaWindow *window,
                                               guint64     new_counter_value);
 
diff --git a/src/core/window.c b/src/core/window.c
index 02d2897..6cdb892 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3387,12 +3387,6 @@ adjust_for_gravity (MetaWindow        *window,
     }
 }
 
-static gboolean
-static_gravity_works (MetaDisplay *display)
-{
-  return display->static_gravity_works;
-}
-
 void
 meta_window_create_sync_request_alarm (MetaWindow *window)
 {
@@ -3596,7 +3590,6 @@ meta_window_move_resize_internal (MetaWindow          *window,
   gboolean do_gravity_adjust;
   gboolean is_user_action;
   gboolean configure_frame_first;
-  gboolean use_static_gravity;
   /* used for the configure request, but may not be final
    * destination due to StaticGravity etc.
    */
@@ -3764,50 +3757,11 @@ meta_window_move_resize_internal (MetaWindow          *window,
 
       new_x = borders.total.left;
       new_y = borders.total.top;
+      client_move_x = new_x;
+      client_move_y = new_y;
 
-      if (need_resize_frame && need_move_frame &&
-          static_gravity_works (window->display))
-        {
-          /* static gravity kicks in because frame
-           * is both moved and resized
-           */
-          /* when we move the frame by frame_pos_dx, frame_pos_dy the
-           * client will implicitly move relative to frame by the
-           * inverse delta.
-           *
-           * When moving client then frame, we move the client by the
-           * frame delta, to be canceled out by the implicit move by
-           * the inverse frame delta, resulting in a client at new_x,
-           * new_y.
-           *
-           * When moving frame then client, we move the client
-           * by the same delta as the frame, because the client
-           * was "left behind" by the frame - resulting in a client
-           * at new_x, new_y.
-           *
-           * In both cases we need to move the client window
-           * in all cases where we had to move the frame window.
-           */
-
-          client_move_x = new_x + frame_pos_dx;
-          client_move_y = new_y + frame_pos_dy;
-
-          if (need_move_frame)
-            need_move_client = TRUE;
-
-          use_static_gravity = TRUE;
-        }
-      else
-        {
-          client_move_x = new_x;
-          client_move_y = new_y;
-
-          if (client_move_x != window->rect.x ||
-              client_move_y != window->rect.y)
-            need_move_client = TRUE;
-
-          use_static_gravity = FALSE;
-        }
+      if (client_move_x != window->rect.x || client_move_y != window->rect.y)
+        need_move_client = TRUE;
 
       /* This is the final target position, but not necessarily what
        * we pass to XConfigureWindow, due to StaticGravity implicit
@@ -3827,8 +3781,6 @@ meta_window_move_resize_internal (MetaWindow          *window,
 
       client_move_x = window->rect.x;
       client_move_y = window->rect.y;
-
-      use_static_gravity = FALSE;
     }
 
   /* If frame extents have changed, fill in other frame fields and
@@ -3890,9 +3842,6 @@ meta_window_move_resize_internal (MetaWindow          *window,
 
   configure_frame_first = (size_dx + size_dy >= 0);
 
-  if (use_static_gravity)
-    meta_window_set_gravity (window, StaticGravity);
-
   if (configure_frame_first && window->frame)
     frame_shape_changed = meta_frame_sync_to_window (window->frame,
                                                      gravity,
@@ -3954,10 +3903,6 @@ meta_window_move_resize_internal (MetaWindow          *window,
                                                      need_move_frame,
                                                      need_resize_frame);
 
-  /* Put gravity back to be nice to lesser window managers */
-  if (use_static_gravity)
-    meta_window_set_gravity (window, NorthWestGravity);
-
   if (need_configure_notify)
     send_configure_notify (window);
 
@@ -8171,26 +8116,6 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
     }
 }
 
-void
-meta_window_set_gravity (MetaWindow *window,
-                         int         gravity)
-{
-  XSetWindowAttributes attrs;
-
-  meta_verbose ("Setting gravity of %s to %d\n", window->desc, gravity);
-
-  attrs.win_gravity = gravity;
-
-  meta_error_trap_push (window->display);
-
-  XChangeWindowAttributes (window->display->xdisplay,
-                           window->xwindow,
-                           CWWinGravity,
-                           &attrs);
-
-  meta_error_trap_pop (window->display);
-}
-
 static void
 get_work_area_xinerama (MetaWindow    *window,
                         MetaRectangle *area,


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