The code assumed the timestamps had the same domain as the type Xlib
uses for them, which is almost never the case with Xlib. Change all
involved variables to guint32.
XSync(ob_display, FALSE);
}
XSync(ob_display, FALSE);
}
-gboolean event_time_after(Time t1, Time t2)
+gboolean event_time_after(guint32 t1, guint32 t2)
{
g_assert(t1 != CurrentTime);
g_assert(t2 != CurrentTime);
{
g_assert(t1 != CurrentTime);
g_assert(t2 != CurrentTime);
- http://tronche.com/gui/x/xlib/input/pointer-grabbing.html
*/
- http://tronche.com/gui/x/xlib/input/pointer-grabbing.html
*/
- /* TIME_HALF is half of the number space of a Time type variable */
-#define TIME_HALF (Time)(1 << (sizeof(Time)*8-1))
+ /* TIME_HALF is not half of the number space of a Time type variable.
+ * Rather, it is half the number space of a timestamp value, which is
+ * always 32 bits. */
+#define TIME_HALF (guint32)(1 << 31)
if (t2 >= TIME_HALF)
/* t2 is in the second half so t1 might wrap around and be smaller than
if (t2 >= TIME_HALF)
/* t2 is in the second half so t1 might wrap around and be smaller than
/*! Compare t1 and t2, taking into account wraparound. True if t1
comes at the same time or later than t2. */
/*! Compare t1 and t2, taking into account wraparound. True if t1
comes at the same time or later than t2. */
-gboolean event_time_after(Time t1, Time t2);
+gboolean event_time_after(guint32 t1, guint32 t2);
Time event_get_server_time();
Time event_get_server_time();