diff options
Diffstat (limited to 'sway/focus.c')
-rw-r--r-- | sway/focus.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sway/focus.c b/sway/focus.c index 45108a11..0c1f8c9e 100644 --- a/sway/focus.c +++ b/sway/focus.c | |||
@@ -53,11 +53,10 @@ bool move_focus(enum movement_direction direction) { | |||
53 | view = get_swayc_in_direction(view, direction); | 53 | view = get_swayc_in_direction(view, direction); |
54 | if (view) { | 54 | if (view) { |
55 | if (direction == MOVE_PARENT) { | 55 | if (direction == MOVE_PARENT) { |
56 | set_focused_container(view); | 56 | return set_focused_container(view); |
57 | } else { | 57 | } else { |
58 | set_focused_container(get_focused_view(view)); | 58 | return set_focused_container(get_focused_view(view)); |
59 | } | 59 | } |
60 | return true; | ||
61 | } | 60 | } |
62 | return false; | 61 | return false; |
63 | } | 62 | } |
@@ -73,9 +72,9 @@ swayc_t *get_focused_container(swayc_t *parent) { | |||
73 | return parent; | 72 | return parent; |
74 | } | 73 | } |
75 | 74 | ||
76 | void set_focused_container(swayc_t *c) { | 75 | bool set_focused_container(swayc_t *c) { |
77 | if (locked_container_focus || !c) { | 76 | if (locked_container_focus || !c) { |
78 | return; | 77 | return false; |
79 | } | 78 | } |
80 | sway_log(L_DEBUG, "Setting focus to %p:%ld", c, c->handle); | 79 | sway_log(L_DEBUG, "Setting focus to %p:%ld", c, c->handle); |
81 | 80 | ||
@@ -84,7 +83,7 @@ void set_focused_container(swayc_t *c) { | |||
84 | swayc_t *focused = get_focused_view(workspace); | 83 | swayc_t *focused = get_focused_view(workspace); |
85 | // if the workspace we are changing focus to has a fullscreen view return | 84 | // if the workspace we are changing focus to has a fullscreen view return |
86 | if (swayc_is_fullscreen(focused) && focused != c) { | 85 | if (swayc_is_fullscreen(focused) && focused != c) { |
87 | return; | 86 | return false; |
88 | } | 87 | } |
89 | 88 | ||
90 | // update container focus from here to root, making necessary changes along | 89 | // update container focus from here to root, making necessary changes along |
@@ -115,17 +114,18 @@ void set_focused_container(swayc_t *c) { | |||
115 | } | 114 | } |
116 | } | 115 | } |
117 | } | 116 | } |
117 | return true; | ||
118 | } | 118 | } |
119 | 119 | ||
120 | void set_focused_container_for(swayc_t *a, swayc_t *c) { | 120 | bool set_focused_container_for(swayc_t *a, swayc_t *c) { |
121 | if (locked_container_focus || !c) { | 121 | if (locked_container_focus || !c) { |
122 | return; | 122 | return false; |
123 | } | 123 | } |
124 | swayc_t *find = c; | 124 | swayc_t *find = c; |
125 | // Ensure that a is an ancestor of c | 125 | // Ensure that a is an ancestor of c |
126 | while (find != a && (find = find->parent)) { | 126 | while (find != a && (find = find->parent)) { |
127 | if (find == &root_container) { | 127 | if (find == &root_container) { |
128 | return; | 128 | return false; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
@@ -134,7 +134,7 @@ void set_focused_container_for(swayc_t *a, swayc_t *c) { | |||
134 | swayc_t *focused = get_focused_view(workspace); | 134 | swayc_t *focused = get_focused_view(workspace); |
135 | // if the workspace we are changing focus to has a fullscreen view return | 135 | // if the workspace we are changing focus to has a fullscreen view return |
136 | if (swayc_is_fullscreen(focused) && c != focused) { | 136 | if (swayc_is_fullscreen(focused) && c != focused) { |
137 | return; | 137 | return false; |
138 | } | 138 | } |
139 | 139 | ||
140 | // Check if we changing a parent container that will see chnage | 140 | // Check if we changing a parent container that will see chnage |
@@ -147,8 +147,7 @@ void set_focused_container_for(swayc_t *a, swayc_t *c) { | |||
147 | } | 147 | } |
148 | if (effective) { | 148 | if (effective) { |
149 | // Go to set_focused_container | 149 | // Go to set_focused_container |
150 | set_focused_container(c); | 150 | return set_focused_container(c); |
151 | return; | ||
152 | } | 151 | } |
153 | 152 | ||
154 | sway_log(L_DEBUG, "Setting focus for %p:%ld to %p:%ld", | 153 | sway_log(L_DEBUG, "Setting focus for %p:%ld to %p:%ld", |
@@ -161,6 +160,7 @@ void set_focused_container_for(swayc_t *a, swayc_t *c) { | |||
161 | p = p->parent; | 160 | p = p->parent; |
162 | p->is_focused = false; | 161 | p->is_focused = false; |
163 | } | 162 | } |
163 | return true; | ||
164 | } | 164 | } |
165 | 165 | ||
166 | swayc_t *get_focused_view(swayc_t *parent) { | 166 | swayc_t *get_focused_view(swayc_t *parent) { |