Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -4917,42 +4917,26 @@ mat4 Application::getHMDSensorPose() const { · 4916 unmodified lines | ||
| 4917 | 4917 | return mat4(); |
| 4918 | 4918 | } |
| 4919 | 4919 | |
| 4920 | −static QRect savedGeometry; | |
| 4921 | −static QScreen* originalScreen = nullptr; | |
| 4922 | − | |
| 4923 | 4920 | 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)); | |
| 4930 | 4921 | if (!_window->isFullScreen()) { |
| 4931 | − savedGeometry = _window->geometry(); | |
| 4932 | − originalScreen = _window->windowHandle()->screen(); | |
| 4933 | − qDebug() << savedGeometry; | |
| 4922 | + _savedGeometry = _window->geometry(); | |
| 4934 | 4923 | } |
| 4935 | − _window->hide(); | |
| 4924 | +#ifdef Q_OS_MAC | |
| 4936 | 4925 | _window->setGeometry(target->availableGeometry()); |
| 4937 | −// _window->windowHandle()->setScreen((QScreen*)target); | |
| 4926 | +#endif | |
| 4927 | + _window->windowHandle()->setScreen((QScreen*)target); | |
| 4938 | 4928 | _window->showFullScreen(); |
| 4939 | − if (!_aboutToQuit) { | |
| 4940 | − _window->show(); | |
| 4941 | − } | |
| 4942 | 4929 | } |
| 4943 | 4930 | |
| 4944 | 4931 | 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, [=] { | |
| 4955 | 4936 | _window->setGeometry(savedGeometry); |
| 4956 | − geometryTimer->deleteLater(); | |
| 4937 | + timer->deleteLater(); | |
| 4957 | 4938 | }); |
| 4939 | +#else | |
| 4940 | + _window->setGeometry(_savedGeometry); | |
| 4941 | +#endif | |
| 4958 | 4942 | } |