diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-24 22:30:44 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-01 23:14:58 +1000 |
commit | 1f2e399ade77070a2d0b82856ad9a3eef96b8676 (patch) | |
tree | c469197e140051aea912cb173723c7e55ce1e410 /sway/commands/floating.c | |
parent | Send frame done to floating views (diff) | |
download | sway-1f2e399ade77070a2d0b82856ad9a3eef96b8676.tar.gz sway-1f2e399ade77070a2d0b82856ad9a3eef96b8676.tar.zst sway-1f2e399ade77070a2d0b82856ad9a3eef96b8676.zip |
Implement floating
Diffstat (limited to 'sway/commands/floating.c')
-rw-r--r-- | sway/commands/floating.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/sway/commands/floating.c b/sway/commands/floating.c index 9e0be9d0..38a4e1da 100644 --- a/sway/commands/floating.c +++ b/sway/commands/floating.c | |||
@@ -31,31 +31,10 @@ struct cmd_results *cmd_floating(int argc, char **argv) { | |||
31 | wants_floating = !container->is_floating; | 31 | wants_floating = !container->is_floating; |
32 | } else { | 32 | } else { |
33 | return cmd_results_new(CMD_FAILURE, "floating", | 33 | return cmd_results_new(CMD_FAILURE, "floating", |
34 | "Expected 'floating <enable|disable|toggle>"); | 34 | "Expected 'floating <enable|disable|toggle>'"); |
35 | } | 35 | } |
36 | 36 | ||
37 | // Change from tiled to floating | 37 | container_set_floating(container, wants_floating); |
38 | if (!container->is_floating && wants_floating) { | ||
39 | struct sway_container *workspace = container_parent( | ||
40 | container, C_WORKSPACE); | ||
41 | container_remove_child(container); | ||
42 | container_add_floating(workspace, container); | ||
43 | |||
44 | struct sway_output *output = workspace->parent->sway_output; | ||
45 | output_damage_whole_container(output, container); | ||
46 | // Reset to sane size and position | ||
47 | container->width = 640; | ||
48 | container->height = 480; | ||
49 | container->x = workspace->width / 2 - container->width / 2; | ||
50 | container->y = workspace->height / 2 - container->height / 2; | ||
51 | view_autoconfigure(container->sway_view); | ||
52 | output_damage_whole_container(output, container); | ||
53 | |||
54 | seat_set_focus(config->handler_context.seat, container); | ||
55 | arrange_workspace(workspace); | ||
56 | } else if (container->is_floating && !wants_floating) { | ||
57 | // TODO | ||
58 | } | ||
59 | 38 | ||
60 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 39 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
61 | } | 40 | } |