diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-02-05 23:01:24 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-02-05 23:01:24 +1000 |
commit | b3fd780dd80f1bdfde00b0b255f02f13b34464b1 (patch) | |
tree | c78e65011b8ec42a1cd373667911a703c138be54 | |
parent | 3c446c495812417232f159ced9f6b91334de2f95 (diff) |
Purge circular scrollinggreat-gutting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/properties.c | 38 | ||||
-rw-r--r-- | src/synaptics.c | 222 | ||||
-rw-r--r-- | src/synapticsstr.h | 6 |
3 files changed, 46 insertions, 220 deletions
diff --git a/src/properties.c b/src/properties.c index 30cd062..ac2bdb2 100644 --- a/src/properties.c +++ b/src/properties.c @@ -72,10 +72,6 @@ Atom prop_off = 0; Atom prop_lockdrags = 0; Atom prop_lockdrags_time = 0; Atom prop_tapaction = 0; -Atom prop_circscroll = 0; -Atom prop_circscroll_dist = 0; -Atom prop_circscroll_trigger = 0; -Atom prop_circpad = 0; Atom prop_palm = 0; Atom prop_palm_dim = 0; Atom prop_coastspeed = 0; @@ -216,12 +212,6 @@ InitDeviceProperties(InputInfoPtr pInfo) memcpy(values, para->tap_action, MAX_TAP * sizeof(int)); prop_tapaction = InitAtom(pInfo->dev, SYNAPTICS_PROP_TAP_ACTION, 8, MAX_TAP, values); - prop_circscroll = InitAtom(pInfo->dev, SYNAPTICS_PROP_CIRCULAR_SCROLLING, 8, 1, ¶->circular_scrolling); - - fvalues[0] = para->scroll_dist_circ; - prop_circscroll_dist = InitFloatAtom(pInfo->dev, SYNAPTICS_PROP_CIRCULAR_SCROLLING_DIST, 1, fvalues); - - prop_circscroll_trigger = InitAtom(pInfo->dev, SYNAPTICS_PROP_CIRCULAR_SCROLLING_TRIGGER, 8, 1, ¶->circular_trigger); prop_palm = InitAtom(pInfo->dev, SYNAPTICS_PROP_PALM_DETECT, 8, 1, ¶->palm_detect); values[0] = para->palm_min_width; @@ -478,34 +468,6 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, for (i = 0; i < MAX_TAP; i++) para->tap_action[i] = action[i]; - } else if (property == prop_circscroll) - { - if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER) - return BadMatch; - - para->circular_scrolling = *(BOOL*)prop->data; - - } else if (property == prop_circscroll_dist) - { - float circdist; - - if (prop->size != 1 || prop->format != 32 || prop->type != float_type) - return BadMatch; - - circdist = *(float*)prop->data; - para->scroll_dist_circ = circdist; - } else if (property == prop_circscroll_trigger) - { - int trigger; - if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER) - return BadMatch; - - trigger = *(CARD8*)prop->data; - if (trigger > 8) - return BadValue; - - para->circular_trigger = trigger; - } else if (property == prop_palm) { if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER) diff --git a/src/synaptics.c b/src/synaptics.c index de8f1aa..72d8f5a 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -473,8 +473,6 @@ static void set_default_parameters(InputInfoPtr pInfo) pars->tap_action[F1_TAP] = xf86SetIntOption(opts, "TapButton1", tapButton1); pars->tap_action[F2_TAP] = xf86SetIntOption(opts, "TapButton2", tapButton2); pars->tap_action[F3_TAP] = xf86SetIntOption(opts, "TapButton3", tapButton3); - pars->circular_scrolling = xf86SetBoolOption(opts, "CircularScrolling", FALSE); - pars->circular_trigger = xf86SetIntOption(opts, "CircScrollTrigger", 0); pars->palm_detect = xf86SetBoolOption(opts, "PalmDetect", FALSE); pars->palm_min_width = xf86SetIntOption(opts, "PalmMinWidth", palmMinWidth); pars->palm_min_z = xf86SetIntOption(opts, "PalmMinZ", palmMinZ); @@ -485,7 +483,6 @@ static void set_default_parameters(InputInfoPtr pInfo) pars->min_speed = xf86SetRealOption(opts, "MinSpeed", 0.4); pars->max_speed = xf86SetRealOption(opts, "MaxSpeed", 0.7); pars->accl = xf86SetRealOption(opts, "AccelFactor", accelFactor); - pars->scroll_dist_circ = xf86SetRealOption(opts, "CircScrollDelta", 0.1); pars->coasting_speed = xf86SetRealOption(opts, "CoastingSpeed", 20.0); pars->coasting_friction = xf86SetRealOption(opts, "CoastingFriction", 50); pars->press_motion_min_factor = xf86SetRealOption(opts, "PressureMotionMinFactor", 1.0); @@ -1076,28 +1073,6 @@ no_touch: return Success; } -/* return angle of point relative to center */ -static double -angle(SynapticsPrivate *priv, int x, int y) -{ - double xCenter = (priv->synpara.left_edge + priv->synpara.right_edge) / 2.0; - double yCenter = (priv->synpara.top_edge + priv->synpara.bottom_edge) / 2.0; - - return atan2(-(y - yCenter), x - xCenter); -} - -/* return angle difference */ -static double -diffa(double a1, double a2) -{ - double da = fmod(a2 - a1, 2 * M_PI); - if (da < 0) - da += 2 * M_PI; - if (da > M_PI) - da -= 2 * M_PI; - return da; -} - static edge_type edge_detection(SynapticsPrivate *priv, int x, int y) { @@ -1748,7 +1723,7 @@ ComputeDeltas(SynapticsPrivate *priv, const struct SynapticsHwState *hw, if (!inside_area || !moving_state || priv->finger_state == FS_BLOCKED || priv->vert_scroll_edge_on || priv->horiz_scroll_edge_on || priv->vert_scroll_twofinger_on || priv->horiz_scroll_twofinger_on || - priv->circ_scroll_on || priv->prevFingers != hw->numFingers) + priv->prevFingers != hw->numFingers) { /* reset packet counter. */ priv->count_packet_finger = 0; @@ -1775,25 +1750,10 @@ out: return delay; } -static double -estimate_delta_circ(SynapticsPrivate *priv) -{ - double a1 = angle(priv, HIST(3).x, HIST(3).y); - double a2 = angle(priv, HIST(2).x, HIST(2).y); - double a3 = angle(priv, HIST(1).x, HIST(1).y); - double a4 = angle(priv, HIST(0).x, HIST(0).y); - double d1 = diffa(a2, a1); - double d2 = d1 + diffa(a3, a2); - double d3 = d2 + diffa(a4, a3); - return estimate_delta(d3, d2, d1, 0); -} - -/* vert and horiz are to know which direction to start coasting - * circ is true if the user had been circular scrolling. - */ +/* vert and horiz are to know which direction to start coasting */ static void start_coasting(SynapticsPrivate *priv, struct SynapticsHwState *hw, - Bool vert, Bool horiz, Bool circ) + Bool vert, Bool horiz) { SynapticsParameters *para = &priv->synpara; @@ -1802,7 +1762,7 @@ start_coasting(SynapticsPrivate *priv, struct SynapticsHwState *hw, if ((priv->scroll.packets_this_scroll > 3) && (para->coasting_speed > 0.0)) { double pkt_time = HIST_DELTA(0, 3, millis) / 1000.0; - if (vert && !circ) { + if (vert) { double dy = estimate_delta(HIST(0).y, HIST(1).y, HIST(2).y, HIST(3).y); int sdelta = para->scroll_dist_vert; if (pkt_time > 0 && sdelta > 0) { @@ -1813,7 +1773,7 @@ start_coasting(SynapticsPrivate *priv, struct SynapticsHwState *hw, } } } - if (horiz && !circ){ + if (horiz){ double dx = estimate_delta(HIST(0).x, HIST(1).x, HIST(2).x, HIST(3).x); int sdelta = para->scroll_dist_horiz; if (pkt_time > 0 && sdelta > 0) { @@ -1824,23 +1784,6 @@ start_coasting(SynapticsPrivate *priv, struct SynapticsHwState *hw, } } } - if (circ) { - double da = estimate_delta_circ(priv); - double sdelta = para->scroll_dist_circ; - if (pkt_time > 0 && sdelta > 0) { - double scrolls_per_sec = da / pkt_time / sdelta; - if (fabs(scrolls_per_sec) >= para->coasting_speed) { - if (vert) { - priv->scroll.coast_speed_y = scrolls_per_sec; - priv->scroll.coast_delta_y = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y)) / sdelta; - } - else if (horiz) { - priv->scroll.coast_speed_x = scrolls_per_sec; - priv->scroll.coast_delta_x = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y)) / sdelta; - } - } - } - } } priv->scroll.packets_this_scroll = 0; } @@ -1862,7 +1805,6 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, if ((priv->synpara.touchpad_off == 2) || (priv->finger_state == FS_BLOCKED)) { stop_coasting(priv); - priv->circ_scroll_on = FALSE; priv->vert_scroll_edge_on = FALSE; priv->horiz_scroll_edge_on = FALSE; priv->vert_scroll_twofinger_on = FALSE; @@ -1871,75 +1813,47 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, } /* scroll detection */ - if (finger && priv->finger_state == FS_UNTOUCHED) { + if (finger && priv->finger_state == FS_UNTOUCHED) stop_coasting(priv); - if (para->circular_scrolling) { - if ((para->circular_trigger == 0 && edge) || - (para->circular_trigger == 1 && edge & TOP_EDGE) || - (para->circular_trigger == 2 && edge & TOP_EDGE && edge & RIGHT_EDGE) || - (para->circular_trigger == 3 && edge & RIGHT_EDGE) || - (para->circular_trigger == 4 && edge & RIGHT_EDGE && edge & BOTTOM_EDGE) || - (para->circular_trigger == 5 && edge & BOTTOM_EDGE) || - (para->circular_trigger == 6 && edge & BOTTOM_EDGE && edge & LEFT_EDGE) || - (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.last_a = angle(priv, hw->x, hw->y); - DBG(7, "circular scroll detected on edge\n"); - } - } + + if (finger) { + if (hw->numFingers == 2) { + if (!priv->vert_scroll_twofinger_on && + (para->scroll_twofinger_vert) && (para->scroll_dist_vert != 0)) { + priv->vert_scroll_twofinger_on = TRUE; + priv->vert_scroll_edge_on = FALSE; + priv->scroll.last_y = hw->y; + DBG(7, "vert two-finger scroll detected\n"); + } + if (!priv->horiz_scroll_twofinger_on && + (para->scroll_twofinger_horiz) && (para->scroll_dist_horiz != 0)) { + priv->horiz_scroll_twofinger_on = TRUE; + priv->horiz_scroll_edge_on = FALSE; + priv->scroll.last_x = hw->x; + DBG(7, "horiz two-finger scroll detected\n"); + } + } } - if (!priv->circ_scroll_on) { - if (finger) { - if (hw->numFingers == 2) { - if (!priv->vert_scroll_twofinger_on && - (para->scroll_twofinger_vert) && (para->scroll_dist_vert != 0)) { - priv->vert_scroll_twofinger_on = TRUE; - priv->vert_scroll_edge_on = FALSE; - priv->scroll.last_y = hw->y; - DBG(7, "vert two-finger scroll detected\n"); - } - if (!priv->horiz_scroll_twofinger_on && - (para->scroll_twofinger_horiz) && (para->scroll_dist_horiz != 0)) { - priv->horiz_scroll_twofinger_on = TRUE; - priv->horiz_scroll_edge_on = FALSE; - priv->scroll.last_x = hw->x; - DBG(7, "horiz two-finger scroll detected\n"); - } - } - } - if (finger && priv->finger_state == FS_UNTOUCHED) { - if (!priv->vert_scroll_twofinger_on && !priv->horiz_scroll_twofinger_on) { - if ((para->scroll_edge_vert) && (para->scroll_dist_vert != 0) && - (edge & RIGHT_EDGE)) { - priv->vert_scroll_edge_on = TRUE; - priv->scroll.last_y = hw->y; - DBG(7, "vert edge scroll detected on right edge\n"); - } - if ((para->scroll_edge_horiz) && (para->scroll_dist_horiz != 0) && - (edge & BOTTOM_EDGE)) { - priv->horiz_scroll_edge_on = TRUE; - priv->scroll.last_x = hw->x; - DBG(7, "horiz edge scroll detected on bottom edge\n"); - } - } - } + if (finger && priv->finger_state == FS_UNTOUCHED) { + if (!priv->vert_scroll_twofinger_on && !priv->horiz_scroll_twofinger_on) { + if ((para->scroll_edge_vert) && (para->scroll_dist_vert != 0) && + (edge & RIGHT_EDGE)) { + priv->vert_scroll_edge_on = TRUE; + priv->scroll.last_y = hw->y; + DBG(7, "vert edge scroll detected on right edge\n"); + } + if ((para->scroll_edge_horiz) && (para->scroll_dist_horiz != 0) && + (edge & BOTTOM_EDGE)) { + priv->horiz_scroll_edge_on = TRUE; + priv->scroll.last_x = hw->x; + DBG(7, "horiz edge scroll detected on bottom edge\n"); + } + } } { - Bool oldv = priv->vert_scroll_twofinger_on || priv->vert_scroll_edge_on || - (priv->circ_scroll_on && priv->circ_scroll_vert); + Bool oldv = priv->vert_scroll_twofinger_on || priv->vert_scroll_edge_on; - Bool oldh = priv->horiz_scroll_twofinger_on || priv->horiz_scroll_edge_on || - (priv->circ_scroll_on && !priv->circ_scroll_vert); - - Bool oldc = priv->circ_scroll_on; - - if (priv->circ_scroll_on && !finger) { - /* circular scroll locks in until finger is raised */ - DBG(7, "cicular scroll off\n"); - priv->circ_scroll_on = FALSE; - } + Bool oldh = priv->horiz_scroll_twofinger_on || priv->horiz_scroll_edge_on; if (!finger || hw->numFingers != 2) { if (priv->vert_scroll_twofinger_on) { @@ -1963,49 +1877,17 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, /* if we were scrolling, but couldn't corner edge scroll, * and are no longer scrolling, then start coasting */ - oldv = oldv && !(priv->vert_scroll_twofinger_on || priv->vert_scroll_edge_on || - (priv->circ_scroll_on && priv->circ_scroll_vert)); + oldv = oldv && !(priv->vert_scroll_twofinger_on || priv->vert_scroll_edge_on); - oldh = oldh && !(priv->horiz_scroll_twofinger_on || priv->horiz_scroll_edge_on || - (priv->circ_scroll_on && !priv->circ_scroll_vert)); + oldh = oldh && !(priv->horiz_scroll_twofinger_on || priv->horiz_scroll_edge_on); - oldc = oldc && !priv->circ_scroll_on; - - if ((oldv || oldh)) { - start_coasting(priv, hw, oldv, oldh, oldc); - } - } - - /* if hitting a corner (top right or bottom right) while vertical - * scrolling is active, consider starting corner edge scrolling or - * switching over to circular scrolling smoothly */ - if (priv->vert_scroll_edge_on && !priv->horiz_scroll_edge_on && - (edge & RIGHT_EDGE) && (edge & (TOP_EDGE | BOTTOM_EDGE))) { - if (para->circular_scrolling) { - priv->vert_scroll_edge_on = FALSE; - priv->circ_scroll_on = TRUE; - priv->circ_scroll_vert = TRUE; - priv->scroll.last_a = angle(priv, hw->x, hw->y); - DBG(7, "switching to circular scrolling\n"); - } - } - /* Same treatment for horizontal scrolling */ - if (priv->horiz_scroll_edge_on && !priv->vert_scroll_edge_on && - (edge & BOTTOM_EDGE) && (edge & (LEFT_EDGE | RIGHT_EDGE))) { - if (para->circular_scrolling) { - priv->horiz_scroll_edge_on = FALSE; - priv->circ_scroll_on = TRUE; - priv->circ_scroll_vert = FALSE; - priv->scroll.last_a = angle(priv, hw->x, hw->y); - DBG(7, "switching to circular scrolling\n"); - } + if (oldv || oldh) + start_coasting(priv, hw, oldv, oldh); } if (priv->vert_scroll_edge_on || priv->horiz_scroll_edge_on || - priv->vert_scroll_twofinger_on || priv->horiz_scroll_twofinger_on || - priv->circ_scroll_on) { + priv->vert_scroll_twofinger_on || priv->horiz_scroll_twofinger_on) priv->scroll.packets_this_scroll++; - } if (priv->vert_scroll_edge_on || priv->vert_scroll_twofinger_on) { /* + = down, - = up */ @@ -2021,18 +1903,6 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, priv->scroll.last_x = hw->x; } } - if (priv->circ_scroll_on) { - /* + = counter clockwise, - = clockwise */ - double delta = para->scroll_dist_circ; - double diff = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y)); - if (delta >= 0.005 && diff != 0.0) { - if (priv->circ_scroll_vert) - priv->scroll.delta_y += diff / delta * para->scroll_dist_vert; - else - priv->scroll.delta_x += diff / delta * para->scroll_dist_horiz;; - priv->scroll.last_a = angle(priv, hw->x, hw->y); - } - } if (priv->scroll.coast_speed_y) { double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0; diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 7815690..8fed7c8 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -144,9 +144,6 @@ typedef struct _SynapticsParameters Bool locked_drags; /* Enable locked drags */ int locked_drag_time; /* timeout for locked drags */ int tap_action[MAX_TAP]; /* Button to report on tap events */ - Bool circular_scrolling; /* Enable circular scrolling */ - double scroll_dist_circ; /* Scrolling angle radians */ - int circular_trigger; /* Trigger area for circular scrolling */ Bool palm_detect; /* Enable Palm Detection */ int palm_min_width; /* Palm detection width */ int palm_min_z; /* Palm detection depth */ @@ -219,9 +216,6 @@ typedef struct _SynapticsPrivateRec Bool horiz_scroll_edge_on; /* Keeps track of currently active scroll modes */ Bool vert_scroll_twofinger_on; /* Keeps track of currently active scroll modes */ Bool horiz_scroll_twofinger_on; /* Keeps track of currently active scroll modes */ - Bool circ_scroll_on; /* Keeps track of currently active scroll modes */ - 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 lastButtons; /* last state of the buttons */ |