From 8b4ffd5cc9c82bfb7ef6303516e1a5721380039f Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 2 Sep 2022 17:48:47 +0300 Subject: [PATCH] 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. --- src/xdgshellwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xdgshellwindow.cpp b/src/xdgshellwindow.cpp index bb7f46866c..52f226f17e 100644 --- a/src/xdgshellwindow.cpp +++ b/src/xdgshellwindow.cpp @@ -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();