diff -urN -x CVS -x '*~' synaptics-0.12.3/README synaptics-0.12.3-c/README --- synaptics-0.12.3/README 2004-01-11 22:22:01.000000000 +1000 +++ synaptics-0.12.3-c/README 2004-01-20 13:47:13.000000000 +1000 @@ -107,6 +107,12 @@ 0=No action, 1=Left Button, 2=Middle Button, 3=Right Button TapButton3 Int Which mouse button is reported on a non-corner three-finger tap 0=No action, 1=Left Button, 2=Middle Button, 3=Right Button +CircularScrolling Bool If on circular scrolling is used (see below) +CircScrollDelta Float Move angle (radians) of finger to generate a scroll event +CircScrollTrigger Int Trigger region on the touchpad to start circular scrolling + 0=All Edges, 1=Top Edge, 2=Top Right Corner, 3=Right Edge, + 4=Bottom Right Corner, 5=Bottom Edge, 6=Bottom Left Corner, + 7=Left Edge, 8=Top Left Corner A tap event happens when the finger is touched and released in a time interval shorter than MaxTapTime, and the touch and release @@ -133,6 +139,14 @@ the same time (no more than EmulateMidButtonTime milliseconds apart) the driver generates a middle mouse button event. +Circular scrolling acts like a scrolling wheel on the trackpad. Scrolling is +engaged when a drag starts in the given CircScrollTrigger region, which can be +all edges, a particular side, or a particular corner. +Once scrolling is engaged, moving your finger in clockwise circles around the +trackpad will generate scroll-down events, and anti-clockwise scroll-up events. +Lifting your finger will disingage circular scrolling. +Use tight circles near the centre of the pad for fast scrolling, and large circle +for better control. FAQ --- Binary files synaptics-0.12.3/ps2comm.o and synaptics-0.12.3-c/ps2comm.o differ diff -urN -x CVS -x '*~' synaptics-0.12.3/synaptics.c synaptics-0.12.3-c/synaptics.c --- synaptics-0.12.3/synaptics.c 2004-01-11 22:22:02.000000000 +1000 +++ synaptics-0.12.3-c/synaptics.c 2004-01-20 13:54:56.000000000 +1000 @@ -1,4 +1,7 @@ /* + * Copyright 2004 Alexei Gilchrist + * patch for circular scrolling + * * Copyright 2003 Jörg Bösner * patch for switching the touchpad off (for example, when a * USB mouse is connected) @@ -334,6 +337,9 @@ priv->synpara->tap_action[F1_TAP] = xf86SetIntOption(local->options, "TapButton1", 1); priv->synpara->tap_action[F2_TAP] = xf86SetIntOption(local->options, "TapButton2", 2); priv->synpara->tap_action[F3_TAP] = xf86SetIntOption(local->options, "TapButton3", 3); + priv->synpara->circular_scrolling = xf86SetBoolOption(local->options, "CircularScrolling", FALSE); + priv->synpara->circular_trigger = xf86SetIntOption(local->options, "CircScrollTrigger", 0); + str_par = xf86FindOptionValue(local->options, "MinSpeed"); if ((!str_par) || (xf86sscanf(str_par, "%lf", &priv->synpara->min_speed) != 1)) @@ -344,6 +350,14 @@ str_par = xf86FindOptionValue(local->options, "AccelFactor"); if ((!str_par) || (xf86sscanf(str_par, "%lf", &priv->synpara->accl) != 1)) priv->synpara->accl=0.0015; + str_par = xf86FindOptionValue(local->options, "CircScrollDelta"); + if ((!str_par) || (xf86sscanf(str_par, "%lf", &priv->synpara->scroll_dist_circ) != 1)) + priv->synpara->scroll_dist_circ=0.1; + + if (priv->synpara->circular_trigger<0 ||priv->synpara->circular_trigger>8){ + xf86Msg(X_WARNING, "Unknown circular scrolling trigger, using 0 (edges)"); + priv->synpara->circular_trigger=0; + } /* Warn about (and fix) incorrectly configured TopEdge/BottomEdge parameters */ if (priv->synpara->top_edge > priv->synpara->bottom_edge) { @@ -569,6 +583,30 @@ return xf86sqrt((dx * dx) + (dy * dy)); } +/* return angle of point relative to centre */ +static float +angle(SynapticsPrivate *priv, int x, int y) +{ + return xf86atan2((float)(x-(priv->synpara->right_edge+priv->synpara->left_edge)/2.0),(float)(y-(priv->synpara->top_edge+priv->synpara->bottom_edge)/2.0)); +} + +/* return angle difference */ +static float +diffa(float a1, float a2) +{ + float da1=0,da2=0; + float pi=3.1415926535897931; + + da1=a2-a1; + if (a2>a1) da2=da1-2*pi; + else da2=da2+2*pi; + + /* pick the shortest way around */ + if (xf86abs(da1)finger_flag) { + 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->scroll_a=angle(priv,hw->x,hw->y); + DBG(7, ErrorF("circular scroll detected on edge\n")); + } + } else { if (edge & RIGHT_EDGE) { priv->vert_scroll_on = TRUE; priv->scroll_y = hw->y; @@ -998,6 +1052,12 @@ priv->scroll_x = hw->x; DBG(7, ErrorF("horiz edge scroll detected on bottom edge\n")); } + } + } + if (priv->circ_scroll_on && ( !finger || priv->palm)) { + /* circular scroll locks in until finger is raised */ + DBG(7, ErrorF("cicular scroll off\n")); + priv->circ_scroll_on = FALSE; } if (priv->vert_scroll_on && (!(edge & RIGHT_EDGE) || !finger || priv->palm)) { DBG(7, ErrorF("vert edge scroll off\n")); @@ -1022,6 +1082,27 @@ priv->scroll_y -= para->scroll_dist_vert; } } + if (priv->circ_scroll_on) { + /* + = clockwise, - = anticlockwise */ + while (diffa(priv->scroll_a,angle(priv,hw->x,hw->y)) > para->scroll_dist_circ) { + scroll_up++; + if (scroll_up>1000)break; /* safety */ + priv->scroll_a += para->scroll_dist_circ; + if (priv->scroll_a>3.14159) + { + priv->scroll_a=priv->scroll_a-2*3.14159; + } + } + while (diffa(priv->scroll_a,angle(priv,hw->x,hw->y)) < -para->scroll_dist_circ) { + scroll_down++; + if (scroll_down>1000)break; /* safety */ + priv->scroll_a -= para->scroll_dist_circ; + if (priv->scroll_a<-3.14159) + { + priv->scroll_a=priv->scroll_a+2*3.14159; + } + } + } scroll_left = 0; scroll_right = 0; if (priv->horiz_scroll_on) { @@ -1037,7 +1118,7 @@ } /* movement */ - if (finger && !priv->vert_scroll_on && !priv->horiz_scroll_on && + if (finger && !priv->vert_scroll_on && !priv->horiz_scroll_on && !priv->circ_scroll_on && !priv->finger_count && !priv->palm) { delay = MIN(delay, 13); if (priv->count_packet_finger > 3) { /* min. 3 packets */ diff -urN -x CVS -x '*~' synaptics-0.12.3/synaptics.h synaptics-0.12.3-c/synaptics.h --- synaptics-0.12.3/synaptics.h 2004-01-11 22:22:02.000000000 +1000 +++ synaptics-0.12.3-c/synaptics.h 2004-01-18 21:20:23.000000000 +1000 @@ -54,6 +54,9 @@ Bool touchpad_off; /* Switches the Touchpad off*/ Bool locked_drags; /* Enable 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 */ } SynapticsSHM; #ifdef SYNAPTICS_PRIVATE @@ -146,6 +149,7 @@ int scroll_y; /* last y-scroll position */ int scroll_x; /* last x-scroll position */ + double scroll_a; /* last angle-scroll position */ unsigned long count_packet_finger; /* packet counter with finger on the touchpad */ unsigned int tapping_millis; /* packet counter for tapping */ unsigned int button_delay_millis; /* button delay for 3rd button emulation */ @@ -156,6 +160,7 @@ Bool tap_left, tap_mid, tap_right; /* tapping buttons */ Bool vert_scroll_on; /* scrolling flag */ Bool horiz_scroll_on; /* scrolling flag */ + Bool circ_scroll_on; /* scrolling flag */ double frac_x, frac_y; /* absoulte -> relative fraction */ enum MidButtonEmulation mid_emu_state; /* emulated 3rd button */ int repeatButtons; /* buttons for repeat */ Binary files synaptics-0.12.3/synaptics.o and synaptics-0.12.3-c/synaptics.o differ Binary files synaptics-0.12.3/synaptics_drv.o and synaptics-0.12.3-c/synaptics_drv.o differ Binary files synaptics-0.12.3/synclient and synaptics-0.12.3-c/synclient differ diff -urN -x CVS -x '*~' synaptics-0.12.3/synclient.c synaptics-0.12.3-c/synclient.c --- synaptics-0.12.3/synclient.c 2004-01-11 22:22:02.000000000 +1000 +++ synaptics-0.12.3-c/synclient.c 2004-01-18 21:26:41.000000000 +1000 @@ -70,6 +70,9 @@ DEFINE_PAR("TapButton1", tap_action[F1_TAP], PT_INT, 0, 3), DEFINE_PAR("TapButton2", tap_action[F2_TAP], PT_INT, 0, 3), DEFINE_PAR("TapButton3", tap_action[F3_TAP], PT_INT, 0, 3), + DEFINE_PAR("CircularScrolling", circular_scrolling, PT_BOOL, 0, 1), + DEFINE_PAR("CircScrollDelta", scroll_dist_circ, PT_DOUBLE, 0, 3), + DEFINE_PAR("CircScrollTrigger", circular_trigger, PT_INT, 0, 8), { 0, 0, 0, 0, 0 } };