Handle touchpads with a scroll region on the right side

where very large X coordinates (typically 8176=0x1ff0) are reported.
This commit is contained in:
Peter Osterlund
2004-01-13 00:38:25 +01:00
parent c86668de26
commit a593f31943
2 changed files with 17 additions and 0 deletions

View File

@@ -90,6 +90,8 @@
#define YMIN_NOMINAL 1408
#define YMAX_NOMINAL 4448
#define XMAX_VALID 6143
#define MAX_UNSYNC_PACKETS 10 /* i.e. 10 to 60 bytes */
typedef enum {
@@ -354,6 +356,8 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
local->name);
}
priv->largest_valid_x = MIN(priv->synpara->right_edge, XMAX_NOMINAL);
priv->buffer = XisbNew(local->fd, 200);
DBG(9, XisbTrace(priv->buffer, 1));
@@ -858,6 +862,18 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw)
hw->up = hw->down = FALSE;
}
/*
* Some touchpads have a scroll wheel region where a very large X
* coordinate is reported. For such touchpads, we adjust the X
* coordinate to eliminate the discontinuity.
*/
if (hw->x <= XMAX_VALID) {
if (priv->largest_valid_x < hw->x)
priv->largest_valid_x = hw->x;
} else {
hw->x = priv->largest_valid_x;
}
edge = edge_detection(priv, hw->x, hw->y);
finger = SynapticsDetectFinger(priv, hw);

View File

@@ -144,6 +144,7 @@ typedef struct _SynapticsPrivateRec
SynapticsTapRec touch_on; /* data when the touchpad is touched */
SynapticsMoveHistRec move_hist[SYNAPTICS_MOVE_HISTORY]; /* movement history */
int largest_valid_x; /* Largest valid X coordinate seen so far */
int scroll_y; /* last y-scroll position */
int scroll_x; /* last x-scroll position */
unsigned long count_packet_finger; /* packet counter with finger on the touchpad */