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:
parent
171bbd662a
commit
acb8016e65
1 changed files with 8 additions and 6 deletions
14
geometry.cpp
14
geometry.cpp
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue