aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/floating.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-09-05 09:33:27 -0400
committerGitHub <noreply@github.com>2018-09-05 09:33:27 -0400
commit610eb946171f782165a20614b2d3318b89273990 (patch)
tree05eec1df1ef48e05b23d273d31143ad32e7632d2 /sway/commands/floating.c
parentaa2bf98e0442f9bf41a852c2fafee5b0897010a2 (diff)
parentdbf4aa3e33bdee53876c6893b15ac3f224818e7c (diff)
Merge pull request #2540 from RyanDwyer/typesafety
Implement type safe arguments and demote sway_container
Diffstat (limited to 'sway/commands/floating.c')
-rw-r--r--sway/commands/floating.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sway/commands/floating.c b/sway/commands/floating.c
index 436376e3..d8729094 100644
--- a/sway/commands/floating.c
+++ b/sway/commands/floating.c
@@ -15,24 +15,23 @@ struct cmd_results *cmd_floating(int argc, char **argv) {
if ((error = checkarg(argc, "floating", EXPECTED_EQUAL_TO, 1))) {
return error;
}
- struct sway_container *container =
- config->handler_context.current_container;
- if (container->type == C_WORKSPACE && container->children->length == 0) {
+ struct sway_container *container = config->handler_context.container;
+ struct sway_workspace *workspace = config->handler_context.workspace;
+ if (!container && workspace->tiling->length == 0) {
return cmd_results_new(CMD_INVALID, "floating",
"Can't float an empty workspace");
}
- if (container->type == C_WORKSPACE) {
+ if (!container) {
// Wrap the workspace's children in a container so we can float it
- struct sway_container *workspace = container;
- container = workspace_wrap_children(container);
+ container = workspace_wrap_children(workspace);
workspace->layout = L_HORIZ;
- seat_set_focus(config->handler_context.seat, container);
+ seat_set_focus(config->handler_context.seat, &container->node);
}
// If the container is in a floating split container,
// operate on the split container instead of the child.
if (container_is_floating_or_child(container)) {
- while (container->parent->type != C_WORKSPACE) {
+ while (container->parent) {
container = container->parent;
}
}
@@ -51,8 +50,7 @@ struct cmd_results *cmd_floating(int argc, char **argv) {
container_set_floating(container, wants_floating);
- struct sway_container *workspace = container_parent(container, C_WORKSPACE);
- arrange_windows(workspace);
+ arrange_workspace(container->workspace);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}