aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-04 00:20:44 -0400
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-04 00:20:44 -0400
commit741e3959e30283f5f699f7e9fa6620e3578b9c76 (patch)
tree8489f010c2f3e112722e7b999bacef18dfe418ef /sway/tree
parentsimplify container close (diff)
parentMerge pull request #1722 from swaywm/swaybar-hidpi (diff)
downloadsway-741e3959e30283f5f699f7e9fa6620e3578b9c76.tar.gz
sway-741e3959e30283f5f699f7e9fa6620e3578b9c76.tar.zst
sway-741e3959e30283f5f699f7e9fa6620e3578b9c76.zip
Merge branch 'wlroots' into split-containers2
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/layout.c16
-rw-r--r--sway/tree/workspace.c18
2 files changed, 28 insertions, 6 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index a46359bd..5abdbc32 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -18,10 +18,14 @@
18 18
19struct sway_container root_container; 19struct sway_container root_container;
20 20
21static void output_layout_change_notify(struct wl_listener *listener, 21static void output_layout_handle_change(struct wl_listener *listener,
22 void *data) { 22 void *data) {
23 struct wlr_box *layout_box = wlr_output_layout_get_box( 23 struct wlr_output_layout *output_layout =
24 root_container.sway_root->output_layout, NULL); 24 root_container.sway_root->output_layout;
25 const struct wlr_box *layout_box =
26 wlr_output_layout_get_box(output_layout, NULL);
27 root_container.x = layout_box->x;
28 root_container.y = layout_box->y;
25 root_container.width = layout_box->width; 29 root_container.width = layout_box->width;
26 root_container.height = layout_box->height; 30 root_container.height = layout_box->height;
27 31
@@ -33,8 +37,8 @@ static void output_layout_change_notify(struct wl_listener *listener,
33 } 37 }
34 struct sway_output *output = output_container->sway_output; 38 struct sway_output *output = output_container->sway_output;
35 39
36 struct wlr_box *output_box = wlr_output_layout_get_box( 40 const struct wlr_box *output_box =
37 root_container.sway_root->output_layout, output->wlr_output); 41 wlr_output_layout_get_box(output_layout, output->wlr_output);
38 if (!output_box) { 42 if (!output_box) {
39 continue; 43 continue;
40 } 44 }
@@ -74,7 +78,7 @@ void layout_init(void) {
74 wl_signal_init(&root_container.sway_root->events.new_container); 78 wl_signal_init(&root_container.sway_root->events.new_container);
75 79
76 root_container.sway_root->output_layout_change.notify = 80 root_container.sway_root->output_layout_change.notify =
77 output_layout_change_notify; 81 output_layout_handle_change;
78 wl_signal_add(&root_container.sway_root->output_layout->events.change, 82 wl_signal_add(&root_container.sway_root->output_layout->events.change,
79 &root_container.sway_root->output_layout_change); 83 &root_container.sway_root->output_layout_change);
80} 84}
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 6ba3d973..316f01e4 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -139,6 +139,24 @@ char *workspace_next_name(const char *output_name) {
139 continue; 139 continue;
140 } 140 }
141 141
142 // If the command is workspace number <name>, isolate the name
143 if (strncmp(_target, "number ", strlen("number ")) == 0) {
144 size_t length = strlen(_target) - strlen("number ") + 1;
145 char *temp = malloc(length);
146 strncpy(temp, _target + strlen("number "), length - 1);
147 temp[length - 1] = '\0';
148 free(_target);
149 _target = temp;
150 wlr_log(L_DEBUG, "Isolated name from workspace number: '%s'", _target);
151
152 // Make sure the workspace number doesn't already exist
153 if (workspace_by_number(_target)) {
154 free(_target);
155 free(dup);
156 continue;
157 }
158 }
159
142 // Make sure that the workspace doesn't already exist 160 // Make sure that the workspace doesn't already exist
143 if (workspace_by_name(_target)) { 161 if (workspace_by_name(_target)) {
144 free(_target); 162 free(_target);