diff options
author | Peter Osterlund <petero2@telia.com> | 2005-01-05 15:18:39 +0100 |
---|---|---|
committer | Peter Osterlund <petero2@telia.com> | 2006-04-09 04:03:01 +0200 |
commit | 9f1a9f7cf89724f0803106eaf4168bbb72d3b558 (patch) | |
tree | b3e18354ace22f45931b4a4535eaf8fca639e465 | |
parent | fdef1418e342dace2eccb79486188d15129b8832 (diff) |
Made it possible to use horizontal circular scrolling by
smoothly switching from "horizontal" to "horizontal circular" when the
finger enters the lower left or lower right corners during horizontal
scrolling. See also change eeb40cac2b2dfa411618f2ecbffedc85166e675f.
-rw-r--r-- | synaptics.c | 30 | ||||
-rw-r--r-- | synaptics.h | 2 |
2 files changed, 24 insertions, 8 deletions
diff --git a/synaptics.c b/synaptics.c index 9053522..c1f0d6c 100644 --- a/synaptics.c +++ b/synaptics.c @@ -1269,6 +1269,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, (para->circular_trigger == 7 && edge & LEFT_EDGE) || (para->circular_trigger == 8 && edge & LEFT_EDGE && edge & TOP_EDGE)) { priv->circ_scroll_on = TRUE; + priv->circ_scroll_vert = TRUE; priv->scroll_a = angle(priv, hw->x, hw->y); DBG(7, ErrorF("circular scroll detected on edge\n")); } @@ -1300,12 +1301,23 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, priv->horiz_scroll_on = FALSE; } - /* if hitting a corner (top right or bottom right) while vertical scrolling is active, - switch over to circular scrolling smoothly */ + /* if hitting a corner (top right or bottom right) while vertical scrolling + is active, switch over to circular scrolling smoothly */ if (priv->vert_scroll_on && !priv->horiz_scroll_on && para->circular_scrolling) { if ((edge & RIGHT_EDGE) && (edge & (TOP_EDGE | BOTTOM_EDGE))) { priv->vert_scroll_on = FALSE; priv->circ_scroll_on = TRUE; + priv->circ_scroll_vert = TRUE; + priv->scroll_a = angle(priv, hw->x, hw->y); + DBG(7, ErrorF("switching to circular scrolling\n")); + } + } + /* Same treatment for horizontal scrolling */ + if (priv->horiz_scroll_on && !priv->vert_scroll_on && para->circular_scrolling) { + if ((edge & BOTTOM_EDGE) && (edge & (LEFT_EDGE | RIGHT_EDGE))) { + priv->horiz_scroll_on = FALSE; + priv->circ_scroll_on = TRUE; + priv->circ_scroll_vert = FALSE; priv->scroll_a = angle(priv, hw->x, hw->y); DBG(7, ErrorF("switching to circular scrolling\n")); } @@ -1325,17 +1337,19 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, if (priv->circ_scroll_on) { /* + = counter clockwise, - = clockwise */ while (diffa(priv->scroll_a, angle(priv, hw->x, hw->y)) > para->scroll_dist_circ) { - sd->up++; - if (sd->up > 1000) - break; /* safety */ + if (priv->circ_scroll_vert) + sd->up++; + else + sd->right++; priv->scroll_a += para->scroll_dist_circ; if (priv->scroll_a > M_PI) priv->scroll_a -= 2 * M_PI; } while (diffa(priv->scroll_a, angle(priv, hw->x, hw->y)) < -para->scroll_dist_circ) { - sd->down++; - if (sd->down > 1000) - break; /* safety */ + if (priv->circ_scroll_vert) + sd->down++; + else + sd->left++; priv->scroll_a -= para->scroll_dist_circ; if (priv->scroll_a < -M_PI) priv->scroll_a += 2 * M_PI; diff --git a/synaptics.h b/synaptics.h index f96583a..a104a2f 100644 --- a/synaptics.h +++ b/synaptics.h @@ -178,6 +178,8 @@ typedef struct _SynapticsPrivateRec Bool vert_scroll_on; /* scrolling flag */ Bool horiz_scroll_on; /* scrolling flag */ Bool circ_scroll_on; /* scrolling flag */ + Bool circ_scroll_vert; /* True: Generate vertical scroll events + False: Generate horizontal events */ double frac_x, frac_y; /* absolute -> relative fraction */ enum MidButtonEmulation mid_emu_state; /* emulated 3rd button */ int repeatButtons; /* buttons for repeat */ |