diff options
author | William Hua <william.hua@canonical.com> | 2015-09-18 16:09:20 -0400 |
---|---|---|
committer | William Hua <william.hua@canonical.com> | 2016-01-06 10:37:41 -0500 |
commit | 2231c31a6deb663a99657c698f92d61add6de739 (patch) | |
tree | 29c896115a96de431b8503cf871d10ca39964ca0 | |
parent | 24c54e7f982955c48b320079763b4896919c1f1c (diff) | |
download | gtk+-2231c31a6deb663a99657c698f92d61add6de739.tar.gz |
gdkwindow: add gdk_window_move_using_params ()
-rw-r--r-- | docs/reference/gdk/gdk3-sections.txt | 1 | ||||
-rw-r--r-- | gdk/gdkattachparams.c | 3 | ||||
-rw-r--r-- | gdk/gdkattachparams.h | 4 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 24 | ||||
-rw-r--r-- | gdk/gdkwindow.h | 5 | ||||
-rw-r--r-- | 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 15690c11bf..0ade0768f4 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 7aa8cc16c8..e1fa3d62d3 100644 --- a/gdk/gdkattachparams.c +++ b/gdk/gdkattachparams.c @@ -446,7 +446,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 e7b2878813..2ffb90fa58 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 57ffa641e1..fc6a6d0617 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 2fc934f2c5..dd072431b7 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 f0743434fc..c4690976e2 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 */ |