From: Orestis Floros Date: Sat, 17 Mar 2018 18:43:11 +0000 (+0200) Subject: floating_maybe_reassign_ws: use get_output_from_rect X-Git-Tag: 4.16~120^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=refs%2Fpull%2F3184%2Fhead;p=i3%2Fi3 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. --- 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");