[PATCH 5/5] dix: loop until the delta is below incr
Peter Hutterer
peter.hutterer at who-t.net
Thu Sep 8 21:19:29 PDT 2011
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 at who-t.net>
---
dix/getevents.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/dix/getevents.c b/dix/getevents.c
index fd7b31f..dfb314d 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 ? 4 : 6;
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 */
--
1.7.6
More information about the xorg-devel
mailing list