[gtk+/multitouch: 9/33] Add gdk_window_[create|remove]_touch_cluster()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/multitouch: 9/33] Add gdk_window_[create|remove]_touch_cluster()
- Date: Thu, 29 Dec 2011 00:38:40 +0000 (UTC)
commit d8655e9b1b4df1ffc52c601187c9a44542a97c97
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 19c6655..f8fa7d7 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -868,6 +868,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 3042bcb..124160f 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -260,6 +260,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 c790a0e..f16bafb 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -565,6 +565,9 @@ gdk_window_finalize (GObject *object)
if (window->layered_region)
cairo_region_destroy (window->layered_region);
+ g_list_foreach (window->touch_clusters, (GFunc) g_object_unref, NULL);
+ g_list_free (window->touch_clusters);
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -11140,3 +11143,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 f6b2be7..cd70cf3 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
@@ -878,6 +879,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]