X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fevent.c;h=7dfcc0c70d91e527f1a979aae83600bd4da4561c;hb=7a1a6da8495bb56bb938bacd58a4d52bf08a2974;hp=15724968844289e85c554903cd48e276c0998ebe;hpb=339d76704400a6ea514817d91a2e935a13ecc928;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index 15724968..7dfcc0c7 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -560,9 +560,11 @@ static void event_handle_root(XEvent *e) msgtype = e->xclient.message_type; if (msgtype == prop_atoms.net_current_desktop) { guint d = e->xclient.data.l[0]; - event_curtime = e->xclient.data.l[1]; - if (d < screen_num_desktops) + if (d < screen_num_desktops) { + event_curtime = e->xclient.data.l[1]; + ob_debug("SWITCH DESKTOP TIME: %d\n", event_curtime); screen_set_desktop(d); + } } else if (msgtype == prop_atoms.net_number_of_desktops) { guint d = e->xclient.data.l[0]; if (d > 0) @@ -1320,11 +1322,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 */ } @@ -1386,5 +1385,15 @@ gboolean event_time_after(Time t1, Time t2) later in time than T. - http://tronche.com/gui/x/xlib/input/pointer-grabbing.html */ - return t1 >= t2 && t1 <= t2 + (1 << (sizeof(Time)*8-1)); + + /* 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); }