clean up old workspace when switching (makes test 2 of t/16-*.t pass)

next
Michael Stapelberg 2010-04-16 20:59:21 +02:00
parent 2534f21940
commit 138a790cd0
1 changed files with 10 additions and 2 deletions

View File

@ -33,7 +33,7 @@ Con *workspace_get(const char *num) {
}
}
LOG("should switch to ws %s\n", num);
LOG("getting ws %s\n", num);
if (workspace == NULL) {
LOG("need to create this one\n");
output = con_get_output(focused);
@ -96,7 +96,9 @@ bool workspace_is_visible(Workspace *ws) {
*
*/
void workspace_show(const char *num) {
Con *workspace, *current;
Con *workspace, *current, *old;
old = con_get_workspace(focused);
workspace = workspace_get(num);
workspace->fullscreen_mode = CF_OUTPUT;
@ -110,6 +112,12 @@ void workspace_show(const char *num) {
while (!TAILQ_EMPTY(&(next->focus_head)))
next = TAILQ_FIRST(&(next->focus_head));
if (TAILQ_EMPTY(&(old->nodes_head))) {
LOG("Closing old workspace (%p / %s), it is empty\n", old, old->name);
tree_close(old);
}
con_focus(next);
workspace->fullscreen_mode = CF_OUTPUT;
LOG("focused now = %p / %s\n", focused, focused->name);