ObClient *c = data;
if (focus_client != c) {
- if (client_validate(c)) {
- client_focus(c);
- if (config_focus_raise)
- client_raise(c);
- }
+ if (client_focus(c) && config_focus_raise)
+ client_raise(c);
}
return FALSE; /* no repeat */
}
}
g_slist_free(saved);
}
+
+gboolean event_time_after(Time t1, Time t2)
+{
+ /*
+ Timestamp values wrap around (after about 49.7 days). The server, given
+ its current time is represented by timestamp T, always interprets
+ timestamps from clients by treating half of the timestamp space as being
+ later in time than T.
+ - 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))
+
+ if (t2 >= TIME_HALF)
+ /* t2 is in the second half so t1 might wrap around and be smaller than
+ t2 */
+ return t1 >= t2 || t1 < (t2 + TIME_HALF);
+ else
+ /* t2 is in the first half so t1 has to come after it */
+ return t1 >= t2 && t1 < (t2 + TIME_HALF);
+}