static gboolean event_ignore(XEvent *e, ObClient *client)
{
switch(e->type) {
+ case EnterNotify:
+ case LeaveNotify:
+ if (e->xcrossing.detail == NotifyInferior)
+ return TRUE;
+ break;
case FocusIn:
/* NotifyAncestor is not ignored in FocusIn like it is in FocusOut
because of RevertToPointerRoot. If the focus ends up reverting to
config_focus_delay,
focus_delay_func,
client, NULL);
- } else {
- client_focus(client);
- if (config_focus_raise)
- stacking_raise(CLIENT_AS_WINDOW(client));
- }
+ } else
+ focus_delay_func(client);
}
}
if (client != focus_client) {
focus_set_client(client);
frame_adjust_focus(client->frame, TRUE);
+ client_calc_layer(client);
}
break;
case FocusOut:
#ifdef DEBUG_FOCUS
ob_debug("FocusOut on client for %lx\n", client->window);
#endif
- /* are we a fullscreen window or a transient of one? (checks layer)
- if we are then we need to be iconified since we are losing focus
- */
- if (client->layer == OB_STACKING_LAYER_FULLSCREEN && !client->iconic &&
- !client_search_focus_tree_full(client))
- /* iconify fullscreen windows when they and their transients
- aren't focused */
- client_iconify(client, TRUE, TRUE);
frame_adjust_focus(client->frame, FALSE);
- break;
+ client_calc_layer(client);
+ break;
case LeaveNotify:
con = frame_context(client, e->xcrossing.window);
switch (con) {
frame_adjust_state(client->frame);
break;
case OB_FRAME_CONTEXT_FRAME:
+ /*
+ if (config_focus_follow && config_focus_delay)
+ ob_main_loop_timeout_remove_data(ob_main_loop,
+ focus_delay_func,
+ client);
+ */
break;
default:
break;
break;
case OB_FRAME_CONTEXT_FRAME:
if (e->xcrossing.mode == NotifyGrab ||
- e->xcrossing.detail == NotifyInferior ||
e->xcrossing.mode == NotifyUngrab)
{
#ifdef DEBUG_FOCUS
switch (e->xconfigurerequest.detail) {
case Below:
case BottomIf:
- stacking_lower(CLIENT_AS_WINDOW(client));
- break;
+ action_run_string("Lower", client);
+ break;
case Above:
case TopIf:
default:
- stacking_raise(CLIENT_AS_WINDOW(client));
- break;
+ action_run_string("Raise", client);
+ break;
}
}
break;
ob_main_loop_timeout_remove_data(ob_main_loop, focus_delay_func, c);
}
-void event_ignore_enter_focus(guint num)
+void event_ignore_queued_enters()
{
- ignore_enter_focus += num;
+ GSList *saved = NULL, *it;
+ XEvent *e;
+
+ XSync(ob_display, FALSE);
+
+ /* count the events */
+ while (TRUE) {
+ e = g_new(XEvent, 1);
+ if (XCheckTypedEvent(ob_display, EnterNotify, e)) {
+ saved = g_slist_append(saved, e);
+ ++ignore_enter_focus;
+ } else {
+ g_free(e);
+ break;
+ }
+ }
+ /* put the events back */
+ for (it = saved; it; it = g_slist_next(it)) {
+ XPutBackEvent(ob_display, it->data);
+ g_free(it->data);
+ }
+ g_slist_free(saved);
}