sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit badfb4bb43f18694a584f47e81ef4f2206b442bb
parent 01c5349e1a792c40725a23d95c537419ee7cdb1a
Author: S. Christoffer Eliesen <christoffer@eliesen.no>
Date:   Sat, 28 Nov 2015 23:48:22 +0100

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:
Msway/commands.c | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sway/commands.c b/sway/commands.c @@ -344,14 +344,12 @@ static struct cmd_results *cmd_floating(int argc, char **argv) { } else if (view->is_floating && !wants_floating) { // Delete the view from the floating list and unset its is_floating flag - // Using length-1 as the index is safe because the view must be the currently - // focused floating output remove_child(view); view->is_floating = false; // Get the properly focused container, and add in the view there swayc_t *focused = container_under_pointer(); // If focused is null, it's because the currently focused container is a workspace - if (focused == NULL) { + if (focused == NULL || focused->is_floating) { focused = swayc_active_workspace(); } set_focused_container(focused);