diff -Nurp xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/include/synaptics-properties.h xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/include/synaptics-properties.h --- xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/include/synaptics-properties.h 2009-06-28 03:04:33.000000000 +0200 +++ xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/include/synaptics-properties.h 2009-07-06 12:29:13.000000000 +0200 @@ -149,4 +149,7 @@ * has_double, has_triple */ #define SYNAPTICS_PROP_CAPABILITIES "Synaptics Capabilities" +/* 32 bit, 4 values, left, right, top, bottom */ +#define SYNAPTICS_PROP_AREA "Synaptics Area" + #endif /* _SYNAPTICS_PROPERTIES_H_ */ diff -Nurp xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/man/synaptics.man xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/man/synaptics.man --- xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/man/synaptics.man 2009-06-28 03:04:33.000000000 +0200 +++ xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/man/synaptics.man 2009-07-15 13:10:36.000000000 +0200 @@ -431,6 +431,34 @@ touching again and moving the finger on The gesture is enabled by default and can be disabled by setting the TapAndDragGesture option to false. Property: "Synaptics Gestures" . +.TP +.BI "Option \*qAreaLeftEdge\*q \*q" boolean \*q +Ignore movements, scrolling and tapping which take place left of this edge. +. +The option is disabled by default and can be enabled by setting the +AreaLeftEdge option to any integer value other than zero. Property: "Synaptics Area" +. +.TP +.BI "Option \*qAreaRightEdge\*q \*q" boolean \*q +Ignore movements, scrolling and tapping which take place right of this edge. +. +The option is disabled by default and can be enabled by setting the +AreaRightEdge option to any integer value other than zero. Property: "Synaptics Area" +. +.TP +.BI "Option \*qAreaTopEdge\*q \*q" boolean \*q +Ignore movements, scrolling and tapping which take place above this edge. +. +The option is disabled by default and can be enabled by setting the +AreaTopEdge option to any integer value other than zero. Property: "Synaptics Area" +. +.TP +.BI "Option \*qAreaBottomEdge\*q \*q" boolean \*q +Ignore movements, scrolling and tapping which take place below this edge. +. +The option is disabled by default and can be enabled by setting the +AreaBottomEdge option to any integer value other than zero. Property: "Synaptics Area" +. .LP The LeftEdge, RightEdge, TopEdge and BottomEdge parameters are used to define the edge and corner areas of the touchpad. @@ -810,6 +838,15 @@ FLOAT, 2 values, min, max. 8 bit (BOOL), 1 value, tap-and-drag. .TP 7 +.BI "Synaptics Area" +The AreaLeftEdge, AreaRightEdge, AreaTopEdge and AreaBottomEdge parameters are used to +define the edges of the active area of the touchpad. All movements, scrolling and tapping +which take place outside of this area will be ignored. This property is disabled by +default. + +32 bit, 4 values, left, right, top, bottom. 0 disables an element. + +.TP 7 .BI "Synaptics Capabilities" This read-only property expresses the physical capability of the touchpad, most notably whether the touchpad hardware supports multi-finger tapping and diff -Nurp xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/src/properties.c xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/src/properties.c --- xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/src/properties.c 2009-06-28 03:04:33.000000000 +0200 +++ xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/src/properties.c 2009-07-15 11:17:52.000000000 +0200 @@ -82,6 +82,7 @@ Atom prop_pressuremotion_factor = 0; Atom prop_grab = 0; Atom prop_gestures = 0; Atom prop_capabilities = 0; +Atom prop_area = 0; static Atom InitAtom(DeviceIntPtr dev, char *name, int format, int nvalues, int *values) @@ -262,6 +263,12 @@ InitDeviceProperties(LocalDevicePtr loca values[3] = priv->has_double; values[4] = priv->has_triple; prop_capabilities = InitAtom(local->dev, SYNAPTICS_PROP_CAPABILITIES, 8, 5, values); + + values[0] = para->area_left_edge; + values[1] = para->area_right_edge; + values[2] = para->area_top_edge; + values[3] = para->area_bottom_edge; + prop_area = InitAtom(local->dev, SYNAPTICS_PROP_AREA, 32, 4, values); } int @@ -612,6 +619,21 @@ SetProperty(DeviceIntPtr dev, Atom prope { /* read-only */ return BadValue; + } else if (property == prop_area) + { + INT32 *area; + if (prop->size != 4 || prop->format != 32 || prop->type != XA_INTEGER) + return BadMatch; + + area = (INT32*)prop->data; + if ((((area[0] != 0) && (area[1] != 0)) && (area[0] > area[1]) ) || (((area[2] != 0) && (area[3] != 0)) && (area[2] > area[3]))) + return BadValue; + + para->area_left_edge = area[0]; + para->area_right_edge = area[1]; + para->area_top_edge = area[2]; + para->area_bottom_edge = area[3]; + } return Success; diff -Nurp xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/src/synaptics.c xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/src/synaptics.c --- xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/src/synaptics.c 2009-06-28 03:06:17.000000000 +0200 +++ xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/src/synaptics.c 2009-07-15 11:22:18.000000000 +0200 @@ -442,6 +442,11 @@ static void set_default_parameters(Local pars->top_edge = xf86SetIntOption(opts, "TopEdge", t); pars->bottom_edge = xf86SetIntOption(opts, "BottomEdge", b); + pars->area_top_edge = xf86SetIntOption(opts, "AreaTopEdge", 0); + pars->area_bottom_edge = xf86SetIntOption(opts, "AreaBottomEdge", 0); + pars->area_left_edge = xf86SetIntOption(opts, "AreaLeftEdge", 0); + pars->area_right_edge = xf86SetIntOption(opts, "AreaRightEdge", 0); + pars->finger_low = xf86SetIntOption(opts, "FingerLow", fingerLow); pars->finger_high = xf86SetIntOption(opts, "FingerHigh", fingerHigh); pars->finger_press = xf86SetIntOption(opts, "FingerPress", fingerPress); @@ -1026,6 +1031,29 @@ edge_detection(SynapticsPrivate *priv, i return edge; } +/* Checks whether coordinates are in the Synaptics Area + * or not. If no Synaptics Area is defined (i.e. if + * priv->{min|max}{x|y} are the edges of the area), the + * function returns TRUE. + */ +static Bool +is_inside_active_area(SynapticsPrivate *priv, int x, int y) +{ + Bool inside_area = TRUE; + + if ((priv->synpara.area_left_edge != 0) && (x < priv->synpara.area_left_edge)) + inside_area = FALSE; + else if ((priv->synpara.area_right_edge != 0) && (x > priv->synpara.area_right_edge)) + inside_area = FALSE; + + if ((priv->synpara.area_top_edge != 0) && (y < priv->synpara.area_top_edge)) + inside_area = FALSE; + else if ((priv->synpara.area_bottom_edge != 0) && (y > priv->synpara.area_bottom_edge)) + inside_area = FALSE; + + return inside_area; +} + static CARD32 timerFunc(OsTimerPtr timer, CARD32 now, pointer arg) { @@ -1364,7 +1392,7 @@ GetTimeOut(SynapticsPrivate *priv) static int HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw, - edge_type edge, enum FingerState finger) + edge_type edge, enum FingerState finger, Bool inside_active_area) { SynapticsParameters *para = &priv->synpara; Bool touch, release, is_timeout, move; @@ -1415,6 +1443,10 @@ HandleTapProcessing(SynapticsPrivate *pr goto restart; } else if (release) { SelectTapButton(priv, edge); + /* Disable taps outside of the active area */ + if (!inside_active_area) { + priv->tap_button = 0; + } SetTapState(priv, TS_2A, hw->millis); } break; @@ -2029,6 +2061,7 @@ HandleState(LocalDevicePtr local, struct int delay = 1000000000; int timeleft; int i; + Bool inside_active_area; /* update hardware state in shared memory */ if (shm) @@ -2125,11 +2158,12 @@ HandleState(LocalDevicePtr local, struct } edge = edge_detection(priv, hw->x, hw->y); + inside_active_area = is_inside_active_area(priv, hw->x, hw->y); finger = SynapticsDetectFinger(priv, hw); /* tap and drag detection */ - timeleft = HandleTapProcessing(priv, hw, edge, finger); + timeleft = HandleTapProcessing(priv, hw, edge, finger, inside_active_area); if (timeleft > 0) delay = MIN(delay, timeleft); @@ -2165,6 +2199,13 @@ HandleState(LocalDevicePtr local, struct } /* Post events */ + + /* Process movements only if coordinates are + * in the Synaptics Area + */ + if (!inside_active_area) + dx = dy = 0; + if (dx || dy) xf86PostMotionEvent(local->dev, 0, 0, 2, dx, dy); @@ -2187,6 +2228,10 @@ HandleState(LocalDevicePtr local, struct xf86PostButtonEvent(local->dev, FALSE, id, (buttons & (1 << (id - 1))), 0, 0); } + /* Process scroll events only if coordinates are + * in the Synaptics Area + */ + if (inside_active_area) { while (scroll.up-- > 0) { xf86PostButtonEvent(local->dev, FALSE, 4, !hw->up, 0, 0); xf86PostButtonEvent(local->dev, FALSE, 4, hw->up, 0, 0); @@ -2203,6 +2248,8 @@ HandleState(LocalDevicePtr local, struct xf86PostButtonEvent(local->dev, FALSE, 7, TRUE, 0, 0); xf86PostButtonEvent(local->dev, FALSE, 7, FALSE, 0, 0); } + } + if (double_click) { int i; for (i = 0; i < 2; i++) { diff -Nurp xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/src/synapticsstr.h xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/src/synapticsstr.h --- xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/src/synapticsstr.h 2009-06-28 03:04:33.000000000 +0200 +++ xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/src/synapticsstr.h 2009-07-08 11:15:36.000000000 +0200 @@ -147,6 +147,7 @@ typedef struct _SynapticsParameters double press_motion_max_factor; /* factor applied on speed when finger pressure is at minimum */ Bool grab_event_device; /* grab event device for exclusive use? */ Bool tap_and_drag_gesture; /* Switches the tap-and-drag gesture on/off */ + int area_left_edge, area_right_edge, area_top_edge, area_bottom_edge; /* area coordinates absolute */ } SynapticsParameters; diff -Nurp xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/tools/synclient.c xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/tools/synclient.c --- xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1.orig/tools/synclient.c 2009-06-28 03:04:33.000000000 +0200 +++ xserver-xorg-input-synaptics-1.1.99+git20090627.bb74e1a1/tools/synclient.c 2009-07-07 11:19:42.000000000 +0200 @@ -139,6 +139,10 @@ static struct Parameter params[] = { {"PressureMotionMaxFactor", PT_DOUBLE, 0, 10.0,SYNAPTICS_PROP_PRESSURE_MOTION_FACTOR, 0 /*float*/, 1}, {"GrabEventDevice", PT_BOOL, 0, 1, SYNAPTICS_PROP_GRAB, 8, 0}, {"TapAndDragGesture", PT_BOOL, 0, 1, SYNAPTICS_PROP_GESTURES, 8, 0}, + {"AreaLeftEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_AREA, 32, 0}, + {"AreaRightEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_AREA, 32, 1}, + {"AreaTopEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_AREA, 32, 2}, + {"AreaBottomEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_AREA, 32, 3}, { NULL, 0, 0, 0, 0 } };