From e6a82b19f6cd3ee76319928e7632c1adf6436baa Mon Sep 17 00:00:00 2001 From: jet-plane Date: Fri, 6 Jun 2008 18:58:43 +0000 Subject: Fixed double/triple click, added timeout interval and threshold to config for mouse emulation.. --- multitouch.c | 31 +++++++++++++++---------------- multitouch.xml.in | 27 +++++++++++++++++++++++++++ 2 files changed, 42 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 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]; diff --git a/multitouch.xml.in b/multitouch.xml.in index 294896e..aff0209 100644 --- a/multitouch.xml.in +++ b/multitouch.xml.in @@ -14,6 +14,8 @@ Use multitouch screens trough tuio protocol to drive various plugins Accessibility + + Keys Key Bindings + + + Other + + Mouse emulation + Mouse interval and threshold values. + + + + + + Other Annotate related settings + -- cgit v1.1