summaryrefslogtreecommitdiff
path: root/synaptics.c
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2003-07-03 22:49:59 +0200
committerPeter Osterlund <petero2@telia.com>2006-04-09 04:00:59 +0200
commit816506d8adb1193ddfafe3717993b57d420489d0 (patch)
treed336af899c16b5e519be94786c751ca69dfbeab5 /synaptics.c
parentf6498a659fbf4be5aee1b65f37f5b6d01bd45bfd (diff)
Workaround for X server bug in the TimerSet() function.
Diffstat (limited to 'synaptics.c')
-rw-r--r--synaptics.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/synaptics.c b/synaptics.c
index 1434db9..9513a03 100644
--- a/synaptics.c
+++ b/synaptics.c
@@ -82,7 +82,7 @@ typedef enum {
#define MIN(a, b) (((a)<(b))?(a):(b))
#define TIME_DIFF(a, b) ((long)((a)-(b)))
-#define VERSION "0.11.3p3"
+#define VERSION "0.11.3p4"
/*****************************************************************************
* Forward declaration
@@ -512,17 +512,27 @@ timerFunc(OsTimerPtr timer, CARD32 now, pointer arg)
SynapticsPrivatePtr priv = (SynapticsPrivatePtr) (local->private);
struct SynapticsHwState hw;
int delay;
- int sigstate;
+ int sigstate;
+ CARD32 wakeUpTime;
sigstate = xf86BlockSIGIO ();
hw = priv->hwState;
- hw.millis = GetTimeInMillis();
+ hw.millis = now;
delay = HandleState(local, &hw);
xf86UnblockSIGIO (sigstate);
- priv->timer = TimerSet(priv->timer, 0, delay, timerFunc, local);
+ /*
+ * Workaround for wraparound bug in the TimerSet function. This bug is already
+ * fixed in CVS, but this driver needs to work with XFree86 versions 4.2.x and
+ * 4.3.x too.
+ */
+ wakeUpTime = now + delay;
+ if (wakeUpTime <= now)
+ wakeUpTime = 0xffffffffL;
+
+ priv->timer = TimerSet(priv->timer, TimerAbsolute, wakeUpTime, timerFunc, local);
return 0;
}
@@ -583,7 +593,7 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw)
int scroll_up, scroll_down, scroll_left, scroll_right;
int double_click;
Bool done;
- int delay = 3600000;
+ int delay = 1000000000;
long timeleft;
mid = FALSE;