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:
@ -444,8 +444,6 @@ int handle_screen_change(void *prophs, xcb_connection_t *conn,
|
||||
*/
|
||||
int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_notify_event_t *event) {
|
||||
|
||||
bool ignored = event_is_ignored(event->sequence);
|
||||
|
||||
/* FIXME: we cannot ignore this sequence because more UnmapNotifys with the same sequence
|
||||
* numbers but different window IDs may follow */
|
||||
/* we need to ignore EnterNotify events which will be generated because a
|
||||
@ -453,14 +451,24 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
|
||||
//add_ignore_event(event->sequence);
|
||||
|
||||
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);
|
||||
if (con == NULL) {
|
||||
LOG("Not a managed window, ignoring\n");
|
||||
/* This could also be an UnmapNotify for the frame. We need to
|
||||
* decrement the ignore_unmap counter. */
|
||||
con = con_by_frame_id(event->window);
|
||||
if (con == NULL) {
|
||||
LOG("Not a managed window, ignoring UnmapNotify event\n");
|
||||
return 1;
|
||||
}
|
||||
if (con->ignore_unmap > 0)
|
||||
con->ignore_unmap--;
|
||||
DLOG("ignore_unmap = %d for frame of container %p\n", con->ignore_unmap, con);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (con->ignore_unmap > 0) {
|
||||
DLOG("ignore_unmap = %d, dec\n", con->ignore_unmap);
|
||||
con->ignore_unmap--;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user