summaryrefslogtreecommitdiff
path: root/mcwm.c
diff options
context:
space:
mode:
authorMC <mc@hack.org>2010-07-10 10:28:05 +0200
committerMC <mc@hack.org>2010-07-10 10:28:05 +0200
commit217a42c46f6ca21c2eda76e53d432509f478b487 (patch)
tree42dffcd73be4354ceb82bd1341f40cb171ce4226 /mcwm.c
parent0b0d0a00a3c115b17f465a9d64085253e24d243d (diff)
downloadmcwm-217a42c46f6ca21c2eda76e53d432509f478b487.zip
Instead of counting UnmapNotify events, which might get fouled up if a
an unrelated window is unmapped just when we're changing workspaces, we just look for the unmapped window in our *current* workspace list, not what we changed from.
Diffstat (limited to 'mcwm.c')
-rw-r--r--mcwm.c68
1 files changed, 22 insertions, 46 deletions
diff --git a/mcwm.c b/mcwm.c
index 19bed16..c92ea90 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -185,8 +185,6 @@ struct conf
xcb_atom_t atom_desktop;
-int unmaps_to_expect;
-
/* Functions declerations. */
@@ -484,7 +482,6 @@ void changeworkspace(uint32_t ws)
}
/* Go through list of current ws. Unmap everything that isn't fixed. */
- unmaps_to_expect = 0;
for (item = wslist[curws]; item != NULL; )
{
client = item->data;
@@ -509,14 +506,14 @@ void changeworkspace(uint32_t ws)
}
else
{
- xcb_unmap_window(conn, client->id);
- item = item->next;
-
/*
- * Keep track of how many UnmapNotify events we can expect
- * before going back to ordinary unmap handling.
+ * This is an ordinary window. Just unmap it. Note that
+ * this will generate an unnecessary UnmapNotify event
+ * which we will try to handle later.
*/
- unmaps_to_expect ++;
+ xcb_unmap_window(conn, client->id);
+
+ item = item->next;
}
} /* for */
@@ -2306,48 +2303,27 @@ void events(void)
struct client *client;
/*
- * If we're currently changing workspace, unmaps_to_expect
- * is larger than 0.
+ * Find the window in our *current* workspace list, then
+ * forget about it. If it gets mapped, we add it to our
+ * lists again then.
*
- * Count all incoming UnmapNotify events. When we reach
- * the number of windows that was on the last workspace,
- * we stop counting and resume ordinary unmap handling.
+ * Note that we might not know about the window we got the
+ * UnmapNotify event for. It might be a window we just
+ * unmapped on *another* workspace when changing
+ * workspaces, for instance. This is not an error.
*/
- if (unmaps_to_expect > 0)
+ for (item = wslist[curws]; item != NULL; item = item->next)
{
- unmaps_to_expect --;
-#if DEBUG
- if (0 == unmaps_to_expect)
+ client = item->data;
+
+ if (client->id == e->window)
{
- PDEBUG("Got all UnmapNotify events we wanted.\n");
+ PDEBUG("Forgetting about %d\n", e->window);
+ forgetclient(client);
+ break;
}
-#endif
- }
- else
- {
- /*
- * Ordinary unmap handling. Find the window in current
- * workspace list, then forget about it. If it gets
- * mapped, we add it to our lists again then.
- *
- * Note that the window we might not know about the
- * window we got the UnmapNotify event for. This might
- * be an override_redirect window, for example. We
- * don't have any way to know.
- */
- for (item = wslist[curws]; item != NULL; item = item->next)
- {
- client = item->data;
-
- if (client->id == e->window)
- {
- PDEBUG("Forgetting about %d\n", e->window);
- forgetclient(client);
- break;
- }
- } /* for */
- }
- }
+ } /* for */
+ }
break;
} /* switch */