From 6aa6fa0af02575174f8bc7c41a6c0f3422cd3bba Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 13 Apr 2010 16:41:23 +0200 Subject: [PATCH] correctly focus workspaces --- src/tree.c | 2 +- src/workspace.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tree.c b/src/tree.c index 1d5405fd..22dcf5cc 100644 --- a/src/tree.c +++ b/src/tree.c @@ -275,7 +275,7 @@ void tree_next(char way, orientation_t orientation) { /* 3: focus choice comes in here. at the moment we will go down * until we find a window */ /* TODO: check for window, atm we only go down as far as possible */ - while (TAILQ_FIRST(&(next->focus_head)) != TAILQ_END(&(next->focus_head))) + while (!TAILQ_EMPTY(&(next->focus_head))) next = TAILQ_FIRST(&(next->focus_head)); con_focus(next); diff --git a/src/workspace.c b/src/workspace.c index d65a5198..63e079f9 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -110,7 +110,12 @@ void workspace_show(const char *num) { current->fullscreen_mode = CF_NONE; LOG("switching to %p\n", workspace); - con_focus(workspace); + Con *next = workspace; + + while (!TAILQ_EMPTY(&(next->focus_head))) + next = TAILQ_FIRST(&(next->focus_head)); + + con_focus(next); workspace->fullscreen_mode = CF_OUTPUT; LOG("focused now = %p / %s\n", focused, focused->name); #if 0 -- 2.39.5