]> Dogcows Code - chaz/openbox/commitdiff
provide a means to properly ignore enter events for focus changes
authorDana Jansens <danakj@orodu.net>
Mon, 22 Sep 2003 04:18:54 +0000 (04:18 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 22 Sep 2003 04:18:54 +0000 (04:18 +0000)
openbox/event.c
openbox/event.h

index 9d141c5ab4ca27ccf5a9542fc29c031d95768d9f..5388e227c4a3a7ce6d823496bf9d8645100cdf4a 100644 (file)
@@ -612,11 +612,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 +709,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;
@@ -1267,7 +1270,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);
 }
index 341bc8d39c4f42890f02ec9f576f8779ba7b6606..5d8600a873ff901acfa121dcbce976b4e9d26d16 100644 (file)
@@ -35,12 +35,12 @@ extern guint ScrollLockMask;
 void event_startup(gboolean reconfig);
 void event_shutdown(gboolean reconfig);
 
-/*! Request that a number of EnterNotify events not be used for distributing
-  focus */
-void event_ignore_enter_focus(guint num);
-
 /*! Make as if the mouse just entered the client, use only when using focus
   follows mouse */
 void event_enter_client(struct _ObClient *client);
 
+/*! Request that any queued EnterNotify events not be used for distributing
+  focus */
+void event_ignore_queued_enters();
+
 #endif
This page took 0.031669 seconds and 4 git commands to generate.