summaryrefslogtreecommitdiff
path: root/multitouch.c
diff options
context:
space:
mode:
Diffstat (limited to 'multitouch.c')
-rw-r--r--multitouch.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/multitouch.c b/multitouch.c
index 179cd2a..def1fbc 100644
--- a/multitouch.c
+++ b/multitouch.c
@@ -106,6 +106,7 @@ typedef struct _MultitouchDisplay
Bool Wm;
Bool TuioFwd;
Bool Cur;
+ int Interval,Threshold;
lo_server_thread st;
mtblob blob[MAXBLOBS];
mtcolor color;
@@ -309,8 +310,6 @@ sendInfoToPlugin (CompDisplay * d, CompOption * argument, int nArgument,
return TRUE;
}
-/* Change notify for bcop
- * TODO: doesn't work at the moment 4 unknown reason */
static void
multitouchDisplayOptionChanged (CompDisplay *d,
CompOption *opt,
@@ -615,17 +614,17 @@ click_handler (void *data)
int width = s->width;
int height = s->height;
int clicked = 0;
- int j,dx,dy;
+ int j,dy,dx;
if (s && clicks[cv->id].id >= 0)
{
for ( j=0;j<MAXBLOBS; j++)
{
if (clicks[j].id > 0 )
- if (j != cv->id && clicks[j].id > 0 )
+ if (j != cv->id )
{
- dx = (int) abs(clicks[j].x - clicks[cv->id].x) * width;
- dy = (int) abs(clicks[j].y - clicks[cv->id].y) * height;
- if ( ( dx < 10 ) && ( dy < 10 ) )
+ dx = abs((int) ((clicks[j].x - clicks[cv->id].x) * width));
+ dy = abs ((int) ((clicks[j].y - clicks[cv->id].y) * height));
+ if ( ( dx < md->Threshold ) && ( dy < md->Threshold ) )
{
clicked++;
clicks[j].id = -1;
@@ -636,15 +635,13 @@ click_handler (void *data)
}
if (clicked == 1)
{
- //moveCursorTo(clicks[cv->id].x * width, clicks[cv->id].y * height);
- //mouseClick(1);
- printf("DOUBLE CLICK!\n");
+ moveCursorTo(clicks[cv->id].x * width, clicks[cv->id].y * height);
+ mouseClick(1);
}
if (clicked == 2)
{
- //moveCursorTo(clicks[cv->id].x * width, clicks[cv->id].y * height);
- //mouseClick(3);
- printf("TRIPLE CLICK!\n");
+ moveCursorTo(clicks[cv->id].x * width, clicks[cv->id].y * height);
+ mouseClick(3);
}
free (cv);
return FALSE;
@@ -746,11 +743,11 @@ static void gesture_handler(mtEvent event, CompDisplay * d,int BlobID)
}
ClickValue *cv = malloc (sizeof (ClickValue));
cv->display = d;
- cv->id = BlobID;
+ cv->id = k;
md->click[k].id = blobs[BlobID].id;
md->click[k].x = blobs[BlobID].x;
md->click[k].y = blobs[BlobID].y;
- md->clickTimeoutHandle = compAddTimeout (400,click_handler, cv);
+ md->clickTimeoutHandle = compAddTimeout (md->Interval,click_handler, cv);
blobs[BlobID].id = 0;
blobs[BlobID].x = 0;
@@ -860,7 +857,7 @@ static int tuio2Dcur_handler(const char *path, const char *types, lo_arg **argv,
{
for (j = 0; j < MAXBLOBS; j++)
{
- if (blobs[j].id == argv[1]->i)
+ if (blobs[j].id == argv[1]->i && blobs[j].x)
{
if ( !blobs[j].x && !blobs[j].y )
{
@@ -952,6 +949,8 @@ multitouchToggleMultitouch (CompDisplay *d,
sprintf (md->fwdport,"%d",multitouchGetFwdport (d));
ms->CurrentEffect = multitouchGetEffect(d);
md->TuioFwd = multitouchGetEnableFwd(d);
+ md->Interval = multitouchGetInterval(d);
+ md->Threshold = multitouchGetThreshold(d);
md->color.R = fillcolor[0];
md->color.G = fillcolor[1];
md->color.B = fillcolor[2];