if (win == RootWindow(ob_display, ob_screen)) {
/* This means focus reverted off of a client */
- if (detail == NotifyPointerRoot || detail == NotifyDetailNone)
+ if (detail == NotifyPointerRoot || detail == NotifyDetailNone ||
+ detail == NotifyInferior)
return TRUE;
else
return FALSE;
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)
} else if (ce.xfocus.detail == NotifyInferior) {
ob_debug("Focus went to parent\n");
/* Focus has been reverted to parent, which is our frame window,
- so fall back to something other than the window which had it. */
+ or the root window, so fall back to something other than the
+ window which had it. */
focus_fallback(FALSE);
} else {
/* Focus did move, so process the FocusIn event */
}
break;
case UnmapNotify:
- ob_debug("UnmapNotify for window 0x%x\n", client->window);
+ ob_debug("UnmapNotify for window 0x%x eventwin 0x%x sendevent %d "
+ "ignores left %d\n",
+ client->window, e->xunmap.event, e->xunmap.from_configure,
+ client->ignore_unmaps);
if (client->ignore_unmaps) {
client->ignore_unmaps--;
break;
X server to deal with after we unmanage the window */
XPutBackEvent(ob_display, e);
+ ob_debug("ReparentNotify for window 0x%x\n", client->window);
client_unmanage(client);
break;
case MapRequest:
case MotionNotify:
if ((f = menu_frame_under(ev->xmotion.x_root,
ev->xmotion.y_root))) {
- menu_frame_move_on_screen(f);
if ((e = menu_entry_frame_under(ev->xmotion.x_root,
- ev->xmotion.y_root)))
+ ev->xmotion.y_root))) {
+ /* XXX menu_frame_entry_move_on_screen(f); */
menu_frame_select(f, e);
+ }
}
{
ObMenuFrame *a;
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);
+}