[gtk+/multitouch: 8/17] Add gdk_window_[create|remove]_touch_cluster()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/multitouch: 8/17] Add gdk_window_[create|remove]_touch_cluster()
- Date: Tue, 25 Oct 2011 00:50:06 +0000 (UTC)
commit 7091595f2d9dba2ee870fcd2cc49d2c444be73ad
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Mar 11 20:53:07 2011 +0100
Add gdk_window_[create|remove]_touch_cluster()
These are the functions to create/destroy a GdkTouchCluster,
as they are associated to GdkWindows.
docs/reference/gdk/gdk3-sections.txt | 4 +++
gdk/gdkinternals.h | 1 +
gdk/gdkwindow.c | 49 ++++++++++++++++++++++++++++++++++
gdk/gdkwindow.h | 6 ++++
4 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index 85b77dd..962c3a4 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -865,6 +865,10 @@ gdk_touch_cluster_set_device
gdk_touch_cluster_get_device
gdk_touch_cluster_get_touches
+<SUBSECTION>
+gdk_window_create_touch_cluster
+gdk_window_remove_touch_cluster
+
<SUBSECTION Standard>
GDK_TYPE_TOUCH_CLUSTER
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index a9a5917..432d684 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -251,6 +251,7 @@ struct _GdkWindow
gulong device_changed_handler_id;
guint num_offscreen_children;
+ GList *touch_clusters;
};
#define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index ae5ae18..d199601 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -570,6 +570,9 @@ gdk_window_finalize (GObject *object)
if (window->devices_inside)
g_list_free (window->devices_inside);
+ g_list_foreach (window->touch_clusters, (GFunc) g_object_unref, NULL);
+ g_list_free (window->touch_clusters);
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -10941,3 +10944,49 @@ gdk_property_delete (GdkWindow *window,
{
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->delete_property (window, property);
}
+
+/**
+ * gdk_window_create_touch_cluster:
+ * @window: a #GdkWindow
+ *
+ * Creates a #GdkTouchCluster associated to @window.
+ *
+ * Returns: (transfer none): a newly created @GdkTouchCluster. This
+ * object is owned by @window and must be freed through
+ * gdk_window_remove_touch_cluster().
+ **/
+GdkTouchCluster *
+gdk_window_create_touch_cluster (GdkWindow *window)
+{
+ GdkTouchCluster *cluster;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
+
+ cluster = g_object_new (GDK_TYPE_TOUCH_CLUSTER, NULL);
+ window->touch_clusters = g_list_prepend (window->touch_clusters, cluster);
+
+ return cluster;
+}
+
+/**
+ * gdk_window_remove_touch_cluster:
+ * @window: a #GdkWindow
+ * @cluster: a #GdkTouchCluster from @window
+ *
+ * Removes @cluster from @window.
+ **/
+void
+gdk_window_remove_touch_cluster (GdkWindow *window,
+ GdkTouchCluster *cluster)
+{
+ g_return_if_fail (GDK_IS_WINDOW (window));
+ g_return_if_fail (GDK_IS_TOUCH_CLUSTER (cluster));
+
+ if (!window->touch_clusters ||
+ !g_list_find (window->touch_clusters, cluster))
+ return;
+
+ gdk_touch_cluster_remove_all (cluster);
+ window->touch_clusters = g_list_remove (window->touch_clusters, cluster);
+ g_object_unref (cluster);
+}
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index f50d84a..a59d012 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -33,6 +33,7 @@
#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>
+#include <gdk/gdktouchcluster.h>
G_BEGIN_DECLS
@@ -864,6 +865,11 @@ void gdk_window_set_support_multidevice (GdkWindow *window,
gboolean support_multidevice);
gboolean gdk_window_get_support_multidevice (GdkWindow *window);
+/* Multitouch support */
+GdkTouchCluster * gdk_window_create_touch_cluster (GdkWindow *window);
+void gdk_window_remove_touch_cluster (GdkWindow *window,
+ GdkTouchCluster *cluster);
+
G_END_DECLS
#endif /* __GDK_WINDOW_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]