[PATCH synaptics] Replace numerical values with an enum for the TouchpadOff prop

Peter Hutterer peter.hutterer at who-t.net
Wed Jan 30 15:30:24 PST 2013


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/synaptics.c    | 8 ++++----
 src/synapticsstr.h | 6 ++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 29e551a..df092c0 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -650,7 +650,7 @@ set_default_parameters(InputInfoPtr pInfo)
         xf86SetBoolOption(opts, "VertTwoFingerScroll", vertTwoFingerScroll);
     pars->scroll_twofinger_horiz =
         xf86SetBoolOption(opts, "HorizTwoFingerScroll", horizTwoFingerScroll);
-    pars->touchpad_off = xf86SetIntOption(opts, "TouchpadOff", 0);
+    pars->touchpad_off = xf86SetIntOption(opts, "TouchpadOff", TOUCHPAD_ON);
     pars->locked_drags = xf86SetBoolOption(opts, "LockedDrags", FALSE);
     pars->locked_drag_time = xf86SetIntOption(opts, "LockedDragTimeout", 5000);
     pars->tap_action[RT_TAP] = xf86SetIntOption(opts, "RTCornerButton", 0);
@@ -1629,7 +1629,7 @@ SelectTapButton(SynapticsPrivate * priv, enum EdgeType edge)
 {
     enum TapEvent tap;
 
-    if (priv->synpara.touchpad_off == 2) {
+    if (priv->synpara.touchpad_off == TOUCHPAD_TAP_OFF) {
         priv->tap_button = 0;
         return;
     }
@@ -2171,7 +2171,7 @@ HandleScrolling(SynapticsPrivate * priv, struct SynapticsHwState *hw,
     SynapticsParameters *para = &priv->synpara;
     int delay = 1000000000;
 
-    if ((priv->synpara.touchpad_off == 2) || (priv->finger_state == FS_BLOCKED)) {
+    if ((priv->synpara.touchpad_off == TOUCHPAD_TAP_OFF) || (priv->finger_state == FS_BLOCKED)) {
         stop_coasting(priv);
         priv->circ_scroll_on = FALSE;
         priv->vert_scroll_edge_on = FALSE;
@@ -2763,7 +2763,7 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
     Bool inside_active_area;
 
     /* If touchpad is switched off, we skip the whole thing and return delay */
-    if (para->touchpad_off == 1) {
+    if (para->touchpad_off == TOUCHPAD_OFF) {
         UpdateTouchState(pInfo, hw);
         return delay;
     }
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index f6cbb4a..428befa 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -47,6 +47,12 @@
 #define SYNAPTICS_MAX_TOUCHES	10
 #define SYN_MAX_BUTTONS 12      /* Max number of mouse buttons */
 
+enum OffState {
+    TOUCHPAD_ON = 0,
+    TOUCHPAD_OFF = 1,
+    TOUCHPAD_TAP_OFF = 2,
+};
+
 enum TapEvent {
     RT_TAP = 0,                 /* Right top corner */
     RB_TAP,                     /* Right bottom corner */
-- 
1.8.1



More information about the xorg-devel mailing list