From 8e9b26fc9028d19b4756bd8e3ed3a3ecfcf5fd6f Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sat, 17 Mar 2018 20:43:11 +0200 Subject: [PATCH] floating_maybe_reassign_ws: use get_output_from_rect This significantly reduces the number of ELOGs while dragging floating containers. The behaviour is improved since floating containers in the edge of the screen will still get reassigned to their closest workspace. For example, consider this setup: fake-outputs 500x500+0+0,500x500+500+0 Now, open a window in the right output and run: i3-msg floating enable, move position 0 px 450 px The window is on the bottom edge of the left workspace but if you run: i3-msg focus mode_toggle focus will go to the right workspace since floating_maybe_reassign_ws didn't change the assigned workspace of the floating container. --- src/floating.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/floating.c b/src/floating.c index 1c310abe..13b30f16 100644 --- a/src/floating.c +++ b/src/floating.c @@ -413,9 +413,7 @@ void floating_raise_con(Con *con) { * */ bool floating_maybe_reassign_ws(Con *con) { - Output *output = get_output_containing( - con->rect.x + (con->rect.width / 2), - con->rect.y + (con->rect.height / 2)); + Output *output = get_output_from_rect(con->rect); if (!output) { ELOG("No output found at destination coordinates?\n"); -- 2.39.5