From e0b7ae872eb826d9f3a7dd78844938bdbb17db7c Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 16 Apr 2010 21:04:36 +0200 Subject: [PATCH] move con_focus to con.c --- include/con.h | 1 + include/tree.h | 1 - src/con.c | 18 ++++++++++++++++++ src/tree.c | 18 ------------------ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/con.h b/include/con.h index 71f73e3d..8022fc01 100644 --- a/include/con.h +++ b/include/con.h @@ -2,6 +2,7 @@ #define _CON_H Con *con_new(Con *parent); +void con_focus(Con *con); bool con_is_leaf(Con *con); bool con_accepts_window(Con *con); Con *con_get_output(Con *con); diff --git a/include/tree.h b/include/tree.h index 21c02967..029bbe34 100644 --- a/include/tree.h +++ b/include/tree.h @@ -15,7 +15,6 @@ extern struct all_cons_head all_cons; void tree_init(); Con *tree_open_con(Con *con); void tree_split(Con *con, orientation_t orientation); -void con_focus(Con *con); void level_up(); void level_down(); void tree_render(); diff --git a/src/con.c b/src/con.c index 5c220458..d0daba59 100644 --- a/src/con.c +++ b/src/con.c @@ -74,6 +74,24 @@ void con_detach(Con *con) { } } +/* + * Sets input focus to the given container. Will be updated in X11 in the next + * run of x_push_changes(). + * + */ +void con_focus(Con *con) { + assert(con != NULL); + + /* 1: set focused-pointer to the new con */ + /* 2: exchange the position of the container in focus stack of the parent all the way up */ + TAILQ_REMOVE(&(con->parent->focus_head), con, focused); + TAILQ_INSERT_HEAD(&(con->parent->focus_head), con, focused); + if (con->parent->parent != NULL) + con_focus(con->parent); + + focused = con; +} + /* * Returns true when this node is a leaf node (has no children) * diff --git a/src/tree.c b/src/tree.c index 22dcf5cc..3a657983 100644 --- a/src/tree.c +++ b/src/tree.c @@ -9,24 +9,6 @@ struct Con *focused; struct all_cons_head all_cons = TAILQ_HEAD_INITIALIZER(all_cons); -/* - * Sets input focus to the given container. Will be updated in X11 in the next - * run of x_push_changes(). - * - */ -void con_focus(Con *con) { - assert(con != NULL); - - /* 1: set focused-pointer to the new con */ - /* 2: exchange the position of the container in focus stack of the parent all the way up */ - TAILQ_REMOVE(&(con->parent->focus_head), con, focused); - TAILQ_INSERT_HEAD(&(con->parent->focus_head), con, focused); - if (con->parent->parent != NULL) - con_focus(con->parent); - - focused = con; -} - /* * Loads tree from ~/.i3/_restart.json *