summaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 6e1f1848..7dde78bd 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -182,20 +182,22 @@ static bool cmd_floating(struct sway_config *config, int argc, char **argv) {
182 if (view->type != C_VIEW) { 182 if (view->type != C_VIEW) {
183 return true; 183 return true;
184 } 184 }
185 int i;
186 // Change from nonfloating to floating 185 // Change from nonfloating to floating
187 if (!view->is_floating) { 186 if (!view->is_floating) {
188 remove_child(view); 187 //Remove view from its current location
188 destroy_container(remove_child(view));
189
190 //and move it into workspace floating
189 add_floating(active_workspace,view); 191 add_floating(active_workspace,view);
190 view->x = (active_workspace->width - view->width)/2; 192 view->x = (active_workspace->width - view->width)/2;
191 view->y = (active_workspace->height - view->height)/2; 193 view->y = (active_workspace->height - view->height)/2;
192 arrange_windows(active_workspace, -1, -1);
193 if (view->desired_width != -1) { 194 if (view->desired_width != -1) {
194 view->width = view->desired_width; 195 view->width = view->desired_width;
195 } 196 }
196 if (view->desired_height != -1) { 197 if (view->desired_height != -1) {
197 view->height = view->desired_height; 198 view->height = view->desired_height;
198 } 199 }
200 arrange_windows(active_workspace, -1, -1);
199 } else { 201 } else {
200 // Delete the view from the floating list and unset its is_floating flag 202 // Delete the view from the floating list and unset its is_floating flag
201 // Using length-1 as the index is safe because the view must be the currently 203 // Using length-1 as the index is safe because the view must be the currently
@@ -221,10 +223,10 @@ static bool cmd_floating(struct sway_config *config, int argc, char **argv) {
221 add_sibling(focused, view); 223 add_sibling(focused, view);
222 } 224 }
223 // Refocus on the view once its been put back into the layout 225 // Refocus on the view once its been put back into the layout
224 set_focused_container(view);
225 arrange_windows(active_workspace, -1, -1); 226 arrange_windows(active_workspace, -1, -1);
226 return true; 227 return true;
227 } 228 }
229 set_focused_container(view);
228 } 230 }
229 231
230 return true; 232 return true;