From 3f69aa4bbcfbaf3035be8d749fbf724d123452c5 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 10 Jul 2009 23:18:50 -0700 Subject: [PATCH] Added PostButtonEvents Option, fixed button atom allocation, added Bool/True/False #defines --- man/tuio.man | 5 +++++ src/tuio.c | 13 ++++++++----- src/tuio.h | 15 +++++++++++++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/man/tuio.man b/man/tuio.man index a7970a6..dd8e140 100644 --- a/man/tuio.man +++ b/man/tuio.man @@ -6,6 +6,11 @@ tuio \- Multitouch TUIO Linux input driver .SH SYNOPSIS .nf .B "Section \*qInputDevice\*q" +.BI " Identifier \*q\" devname \*q +.B " Driver \*qtuio\*q" +.BI " Option \*qPort\*q \*q" 3333 \*q +.BI " Option \*qSubDevices\*q \*q" 5 \*q +.BI " Option \*qPostButtonEvents\*q \*q" True \*q \ \ ... .B EndSection .fi diff --git a/src/tuio.c b/src/tuio.c index ed2a22d..c8b79fc 100644 --- a/src/tuio.c +++ b/src/tuio.c @@ -28,9 +28,7 @@ #include #include -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 #include -#endif #include @@ -231,6 +229,11 @@ TuioPreInit(InputDriverPtr drv, xf86Msg(X_INFO, "%s: FseqThreshold set to %i\n", dev->identifier, pTuio->fseq_threshold); } + + /* Get setting for whether to send button events or not with + * object add & remove */ + pTuio->post_button_events = xf86CheckIntOption(dev->commonOptions, + "PostButtonEvents", True); } /* Allocate device storage and add to device list */ @@ -310,7 +313,7 @@ TuioReadInput(InputInfoPtr pInfo) while (obj != NULL) { if (!obj->alive) { - if (obj->subdev) { + if (obj->subdev && pTuio->post_button_events) { /* Post button "up" event */ xf86PostButtonEvent(obj->subdev->pInfo->dev, TRUE, 1, FALSE, 0, 0); } @@ -510,7 +513,7 @@ _tuio_lo_cur2d_handle(const char *path, obj = _object_new(argv[1]->i); _object_add(obj_list, obj); obj->subdev = _subdev_remove(&pTuio->subdev_list); - if (obj->subdev) + if (obj->subdev && pTuio->post_button_events) xf86PostButtonEvent(obj->subdev->pInfo->dev, TRUE, 1, TRUE, 0, 0); } @@ -679,7 +682,7 @@ _tuio_init_buttons(DeviceIntPtr device) int i; map = xcalloc(numbuttons, sizeof(CARD8)); - labels = xcalloc(1, sizeof(Atom)); + labels = xcalloc(numbuttons, sizeof(Atom)); for (i=0; i #include +#ifndef Bool +#define Bool int +#endif +#ifndef True +#define True 1 +#endif +#ifndef False +#define False 0 +#endif + #define MIN_SUBDEVICES 0 /* min/max subdevices */ #define MAX_SUBDEVICES 20 #define DEFAULT_SUBDEVICES 5 @@ -48,8 +58,9 @@ typedef struct _TuioDevice { int tuio_port; int num_subdev; - Bool check_fseq; - int fseq_threshold; + Bool post_button_events; + int fseq_threshold; /* Maximum difference between consecutive fseq values + that will allow a packet to be dropped */ struct _Object *obj_list; -- 2.11.4.GIT