[gtk+/wip/attach-params: 2/20] gdkwindow: add gdk_window_move_using_params ()



commit bf9dbbc99a12d0c65e679481108959bc671cf56d
Author: William Hua <william hua canonical com>
Date:   Wed Jan 6 12:00:00 2016 -0500

    gdkwindow: add gdk_window_move_using_params ()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756579

 docs/reference/gdk/gdk3-sections.txt |    1 +
 gdk/gdkattachparams.c                |    3 ++-
 gdk/gdkattachparams.h                |    4 +++-
 gdk/gdkwindow.c                      |   24 ++++++++++++++++++++++++
 gdk/gdkwindow.h                      |    5 +++++
 gdk/gdkwindowimpl.h                  |    4 ++++
 6 files changed, 39 insertions(+), 2 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index eae7150..24260a6 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -379,6 +379,7 @@ gdk_window_get_pass_through
 gdk_window_move
 gdk_window_resize
 gdk_window_move_resize
+gdk_window_move_using_params
 gdk_window_scroll
 gdk_window_move_region
 gdk_window_flush
diff --git a/gdk/gdkattachparams.c b/gdk/gdkattachparams.c
index 2e0ea4b..470cb73 100644
--- a/gdk/gdkattachparams.c
+++ b/gdk/gdkattachparams.c
@@ -440,7 +440,8 @@ gdk_attach_params_secondary_rules_foreach (GdkAttachParams *params,
  * @destroy_notify: (nullable): a function to release @user_data
  *
  * Sets the function to be called when the final position of the window is
- * known.
+ * known. Since the position might be determined asynchronously, don't assume
+ * it will be called directly from gdk_window_move_using_params().
  *
  * Since: 3.20
  */
diff --git a/gdk/gdkattachparams.h b/gdk/gdkattachparams.h
index e5e59f6..b1c05e6 100644
--- a/gdk/gdkattachparams.h
+++ b/gdk/gdkattachparams.h
@@ -74,7 +74,9 @@ typedef struct _GdkAttachParams GdkAttachParams;
  *             @params
  *
  * A function that can be used to receive information about the final position
- * of a window.
+ * of a window after gdk_window_move_using_params() is called. Since the
+ * position might be determined asynchronously, don't assume it will be called
+ * directly from gdk_window_move_using_params().
  *
  * Since: 3.20
  */
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 57ffa64..fc6a6d0 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -11548,3 +11548,27 @@ gdk_window_show_window_menu (GdkWindow *window,
   else
     return FALSE;
 }
+
+/**
+ * gdk_window_move_using_params:
+ * @window: a #GdkWindow
+ * @params: (nullable): information for positioning @window
+ *
+ * Moves @window to the best position according to @params. The best position
+ * is decided by the backend.
+ *
+ * Since: 3.20
+ */
+void
+gdk_window_move_using_params (GdkWindow             *window,
+                              const GdkAttachParams *params)
+{
+  GdkWindowImplClass *impl_class;
+
+  g_return_if_fail (GDK_IS_WINDOW (window));
+
+  impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
+
+  if (impl_class->move_using_params)
+    impl_class->move_using_params (window, params);
+}
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 2fc934f..dd07243 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -33,6 +33,7 @@
 #include <gdk/gdktypes.h>
 #include <gdk/gdkevents.h>
 #include <gdk/gdkframeclock.h>
+#include <gdk/gdkattachparams.h>
 
 G_BEGIN_DECLS
 
@@ -1075,6 +1076,10 @@ GDK_AVAILABLE_IN_3_16
 GdkGLContext * gdk_window_create_gl_context    (GdkWindow      *window,
                                                 GError        **error);
 
+GDK_AVAILABLE_IN_3_20
+void       gdk_window_move_using_params        (GdkWindow             *window,
+                                                const GdkAttachParams *params);
+
 G_END_DECLS
 
 #endif /* __GDK_WINDOW_H__ */
diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h
index f074343..c469097 100644
--- a/gdk/gdkwindowimpl.h
+++ b/gdk/gdkwindowimpl.h
@@ -27,6 +27,7 @@
 
 #include <gdk/gdkwindow.h>
 #include <gdk/gdkproperty.h>
+#include <gdk/gdkattachparams.h>
 
 G_BEGIN_DECLS
 
@@ -303,6 +304,9 @@ struct _GdkWindowImplClass
                                            GError        **error);
   void         (*invalidate_for_new_frame)(GdkWindow      *window,
                                            cairo_region_t *update_area);
+
+  void         (* move_using_params)      (GdkWindow             *window,
+                                           const GdkAttachParams *params);
 };
 
 /* Interface Functions */


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