summaryrefslogtreecommitdiffstats
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) {
183 view->is_floating = true; 183 view->is_floating = true;
184 for (i = 0; i < view->parent->children->length; i++) { 184 for (i = 0; i < view->parent->children->length; i++) {
185 if (view->parent->children->items[i] == view) { 185 if (view->parent->children->items[i] == view) {
186 // Cut down on width/height so it's obvious that you've gone floating 186 // Try to use desired geometry to set w/h
187 // if this is the only view 187 if (view->desired_width != -1) {
188 view->width = view->width - 30; 188 view->width = view->desired_width;
189 view->height = view->height - 30; 189 }
190 if (view->desired_height != -1) {
191 view->height = view->desired_height;
192 }
190 193
191 // Swap from the list of whatever container the view was in 194 // Swap from the list of whatever container the view was in
192 // to the workspace->floating list 195 // to the workspace->floating list
193 // TODO: Destroy any remaining empty containers
194 list_del(view->parent->children, i); 196 list_del(view->parent->children, i);
195 list_add(active_workspace->floating, view); 197 list_add(active_workspace->floating, view);
198 destroy_container(view->parent);
196 199
197 // Set the new position of the container and arrange windows 200 // Set the new position of the container and arrange windows
198 view->x = (active_workspace->width - view->width)/2; 201 view->x = (active_workspace->width - view->width)/2;