wayland: Relax conditions in strut edge heuristics

When the output layout changes, it's possible that the bottom panel
will float in the middle of the screen, e.g. left edge of the panel
touches the left screen edge while top and bottom panel edges touch no
screen edge.

In that case, XdgToplevelWindow::strutRect() will erroneously indicate
that the left strut rect is valid, while it's not.

Since the strut area is garbage, Window::checkWorkspacePosition() may
incorrectly move and resize windows during output layout change.

The proposed heuristic will fail with square panels, but those are rare
and the only way to detect the correct strut area would be to use the
layer shell protocol.
This commit is contained in:
Vlad Zahorodnii 2022-09-02 17:48:47 +03:00
parent 82c09653aa
commit 8b4ffd5cc9

View file

@ -791,22 +791,22 @@ StrutRect XdgToplevelWindow::strutRect(StrutArea area) const
switch (area) {
case StrutAreaTop:
if (top && ((!left && !right) || horizontal)) {
if (top && horizontal) {
return StrutRect(windowRect, StrutAreaTop);
}
return StrutRect();
case StrutAreaRight:
if (right && ((!top && !bottom) || !horizontal)) {
if (right && !horizontal) {
return StrutRect(windowRect, StrutAreaRight);
}
return StrutRect();
case StrutAreaBottom:
if (bottom && ((!left && !right) || horizontal)) {
if (bottom && horizontal) {
return StrutRect(windowRect, StrutAreaBottom);
}
return StrutRect();
case StrutAreaLeft:
if (left && ((!top && !bottom) || !horizontal)) {
if (left && !horizontal) {
return StrutRect(windowRect, StrutAreaLeft);
}
return StrutRect();