diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index 5b8b654ab829e128604f0fdbc42531fb258d508a..9107f5236aaf899f10498a76186a9d30347f7556 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -127,25 +127,22 @@ OBSBasic::OBSBasic(QWidget *parent) ui->sources->setItemDelegate(new VisibilityItemDelegate(ui->sources)); - int width = config_get_int(App()->GlobalConfig(), "BasicWindow", "cx"); - - // Check if no values are saved (new installation). - if (width != 0) { - int height = config_get_int(App()->GlobalConfig(), - "BasicWindow", "cy"); - int posx = config_get_int(App()->GlobalConfig(), "BasicWindow", - "posx"); - int posy = config_get_int(App()->GlobalConfig(), "BasicWindow", - "posy"); - + const char *geometry = config_get_string(App()->GlobalConfig(), + "BasicWindow", "geometry"); + if (geometry != NULL) { + QByteArray byteArray = QByteArray::fromBase64( + QByteArray(geometry)); + restoreGeometry(byteArray); + + QRect windowGeometry = normalGeometry(); + int posx = windowGeometry.x(); + int posy = windowGeometry.y(); if (!WindowPositionValid(posx, posy)) { QRect rect = App()->desktop()->availableGeometry(); setGeometry(QStyle::alignedRect( Qt::LeftToRight, Qt::AlignCenter, size(), rect)); - } else { - setGeometry(posx, posy, width, height); } } @@ -1450,14 +1447,8 @@ OBSBasic::~OBSBasic() QList splitterSizes = ui->mainSplitter->sizes(); bool alwaysOnTop = IsAlwaysOnTop(this); - config_set_int(App()->GlobalConfig(), "BasicWindow", "cx", - lastGeom.width()); - config_set_int(App()->GlobalConfig(), "BasicWindow", "cy", - lastGeom.height()); - config_set_int(App()->GlobalConfig(), "BasicWindow", "posx", - lastGeom.x()); - config_set_int(App()->GlobalConfig(), "BasicWindow", "posy", - lastGeom.y()); + config_set_string(App()->GlobalConfig(), "BasicWindow", "geometry", + saveGeometry().toBase64().constData()); config_set_int(App()->GlobalConfig(), "BasicWindow", "splitterTop", splitterSizes[0]); config_set_int(App()->GlobalConfig(), "BasicWindow", "splitterBottom",