Commit fa92aef9 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

Move the geometry restore stuff for fullscreen into a new method

parent 3305089a
......@@ -999,6 +999,9 @@ void AbstractClient::finishMoveResize(bool cancel)
}
checkScreen(); // needs to be done because clientFinishUserMovedResized has not yet re-activated online alignment
if (screen() != moveResizeStartScreen()) {
if (isFullScreen()) {
updateGeometryRestoresForFullscreen();
}
workspace()->sendClientToScreen(this, screen()); // checks rule validity
if (maximizeMode() != MaximizeRestore) {
checkWorkspacePosition();
......@@ -3109,23 +3112,7 @@ void AbstractClient::sendToScreen(int newScreen)
}
if (isFullScreen()) {
QRect newFullScreenGeometryRestore = screenArea;
if (!(maximizeMode() & MaximizeVertical)) {
newFullScreenGeometryRestore.setHeight(geometryRestore().height());
}
if (!(maximizeMode() & MaximizeHorizontal)) {
newFullScreenGeometryRestore.setWidth(geometryRestore().width());
}
newFullScreenGeometryRestore.setSize(newFullScreenGeometryRestore.size().boundedTo(screenArea.size()));
QSize move = (screenArea.size() - newFullScreenGeometryRestore.size()) / 2;
newFullScreenGeometryRestore.translate(move.width(), move.height());
QRect newGeometryRestore = QRect(screenArea.topLeft(), geometryRestore().size().boundedTo(screenArea.size()));
move = (screenArea.size() - newGeometryRestore.size()) / 2;
newGeometryRestore.translate(move.width(), move.height());
setFullscreenGeometryRestore(newFullScreenGeometryRestore);
setGeometryRestore(newGeometryRestore);
updateGeometryRestoresForFullscreen();
checkWorkspacePosition(oldGeom);
} else {
// align geom_restore - checkWorkspacePosition operates on it
......@@ -3149,6 +3136,28 @@ void AbstractClient::sendToScreen(int newScreen)
(*it)->sendToScreen(newScreen);
}
void AbstractClient::updateGeometryRestoresForFullscreen()
{
QRect screenArea = workspace()->clientArea(MaximizeArea, screen(), desktop());
QRect newFullScreenGeometryRestore = screenArea;
if (!(maximizeMode() & MaximizeVertical)) {
newFullScreenGeometryRestore.setHeight(geometryRestore().height());
}
if (!(maximizeMode() & MaximizeHorizontal)) {
newFullScreenGeometryRestore.setWidth(geometryRestore().width());
}
newFullScreenGeometryRestore.setSize(newFullScreenGeometryRestore.size().boundedTo(screenArea.size()));
QSize move = (screenArea.size() - newFullScreenGeometryRestore.size()) / 2;
newFullScreenGeometryRestore.translate(move.width(), move.height());
QRect newGeometryRestore = QRect(screenArea.topLeft(), geometryRestore().size().boundedTo(screenArea.size()));
move = (screenArea.size() - newGeometryRestore.size()) / 2;
newGeometryRestore.translate(move.width(), move.height());
setFullscreenGeometryRestore(newFullScreenGeometryRestore);
setGeometryRestore(newGeometryRestore);
}
void AbstractClient::checkWorkspacePosition(QRect oldGeometry, int oldDesktop, QRect oldClientGeometry)
{
if (isDock() || isDesktop() || !isPlaceable()) {
......
......@@ -453,6 +453,7 @@ public:
*/
bool isSpecialWindow() const;
void sendToScreen(int screen);
void updateGeometryRestoresForFullscreen();
const QKeySequence &shortcut() const {
return _shortcut;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment