Move the "noOffscreensWindow" into a method so we can reuse it
This commit is contained in:
parent
e79cf50087
commit
c0b89870b9
2 changed files with 15 additions and 9 deletions
2
client.h
2
client.h
|
@ -572,6 +572,8 @@ private:
|
|||
Time readUserCreationTime() const;
|
||||
void startupIdChanged();
|
||||
|
||||
void checkOffscreenPosition (QRect& geom, const QRect& screenArea);
|
||||
|
||||
Window client;
|
||||
Window wrapper;
|
||||
KDecoration* decoration;
|
||||
|
|
22
geometry.cpp
22
geometry.cpp
|
@ -1157,15 +1157,7 @@ void Client::checkWorkspacePosition(const QRect &geo)
|
|||
newGeom.x() + newGeom.width() - 1));
|
||||
}
|
||||
|
||||
if (newGeom.x() > screenArea.right()) {
|
||||
int screenWidth = screenArea.width();
|
||||
newGeom.moveLeft(screenWidth - (screenWidth / 4));
|
||||
}
|
||||
if (newGeom.y() > screenArea.bottom()) {
|
||||
int screenHeight = screenArea.height();
|
||||
newGeom.moveBottom(screenHeight - (screenHeight / 4));
|
||||
}
|
||||
|
||||
checkOffscreenPosition(newGeom, screenArea);
|
||||
// Obey size hints. TODO: We really should make sure it stays in the right place
|
||||
newGeom.setSize(adjustedSize(newGeom.size()));
|
||||
|
||||
|
@ -1174,6 +1166,18 @@ void Client::checkWorkspacePosition(const QRect &geo)
|
|||
}
|
||||
}
|
||||
|
||||
void Client::checkOffscreenPosition(QRect& geom, const QRect& screenArea)
|
||||
{
|
||||
if (geom.x() > screenArea.right()) {
|
||||
int screenWidth = screenArea.width();
|
||||
geom.moveLeft(screenWidth - (screenWidth / 4));
|
||||
}
|
||||
if (geom.y() > screenArea.bottom()) {
|
||||
int screenHeight = screenArea.height();
|
||||
geom.moveBottom(screenHeight - (screenHeight / 4));
|
||||
}
|
||||
}
|
||||
|
||||
// Try to be smart about keeping the clients visible.
|
||||
// If the client was fully inside the workspace before, try to keep
|
||||
// it still inside the workarea, possibly moving it or making it smaller if possible,
|
||||
|
|
Loading…
Reference in a new issue