diff options
-rw-r--r-- | synaptics.c | 44 | ||||
-rw-r--r-- | synaptics.h | 3 |
2 files changed, 41 insertions, 6 deletions
diff --git a/synaptics.c b/synaptics.c index 4bf846f..d98f7c0 100644 --- a/synaptics.c +++ b/synaptics.c @@ -196,6 +196,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) priv->synpara->tap_time = xf86SetIntOption(local->options, "MaxTapTime", 20); priv->synpara->tap_move = xf86SetIntOption(local->options, "MaxTapMove", 220); priv->synpara->scroll_dist_vert = xf86SetIntOption(local->options, "VertScrollDelta", 100); + priv->synpara->scroll_dist_horiz = xf86SetIntOption(local->options, "HorizScrollDelta", 100); priv->synpara->edge_motion_speed = xf86SetIntOption(local->options, "EdgeMotionSpeed", 40); priv->synpara->repeater = xf86SetStrOption(local->options, "Repeater", NULL); s = xf86FindOptionValue(local->options, "MinSpeed"); @@ -370,14 +371,14 @@ static Bool DeviceInit(DeviceIntPtr dev) { LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; - unsigned char map[] = {0, 1, 2, 3, 4, 5}; + unsigned char map[] = {0, 1, 2, 3, 4, 5, 6, 7}; ErrorF("Synaptics DeviceInit called\n"); dev->public.on = FALSE; InitPointerDeviceStruct((DevicePtr)dev, map, - 5, + 7, miPointerGetMotionEvents, SynapticsCtrl, miPointerGetMotionBufferSize()); @@ -464,7 +465,7 @@ ReadInput(LocalDevicePtr local) Bool left, mid, right, up, down; double speed, integral; int change; - int scroll_up, scroll_down; + int scroll_up, scroll_down, scroll_left, scroll_right; /* * set blocking to -1 on the first call because we know there is data to @@ -681,13 +682,22 @@ ReadInput(LocalDevicePtr local) if(edge & RIGHT_EDGE) { priv->vert_scroll_on = TRUE; priv->scroll_y = y; - DBG(7, ErrorF("edge scroll detected on right edge\n")); + DBG(7, ErrorF("vert edge scroll detected on right edge\n")); + } + if(edge & BOTTOM_EDGE) { + priv->horiz_scroll_on = TRUE; + priv->scroll_x = x; + DBG(7, ErrorF("horiz edge scroll detected on bottom edge\n")); } } if(priv->vert_scroll_on && (!(edge & RIGHT_EDGE) || !finger || priv->palm)) { - DBG(7, ErrorF("edge scroll off\n")); + DBG(7, ErrorF("vert edge scroll off\n")); priv->vert_scroll_on = FALSE; } + if(priv->horiz_scroll_on && (!(edge & BOTTOM_EDGE) || !finger || priv->palm)) { + DBG(7, ErrorF("horiz edge scroll off\n")); + priv->horiz_scroll_on = FALSE; + } /* scroll processing */ scroll_up = 0; @@ -703,9 +713,23 @@ ReadInput(LocalDevicePtr local) priv->scroll_y -= para->scroll_dist_vert; } } + scroll_left = 0; + scroll_right = 0; + if(priv->horiz_scroll_on) { + /* + = right, - = left */ + while(x - priv->scroll_x > para->scroll_dist_horiz) { + scroll_right++; + priv->scroll_x += para->scroll_dist_horiz; + } + while(x - priv->scroll_x < -para->scroll_dist_horiz) { + scroll_left++; + priv->scroll_x -= para->scroll_dist_horiz; + } + } /* movement */ - if(finger && !priv->vert_scroll_on && !priv->finger_count && !priv->palm) { + if(finger && !priv->vert_scroll_on && !priv->horiz_scroll_on && + !priv->finger_count && !priv->palm) { if(priv->count_packet_finger > 3) { /* min. 3 packets */ dy = (1 * (((priv->move_hist[MOVE_HIST(1)].y + priv->move_hist[MOVE_HIST(2)].y) / 2) - @@ -796,6 +820,14 @@ ReadInput(LocalDevicePtr local) xf86PostButtonEvent(local->dev, FALSE, 5, !down, 0, 0); xf86PostButtonEvent(local->dev, FALSE, 5, down, 0, 0); } + while(scroll_left-- > 0) { + xf86PostButtonEvent(local->dev, FALSE, 6, TRUE, 0, 0); + xf86PostButtonEvent(local->dev, FALSE, 6, FALSE, 0, 0); + } + while(scroll_right-- > 0) { + xf86PostButtonEvent(local->dev, FALSE, 7, TRUE, 0, 0); + xf86PostButtonEvent(local->dev, FALSE, 7, FALSE, 0, 0); + } } } diff --git a/synaptics.h b/synaptics.h index d8d2f96..f4ba388 100644 --- a/synaptics.h +++ b/synaptics.h @@ -34,6 +34,7 @@ typedef struct _SynapticsSHM { int finger_low, finger_high; /* finger detection values in Z-values */ int tap_time, tap_move; /* max. tapping-time and movement in packets and coord. */ int scroll_dist_vert; /* Scrolling distance in absolute coordinates */ + int scroll_dist_horiz; /* Scrolling distance in absolute coordinates */ double min_speed, max_speed, accl; /* movement parameters */ int edge_motion_speed; /* Edge motion speed when dragging */ char* repeater; /* Repeater on or off */ @@ -61,6 +62,7 @@ typedef struct _SynapticsPrivateRec SynapticsMoveHistRec move_hist[SYNAPTICS_MOVE_HISTORY]; /* movement history */ int scroll_y; /* last y-scroll position */ + int scroll_x; /* last x-scroll position */ unsigned int count_packet_finger; /* packet counter with finger on the touchpad */ unsigned int count_packet; /* packet counter */ unsigned int count_packet_tapping; /* packet counter for tapping */ @@ -69,6 +71,7 @@ typedef struct _SynapticsPrivateRec Bool tap, drag, doubletap; /* feature flags */ Bool tap_left, tap_mid, tap_right; /* tapping buttons */ Bool vert_scroll_on; /* scrolling flag */ + Bool horiz_scroll_on; /* scrolling flag */ double frac_x, frac_y; /* absoulte -> relative fraction */ Bool third_button; /* emulated 3rd button */ OsTimerPtr repeat_timer; /* for up/down-button repeat */ |