]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: after the first UnmapNotify, unignore the event
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 14 Nov 2010 19:15:12 +0000 (20:15 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 14 Nov 2010 19:15:12 +0000 (20:15 +0100)
src/handlers.c

index f5324dfe24b33df7fae7a4afd9a55abf6fb9b677..7dd73acbd7d4925b05d0d4ed97f1089d25fb0dfd 100644 (file)
@@ -28,6 +28,30 @@ void add_ignore_event(const int sequence) {
     SLIST_INSERT_HEAD(&ignore_events, event, ignore_events);
 }
 
+/*
+ * Unignores the given sequence. Called when unmap events (generated by
+ * reparenting) should be ignored and the unmap event actually happens, in
+ * order to not ignore too many unmap events (leading to ghost window
+ * decorations).
+ *
+ */
+static void unignore_event(const int sequence) {
+    struct Ignore_Event *event;
+    for (event = SLIST_FIRST(&ignore_events);
+         event != SLIST_END(&ignore_events);
+         event = SLIST_NEXT(event, ignore_events)) {
+        if (event->sequence != sequence)
+            continue;
+
+        DLOG("Unignoring sequence number %d\n", sequence);
+        struct Ignore_Event *save = event;
+        event = SLIST_NEXT(event, ignore_events);
+        SLIST_REMOVE(&ignore_events, save, Ignore_Event, ignore_events);
+        free(save);
+        break;
+    }
+}
+
 /*
  * Checks if the given sequence is ignored and returns true if so.
  *
@@ -428,6 +452,7 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
     DLOG("UnmapNotify for 0x%08x (received from 0x%08x), serial %d\n", event->window, event->event, event->sequence);
     if (ignored) {
         DLOG("Ignoring UnmapNotify (generated by reparenting)\n");
+        unignore_event(event->sequence);
         return 1;
     }
     Con *con = con_by_window_id(event->window);