make checkOffscreenPosition multiscreen aware

on a multiscreen setup, the window can be off in multiple directions

CCBUG: 336193
REVIEW: 124122
This commit is contained in:
Thomas Lübking 2015-02-06 16:29:12 +01:00
parent 171bbd662a
commit acb8016e65

View file

@ -1225,13 +1225,15 @@ void Client::checkWorkspacePosition(QRect oldGeometry, int oldDesktop)
void Client::checkOffscreenPosition(QRect* geom, const QRect& screenArea)
{
if (geom->x() > screenArea.right()) {
int screenWidth = screenArea.width();
geom->moveLeft(screenWidth - (screenWidth / 4));
if (geom->left() > screenArea.right()) {
geom->moveLeft(screenArea.right() - screenArea.width()/4);
} else if (geom->right() < screenArea.left()) {
geom->moveRight(screenArea.left() + screenArea.width()/4);
}
if (geom->y() > screenArea.bottom()) {
int screenHeight = screenArea.height();
geom->moveBottom(screenHeight - (screenHeight / 4));
if (geom->top() > screenArea.bottom()) {
geom->moveTop(screenArea.bottom() - screenArea.height()/4);
} else if (geom->bottom() < screenArea.top()) {
geom->moveBottom(screenArea.top() + screenArea.width()/4);
}
}