Refine order of previous/next screens in Workspace::findOutput

A screen should be considered further top, and therefore more previous, only it is strictly above the other with no vertical overlap, and not if only the vertical center is higher while they are horizontally on a line. Otherwise, on a left to right setup with screens of different resolutions aligned at the edges (and thus different vertical centesr), the order will be unintuitive.

BUG: 467996
FIXED-IN: 5.27
This commit is contained in:
Natalie Clarius 2023-05-16 07:54:06 +00:00 committed by Vlad Zahorodnii
parent 966416cb60
commit 9a3da09899

View file

@ -1247,7 +1247,9 @@ Output *Workspace::findOutput(Output *reference, Direction direction, bool wrapA
return o1->geometry().center().y() < o2->geometry().center().y();
default:
// order outputs from top to bottom, then left to right
return (o1->geometry().center().y() < o2->geometry().center().y() || (o1->geometry().center().y() == o2->geometry().center().y() && o1->geometry().center().x() < o2->geometry().center().x()));
// case 1: o1 is above o2
// case 2: o1 is not below o2, and o1 is left of o2
return o1->geometry().y() + o1->geometry().height() <= o2->geometry().top() || (o1->geometry().top() < o2->geometry().y() + o2->geometry().height() && o1->geometry().left() < o2->geometry().left());
}
});