diff options
author | Erkin Bahceci <erkinbah@gmail.com> | 2009-05-11 12:32:32 -0500 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-13 09:03:46 +1000 |
commit | ee265e10c9cc724ad0badcab86a3893667717322 (patch) | |
tree | bf46224fce9a107dda3834236a5a6bfa486f4d32 /src | |
parent | e4b1571d487cb67bab64e1ee890bddcd02437ddf (diff) |
Add TapAndDragGesture option and gestures property.
The tap-and-drag gesture is an alternative way of dragging.
It is performed by tapping (touching and releasing the finger), then
touching again and moving the finger on the touchpad.
This gesture is enabled by default and can be disabled by setting the
TapAndDragGesture option to false.
The gesture already existed in synaptics and was always enabled. This
commit adds an option to switch it on/off. The default behavior is
tap-and-drag being enabled, that is, TapAndDragGesture is true.
The "Synaptics Gestures" property is intended to hold all new gesture
enabling options, like options for the upcoming multitouch gestures.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/properties.c | 12 | ||||
-rw-r--r-- | src/synaptics.c | 28 | ||||
-rw-r--r-- | src/synapticsstr.h | 1 |
3 files changed, 33 insertions, 8 deletions
diff --git a/src/properties.c b/src/properties.c index 2cf485a..886b4c1 100644 --- a/src/properties.c +++ b/src/properties.c @@ -80,6 +80,7 @@ Atom prop_coastspeed = 0; Atom prop_pressuremotion = 0; Atom prop_pressuremotion_factor = 0; Atom prop_grab = 0; +Atom prop_gestures = 0; static Atom InitAtom(DeviceIntPtr dev, char *name, int format, int nvalues, int *values) @@ -251,6 +252,8 @@ InitDeviceProperties(LocalDevicePtr local) prop_grab = InitAtom(local->dev, SYNAPTICS_PROP_GRAB, 8, 1, ¶->grab_event_device); + values[0] = para->tap_and_drag_gesture; + prop_gestures = InitAtom(local->dev, SYNAPTICS_PROP_GESTURES, 8, 1, values); } int @@ -473,6 +476,15 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, return BadMatch; para->guestmouse_off = *(BOOL*)prop->data; + } else if (property == prop_gestures) + { + BOOL *gestures; + + if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER) + return BadMatch; + + gestures = (BOOL*)prop->data; + para->tap_and_drag_gesture = gestures[0]; } else if (property == prop_lockdrags) { if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER) diff --git a/src/synaptics.c b/src/synaptics.c index 421cc0a..ff66517 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -503,6 +503,7 @@ static void set_default_parameters(LocalDevicePtr local) pars->press_motion_min_factor = xf86SetRealOption(opts, "PressureMotionMinFactor", 1.0); pars->press_motion_max_factor = xf86SetRealOption(opts, "PressureMotionMaxFactor", 1.0); pars->grab_event_device = xf86SetBoolOption(opts, "GrabEventDevice", TRUE); + pars->tap_and_drag_gesture = xf86SetBoolOption(opts, "TapAndDragGesture", TRUE); /* Warn about (and fix) incorrectly configured TopEdge/BottomEdge parameters */ if (pars->top_edge > pars->bottom_edge) { @@ -1225,7 +1226,10 @@ SetTapState(SynapticsPrivate *priv, enum TapState tap_state, int millis) priv->tap_button_state = TBS_BUTTON_UP; break; case TS_3: - priv->tap_button_state = TBS_BUTTON_DOWN; + if (para->tap_and_drag_gesture) + priv->tap_button_state = TBS_BUTTON_DOWN; + else + priv->tap_button_state = TBS_BUTTON_UP; break; case TS_SINGLETAP: if (para->fast_taps) @@ -1363,16 +1367,24 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw, break; case TS_3: if (move) { - SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis); - SetTapState(priv, TS_DRAG, hw->millis); + if (para->tap_and_drag_gesture) { + SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis); + SetTapState(priv, TS_DRAG, hw->millis); + } else { + SetTapState(priv, TS_1, hw->millis); + } goto restart; } else if (is_timeout) { - if (finger == FS_TOUCHED) { - SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis); - } else if (finger == FS_PRESSED) { - SetMovingState(priv, MS_TRACKSTICK, hw->millis); + if (para->tap_and_drag_gesture) { + if (finger == FS_TOUCHED) { + SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis); + } else if (finger == FS_PRESSED) { + SetMovingState(priv, MS_TRACKSTICK, hw->millis); + } + SetTapState(priv, TS_DRAG, hw->millis); + } else { + SetTapState(priv, TS_1, hw->millis); } - SetTapState(priv, TS_DRAG, hw->millis); goto restart; } else if (release) { SetTapState(priv, TS_2B, hw->millis); diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 15c0e90..d2ff57c 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -146,6 +146,7 @@ typedef struct _SynapticsParameters double press_motion_min_factor; /* factor applied on speed when finger pressure is at minimum */ double press_motion_max_factor; /* factor applied on speed when finger pressure is at minimum */ Bool grab_event_device; /* grab event device for exclusive use? */ + Bool tap_and_drag_gesture; /* Switches the tap-and-drag gesture on/off */ } SynapticsParameters; |