aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-04-04 00:20:44 -0400
committerTony Crisci <tony@dubstepdish.com>2018-04-04 00:20:44 -0400
commit741e3959e30283f5f699f7e9fa6620e3578b9c76 (patch)
tree8489f010c2f3e112722e7b999bacef18dfe418ef /sway/tree
parent9d1cbd77aca72ca72eaba5056de5805b14f004c1 (diff)
parent3ea7d2d10ed0d6d68e5bf3dd4efac765eb2b0212 (diff)
downloadsway-741e3959e30283f5f699f7e9fa6620e3578b9c76.tar.xz
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 @@
struct sway_container root_container;
-static void output_layout_change_notify(struct wl_listener *listener,
+static void output_layout_handle_change(struct wl_listener *listener,
void *data) {
- struct wlr_box *layout_box = wlr_output_layout_get_box(
- root_container.sway_root->output_layout, NULL);
+ struct wlr_output_layout *output_layout =
+ root_container.sway_root->output_layout;
+ const struct wlr_box *layout_box =
+ wlr_output_layout_get_box(output_layout, NULL);
+ root_container.x = layout_box->x;
+ root_container.y = layout_box->y;
root_container.width = layout_box->width;
root_container.height = layout_box->height;
@@ -33,8 +37,8 @@ static void output_layout_change_notify(struct wl_listener *listener,
}
struct sway_output *output = output_container->sway_output;
- struct wlr_box *output_box = wlr_output_layout_get_box(
- root_container.sway_root->output_layout, output->wlr_output);
+ const struct wlr_box *output_box =
+ wlr_output_layout_get_box(output_layout, output->wlr_output);
if (!output_box) {
continue;
}
@@ -74,7 +78,7 @@ void layout_init(void) {
wl_signal_init(&root_container.sway_root->events.new_container);
root_container.sway_root->output_layout_change.notify =
- output_layout_change_notify;
+ output_layout_handle_change;
wl_signal_add(&root_container.sway_root->output_layout->events.change,
&root_container.sway_root->output_layout_change);
}
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) {
continue;
}
+ // If the command is workspace number <name>, isolate the name
+ if (strncmp(_target, "number ", strlen("number ")) == 0) {
+ size_t length = strlen(_target) - strlen("number ") + 1;
+ char *temp = malloc(length);
+ strncpy(temp, _target + strlen("number "), length - 1);
+ temp[length - 1] = '\0';
+ free(_target);
+ _target = temp;
+ wlr_log(L_DEBUG, "Isolated name from workspace number: '%s'", _target);
+
+ // Make sure the workspace number doesn't already exist
+ if (workspace_by_number(_target)) {
+ free(_target);
+ free(dup);
+ continue;
+ }
+ }
+
// Make sure that the workspace doesn't already exist
if (workspace_by_name(_target)) {
free(_target);