Changeset View
Changeset View
Standalone View
Standalone View
app/mainwindow.cpp
Context not available. | |||||
56 | #include <QWindow> | 56 | #include <QWindow> | ||
---|---|---|---|---|---|
57 | #include <QDBusConnection> | 57 | #include <QDBusConnection> | ||
58 | #include <QPlatformSurfaceEvent> | 58 | #include <QPlatformSurfaceEvent> | ||
59 | #include <QScreen> | ||||
59 | 60 | | |||
60 | #if HAVE_X11 | 61 | #if HAVE_X11 | ||
61 | #include <QX11Info> | 62 | #include <QX11Info> | ||
Context not available. | |||||
1427 | 1428 | | |||
1428 | int MainWindow::getScreen() | 1429 | int MainWindow::getScreen() | ||
1429 | { | 1430 | { | ||
1430 | if (!Settings::screen()) | 1431 | if (!Settings::screen() || Settings::screen() > QGuiApplication::screens().length()) | ||
1431 | return QApplication::desktop()->screenNumber(QCursor::pos()); | 1432 | return QGuiApplication::screens().indexOf(QGuiApplication::screenAt(QCursor::pos())); | ||
1432 | else | 1433 | else | ||
1433 | return Settings::screen() - 1; | 1434 | return Settings::screen() - 1; | ||
1434 | } | 1435 | } | ||
1435 | 1436 | | |||
1437 | QRect MainWindow::getScreenGeometry() | ||||
1438 | { | ||||
1439 | QScreen *screen = QGuiApplication::screens().at(getScreen()); | ||||
1440 | QRect screenGeometry = screen->geometry(); | ||||
1441 | screenGeometry.moveTo(screenGeometry.topLeft() / screen->devicePixelRatio()); | ||||
1442 | return screenGeometry; | ||||
1443 | } | ||||
1444 | | ||||
1436 | QRect MainWindow::getDesktopGeometry() | 1445 | QRect MainWindow::getDesktopGeometry() | ||
1437 | { | 1446 | { | ||
1438 | QRect screenGeometry = QApplication::desktop()->screenGeometry(getScreen()); | 1447 | QRect screenGeometry = getScreenGeometry(); | ||
1439 | 1448 | | |||
1440 | QAction* action = actionCollection()->action(QStringLiteral("view-full-screen")); | 1449 | QAction* action = actionCollection()->action(QStringLiteral("view-full-screen")); | ||
1441 | 1450 | | |||
Context not available. |