mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-13 05:37:42 +02:00
When java disappoints try C++
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -91,6 +91,9 @@
|
||||
#include "tools/BaseProfiler.h"
|
||||
|
||||
#include <QActionGroup>
|
||||
#include <QMainWindow>
|
||||
#include <QScreen>
|
||||
#include <QWindow>
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include "MangoHud.h"
|
||||
@ -752,11 +755,29 @@ QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftT
|
||||
// window size, title and state, legacy
|
||||
{
|
||||
QString windowParams;
|
||||
if (settings()->get("LaunchMaximized").toBool())
|
||||
windowParams = "maximized";
|
||||
else
|
||||
if (settings()->get("LaunchMaximized").toBool()) {
|
||||
// FIXME doesn't support maximisation
|
||||
if (getLauncher() == "standard") {
|
||||
auto screen = QGuiApplication::primaryScreen();
|
||||
auto screenGeometry = screen->availableSize();
|
||||
|
||||
// small hack to get the widow decorations
|
||||
for (auto w : QApplication::topLevelWidgets()) {
|
||||
auto mainWindow = qobject_cast<QMainWindow*>(w);
|
||||
if (mainWindow) {
|
||||
screenGeometry = screenGeometry.shrunkBy(mainWindow->windowHandle()->frameMargins());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
windowParams = QString("%1x%2").arg(screenGeometry.width()).arg(screenGeometry.height());
|
||||
} else {
|
||||
windowParams = "maximized";
|
||||
}
|
||||
} else {
|
||||
windowParams =
|
||||
QString("%1x%2").arg(settings()->get("MinecraftWinWidth").toInt()).arg(settings()->get("MinecraftWinHeight").toInt());
|
||||
}
|
||||
launchScript += "windowTitle " + windowTitle() + "\n";
|
||||
launchScript += "windowParams " + windowParams + "\n";
|
||||
}
|
||||
|
Reference in New Issue
Block a user