+
+static gboolean menu_hide_delay_func(gpointer data)
+{
+ menu_can_hide = TRUE;
+ return FALSE; /* no repeat */
+}
+
+static gboolean focus_delay_func(gpointer data)
+{
+ ObClient *c = data;
+
+ client_focus(c);
+ if (config_focus_raise)
+ stacking_raise(CLIENT_AS_WINDOW(c));
+ return FALSE; /* no repeat */
+}
+
+static void focus_delay_client_dest(gpointer data)
+{
+ ObClient *c = data;
+
+ ob_main_loop_timeout_remove_data(ob_main_loop, focus_delay_func, c);
+}
+
+void event_ignore_queued_enters()
+{
+ 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);
+}