summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar taiyu <taiyu.len@gmail.com>2015-08-19 16:15:17 -0700
committerLibravatar taiyu <taiyu.len@gmail.com>2015-08-19 16:15:17 -0700
commit6f424ff6b82d86a174319ffd534e517b2ae6d367 (patch)
tree2ebf5631c4ddf3fd855f1e655fe20d5175a8e801
parentuse enums for pointer click names (diff)
downloadsway-6f424ff6b82d86a174319ffd534e517b2ae6d367.tar.gz
sway-6f424ff6b82d86a174319ffd534e517b2ae6d367.tar.zst
sway-6f424ff6b82d86a174319ffd534e517b2ae6d367.zip
fixed default active_workspace, and more use of set_focused_container_for(...)
-rw-r--r--sway/container.c1
-rw-r--r--sway/layout.c7
2 files changed, 5 insertions, 3 deletions
diff --git a/sway/container.c b/sway/container.c
index 0a89f634..0a75643d 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -150,6 +150,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) {
150 // give them proper layouts 150 // give them proper layouts
151 cont->layout = workspace->layout; 151 cont->layout = workspace->layout;
152 workspace->layout = layout; 152 workspace->layout = layout;
153 set_focused_container_for(workspace, get_focused_view(workspace));
153 } else { // Or is built around container 154 } else { // Or is built around container
154 swayc_t *parent = replace_child(child, cont); 155 swayc_t *parent = replace_child(child, cont);
155 if (parent) { 156 if (parent) {
diff --git a/sway/layout.c b/sway/layout.c
index 7125ffc3..eb8391ce 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -33,8 +33,9 @@ void add_child(swayc_t *parent, swayc_t *child) {
33 child->width, child->height, parent, parent->type, parent->width, parent->height); 33 child->width, child->height, parent, parent->type, parent->width, parent->height);
34 list_add(parent->children, child); 34 list_add(parent->children, child);
35 child->parent = parent; 35 child->parent = parent;
36 //set focus for this container
36 if (parent->children->length == 1) { 37 if (parent->children->length == 1) {
37 parent->focused = child; 38 set_focused_container_for(parent, child);
38 } 39 }
39} 40}
40 41
@@ -45,7 +46,7 @@ void add_floating(swayc_t *ws, swayc_t *child) {
45 child->parent = ws; 46 child->parent = ws;
46 child->is_floating = true; 47 child->is_floating = true;
47 if (!ws->focused) { 48 if (!ws->focused) {
48 ws->focused = child; 49 set_focused_container_for(ws, child);
49 } 50 }
50} 51}
51 52
@@ -70,7 +71,7 @@ swayc_t *replace_child(swayc_t *child, swayc_t *new_child) {
70 new_child->parent = child->parent; 71 new_child->parent = child->parent;
71 72
72 if (child->parent->focused == child) { 73 if (child->parent->focused == child) {
73 child->parent->focused = new_child; 74 set_focused_container_for(child->parent, new_child);
74 } 75 }
75 child->parent = NULL; 76 child->parent = NULL;
76 return parent; 77 return parent;