aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-11-28 23:48:22 +0100
committerLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-11-29 13:00:10 +0100
commitbadfb4bb43f18694a584f47e81ef4f2206b442bb (patch)
tree98d07b0e80a9db1283f9a2447b91426c33bbad37 /sway
parentMerge pull request #272 from mikkeloscar/output-cmd-warnings (diff)
downloadsway-badfb4bb43f18694a584f47e81ef4f2206b442bb.tar.gz
sway-badfb4bb43f18694a584f47e81ef4f2206b442bb.tar.zst
sway-badfb4bb43f18694a584f47e81ef4f2206b442bb.zip
cmd_floating: Don't add non-float as sibling to float.
When turning a float to a non-float, `get_focused_container` might return another floating view, causing the active view to be inserted into the floating list on its workspace instead of the normal child list which it should. (Since it has `is_floating` as false the resulting discrepency triggered other bad behaviour eventually leading sway to crash.) This patch fixes that by simply checking floating status before making it a sibling.
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 42845f65..13fc29ad 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -344,14 +344,12 @@ static struct cmd_results *cmd_floating(int argc, char **argv) {
344 344
345 } else if (view->is_floating && !wants_floating) { 345 } else if (view->is_floating && !wants_floating) {
346 // Delete the view from the floating list and unset its is_floating flag 346 // Delete the view from the floating list and unset its is_floating flag
347 // Using length-1 as the index is safe because the view must be the currently
348 // focused floating output
349 remove_child(view); 347 remove_child(view);
350 view->is_floating = false; 348 view->is_floating = false;
351 // Get the properly focused container, and add in the view there 349 // Get the properly focused container, and add in the view there
352 swayc_t *focused = container_under_pointer(); 350 swayc_t *focused = container_under_pointer();
353 // If focused is null, it's because the currently focused container is a workspace 351 // If focused is null, it's because the currently focused container is a workspace
354 if (focused == NULL) { 352 if (focused == NULL || focused->is_floating) {
355 focused = swayc_active_workspace(); 353 focused = swayc_active_workspace();
356 } 354 }
357 set_focused_container(focused); 355 set_focused_container(focused);