diff options
author | Benjamin Otte <otte@redhat.com> | 2016-10-17 20:11:23 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-10-18 00:22:35 +0200 |
commit | d22e5e69d93401f8f0a040767fbf69ac5643a19d (patch) | |
tree | 1df061968e3697d1326859a378f85859b2bb9b6b /gdk | |
parent | 6b01940194f84a7dc042e9561024a357702c88f7 (diff) | |
download | gtk+-d22e5e69d93401f8f0a040767fbf69ac5643a19d.tar.gz |
API: gdk: Add gdk_window_new_child() and gdk_window_new_input()
This is an attempt to get rid of gdk_window_new() for more specific use
cases. These 2 are for client-side windows - regular ones and input-only
ones resepectively.
So far all those functions just call into gdk_window_new().
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkwindow.c | 60 | ||||
-rw-r--r-- | gdk/gdkwindow.h | 10 |
2 files changed, 70 insertions, 0 deletions
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 541e6a2f02..8206b7b967 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -1484,6 +1484,66 @@ gdk_window_new (GdkWindow *parent, return window; } +/** + * gdk_window_new_child: (constructor) + * @parent: the parent window + * @event_mask: event mask (see gdk_window_set_events()) + * @position: placement of the window inside @parent + * + * Creates a new client-side child window. + * + * Returns: (transfer full): the new #GdkWindow + **/ +GdkWindow * +gdk_window_new_child (GdkWindow *parent, + gint event_mask, + const GdkRectangle *position) +{ + GdkWindowAttr attr; + + g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL); + + attr.event_mask = event_mask; + attr.wclass = GDK_INPUT_OUTPUT; + attr.x = position->x; + attr.y = position->y; + attr.width = position->width; + attr.height = position->height; + attr.window_type = GDK_WINDOW_CHILD; + + return gdk_window_new (parent, &attr, GDK_WA_X | GDK_WA_Y); +} + +/** + * gdk_window_new_input: (constructor) + * @parent: the parent window + * @event_mask: event mask (see gdk_window_set_events()) + * @position: placement of the window inside @parent + * + * Creates a new client-side input-only window. + * + * Returns: (transfer full): the new #GdkWindow + **/ +GdkWindow * +gdk_window_new_input (GdkWindow *parent, + gint event_mask, + const GdkRectangle *position) +{ + GdkWindowAttr attr; + + g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL); + + attr.event_mask = event_mask; + attr.wclass = GDK_INPUT_ONLY; + attr.x = position->x; + attr.y = position->y; + attr.width = position->width; + attr.height = position->height; + attr.window_type = GDK_WINDOW_CHILD; + + return gdk_window_new (parent, &attr, GDK_WA_X | GDK_WA_Y); +} + static gboolean is_parent_of (GdkWindow *parent, GdkWindow *child) diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h index aaaafcbb37..7bc84bddc0 100644 --- a/gdk/gdkwindow.h +++ b/gdk/gdkwindow.h @@ -498,6 +498,16 @@ GDK_AVAILABLE_IN_ALL GdkWindow* gdk_window_new (GdkWindow *parent, GdkWindowAttr *attributes, gint attributes_mask); +GDK_AVAILABLE_IN_3_90 +GdkWindow * gdk_window_new_child (GdkWindow *parent, + gint event_mask, + const GdkRectangle *position); +GDK_AVAILABLE_IN_3_90 +GdkWindow * gdk_window_new_input (GdkWindow *parent, + gint event_mask, + const GdkRectangle *position); + + GDK_AVAILABLE_IN_ALL void gdk_window_destroy (GdkWindow *window); GDK_AVAILABLE_IN_ALL |