History

Working on fullscreen targeting

Brad Davis committed 11 years ago

Commit 2bb7a201 parent de446fe2 files · +13 −28Browse files

Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all

Unified · Split

interface/src/Application.cpp+12−28
@@ -4917,42 +4917,26 @@ mat4 Application::getHMDSensorPose() const { · 4916 unmodified lines
49174917 return mat4();
49184918 }
49194919
4920−static QRect savedGeometry;
4921−static QScreen* originalScreen = nullptr;
4922−
49234920 void Application::setFullscreen(const QScreen* target) {
4924− // Work around Qt bug that prevents floating menus being shown when in fullscreen mode.
4925− // https://bugreports.qt.io/browse/QTBUG-41883
4926− // Known issue: Top-level menu items don't highlight when cursor hovers. This is probably a side-effect of the work-around.
4927− // TODO: Remove this work-around once the bug has been fixed and restore the following lines.
4928− //_window->setWindowState(fullscreen ? (_window->windowState() | Qt::WindowFullScreen) :
4929− // (_window->windowState() & ~Qt::WindowFullScreen));
49304921 if (!_window->isFullScreen()) {
4931− savedGeometry = _window->geometry();
4932− originalScreen = _window->windowHandle()->screen();
4933− qDebug() << savedGeometry;
4922+ _savedGeometry = _window->geometry();
49344923 }
4935− _window->hide();
4924+#ifdef Q_OS_MAC
49364925 _window->setGeometry(target->availableGeometry());
4937−// _window->windowHandle()->setScreen((QScreen*)target);
4926+#endif
4927+ _window->windowHandle()->setScreen((QScreen*)target);
49384928 _window->showFullScreen();
4939− if (!_aboutToQuit) {
4940− _window->show();
4941− }
49424929 }
49434930
49444931 void Application::unsetFullscreen() {
4945− _window->hide();
4946−// _window->windowHandle()->setScreen(originalScreen);
4947−// _window->setGeometry(savedGeometry);
4948− _window->setWindowState(_window->windowState() & ~Qt::WindowFullScreen);
4949− _window->show();
4950−
4951− QTimer* geometryTimer = new QTimer();
4952− // FIXME do better and moving from screen to screen on unset of fullscreen
4953− geometryTimer->singleShot(2000, [=]{
4954− qDebug() << savedGeometry;
4932+ _window->showNormal();
4933+#ifdef Q_OS_MAC
4934+ QTimer* timer = new QTimer();
4935+ timer->singleShot(1000, [=] {
49554936 _window->setGeometry(savedGeometry);
4956− geometryTimer->deleteLater();
4937+ timer->deleteLater();
49574938 });
4939+#else
4940+ _window->setGeometry(_savedGeometry);
4941+#endif
49584942 }