- /* 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);
+