[gtk+] API: gdk: Add gdk_window_new_child() and gdk_window_new_input()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] API: gdk: Add gdk_window_new_child() and gdk_window_new_input()
- Date: Mon, 17 Oct 2016 22:39:15 +0000 (UTC)
commit d22e5e69d93401f8f0a040767fbf69ac5643a19d
Author: Benjamin Otte <otte redhat com>
Date: Mon Oct 17 20:11:23 2016 +0200
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().
docs/reference/gdk/gdk4-sections.txt | 2 +
gdk/gdkwindow.c | 60 ++++++++++++++++++++++++++++++++++
gdk/gdkwindow.h | 10 ++++++
3 files changed, 72 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 5d581b7..a153e08 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -334,6 +334,8 @@ GdkWindowTypeHint
GdkWindowAttr
GdkWindowAttributesType
gdk_window_new
+gdk_window_new_child
+gdk_window_new_input
gdk_window_destroy
gdk_window_get_window_type
gdk_window_get_display
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 541e6a2..8206b7b 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 aaaafcb..7bc84bd 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]