[mutter] window: Move move_resize_wayland to window-wayland.c



commit 8461b2c9106a5eba970545a956dfaae5a4433b6c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 28 17:44:45 2014 -0400

    window: Move move_resize_wayland to window-wayland.c
    
    The move/resize logic is still busted for top/left resizes... sigh.

 src/core/window-private.h          |   14 +++++---
 src/core/window.c                  |   59 +++--------------------------------
 src/wayland/meta-wayland-surface.c |    3 +-
 src/wayland/window-wayland.c       |   39 +++++++++++++++++++++++
 src/wayland/window-wayland.h       |    6 ++++
 5 files changed, 61 insertions(+), 60 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 1e38586..798d76c 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -619,11 +619,6 @@ void     meta_window_move_resize_request(MetaWindow *window,
                                          int         y,
                                          int         width,
                                          int         height);
-void     meta_window_move_resize_wayland (MetaWindow *window,
-                                          int         width,
-                                          int         height,
-                                          int         dx,
-                                          int         dy);
 void     meta_window_set_focused_internal (MetaWindow *window,
                                            gboolean    focused);
 
@@ -755,4 +750,13 @@ void meta_window_update_resize (MetaWindow *window,
                                 int x, int y,
                                 gboolean force);
 
+void meta_window_move_resize_internal (MetaWindow          *window,
+                                       MetaMoveResizeFlags  flags,
+                                       int                  gravity,
+                                       int                  root_x_nw,
+                                       int                  root_y_nw,
+                                       int                  w,
+                                       int                  h);
+void meta_window_save_user_window_placement (MetaWindow *window);
+
 #endif
diff --git a/src/core/window.c b/src/core/window.c
index 649503a..1cdf6bf 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -81,17 +81,8 @@ static void     meta_window_show          (MetaWindow     *window);
 static void     meta_window_hide          (MetaWindow     *window);
 
 static void     meta_window_save_rect         (MetaWindow    *window);
-static void     save_user_window_placement    (MetaWindow    *window);
 static void     force_save_user_window_placement (MetaWindow    *window);
 
-static void meta_window_move_resize_internal (MetaWindow         *window,
-                                              MetaMoveResizeFlags flags,
-                                              int                 resize_gravity,
-                                              int                 root_x_nw,
-                                              int                 root_y_nw,
-                                              int                 w,
-                                              int                 h);
-
 static void     ensure_mru_position_after (MetaWindow *window,
                                            MetaWindow *after_this_one);
 
@@ -2907,8 +2898,8 @@ force_save_user_window_placement (MetaWindow *window)
  * fullscreen, otherwise the window may snap back to those dimensions
  * (bug #461927).
  */
-static void
-save_user_window_placement (MetaWindow *window)
+void
+meta_window_save_user_window_placement (MetaWindow *window)
 {
   if (!(META_WINDOW_MAXIMIZED (window) || META_WINDOW_TILED_SIDE_BY_SIDE (window) || window->fullscreen))
     {
@@ -4147,7 +4138,7 @@ meta_window_update_monitor (MetaWindow *window)
     }
 }
 
-static void
+void
 meta_window_move_resize_internal (MetaWindow          *window,
                                   MetaMoveResizeFlags  flags,
                                   int                  gravity,
@@ -4295,7 +4286,7 @@ meta_window_move_resize_internal (MetaWindow          *window,
   if (!window->placed && window->force_save_user_rect && !window->fullscreen)
     force_save_user_window_placement (window);
   else if (is_user_action)
-    save_user_window_placement (window);
+    meta_window_save_user_window_placement (window);
 
   if (result & META_MOVE_RESIZE_RESULT_MOVED)
     g_signal_emit (window, window_signals[POSITION_CHANGED], 0);
@@ -4374,46 +4365,6 @@ meta_window_resize (MetaWindow  *window,
                                     x, y, w, h);
 }
 
-/*
- * meta_window_move_resize_wayland:
- *
- * Complete a resize operation from a wayland client.
- *
- */
-void
-meta_window_move_resize_wayland (MetaWindow *window,
-                                 int         width,
-                                 int         height,
-                                 int         dx,
-                                 int         dy)
-{
-  int x, y;
-  MetaMoveResizeFlags flags;
-
-  flags = META_IS_WAYLAND_RESIZE;
-
-  meta_window_get_position (window, &x, &y);
-
-  /* dx/dy are ignored during resizing */
-  if (!meta_grab_op_is_resizing (window->display->grab_op))
-    {
-      if (dx != 0 || dy != 0)
-        {
-          x += dx;
-          y += dy;
-          flags |= META_IS_MOVE_ACTION;
-        }
-    }
-
-  if (width != window->rect.width || height != window->rect.height)
-    flags |= META_IS_RESIZE_ACTION;
-
-  meta_window_move_resize_internal (window, flags,
-                                    meta_resize_gravity_from_grab_op (window->display->grab_op),
-                                    x, y, width, height);
-  save_user_window_placement (window);
-}
-
 /**
  * meta_window_move:
  * @window: a #MetaWindow
@@ -5516,7 +5467,7 @@ meta_window_move_resize_request (MetaWindow *window,
    *
    * See also bug 426519.
    */
-  save_user_window_placement (window);
+  meta_window_save_user_window_placement (window);
 }
 
 /*
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 3b1935e..0c7cfdb 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -51,6 +51,7 @@
 #include "meta-cursor-tracker-private.h"
 #include "display-private.h"
 #include "window-private.h"
+#include "window-wayland.h"
 #include <meta/types.h>
 #include <meta/main.h>
 #include "frame.h"
@@ -182,7 +183,7 @@ toplevel_surface_commit (MetaWaylandSurface             *surface,
               new_height != window->rect.height ||
               pending->dx != 0 ||
               pending->dy != 0)
-            meta_window_move_resize_wayland (window, new_width, new_height, pending->dx, pending->dy);
+            meta_window_wayland_move_resize (window, new_width, new_height, pending->dx, pending->dy);
         }
     }
 
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index a76cc10..1009cd5 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -223,3 +223,42 @@ meta_window_wayland_class_init (MetaWindowWaylandClass *klass)
   window_class->focus = meta_window_wayland_focus;
   window_class->move_resize_internal = meta_window_wayland_move_resize_internal;
 }
+
+/**
+ * meta_window_move_resize_wayland:
+ *
+ * Complete a resize operation from a wayland client.
+ */
+void
+meta_window_wayland_move_resize (MetaWindow *window,
+                                 int         width,
+                                 int         height,
+                                 int         dx,
+                                 int         dy)
+{
+  int x, y;
+  MetaMoveResizeFlags flags;
+
+  flags = META_IS_WAYLAND_RESIZE;
+
+  meta_window_get_position (window, &x, &y);
+
+  /* dx/dy are ignored during resizing */
+  if (!meta_grab_op_is_resizing (window->display->grab_op))
+    {
+      if (dx != 0 || dy != 0)
+        {
+          x += dx;
+          y += dy;
+          flags |= META_IS_MOVE_ACTION;
+        }
+    }
+
+  if (width != window->rect.width || height != window->rect.height)
+    flags |= META_IS_RESIZE_ACTION;
+
+  meta_window_move_resize_internal (window, flags,
+                                    meta_resize_gravity_from_grab_op (window->display->grab_op),
+                                    x, y, width, height);
+  meta_window_save_user_window_placement (window);
+}
diff --git a/src/wayland/window-wayland.h b/src/wayland/window-wayland.h
index c1c6674..361035f 100644
--- a/src/wayland/window-wayland.h
+++ b/src/wayland/window-wayland.h
@@ -41,4 +41,10 @@ GType meta_window_wayland_get_type (void);
 typedef struct _MetaWindowWayland      MetaWindowWayland;
 typedef struct _MetaWindowWaylandClass MetaWindowWaylandClass;
 
+void meta_window_wayland_move_resize (MetaWindow *window,
+                                      int         width,
+                                      int         height,
+                                      int         dx,
+                                      int         dy);
+
 #endif


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