summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2003-10-12 16:45:02 +0200
committerPeter Osterlund <petero2@telia.com>2006-04-09 04:01:16 +0200
commit215c8256a5ddfc48c7b8bf850eff3c5951b9d673 (patch)
tree50821d0d53ce7db43cc321f793fdcdd8c32311e1
parent0160f6e854a0f384df280b299c8d504b815a47f8 (diff)
Implemented "locked drags", after a suggestion from
"Karl Kashofer" <karl.kashofer@gmx.at>.
-rw-r--r--PARAMETER3
-rw-r--r--synaptics.c14
-rw-r--r--synaptics.h2
-rw-r--r--synclient.c1
4 files changed, 16 insertions, 4 deletions
diff --git a/PARAMETER b/PARAMETER
index 12c694d..06975ea 100644
--- a/PARAMETER
+++ b/PARAMETER
@@ -25,3 +25,6 @@ UpDownScrolling Bool If on, the up/down buttons generate button 4/5 events.
EmulateMidButtonTime Int max time (in milliseconds) for middle button emulation.
TouchpadOff Bool If on, the Touchpad is switched off (useful
if an external mouse is connected)
+LockedDrags Bool If off, a tap and drag gesture ends when you release
+ the finger. If on, the gesture is active until you
+ tap a second time.
diff --git a/synaptics.c b/synaptics.c
index 030114c..2dab71d 100644
--- a/synaptics.c
+++ b/synaptics.c
@@ -318,6 +318,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
priv->synpara->repeater = xf86SetStrOption(local->options, "Repeater", NULL);
priv->synpara->updown_button_scrolling = xf86SetBoolOption(local->options, "UpDownScrolling", TRUE);
priv->synpara->touchpad_off = xf86SetBoolOption(local->options, "TouchpadOff", FALSE);
+ priv->synpara->locked_drags = xf86SetBoolOption(local->options, "LockedDrags", FALSE);
str_par = xf86FindOptionValue(local->options, "MinSpeed");
if ((!str_par) || (xf86sscanf(str_par, "%lf", &priv->synpara->min_speed) != 1))
@@ -848,7 +849,8 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw)
/* check if
1. the tap is in tap_time
2. the max movement is in tap_move or more than one finger are tapped */
- if ((TIME_DIFF(hw->millis, priv->touch_on.millis + para->tap_time) < 0) &&
+ timeleft = TIME_DIFF(priv->touch_on.millis + para->tap_time, hw->millis);
+ if (timeleft > 0 &&
(((abs(hw->x - priv->touch_on.x) < para->tap_move) &&
(abs(hw->y - priv->touch_on.y) < para->tap_move)) ||
priv->finger_count)) {
@@ -897,6 +899,8 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw)
}
}
} /* tap detection */
+ if ((timeleft <= 0) && priv->drag && para->locked_drags)
+ priv->draglock = TRUE;
priv->drag = FALSE;
} /* finger lost */
@@ -916,7 +920,7 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw)
}
/* reset tapping button flags */
- if (!priv->tap && !priv->drag && !priv->doubletap) {
+ if (!priv->tap && !priv->drag && !priv->doubletap && !priv->draglock) {
priv->tap_left = priv->tap_mid = priv->tap_right = FALSE;
}
@@ -929,11 +933,13 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw)
mid |= priv->tap_mid;
hw->right |= priv->tap_right;
} else {
+ if (priv->tap)
+ priv->draglock = FALSE;
priv->tap = FALSE;
}
/* drag processing */
- if (priv->drag) {
+ if (priv->drag || priv->draglock) {
hw->left |= priv->tap_left;
mid |= priv->tap_mid;
hw->right |= priv->tap_right;
@@ -1005,7 +1011,7 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw)
dx = (hw->x - MOVE_HIST(2).x) / 2;
dy = (hw->y - MOVE_HIST(2).y) / 2;
- if (priv->drag) {
+ if (priv->drag || priv->draglock) {
if (edge & RIGHT_EDGE) {
dx += clamp(para->edge_motion_speed - dx, 0, para->edge_motion_speed);
} else if (edge & LEFT_EDGE) {
diff --git a/synaptics.h b/synaptics.h
index dca94d9..29e008b 100644
--- a/synaptics.h
+++ b/synaptics.h
@@ -38,6 +38,7 @@ typedef struct _SynapticsSHM
char* repeater; /* Repeater on or off */
Bool updown_button_scrolling; /* Up/Down-Button scrolling or middle/double-click */
Bool touchpad_off; /* Switches the Touchpad off*/
+ Bool locked_drags; /* Enable locked drags */
} SynapticsSHM, *SynapticsSHMPtr;
#ifdef SYNAPTICS_PRIVATE
@@ -131,6 +132,7 @@ typedef struct _SynapticsPrivateRec
unsigned int prev_up; /* Previous up button value, for double click emulation */
Bool finger_flag; /* previous finger */
Bool tap, drag, doubletap; /* feature flags */
+ Bool draglock; /* Locked drag active */
Bool tap_left, tap_mid, tap_right; /* tapping buttons */
Bool vert_scroll_on; /* scrolling flag */
Bool horiz_scroll_on; /* scrolling flag */
diff --git a/synclient.c b/synclient.c
index 2aacacf..6197ea6 100644
--- a/synclient.c
+++ b/synclient.c
@@ -62,6 +62,7 @@ static struct Parameter params[] = {
DEFINE_PAR("EdgeMotionSpeed", edge_motion_speed, PT_INT, 0, 400),
DEFINE_PAR("UpDownScrolling", updown_button_scrolling, PT_BOOL, 0, 1),
DEFINE_PAR("TouchpadOff", touchpad_off, PT_BOOL, 0, 1),
+ DEFINE_PAR("LockedDrags", locked_drags, PT_BOOL, 0, 1),
{ 0, 0, 0, 0, 0 }
};