- /* put the events back */
- for (it = saved; it; it = g_slist_next(it)) {
- XPutBackEvent(ob_display, it->data);
- g_free(it->data);
+ return False; /* don't disrupt the queue order, just count them */
+}
+
+void event_ignore_all_queued_enters()
+{
+ XEvent e;
+
+ XSync(ob_display, FALSE);
+
+ /* count the events without disrupting them */
+ ignore_enter_focus = 0;
+ XCheckIfEvent(ob_display, &e, event_look_for_enters, NULL);
+}
+
+static gboolean is_enter_focus_event_ignored(XEvent *e)
+{
+ g_assert(e->type == EnterNotify &&
+ !(e->xcrossing.mode == NotifyGrab ||
+ e->xcrossing.mode == NotifyUngrab ||
+ e->xcrossing.detail == NotifyInferior));
+
+ ob_debug_type(OB_DEBUG_FOCUS, "# enters ignored: %d\n",
+ ignore_enter_focus);
+
+ if (ignore_enter_focus) {
+ --ignore_enter_focus;
+ return TRUE;