X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fevent.c;h=a1a09c301e67a31b418c22295606e00f6141dbe5;hb=9f03493b0c3d2815625bbcc51ac4da5b72450b69;hp=9d141c5ab4ca27ccf5a9542fc29c031d95768d9f;hpb=d9e08487dffd010f4434d24b98a3a571b2e5a600;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index 9d141c5a..a1a09c30 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -303,6 +303,11 @@ static void event_hack_mods(XEvent *e) 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 @@ -612,11 +617,8 @@ void event_enter_client(ObClient *client) 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); } } @@ -712,6 +714,12 @@ static void event_handle_client(ObClient *client, XEvent *e) 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; @@ -750,7 +758,6 @@ static void event_handle_client(ObClient *client, XEvent *e) break; case OB_FRAME_CONTEXT_FRAME: if (e->xcrossing.mode == NotifyGrab || - e->xcrossing.detail == NotifyInferior || e->xcrossing.mode == NotifyUngrab) { #ifdef DEBUG_FOCUS @@ -1267,7 +1274,28 @@ static void focus_delay_client_dest(gpointer data) 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); }