summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2007-01-28 23:12:33 +0100
committerPeter Osterlund <petero2@telia.com>2007-01-28 23:12:33 +0100
commit683d78c621e506eb7e65597d35c872ba2b007e8e (patch)
tree73e9182cf0c4218b0857714740b856c343377b39
parenta527e26089c05a75ecddfcf51a34400a8574e5ce (diff)
Fix whitespace in trackstick patches.
-rw-r--r--synaptics.c179
-rw-r--r--synaptics.h23
2 files changed, 102 insertions, 100 deletions
diff --git a/synaptics.c b/synaptics.c
index 72fe2cf..77bacac 100644
--- a/synaptics.c
+++ b/synaptics.c
@@ -916,9 +916,9 @@ SynapticsDetectFinger(SynapticsPrivate *priv, struct SynapticsHwState *hw)
/* finger detection thru pressure and threshold */
finger = ((hw->z > para->finger_press) && priv->finger_state < FS_PRESSED) ? FS_PRESSED
- : ((hw->z > para->finger_high) && priv->finger_state < FS_TOUCHED) ? FS_TOUCHED
- : ((hw->z < para->finger_low) && priv->finger_state > FS_UNTOUCHED) ? FS_UNTOUCHED
- : priv->finger_state;
+ : ((hw->z > para->finger_high) && priv->finger_state < FS_TOUCHED) ? FS_TOUCHED
+ : ((hw->z < para->finger_low) && priv->finger_state > FS_UNTOUCHED) ? FS_UNTOUCHED
+ : priv->finger_state;
if (!para->palm_detect)
return finger;
@@ -1052,11 +1052,11 @@ SetMovingState(SynapticsPrivate *priv, enum MovingState moving_state, int millis
{
/* SynapticsSHM *para = priv->synpara; */
DBG(7, ErrorF("SetMovingState - %d -> %d center at %d/%d (millis:%d)\n", priv->moving_state,
- moving_state,priv->hwState.x, priv->hwState.y, millis));
+ moving_state,priv->hwState.x, priv->hwState.y, millis));
if (moving_state == MS_TRACKSTICK) {
- priv->trackstick_neutral_x = priv->hwState.x;
- priv->trackstick_neutral_y = priv->hwState.y;
+ priv->trackstick_neutral_x = priv->hwState.x;
+ priv->trackstick_neutral_y = priv->hwState.y;
}
priv->moving_state = moving_state;
}
@@ -1097,8 +1097,8 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw,
touch = finger && !priv->finger_state;
release = !finger && priv->finger_state;
move = ((priv->tap_max_fingers <= 1) &&
- ((abs(hw->x - priv->touch_on.x) >= para->tap_move) ||
- (abs(hw->y - priv->touch_on.y) >= para->tap_move)));
+ ((abs(hw->x - priv->touch_on.x) >= para->tap_move) ||
+ (abs(hw->y - priv->touch_on.y) >= para->tap_move)));
if (touch) {
priv->touch_on.x = hw->x;
@@ -1124,31 +1124,31 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw,
SetTapState(priv, TS_1, hw->millis);
break;
case TS_1:
- if (move) {
- SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis);
- SetTapState(priv, TS_MOVE, 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);
- }
- SetTapState(priv, TS_MOVE, hw->millis);
- goto restart;
- } else if (release) {
- SelectTapButton(priv, edge);
- SetTapState(priv, TS_2A, hw->millis);
- }
- break;
+ if (move) {
+ SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis);
+ SetTapState(priv, TS_MOVE, 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);
+ }
+ SetTapState(priv, TS_MOVE, hw->millis);
+ goto restart;
+ } else if (release) {
+ SelectTapButton(priv, edge);
+ SetTapState(priv, TS_2A, hw->millis);
+ }
+ break;
case TS_MOVE:
- if (move && priv->moving_state == MS_TRACKSTICK) {
- SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis);
- }
+ if (move && priv->moving_state == MS_TRACKSTICK) {
+ SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis);
+ }
if (release) {
SetMovingState(priv, MS_FALSE, hw->millis);
SetTapState(priv, TS_START, hw->millis);
- }
+ }
break;
case TS_2A:
if (touch)
@@ -1171,32 +1171,32 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw,
SetTapState(priv, TS_START, hw->millis);
break;
case TS_3:
- if (move) {
- SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis);
- SetTapState(priv, TS_DRAG, 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);
- }
- SetTapState(priv, TS_DRAG, hw->millis);
- goto restart;
- } else if (release) {
+ if (move) {
+ SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis);
+ SetTapState(priv, TS_DRAG, 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);
+ }
+ SetTapState(priv, TS_DRAG, hw->millis);
+ goto restart;
+ } else if (release) {
SetTapState(priv, TS_2B, hw->millis);
- }
+ }
break;
case TS_DRAG:
- if (move)
- SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis);
+ if (move)
+ SetMovingState(priv, MS_TOUCHPAD_RELATIVE, hw->millis);
if (release) {
SetMovingState(priv, MS_FALSE, hw->millis);
if (para->locked_drags) {
SetTapState(priv, TS_4, hw->millis);
} else {
SetTapState(priv, TS_START, hw->millis);
- }
+ }
}
break;
case TS_4:
@@ -1208,9 +1208,9 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw,
SetTapState(priv, TS_DRAG, hw->millis);
goto restart;
} else if (release) {
- SetMovingState(priv, MS_FALSE, hw->millis);
+ SetMovingState(priv, MS_FALSE, hw->millis);
SetTapState(priv, TS_START, hw->millis);
- }
+ }
break;
}
@@ -1259,22 +1259,22 @@ ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw,
dx = dy = 0;
moving_state = priv->moving_state;
- if (moving_state == MS_FALSE)
- switch (priv->tap_state) {
- case TS_MOVE:
- case TS_DRAG:
- moving_state = MS_TOUCHPAD_RELATIVE;
- break;
- case TS_1:
- case TS_3:
- case TS_5:
- if (hw->numFingers == 1)
- moving_state = MS_TOUCHPAD_RELATIVE;
- break;
- default:
- break;
- }
-
+ if (moving_state == MS_FALSE) {
+ switch (priv->tap_state) {
+ case TS_MOVE:
+ case TS_DRAG:
+ moving_state = MS_TOUCHPAD_RELATIVE;
+ break;
+ case TS_1:
+ case TS_3:
+ case TS_5:
+ if (hw->numFingers == 1)
+ moving_state = MS_TOUCHPAD_RELATIVE;
+ break;
+ default:
+ break;
+ }
+ }
if (moving_state && !priv->palm &&
!priv->vert_scroll_edge_on && !priv->horiz_scroll_edge_on &&
!priv->vert_scroll_twofinger_on && !priv->horiz_scroll_twofinger_on &&
@@ -1286,15 +1286,16 @@ ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw,
int y_edge_speed = 0;
double dtime = (hw->millis - HIST(0).millis) / 1000.0;
- if (priv->moving_state == MS_TRACKSTICK) {
- dx = (hw->x - priv->trackstick_neutral_x);
- dy = (hw->y - priv->trackstick_neutral_y);
+ if (priv->moving_state == MS_TRACKSTICK) {
+ dx = (hw->x - priv->trackstick_neutral_x);
+ dy = (hw->y - priv->trackstick_neutral_y);
+
+ dx = dx * para->trackstick_accl;
+ dy = dy * para->trackstick_accl;
+ } else if (moving_state == MS_TOUCHPAD_RELATIVE) {
+ dx = estimate_delta(hw->x, HIST(0).x, HIST(1).x, HIST(2).x);
+ dy = estimate_delta(hw->y, HIST(0).y, HIST(1).y, HIST(2).y);
- dx = dx * para->trackstick_accl;
- dy = dy * para->trackstick_accl;
- } else if (moving_state == MS_TOUCHPAD_RELATIVE) {
- dx = estimate_delta(hw->x, HIST(0).x, HIST(1).x, HIST(2).x);
- dy = estimate_delta(hw->y, HIST(0).y, HIST(1).y, HIST(2).y);
if ((priv->tap_state == TS_DRAG) || para->edge_motion_use_always) {
int minZ = para->edge_motion_min_z;
int maxZ = para->edge_motion_max_z;
@@ -1305,32 +1306,32 @@ ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw,
if (hw->z <= minZ) {
edge_speed = minSpd;
} else if (hw->z >= maxZ) {
- edge_speed = maxSpd;
+ edge_speed = maxSpd;
} else {
- edge_speed = minSpd + (hw->z - minZ) * (maxSpd - minSpd) / (maxZ - minZ);
+ edge_speed = minSpd + (hw->z - minZ) * (maxSpd - minSpd) / (maxZ - minZ);
}
if (!priv->synpara->circular_pad) {
- /* on rectangular pad */
- if (edge & RIGHT_EDGE) {
+ /* on rectangular pad */
+ if (edge & RIGHT_EDGE) {
x_edge_speed = edge_speed;
- } else if (edge & LEFT_EDGE) {
+ } else if (edge & LEFT_EDGE) {
x_edge_speed = -edge_speed;
- }
- if (edge & TOP_EDGE) {
+ }
+ if (edge & TOP_EDGE) {
y_edge_speed = -edge_speed;
- } else if (edge & BOTTOM_EDGE) {
+ } else if (edge & BOTTOM_EDGE) {
y_edge_speed = edge_speed;
- }
+ }
} else if (edge) {
- /* at edge of circular pad */
- double relX, relY;
+ /* at edge of circular pad */
+ double relX, relY;
- relative_coords(priv, hw->x, hw->y, &relX, &relY);
- x_edge_speed = (int)(edge_speed * relX);
- y_edge_speed = (int)(edge_speed * relY);
+ relative_coords(priv, hw->x, hw->y, &relX, &relY);
+ x_edge_speed = (int)(edge_speed * relX);
+ y_edge_speed = (int)(edge_speed * relY);
}
- }
- }
+ }
+ }
/* speed depending on distance/packet */
dist = move_distance(dx, dy);
@@ -1342,7 +1343,7 @@ ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw,
}
/* modify speed according to pressure */
- if (priv->moving_state == MS_TOUCHPAD_RELATIVE) {
+ if (priv->moving_state == MS_TOUCHPAD_RELATIVE) {
int minZ = para->press_motion_min_z;
int maxZ = para->press_motion_max_z;
double minFctr = para->press_motion_min_factor;
diff --git a/synaptics.h b/synaptics.h
index 032a9a3..8292802 100644
--- a/synaptics.h
+++ b/synaptics.h
@@ -50,7 +50,7 @@ typedef struct _SynapticsSHM
/* Parameter data */
int left_edge, right_edge, top_edge, bottom_edge; /* edge coordinates absolute */
- int finger_low, finger_high, finger_press; /* finger detection values in Z-values */
+ int finger_low, finger_high, finger_press; /* finger detection values in Z-values */
int tap_time;
int tap_move; /* max. tapping time and movement in packets and coord. */
int single_tap_timeout; /* timeout to recognize a single tap */
@@ -67,7 +67,7 @@ typedef struct _SynapticsSHM
Bool scroll_twofinger_vert; /* Enable/disable vertical two-finger scrolling */
Bool scroll_twofinger_horiz; /* Enable/disable horizontal two-finger scrolling */
double min_speed, max_speed, accl; /* movement parameters */
- double trackstick_accl; /* trackstick mode acceleration parameters */
+ double trackstick_accl; /* trackstick mode acceleration parameters */
int edge_motion_min_z; /* finger pressure at which minimum edge motion speed is set */
int edge_motion_max_z; /* finger pressure at which maximum edge motion speed is set */
int edge_motion_min_speed; /* slowest setting for edge motion speed */
@@ -138,16 +138,16 @@ typedef struct _SynapticsMoveHist
} SynapticsMoveHistRec;
enum FingerState {
- FS_UNTOUCHED,
- FS_TOUCHED,
- FS_PRESSED
+ FS_UNTOUCHED,
+ FS_TOUCHED,
+ FS_PRESSED
};
enum MovingState {
- MS_FALSE,
- MS_TOUCHPAD_RELATIVE,
- MS_TOUCHPAD_ABSOLUTE, /* lets reserve this for future extension, in no way supported for now */
- MS_TRACKSTICK /* trackstick is always relative */
+ MS_FALSE,
+ MS_TOUCHPAD_RELATIVE,
+ MS_TOUCHPAD_ABSOLUTE, /* lets reserve this for future extension, in no way supported for now */
+ MS_TRACKSTICK /* trackstick is always relative */
};
enum MidButtonEmulation {
@@ -213,6 +213,7 @@ typedef struct _SynapticsPrivateRec
int tap_button; /* Which button started the tap processing */
enum TapButtonState tap_button_state; /* Current tap action */
SynapticsMoveHistRec touch_on; /* data when the touchpad is touched/released */
+
enum MovingState moving_state; /* previous moving state */
Bool vert_scroll_edge_on; /* Keeps track of currently active scroll modes */
Bool horiz_scroll_edge_on; /* Keeps track of currently active scroll modes */
@@ -221,8 +222,8 @@ typedef struct _SynapticsPrivateRec
Bool circ_scroll_on; /* Keeps track of currently active scroll modes */
Bool circ_scroll_vert; /* True: Generate vertical scroll events
False: Generate horizontal events */
- int trackstick_neutral_x; /* neutral x position for trackstick mode */
- int trackstick_neutral_y; /* neutral y position for trackstick mode */
+ int trackstick_neutral_x; /* neutral x position for trackstick mode */
+ int trackstick_neutral_y; /* neutral y position for trackstick mode */
double autoscroll_xspd; /* Horizontal coasting speed */
double autoscroll_yspd; /* Vertical coasting speed */
double autoscroll_x; /* Accumulated horizontal coasting scroll */