Bugfix: Properly ignore UnmapNotify events (especially for floating windows)

This fixes the bug which caused floating windows to be visible even when
switching to a different workspace.

Instead of ignoring a specific sequence, we now set an ignore_unmap counter for
each container. (So, should containers be closed too early or stay open even if
they should be closed, we probably need to have a closer look at the counter.
At the moment, it is increased by one on reparenting and unmapping (for
workspace changes) and decremented by one on each UnmapNotify event).

This system is better because a sequence does not describe a single unmap or
reparent request but a request to X11 on the network layer -- which can contain
multiple requests.
This commit is contained in:
Michael Stapelberg
2010-11-20 19:11:43 +01:00
parent 131a2f8765
commit db651679c5
5 changed files with 106 additions and 8 deletions

View File

@ -425,6 +425,10 @@ static void x_push_node(Con *con) {
state->old_frame = XCB_NONE;
state->need_reparent = false;
con->ignore_unmap++;
DLOG("ignore_unmap for reparenting of con %p (win 0x%08x) is now %d\n",
con, con->window->id, con->ignore_unmap);
}
/* map/unmap if map state changed, also ensure that the child window
@ -442,6 +446,11 @@ static void x_push_node(Con *con) {
cookie = xcb_unmap_window(conn, con->frame);
LOG("unmapping container (serial %d)\n", cookie.sequence);
/* we need to increase ignore_unmap for this container (if it contains a window) and for every window "under" this one which contains a window */
if (con->window != NULL) {
con->ignore_unmap++;
DLOG("ignore_unmap for con %p (frame 0x%08x) now %d\n", con, con->frame, con->ignore_unmap);
}
/* Ignore enter_notifies which are generated when unmapping */
add_ignore_event(cookie.sequence);
} else {