diff options
-rw-r--r-- | multitouch.c | 31 | ||||
-rw-r--r-- | 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<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]; 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 @@ <long>Use multitouch screens trough tuio protocol to drive various plugins</long> <category>Accessibility</category> <display> + <group> + <short>Keys</short> <short>Key Bindings</short> <option name="toggle_multitouch" type="key"> <short>Toggle the plugin</short> @@ -45,6 +47,9 @@ <long>Switch from annotate to water wave or disable effects.</long> <default><Super>F12</default> </option> + </group> + <group> + <short>Other</short> <option name="effect" type="int"> <short>Choose effect</short> <long>Choose ripples or annotate on the screen.</long> @@ -86,8 +91,29 @@ <max>65535</max> </option> </subgroup> + <subgroup> + <short>Mouse emulation</short> + <long>Mouse interval and threshold values.</long> + <option name="interval" type="int"> + <short>Mouse double/tripple click interval</short> + <long>Maximal time (in milliseconds) between 2 or 3 mouse clicks that turns them into double/tripple click.</long> + <default>400</default> + <min>200</min> + <max>1000</max> + </option> + <option name="threshold" type="int"> + <short>Pointer threshold</short> + <long>Smallest distance (in pixels) that the mouse pointer can move when performing double/tripple click to be recognized as such.</long> + <default>10</default> + <min>1</min> + <max>100</max> + </option> + </subgroup> + </group> </display> <screen> + <group> + <short>Other</short> <subgroup> <short>Annotate related settings</short> <option type="color" name="fill_color"> @@ -98,6 +124,7 @@ </default> </option> </subgroup> + </group> </screen> </plugin> </compiz> |