aboutsummaryrefslogtreecommitdiff
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 91dfa2b2..8a81cd76 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -183,16 +183,19 @@ static bool cmd_floating(struct sway_config *config, int argc, char **argv) {
view->is_floating = true;
for (i = 0; i < view->parent->children->length; i++) {
if (view->parent->children->items[i] == view) {
- // Cut down on width/height so it's obvious that you've gone floating
- // if this is the only view
- view->width = view->width - 30;
- view->height = view->height - 30;
+ // Try to use desired geometry to set w/h
+ if (view->desired_width != -1) {
+ view->width = view->desired_width;
+ }
+ if (view->desired_height != -1) {
+ view->height = view->desired_height;
+ }
// Swap from the list of whatever container the view was in
// to the workspace->floating list
- // TODO: Destroy any remaining empty containers
list_del(view->parent->children, i);
list_add(active_workspace->floating, view);
+ destroy_container(view->parent);
// Set the new position of the container and arrange windows
view->x = (active_workspace->width - view->width)/2;