summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-08-24 11:19:46 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-09-22 17:10:29 +1000
commit7dd4941f1d3f3bc488a001175c8718f9564e258c (patch)
tree999fb1687812069e8de52b1cc1896b250a66c4b4
parent02dc1621d9343b178a5e7b4596995315f08cdff0 (diff)
dix: loop until the delta is below incr
Otherwise, a delta that exceeds the number of events possible will leave last.scroll in a state we may not be able to recover from (the delta will never go back to normal). Instead, keep looping until we're done but only generate events while we can. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--dix/getevents.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 0bdcb34f7..1f55e6a49 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1225,11 +1225,6 @@ emulate_scroll_button_events(InternalEvent *events,
int b = ax->scroll.type == SCROLL_TYPE_VERTICAL ? 5 : 7;
int nev_tmp;
- /* fill_pointer_events() generates four events: one normal and one raw
- * event each for the emulated button press and release both. */
- if (num_events + 4 >= max_events)
- break;
-
if (delta <= -incr)
delta += incr;
else if (delta >= incr) {
@@ -1237,14 +1232,19 @@ emulate_scroll_button_events(InternalEvent *events,
b--;
}
- nev_tmp = fill_pointer_events(events, dev, ButtonPress, b, ms,
- POINTER_EMULATED, NULL);
- events += nev_tmp;
- num_events += nev_tmp;
- nev_tmp = fill_pointer_events(events, dev, ButtonRelease, b, ms,
- POINTER_EMULATED, NULL);
- events += nev_tmp;
- num_events += nev_tmp;
+ /* fill_pointer_events() generates four events: one normal and one raw
+ * event each for the emulated button press and release both. */
+ if (num_events + 4 < max_events)
+ {
+ nev_tmp = fill_pointer_events(events, dev, ButtonPress, b, ms,
+ POINTER_EMULATED, NULL);
+ events += nev_tmp;
+ num_events += nev_tmp;
+ nev_tmp = fill_pointer_events(events, dev, ButtonRelease, b, ms,
+ POINTER_EMULATED, NULL);
+ events += nev_tmp;
+ num_events += nev_tmp;
+ }
}
/* We emulated, update last.scroll */