Bugfix: after the first UnmapNotify, unignore the event

This commit is contained in:
Michael Stapelberg 2010-11-14 20:15:12 +01:00
parent d760a1c7b2
commit 055bd18142
1 changed files with 25 additions and 0 deletions

View 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);