summaryrefslogtreecommitdiff
path: root/sway/movement.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2015-08-10 10:18:04 -0400
committerDrew DeVault <[email protected]>2015-08-10 10:18:04 -0400
commitf9ae9ab6e37f1dab657527028f3123290f299406 (patch)
tree6e582145410b24851b41f0f3e3208920dac9eed3 /sway/movement.c
parent113fb708fb4b1d4eb49e4b6ea6a6c6a45c4e7a1a (diff)
parentf923c4e6b93a5361c1737b239dbacef6e7219b04 (diff)
Merge pull request #4 from taiyu-len/master
fixed focus_parent, moved into move_focus() function
Diffstat (limited to 'sway/movement.c')
-rw-r--r--sway/movement.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sway/movement.c b/sway/movement.c
index 108e2588..a55d0350 100644
--- a/sway/movement.c
+++ b/sway/movement.c
@@ -9,6 +9,20 @@ int move_focus(enum movement_direction direction) {
swayc_t *current = get_focused_container(&root_container);
swayc_t *parent = current->parent;
+ if (direction == MOVE_PARENT) {
+ current = parent;
+ parent = parent->parent;
+ if (parent->type == C_ROOT) {
+ sway_log(L_DEBUG, "Focus cannot move to parent");
+ return 1;
+ } else {
+ sway_log(L_DEBUG, "Moving focus away from %p", current);
+ unfocus_all(parent);
+ focus_view(parent);
+ return 0;
+ }
+ }
+
while (true) {
sway_log(L_DEBUG, "Moving focus away from %p", current);