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.
next
Orestis Floros 2018-03-17 20:43:11 +02:00
parent 128122e766
commit 8e9b26fc90
1 changed files with 1 additions and 3 deletions

View File

@ -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");