aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2010-09-14 17:26:36 -0500
committerCody Russell <crussell@canonical.com>2010-09-14 17:26:36 -0500
commit9aa08ce6f34cc9db361c58bb6bbc5da33eb4aed3 (patch)
treed63ea12523cf7eaa88c4a386e42375990a56fef2
parentf3ca63f0d411a477a5ccbb4faa4ab7c625705ffe (diff)
parent0a8cdd0815379bbbbb344863185a0b6628ce8e6a (diff)
downloadayatana-ido-9aa08ce6f34cc9db361c58bb6bbc5da33eb4aed3.tar.gz
ayatana-ido-9aa08ce6f34cc9db361c58bb6bbc5da33eb4aed3.tar.bz2
ayatana-ido-9aa08ce6f34cc9db361c58bb6bbc5da33eb4aed3.zip
Merge geis updates.
-rw-r--r--example/gesture.c9
-rw-r--r--gtk-doc.make196
-rw-r--r--src/idogesturemanager.c320
-rw-r--r--src/idogesturemanager.h29
4 files changed, 174 insertions, 380 deletions
diff --git a/example/gesture.c b/example/gesture.c
index 57c4c24..22bbd8b 100644
--- a/example/gesture.c
+++ b/example/gesture.c
@@ -120,21 +120,24 @@ window_mapped (GtkWidget *widget)
ido_gesture_manager_register_window (manager,
window,
- IDO_GESTURE_PINCH2,
+ IDO_GESTURE_PINCH,
+ 2,
gesture_start,
pinch_update,
gesture_end);
ido_gesture_manager_register_window (manager,
window,
- IDO_GESTURE_ROTATE2,
+ IDO_GESTURE_ROTATE,
+ 2,
gesture_start,
rotate_update,
gesture_end);
ido_gesture_manager_register_window (manager,
window,
- IDO_GESTURE_DRAG2,
+ IDO_GESTURE_DRAG,
+ 2,
gesture_start,
drag_update,
gesture_end);
diff --git a/gtk-doc.make b/gtk-doc.make
deleted file mode 100644
index 0f87cc7..0000000
--- a/gtk-doc.make
+++ /dev/null
@@ -1,196 +0,0 @@
-# -*- mode: makefile -*-
-
-####################################
-# Everything below here is generic #
-####################################
-
-if GTK_DOC_USE_LIBTOOL
-GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
-GTKDOC_RUN = $(LIBTOOL) --mode=execute
-else
-GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
-GTKDOC_RUN = sh -c
-endif
-
-# We set GPATH here; this gives us semantics for GNU make
-# which are more like other make's VPATH, when it comes to
-# whether a source that is a target of one rule is then
-# searched for in VPATH/GPATH.
-#
-GPATH = $(srcdir)
-
-TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
-
-EXTRA_DIST = \
- $(content_files) \
- $(HTML_IMAGES) \
- $(DOC_MAIN_SGML_FILE) \
- $(DOC_MODULE)-sections.txt \
- $(DOC_MODULE)-overrides.txt
-
-DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
- $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp
-
-SCANOBJ_FILES = \
- $(DOC_MODULE).args \
- $(DOC_MODULE).hierarchy \
- $(DOC_MODULE).interfaces \
- $(DOC_MODULE).prerequisites \
- $(DOC_MODULE).signals
-
-REPORT_FILES = \
- $(DOC_MODULE)-undocumented.txt \
- $(DOC_MODULE)-undeclared.txt \
- $(DOC_MODULE)-unused.txt
-
-CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
-
-if ENABLE_GTK_DOC
-all-local: html-build.stamp
-else
-all-local:
-endif
-
-docs: html-build.stamp
-
-$(REPORT_FILES): sgml-build.stamp
-
-#### scan ####
-
-scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
- @echo 'gtk-doc: Scanning header files'
- @-chmod -R u+w $(srcdir)
- cd $(srcdir) && \
- gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
- if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
- CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
- else \
- cd $(srcdir) ; \
- for i in $(SCANOBJ_FILES) ; do \
- test -f $$i || touch $$i ; \
- done \
- fi
- touch scan-build.stamp
-
-$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
- @true
-
-#### templates ####
-
-tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
- @echo 'gtk-doc: Rebuilding template files'
- @-chmod -R u+w $(srcdir)
- cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
- touch tmpl-build.stamp
-
-tmpl.stamp: tmpl-build.stamp
- @true
-
-tmpl/*.sgml:
- @true
-
-
-#### xml ####
-
-sgml-build.stamp: tmpl.stamp $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files)
- @echo 'gtk-doc: Building XML'
- @-chmod -R u+w $(srcdir)
- cd $(srcdir) && \
- gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS)
- touch sgml-build.stamp
-
-sgml.stamp: sgml-build.stamp
- @true
-
-#### html ####
-
-html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
- @echo 'gtk-doc: Building HTML'
- @-chmod -R u+w $(srcdir)
- rm -rf $(srcdir)/html
- mkdir $(srcdir)/html
- mkhtml_options=""; \
- gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
- if test "$(?)" = "0"; then \
- mkhtml_options=--path="$(srcdir)"; \
- fi
- cd $(srcdir)/html && gtkdoc-mkhtml $(mkhtml_options) $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
- test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
- @echo 'gtk-doc: Fixing cross-references'
- cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
- touch html-build.stamp
-
-##############
-
-clean-local:
- rm -f *~ *.bak
- rm -rf .libs
-
-distclean-local:
- cd $(srcdir) && \
- rm -rf xml $(REPORT_FILES) \
- $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
-
-maintainer-clean-local: clean
- cd $(srcdir) && rm -rf xml html
-
-install-data-local:
- installfiles=`echo $(srcdir)/html/*`; \
- if test "$$installfiles" = '$(srcdir)/html/*'; \
- then echo '-- Nothing to install' ; \
- else \
- if test -n "$(DOC_MODULE_VERSION)"; then \
- installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
- else \
- installdir="$(DESTDIR)$(TARGET_DIR)"; \
- fi; \
- $(mkinstalldirs) $${installdir} ; \
- for i in $$installfiles; do \
- echo '-- Installing '$$i ; \
- $(INSTALL_DATA) $$i $${installdir}; \
- done; \
- if test -n "$(DOC_MODULE_VERSION)"; then \
- mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
- $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
- mv -f $${installdir}/$(DOC_MODULE).devhelp \
- $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \
- fi; \
- ! which gtkdoc-rebase >/dev/null 2>&1 || \
- gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir} ; \
- fi
-
-uninstall-local:
- if test -n "$(DOC_MODULE_VERSION)"; then \
- installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
- else \
- installdir="$(DESTDIR)$(TARGET_DIR)"; \
- fi; \
- rm -rf $${installdir}
-
-#
-# Require gtk-doc when making dist
-#
-if ENABLE_GTK_DOC
-dist-check-gtkdoc:
-else
-dist-check-gtkdoc:
- @echo "*** gtk-doc must be installed and enabled in order to make dist"
- @false
-endif
-
-dist-hook: dist-check-gtkdoc dist-hook-local
- mkdir $(distdir)/tmpl
- mkdir $(distdir)/xml
- mkdir $(distdir)/html
- -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
- -cp $(srcdir)/xml/*.xml $(distdir)/xml
- cp $(srcdir)/html/* $(distdir)/html
- -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
- -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
- cd $(distdir) && rm -f $(DISTCLEANFILES)
- ! which gtkdoc-rebase >/dev/null 2>&1 || \
- gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
-
-.PHONY : dist-hook-local docs
diff --git a/src/idogesturemanager.c b/src/idogesturemanager.c
index f603816..5225d10 100644
--- a/src/idogesturemanager.c
+++ b/src/idogesturemanager.c
@@ -39,6 +39,7 @@ struct _IdoGestureManagerPrivate
struct _IdoGestureBinding
{
IdoGestureType type;
+ gint touches;
IdoGestureCallback start;
IdoGestureCallback update;
IdoGestureCallback end;
@@ -172,145 +173,169 @@ print_attr (GeisGestureAttr *attr)
}
*/
-static void
+static gint
pinch_gesture_handle_properties (IdoEventGesturePinch *event,
GeisSize attr_count,
GeisGestureAttr *attrs)
{
gint i = 0;
+ gint touches = 0;
for (i = 0; i < attr_count; ++i)
{
- if (g_strcmp0 (attrs[i].name, "timestamp") == 0 &&
+ if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FINGERS) == 0 &&
+ attrs[i].type == GEIS_ATTR_TYPE_INTEGER)
+ {
+ touches = attrs[i].integer_val;
+ }
+ if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_INTEGER)
{
event->timestamp = attrs[i].integer_val;
}
- else if (g_strcmp0 (attrs[i].name, "focus X") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->focus_x = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "focus Y") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->focus_y = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "radius delta") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_RADIUS_DELTA) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->radius_delta = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "radial velocity") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_RADIAL_VELOCITY) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->radial_velocity = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "radius") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_RADIUS) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->radius = attrs[i].float_val;
}
}
+
+ return touches;
}
-static void
+static gint
drag_gesture_handle_properties (IdoEventGestureDrag *event,
GeisSize attr_count,
GeisGestureAttr *attrs)
{
gint i;
+ gint touches = 0;
for (i = 0; i < attr_count; ++i)
{
- if (g_strcmp0 (attrs[i].name, "timestamp") == 0 &&
+ if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FINGERS) == 0 &&
+ attrs[i].type == GEIS_ATTR_TYPE_INTEGER)
+ {
+ touches = attrs[i].integer_val;
+ }
+ if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_INTEGER)
{
event->timestamp = attrs[i].integer_val;
}
- else if (g_strcmp0 (attrs[i].name, "focus X") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->focus_x = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "focus Y") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->focus_y = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "delta X") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_DELTA_X) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->delta_x = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "delta Y") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_DELTA_Y) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->delta_y = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "velocity X") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_VELOCITY_X) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->velocity_x = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "velocity Y") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_VELOCITY_Y) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->velocity_y = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "position X") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_POSITION_X) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->position_x = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "position Y") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_POSITION_Y) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->position_y = attrs[i].float_val;
}
}
+
+ return touches;
}
-static void
+static gint
rotate_gesture_handle_properties (IdoEventGestureRotate *event,
GeisSize attr_count,
GeisGestureAttr *attrs)
{
gint i;
+ gint touches = 0;
for (i = 0; i < attr_count; ++i)
{
- if (g_strcmp0 (attrs[i].name, "timestamp") == 0 &&
+ if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FINGERS) == 0 &&
+ attrs[i].type == GEIS_ATTR_TYPE_INTEGER)
+ {
+ touches = attrs[i].integer_val;
+ }
+ if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_INTEGER)
{
event->timestamp = attrs[i].integer_val;
}
- else if (g_strcmp0 (attrs[i].name, "focus X") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->focus_x = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "focus Y") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->focus_y = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "angle delta") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_ANGLE_DELTA) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->angle_delta = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "angular velocity") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_ANGULAR_VELOCITY) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->angular_velocity = attrs[i].float_val;
}
- else if (g_strcmp0 (attrs[i].name, "angle") == 0 &&
+ else if (g_strcmp0 (attrs[i].name, GEIS_GESTURE_ATTRIBUTE_ANGLE) == 0 &&
attrs[i].type == GEIS_ATTR_TYPE_FLOAT)
{
event->angle = attrs[i].float_val;
}
}
+
+ return touches;
}
@@ -348,59 +373,53 @@ gesture_start (void *cookie,
if (binding->type == type)
{
- if (type == IDO_GESTURE_DRAG1 ||
- type == IDO_GESTURE_DRAG2 ||
- type == IDO_GESTURE_DRAG3 ||
- type == IDO_GESTURE_DRAG4 ||
- type == IDO_GESTURE_DRAG5)
+ if (type == IDO_GESTURE_DRAG)
{
IdoEventGestureDrag drag;
- drag.type = type;
- drag.id = id;
-
- drag_gesture_handle_properties (&drag,
- attr_count,
- attrs);
-
- binding->start (reg->window,
- ((IdoGestureEvent*)&drag));
+ drag.type = type;
+ drag.id = id;
+ drag.fingers = drag_gesture_handle_properties (&drag,
+ attr_count,
+ attrs);
+
+ if (drag.fingers == binding->touches)
+ {
+ binding->start (reg->window,
+ ((IdoGestureEvent*)&drag));
+ }
}
- else if (type == IDO_GESTURE_PINCH1 ||
- type == IDO_GESTURE_PINCH2 ||
- type == IDO_GESTURE_PINCH3 ||
- type == IDO_GESTURE_PINCH4 ||
- type == IDO_GESTURE_PINCH5)
+ else if (type == IDO_GESTURE_PINCH)
{
IdoEventGesturePinch pinch;
- pinch.type = type;
- pinch.id = id;
-
- pinch_gesture_handle_properties (&pinch,
- attr_count,
- attrs);
-
- binding->start (reg->window,
- ((IdoGestureEvent*)&pinch));
+ pinch.type = type;
+ pinch.id = id;
+ pinch.fingers = pinch_gesture_handle_properties (&pinch,
+ attr_count,
+ attrs);
+
+ if (pinch.fingers == binding->touches)
+ {
+ binding->start (reg->window,
+ ((IdoGestureEvent*)&pinch));
+ }
}
- else if (type == IDO_GESTURE_ROTATE1 ||
- type == IDO_GESTURE_ROTATE2 ||
- type == IDO_GESTURE_ROTATE3 ||
- type == IDO_GESTURE_ROTATE4 ||
- type == IDO_GESTURE_ROTATE5)
+ else if (type == IDO_GESTURE_ROTATE)
{
IdoEventGestureRotate rotate;
- rotate.type = type;
- rotate.id = id;
-
- rotate_gesture_handle_properties (&rotate,
- attr_count,
- attrs);
-
- binding->start (reg->window,
- ((IdoGestureEvent*)&rotate));
+ rotate.type = type;
+ rotate.id = id;
+ rotate.fingers = rotate_gesture_handle_properties (&rotate,
+ attr_count,
+ attrs);
+
+ if (rotate.fingers == binding->touches)
+ {
+ binding->start (reg->window,
+ ((IdoGestureEvent*)&rotate));
+ }
}
return;
@@ -424,59 +443,53 @@ gesture_update (void *cookie,
if (binding->type == type)
{
- if (type == IDO_GESTURE_DRAG1 ||
- type == IDO_GESTURE_DRAG2 ||
- type == IDO_GESTURE_DRAG3 ||
- type == IDO_GESTURE_DRAG4 ||
- type == IDO_GESTURE_DRAG5)
+ if (type == IDO_GESTURE_DRAG)
{
IdoEventGestureDrag drag;
- drag.type = type;
- drag.id = id;
-
- drag_gesture_handle_properties (&drag,
- attr_count,
- attrs);
-
- binding->update (reg->window,
- ((IdoGestureEvent*)&drag));
+ drag.type = type;
+ drag.id = id;
+ drag.fingers = drag_gesture_handle_properties (&drag,
+ attr_count,
+ attrs);
+
+ if (drag.fingers == binding->touches)
+ {
+ binding->update (reg->window,
+ ((IdoGestureEvent*)&drag));
+ }
}
- else if (type == IDO_GESTURE_PINCH1 ||
- type == IDO_GESTURE_PINCH2 ||
- type == IDO_GESTURE_PINCH3 ||
- type == IDO_GESTURE_PINCH4 ||
- type == IDO_GESTURE_PINCH5)
+ else if (type == IDO_GESTURE_PINCH)
{
IdoEventGesturePinch pinch;
- pinch.type = type;
- pinch.id = id;
-
- pinch_gesture_handle_properties (&pinch,
- attr_count,
- attrs);
-
- binding->update (reg->window,
- ((IdoGestureEvent*)&pinch));
+ pinch.type = type;
+ pinch.id = id;
+ pinch.fingers = pinch_gesture_handle_properties (&pinch,
+ attr_count,
+ attrs);
+
+ if (pinch.fingers == binding->touches)
+ {
+ binding->update (reg->window,
+ ((IdoGestureEvent*)&pinch));
+ }
}
- else if (type == IDO_GESTURE_ROTATE1 ||
- type == IDO_GESTURE_ROTATE2 ||
- type == IDO_GESTURE_ROTATE3 ||
- type == IDO_GESTURE_ROTATE4 ||
- type == IDO_GESTURE_ROTATE5)
+ else if (type == IDO_GESTURE_ROTATE)
{
IdoEventGestureRotate rotate;
- rotate.type = type;
- rotate.id = id;
-
- rotate_gesture_handle_properties (&rotate,
- attr_count,
- attrs);
-
- binding->update (reg->window,
- ((IdoGestureEvent*)&rotate));
+ rotate.type = type;
+ rotate.id = id;
+ rotate.fingers = rotate_gesture_handle_properties (&rotate,
+ attr_count,
+ attrs);
+
+ if (rotate.fingers == binding->touches)
+ {
+ binding->update (reg->window,
+ ((IdoGestureEvent*)&rotate));
+ }
}
}
}
@@ -498,59 +511,53 @@ gesture_finish (void *cookie,
if (binding->type == type)
{
- if (type == IDO_GESTURE_DRAG1 ||
- type == IDO_GESTURE_DRAG2 ||
- type == IDO_GESTURE_DRAG3 ||
- type == IDO_GESTURE_DRAG4 ||
- type == IDO_GESTURE_DRAG5)
+ if (type == IDO_GESTURE_DRAG)
{
IdoEventGestureDrag drag;
- drag.type = type;
- drag.id = id;
-
- drag_gesture_handle_properties (&drag,
- attr_count,
- attrs);
-
- binding->end (reg->window,
- ((IdoGestureEvent*)&drag));
+ drag.type = type;
+ drag.id = id;
+ drag.fingers = drag_gesture_handle_properties (&drag,
+ attr_count,
+ attrs);
+
+ if (drag.fingers == binding->touches)
+ {
+ binding->end (reg->window,
+ ((IdoGestureEvent*)&drag));
+ }
}
- else if (type == IDO_GESTURE_PINCH1 ||
- type == IDO_GESTURE_PINCH2 ||
- type == IDO_GESTURE_PINCH3 ||
- type == IDO_GESTURE_PINCH4 ||
- type == IDO_GESTURE_PINCH5)
+ else if (type == IDO_GESTURE_PINCH)
{
IdoEventGesturePinch pinch;
- pinch.type = type;
- pinch.id = id;
-
- pinch_gesture_handle_properties (&pinch,
- attr_count,
- attrs);
-
- binding->end (reg->window,
- ((IdoGestureEvent*)&pinch));
+ pinch.type = type;
+ pinch.id = id;
+ pinch.fingers = pinch_gesture_handle_properties (&pinch,
+ attr_count,
+ attrs);
+
+ if (pinch.fingers == binding->touches)
+ {
+ binding->end (reg->window,
+ ((IdoGestureEvent*)&pinch));
+ }
}
- else if (type == IDO_GESTURE_ROTATE1 ||
- type == IDO_GESTURE_ROTATE2 ||
- type == IDO_GESTURE_ROTATE3 ||
- type == IDO_GESTURE_ROTATE4 ||
- type == IDO_GESTURE_ROTATE5)
+ else if (type == IDO_GESTURE_ROTATE)
{
IdoEventGestureRotate rotate;
- rotate.type = type;
- rotate.id = id;
-
- rotate_gesture_handle_properties (&rotate,
- attr_count,
- attrs);
-
- binding->end (reg->window,
- ((IdoGestureEvent*)&rotate));
+ rotate.type = type;
+ rotate.id = id;
+ rotate.fingers = rotate_gesture_handle_properties (&rotate,
+ attr_count,
+ attrs);
+
+ if (rotate.fingers == binding->touches)
+ {
+ binding->end (reg->window,
+ ((IdoGestureEvent*)&rotate));
+ }
}
}
}
@@ -589,6 +596,7 @@ ido_gesture_manager_get (void)
* ido_gesture_manager_register_window:
* @window: A #GtkWindow to register the gesture event for.
* @gesture_type: The type of gesture event to register.
+ * @touch_points: Number of touch points for this gesture.
* @start: Called when a user initiates a gesture.
* @update: Called each time the user updates the gesture.
* @end: Called when the user ends the gesture.
@@ -602,6 +610,7 @@ void
ido_gesture_manager_register_window (IdoGestureManager *manager,
GtkWindow *window,
IdoGestureType gesture_type,
+ gint touch_points,
IdoGestureCallback start,
IdoGestureCallback update,
IdoGestureCallback end)
@@ -673,12 +682,11 @@ ido_gesture_manager_register_window (IdoGestureManager *manager,
/* XXX - check for duplicates in reg->bindings first */
binding = g_new0 (IdoGestureBinding, 1);
- g_print (" *** Adding binding type %d\n", (gint)gesture_type);
-
- binding->type = gesture_type;
- binding->start = start;
- binding->update = update;
- binding->end = end;
+ binding->type = gesture_type;
+ binding->touches = touch_points;
+ binding->start = start;
+ binding->update = update;
+ binding->end = end;
reg->bindings = g_list_append (reg->bindings, binding);
diff --git a/src/idogesturemanager.h b/src/idogesturemanager.h
index bc3ad33..87e5fe8 100644
--- a/src/idogesturemanager.h
+++ b/src/idogesturemanager.h
@@ -47,31 +47,9 @@ typedef struct _IdoEventGesturePinch IdoEventGesturePinch;
typedef struct _IdoEventGestureRotate IdoEventGestureRotate;
typedef enum {
- IDO_GESTURE_DRAG1,
- IDO_GESTURE_PINCH1,
- IDO_GESTURE_ROTATE1,
-
- IDO_GESTURE_DRAG2,
- IDO_GESTURE_PINCH2,
- IDO_GESTURE_ROTATE2,
-
- IDO_GESTURE_DRAG3,
- IDO_GESTURE_PINCH3,
- IDO_GESTURE_ROTATE3,
-
- IDO_GESTURE_DRAG4,
- IDO_GESTURE_PINCH4,
- IDO_GESTURE_ROTATE4,
-
- IDO_GESTURE_DRAG5,
- IDO_GESTURE_PINCH5,
- IDO_GESTURE_ROTATE5,
-
- IDO_GESTURE_TAP1,
- IDO_GESTURE_TAP2,
- IDO_GESTURE_TAP3,
- IDO_GESTURE_TAP4,
- IDO_GESTURE_TAP5
+ IDO_GESTURE_DRAG,
+ IDO_GESTURE_PINCH,
+ IDO_GESTURE_ROTATE
} IdoGestureType;
struct _IdoEventGestureDrag
@@ -153,6 +131,7 @@ IdoGestureManager *ido_gesture_manager_get (void);
void ido_gesture_manager_register_window (IdoGestureManager *manager,
GtkWindow *window,
IdoGestureType gesture_type,
+ gint touch_points,
IdoGestureCallback start,
IdoGestureCallback update,
IdoGestureCallback end);