summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2008-01-11 08:08:55 +0100
committerDanny Baumann <dannybaumann@web.de>2008-01-11 08:08:55 +0100
commit747102e79b5887586b6c0a31237b24d2423a72f2 (patch)
treef9e931e3d469e08e6b8a8cb6295468446ef494bd
parentd345e4d29a30dc7c76ce6cca2e0d70d8d3197a35 (diff)
downloadmousegestures-747102e79b5887586b6c0a31237b24d2423a72f2.tar.gz
mousegestures-747102e79b5887586b6c0a31237b24d2423a72f2.tar.bz2
Added "detect diagonal movements" setting that can be used to disable the diagonal movement detection which decreases detection precision.
-rw-r--r--mousegestures.c26
-rw-r--r--mousegestures.xml.in5
2 files changed, 24 insertions, 7 deletions
diff --git a/mousegestures.c b/mousegestures.c
index 11a8a42..400b8f5 100644
--- a/mousegestures.c
+++ b/mousegestures.c
@@ -21,10 +21,11 @@
#include <compiz-core.h>
#define MOUSEGESTURES_DISPLAY_OPTION_INITIATE_BUTTON 0
-#define MOUSEGESTURES_DISPLAY_OPTION_GESTURE 1
-#define MOUSEGESTURES_DISPLAY_OPTION_PLUGIN 2
-#define MOUSEGESTURES_DISPLAY_OPTION_ACTION 3
-#define MOUSEGESTURES_DISPLAY_OPTION_NUM 4
+#define MOUSEGESTURES_DISPLAY_OPTION_DETECT_DIAGONAL 1
+#define MOUSEGESTURES_DISPLAY_OPTION_GESTURE 2
+#define MOUSEGESTURES_DISPLAY_OPTION_PLUGIN 3
+#define MOUSEGESTURES_DISPLAY_OPTION_ACTION 4
+#define MOUSEGESTURES_DISPLAY_OPTION_NUM 5
#define MOUSEGESTURE_MIN_DELTA 80
#define MOUSEGESTURE_MAX_VARIANCE (MOUSEGESTURE_MIN_DELTA / 2)
@@ -245,23 +246,33 @@ mousegesturesHandleEvent (CompDisplay *d,
case MotionNotify:
if (md->grabIndex)
{
+ Bool detectDiagonal;
char currentStroke = '\0';
- int deltaX = 0, deltaY = 0;
+ int deltaX = 0, deltaY = 0, opt;
md->deltaX += (pointerX - lastPointerX);
md->deltaY += (pointerY - lastPointerY);
+ opt = MOUSEGESTURES_DISPLAY_OPTION_DETECT_DIAGONAL;
+ detectDiagonal = md->opt[opt].value.b;
+
if (abs (md->deltaX) > MOUSEGESTURE_MIN_DELTA)
{
deltaX = md->deltaX;
- if (abs (md->deltaY) > MOUSEGESTURE_MAX_VARIANCE)
+ if (detectDiagonal &&
+ abs (md->deltaY) > MOUSEGESTURE_MAX_VARIANCE)
+ {
deltaY = md->deltaY;
+ }
}
else if (abs (md->deltaY) > MOUSEGESTURE_MIN_DELTA)
{
deltaY = md->deltaY;
- if (abs (md->deltaX) > MOUSEGESTURE_MAX_VARIANCE)
+ if (detectDiagonal &&
+ abs (md->deltaX) > MOUSEGESTURE_MAX_VARIANCE)
+ {
deltaX = md->deltaX;
+ }
}
/* handle horizontal and vertical cases first */
@@ -413,6 +424,7 @@ mousegesturesSetDisplayOption (CompPlugin *p,
static const CompMetadataOptionInfo mousegesturesDisplayOptionInfo[] = {
{ "initiate_button", "button", 0,
mousegesturesInitiate, mousegesturesTerminate },
+ { "detect_diagonal", "bool", 0, 0, 0 },
{ "gestures", "list", "<type>string</type>", 0, 0 },
{ "plugins", "list", "<type>string</type>", 0, 0 },
{ "actions", "list", "<type>string</type>", 0, 0 }
diff --git a/mousegestures.xml.in b/mousegestures.xml.in
index b17145c..99acc36 100644
--- a/mousegestures.xml.in
+++ b/mousegestures.xml.in
@@ -17,6 +17,11 @@
</group>
<group>
<_short>Gestures</_short>
+ <option type="bool" name="detect_diagonal">
+ <_short>Detect Diagonal Movements</_short>
+ <_long>If this option is selected, diagonal movements are detected, which may lead to a decreased detection accuracy.</_long>
+ <default>false</default>
+ </option>
<subgroup>
<_short>Gesture assignment</_short>
<option type="list" name="gestures">