[PATCH 2/2] xibarriers: Reset dt on barrier leave

Jasper St. Pierre jstpierre at mecheye.net
Sun Mar 3 01:50:56 PST 2013


From: "Jasper St. Pierre" <jstpierre at mecheye.net>

If we do this, then we could get a nonsensically giant or even
overflowing delta timestamp, which is bad.
---
 Xi/xibarriers.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
index a225cbc..9cc8364 100644
--- a/Xi/xibarriers.c
+++ b/Xi/xibarriers.c
@@ -466,7 +466,11 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
         ev.event_id = pbd->barrier_event_id;
         ev.barrierid = c->id;
 
-        ev.dt = ms - pbd->last_timestamp;
+        if (pbd->last_timestamp > 0)
+            ev.dt = ms - pbd->last_timestamp;
+        else
+            ev.dt = 0;
+
         ev.window = c->window;
         pbd->last_timestamp = ms;
 
@@ -502,7 +506,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
 
         ev.dt = ms - pbd->last_timestamp;
         ev.window = c->window;
-        pbd->last_timestamp = ms;
+        pbd->last_timestamp = 0;
 
         /* root x/y is filled in later */
 
-- 
1.8.1.4



More information about the xorg-devel mailing list