Forbid passing "-1" as screen to Workspace::clientArea()

This simplifies Workspace::clientArea() implementation. Also, it will be
very handy with transition from int-based screens to AbstractOutput.
This commit is contained in:
Vlad Zahorodnii 2021-08-21 21:59:23 +03:00
parent fddbd57d09
commit a234e5aaf4
2 changed files with 2 additions and 5 deletions

View file

@ -1222,7 +1222,7 @@ void AbstractClient::handleInteractiveMoveResize(int x, int y, int x_root, int y
// Make sure the titlebar isn't behind a restricted area. We don't need to restrict
// the other directions. If not visible enough, move the window to the closest valid
// point. We bruteforce this by slowly moving the window back to its previous position
QRegion availableArea(workspace()->clientArea(FullArea, this, -1)); // On the screen
QRegion availableArea(workspace()->clientArea(FullArea, this, screens()->current()));
availableArea -= workspace()->restrictedMoveArea(VirtualDesktopManager::self()->currentDesktop());
bool transposed = false;
int requiredPixels;
@ -1350,7 +1350,7 @@ void AbstractClient::handleInteractiveMoveResize(int x, int y, int x_root, int y
if (!isUnrestrictedInteractiveMoveResize()) {
const QRegion strut = workspace()->restrictedMoveArea(VirtualDesktopManager::self()->currentDesktop());
QRegion availableArea(workspace()->clientArea(FullArea, this, -1)); // On the screen
QRegion availableArea(workspace()->clientArea(FullArea, this, screens()->current()));
availableArea -= strut; // Strut areas
bool transposed = false;
int requiredPixels;

View file

@ -2341,9 +2341,6 @@ QRect Workspace::clientArea(clientAreaOption opt, int screen, int desktop) const
Q_ASSERT(virtualDesktop);
}
if (screen == -1) {
screen = screens()->current();
}
output = kwinApp()->platform()->findOutput(screen);
Q_ASSERT(output);