[gtk+/wip/attachment-parameters-4: 2/20] gdkwindow: add gdk_window_move_using_params ()



commit 944bb05d6b93b60f89c13cf36926b29d37b2d7d4
Author: William Hua <william hua canonical com>
Date:   Fri Sep 18 16:09:20 2015 -0400

    gdkwindow: add gdk_window_move_using_params ()

 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 83ac024..b4ee465 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 40d3a5e..ea342f7 100644
--- a/gdk/gdkattachparams.c
+++ b/gdk/gdkattachparams.c
@@ -411,7 +411,8 @@ gdk_attach_params_add_secondary_rules (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 4a6a394..309d0dd 100644
--- a/gdk/gdkattachparams.h
+++ b/gdk/gdkattachparams.h
@@ -73,7 +73,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]