summaryrefslogtreecommitdiff
path: root/mcwm.c
diff options
context:
space:
mode:
authorMC <mc@hack.org>2010-07-01 11:09:34 +0200
committerMC <mc@brain.hack.org>2010-07-01 11:09:34 +0200
commit409eb3a123101714ea2b55b42fdd5ab1d45c5e78 (patch)
treea3281a2f03c995fbc43b140a6734d86eddde59cc /mcwm.c
parent1b2083a88ecd46e16d83a2276c4af2c54770f0de (diff)
downloadmcwm-409eb3a123101714ea2b55b42fdd5ab1d45c5e78.zip
When changing workspaces, remove fixed windows from the current and
add them to where we're going to. Take care to save the next pointer so we don't lose our ability to traverse the list.
Diffstat (limited to 'mcwm.c')
-rw-r--r--mcwm.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/mcwm.c b/mcwm.c
index efdb899..a691668 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -288,6 +288,7 @@ void delfromworkspace(struct client *client, uint32_t ws)
if (client == item->data)
{
delitem(&wslist[ws], item);
+ return;
}
}
}
@@ -295,6 +296,7 @@ void delfromworkspace(struct client *client, uint32_t ws)
void changeworkspace(uint32_t ws)
{
struct item *item;
+ struct item *tmpitem;
struct client *client;
if (ws == curws)
@@ -314,20 +316,9 @@ void changeworkspace(uint32_t ws)
setunfocus(focuswin->id);
focuswin = NULL;
}
-
-#if DEBUG
- PDEBUG("From workspace:\n");
- listitems(wslist[curws]);
-#endif
-
-
-#if DEBUG
- PDEBUG("To workspace:\n");
- listitems(wslist[ws]);
-#endif
/* Go through list of current ws. Unmap everything that isn't fixed. */
- for (item = wslist[curws]; item != NULL; item = item->next)
+ for (item = wslist[curws]; item != NULL; )
{
client = item->data;
@@ -336,23 +327,26 @@ void changeworkspace(uint32_t ws)
if (client->fixed)
{
-#if 0
/* We move all fixed windows to every new workspace we go to. */
- delfromworkspace(client, curws);
addtoworkspace(client, ws);
- PDEBUG("After deleting fixed, curws::\n");
- listitems(wslist[curws]);
+ /*
+ * NB! Before deleting this item, we need to save the
+ * address to next item so we can continue through the
+ * list.
+ */
+ tmpitem = item;
+ item = item->next;
- PDEBUG("After deleting fixed, going to ws:\n");
- listitems(wslist[ws]);
-#endif
+ delitem(&wslist[curws], tmpitem);
}
else
{
- xcb_unmap_window(conn, client->id);
+ xcb_unmap_window(conn, client->id);
+ item = item->next;
}
- }
+
+ } /* for */
/* Go through list of new ws. Map everything that isn't fixed. */
for (item = wslist[ws]; item != NULL; item = item->next)
@@ -362,7 +356,6 @@ void changeworkspace(uint32_t ws)
PDEBUG("changeworkspace. map phase. ws #%d, client-fixed: %d\n",
ws, client->fixed);
-
/* Fixed windows are already mapped. Map everything else. */
if (!client->fixed)
{
@@ -378,6 +371,11 @@ void changeworkspace(uint32_t ws)
void fixwindow(struct client *client)
{
uint32_t values[1];
+
+ if (NULL == client)
+ {
+ return;
+ }
if (client->fixed)
{