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



commit 3ff4e0bf8a8c1bf952ba8b9236d9550f4b800481
Author: William Hua <william hua canonical com>
Date:   Wed Jan 20 02:20:20 2016 -0600

    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 96d4231..2001c98 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 208e40e..1fc1227 100644
--- a/gdk/gdkattachparams.c
+++ b/gdk/gdkattachparams.c
@@ -286,7 +286,8 @@ gdk_attach_params_set_window_offset (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 8bdeb7f..3e82326 100644
--- a/gdk/gdkattachparams.h
+++ b/gdk/gdkattachparams.h
@@ -36,7 +36,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 6995db9..27f6693 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -11549,3 +11549,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 e4c1b60..dfcf626 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
 
@@ -1049,6 +1050,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]