From 055bd18142ebab2499d443be17a23b2c9e1df31f Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 14 Nov 2010 20:15:12 +0100 Subject: [PATCH] Bugfix: after the first UnmapNotify, unignore the event --- src/handlers.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/handlers.c b/src/handlers.c index f5324dfe..7dd73acb 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -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); -- 2.39.5