X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fevent.c;h=fd70c972611e1ef06e95629f50ca0a06c475ce3b;hb=ae269d77ca816dd6b05f20017dab012750636b90;hp=9720f24be06a947552acbfaf4812a431436c2a73;hpb=e47499a07c28f68889dab2b06d03a827c5238e60;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index 9720f24b..fd70c972 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -359,7 +359,7 @@ static Bool event_look_for_focusin(Display *d, XEvent *e, XPointer arg) return e->type == FocusIn && wanted_focusevent(e, FALSE); } -Bool event_look_for_focusin_client(Display *d, XEvent *e, XPointer arg) +static Bool event_look_for_focusin_client(Display *d, XEvent *e, XPointer arg) { return e->type == FocusIn && wanted_focusevent(e, TRUE); } @@ -1717,39 +1717,29 @@ void event_halt_focus_delay() ob_main_loop_timeout_remove(ob_main_loop, focus_delay_func); } +static Bool event_look_for_enters(Display *d, XEvent *e, XPointer arg) +{ + guint *count = (guint*)arg; + if (e->type == EnterNotify) { + ObWindow *win; + + win = g_hash_table_lookup(window_map, &e->xany.window); + if (win && WINDOW_IS_CLIENT(win)) + ++(*count); + } + return False; /* don't disrupt the queue order, just count them */ +} + void event_ignore_queued_enters() { - GSList *saved = NULL, *it; - XEvent *e; - gint i = 0; + XEvent e; XSync(ob_display, FALSE); - /* count the events */ - while (TRUE) { - e = g_new(XEvent, 1); - if (XCheckTypedEvent(ob_display, EnterNotify, e)) { - ObWindow *win; - - win = g_hash_table_lookup(window_map, &e->xany.window); - /* check to make sure we're not ignoring the same event multiple - times */ - if (win && WINDOW_IS_CLIENT(win) && i >= ignore_enter_focus) - ++ignore_enter_focus; - - saved = g_slist_append(saved, e); - ++i; - } 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); + /* count the events without disrupting them */ + XCheckIfEvent(ob_display, &e, event_look_for_enters, + (XPointer)&ignore_enter_focus); + } gboolean event_time_after(Time t1, Time t2)