mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Working on fullscreen targeting
This commit is contained in:
parent
de446fe91e
commit
2bb7a20578
2 changed files with 13 additions and 28 deletions
|
@ -4917,42 +4917,26 @@ mat4 Application::getHMDSensorPose() const {
|
||||||
return mat4();
|
return mat4();
|
||||||
}
|
}
|
||||||
|
|
||||||
static QRect savedGeometry;
|
|
||||||
static QScreen* originalScreen = nullptr;
|
|
||||||
|
|
||||||
void Application::setFullscreen(const QScreen* target) {
|
void Application::setFullscreen(const QScreen* target) {
|
||||||
// Work around Qt bug that prevents floating menus being shown when in fullscreen mode.
|
|
||||||
// https://bugreports.qt.io/browse/QTBUG-41883
|
|
||||||
// Known issue: Top-level menu items don't highlight when cursor hovers. This is probably a side-effect of the work-around.
|
|
||||||
// TODO: Remove this work-around once the bug has been fixed and restore the following lines.
|
|
||||||
//_window->setWindowState(fullscreen ? (_window->windowState() | Qt::WindowFullScreen) :
|
|
||||||
// (_window->windowState() & ~Qt::WindowFullScreen));
|
|
||||||
if (!_window->isFullScreen()) {
|
if (!_window->isFullScreen()) {
|
||||||
savedGeometry = _window->geometry();
|
_savedGeometry = _window->geometry();
|
||||||
originalScreen = _window->windowHandle()->screen();
|
|
||||||
qDebug() << savedGeometry;
|
|
||||||
}
|
}
|
||||||
_window->hide();
|
#ifdef Q_OS_MAC
|
||||||
_window->setGeometry(target->availableGeometry());
|
_window->setGeometry(target->availableGeometry());
|
||||||
// _window->windowHandle()->setScreen((QScreen*)target);
|
#endif
|
||||||
|
_window->windowHandle()->setScreen((QScreen*)target);
|
||||||
_window->showFullScreen();
|
_window->showFullScreen();
|
||||||
if (!_aboutToQuit) {
|
|
||||||
_window->show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::unsetFullscreen() {
|
void Application::unsetFullscreen() {
|
||||||
_window->hide();
|
_window->showNormal();
|
||||||
// _window->windowHandle()->setScreen(originalScreen);
|
#ifdef Q_OS_MAC
|
||||||
// _window->setGeometry(savedGeometry);
|
QTimer* timer = new QTimer();
|
||||||
_window->setWindowState(_window->windowState() & ~Qt::WindowFullScreen);
|
timer->singleShot(1000, [=] {
|
||||||
_window->show();
|
|
||||||
|
|
||||||
QTimer* geometryTimer = new QTimer();
|
|
||||||
// FIXME do better and moving from screen to screen on unset of fullscreen
|
|
||||||
geometryTimer->singleShot(2000, [=]{
|
|
||||||
qDebug() << savedGeometry;
|
|
||||||
_window->setGeometry(savedGeometry);
|
_window->setGeometry(savedGeometry);
|
||||||
geometryTimer->deleteLater();
|
timer->deleteLater();
|
||||||
});
|
});
|
||||||
|
#else
|
||||||
|
_window->setGeometry(_savedGeometry);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -667,6 +667,7 @@ private:
|
||||||
int _numFramesSinceLastResize = 0;
|
int _numFramesSinceLastResize = 0;
|
||||||
|
|
||||||
bool _overlayEnabled = true;
|
bool _overlayEnabled = true;
|
||||||
|
QRect _savedGeometry;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Application_h
|
#endif // hifi_Application_h
|
||||||
|
|
Loading…
Reference in a new issue