[mutter] expose MetaWindow .move(), resize() and add/expose .move_frame()



commit 70ffb564ffbc0645e8b47a338c21b74231a1cd11
Author: Jeffery Olson <olson jeffery gmail com>
Date:   Wed Mar 9 07:01:44 2011 -0800

    expose MetaWindow .move(), resize() and add/expose .move_frame()
    
    The latter move method will place the window by the origin of the
    enclosing window decoration/frame, while the former will place by the
    origin of the inner window, itself.
    
    (Also moved meta_window_showing_on_its_workspace comment into
     gtk-doc)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=642355

 src/core/window.c |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/meta/window.h |    5 +++-
 2 files changed, 62 insertions(+), 1 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index b63352e..7f7abdf 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1711,6 +1711,12 @@ ancestor_is_minimized (MetaWindow *window)
   return is_minimized;
 }
 
+/**
+ * meta_window_showing_on_its_workspace:
+ * @window: A #MetaWindow
+ *
+ * Returns: %TRUE if window would be visible, if its workspace was current
+ */
 gboolean
 meta_window_showing_on_its_workspace (MetaWindow *window)
 {
@@ -4448,6 +4454,15 @@ meta_window_move_resize_internal (MetaWindow          *window,
     meta_window_foreach_transient (window, move_attached_dialog, NULL);
 }
 
+/**
+ * meta_window_resize:
+ * @window: a #MetaWindow
+ * @user_op: bool to indicate whether or not this is a user operation
+ * @w: desired width
+ * @h: desired height
+ *
+ * Resize the window to the desired size.
+ */
 void
 meta_window_resize (MetaWindow  *window,
                     gboolean     user_op,
@@ -4468,6 +4483,18 @@ meta_window_resize (MetaWindow  *window,
                                     x, y, w, h);
 }
 
+/**
+ * meta_window_move:
+ * @window: a #MetaWindow
+ * @user_op: bool to indicate whether or not this is a user operation
+ * @root_x_nw: desired x pos
+ * @root_y_nw: desired y pos
+ *
+ * Moves the window to the desired location on window's assigned workspace.
+ * NOTE: does NOT place according to the origin of the enclosing
+ * frame/window-decoration, but according to the origin of the window,
+ * itself.
+ */
 void
 meta_window_move (MetaWindow  *window,
                   gboolean     user_op,
@@ -4487,6 +4514,37 @@ meta_window_move (MetaWindow  *window,
                                     window->rect.width,
                                     window->rect.height);
 }
+/**
+ * meta_window_move_frame:
+ * @window: a #MetaWindow
+ * @user_op: bool to indicate whether or not this is a user operation
+ * @root_x_nw: desired x pos
+ * @root_y_nw: desired y pos
+ *
+ * Moves the window to the desired location on window's assigned
+ * workspace, using the northwest edge of the frame as the reference,
+ * instead of the actual window's origin, but only if a frame is present.
+ * Otherwise, acts identically to meta_window_move().
+ */
+void
+meta_window_move_frame (MetaWindow  *window,
+                  gboolean     user_op,
+                  int          root_x_nw,
+                  int          root_y_nw)
+{
+  int x = root_x_nw;
+  int y = root_y_nw;
+
+  if (window->frame)
+    {
+      /* offset by the distance between the origin of the window
+       * and the origin of the enclosing window decorations
+       */
+      x += window->frame->child_x;
+      y += window->frame->child_y;
+    }
+  meta_window_move (window, user_op, x, y);
+}
 
 void
 meta_window_move_resize (MetaWindow  *window,
diff --git a/src/meta/window.h b/src/meta/window.h
index 1eac457..467434f 100644
--- a/src/meta/window.h
+++ b/src/meta/window.h
@@ -90,9 +90,12 @@ void     meta_window_activate_with_workspace (MetaWindow    *window,
 const char * meta_window_get_description (MetaWindow *window);
 const char * meta_window_get_wm_class (MetaWindow *window);
 const char * meta_window_get_wm_class_instance (MetaWindow *window);
-/* Return whether the window would be showing if we were on its workspace */
 gboolean    meta_window_showing_on_its_workspace (MetaWindow *window);
 
+void meta_window_move(MetaWindow *window, gboolean user_op, int root_x_nw, int root_y_nw);
+void meta_window_move_frame(MetaWindow *window, gboolean user_op, int root_x_nw, int root_y_nw);
+void meta_window_resize(MetaWindow *window, gboolean user_op, int w, int h);
+
 void meta_window_set_demands_attention (MetaWindow *window);
 void meta_window_unset_demands_attention (MetaWindow *window);
 



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