X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fevent.c;h=3aa91c618ffbb14cb667a6434c3ea4b459f55e94;hb=fc5b9a56121e1da230ae77dea0ef91979a4660e3;hp=75cf5d2e6f3471f4ea0e2b59051719285e083568;hpb=e6c82786ff65e7681c980c8adebe082656c16438;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index 75cf5d2e..3aa91c61 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1320,11 +1320,8 @@ static gboolean focus_delay_func(gpointer data) 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 */ } @@ -1376,3 +1373,25 @@ void event_ignore_queued_enters() } 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); +}