diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-05-04 08:41:16 -0400 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-01 23:14:58 +1000 |
commit | 1132efe42e8086216c7bab6b405d09a22231dde5 (patch) | |
tree | 918a682faf3dd5f53fda799bcd3e12d2b0123840 /sway/commands/floating.c | |
parent | Render floating views (diff) | |
download | sway-1132efe42e8086216c7bab6b405d09a22231dde5.tar.gz sway-1132efe42e8086216c7bab6b405d09a22231dde5.tar.zst sway-1132efe42e8086216c7bab6b405d09a22231dde5.zip |
Send frame done to floating views
Also centers them on the screen when initially floated
In the future we'll need a more sophisticated solution than that
Diffstat (limited to 'sway/commands/floating.c')
-rw-r--r-- | sway/commands/floating.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sway/commands/floating.c b/sway/commands/floating.c index 8432b0dc..9e0be9d0 100644 --- a/sway/commands/floating.c +++ b/sway/commands/floating.c | |||
@@ -3,9 +3,11 @@ | |||
3 | #include "sway/commands.h" | 3 | #include "sway/commands.h" |
4 | #include "sway/input/seat.h" | 4 | #include "sway/input/seat.h" |
5 | #include "sway/ipc-server.h" | 5 | #include "sway/ipc-server.h" |
6 | #include "sway/output.h" | ||
6 | #include "sway/tree/arrange.h" | 7 | #include "sway/tree/arrange.h" |
7 | #include "sway/tree/container.h" | 8 | #include "sway/tree/container.h" |
8 | #include "sway/tree/layout.h" | 9 | #include "sway/tree/layout.h" |
10 | #include "sway/tree/view.h" | ||
9 | #include "list.h" | 11 | #include "list.h" |
10 | 12 | ||
11 | struct cmd_results *cmd_floating(int argc, char **argv) { | 13 | struct cmd_results *cmd_floating(int argc, char **argv) { |
@@ -38,6 +40,17 @@ struct cmd_results *cmd_floating(int argc, char **argv) { | |||
38 | container, C_WORKSPACE); | 40 | container, C_WORKSPACE); |
39 | container_remove_child(container); | 41 | container_remove_child(container); |
40 | container_add_floating(workspace, 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 | |||
41 | seat_set_focus(config->handler_context.seat, container); | 54 | seat_set_focus(config->handler_context.seat, container); |
42 | arrange_workspace(workspace); | 55 | arrange_workspace(workspace); |
43 | } else if (container->is_floating && !wants_floating) { | 56 | } else if (container->is_floating && !wants_floating) { |