diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/main-window.cpp | 29 | ||||
-rw-r--r-- | gui/main-window.hpp | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/gui/main-window.cpp b/gui/main-window.cpp index 225d0629..49de59d1 100644 --- a/gui/main-window.cpp +++ b/gui/main-window.cpp @@ -12,6 +12,8 @@ #include "opentrack-library-path.h" #include "new_file_dialog.h" #include "migration/migration.hpp" +#include "compat/check-visible.hpp" + #include <QFile> #include <QFileDialog> #include <QDesktopServices> @@ -561,6 +563,11 @@ void MainWindow::set_title(const QString& game_title_) void MainWindow::showHeadPose() { + set_is_visible(*this); + + if (!check_is_visible()) + return; + double mapped[6], raw[6]; work->tracker->raw_and_mapped_pose(mapped, raw); @@ -840,6 +847,28 @@ void MainWindow::closeEvent(QCloseEvent*) exit(); } +bool MainWindow::event(QEvent* event) +{ + using t = QEvent::Type; + + if (work) + { + switch (event->type()) + { + case t::Show: + case t::Hide: + case t::WindowActivate: + case t::WindowDeactivate: + case t::WindowStateChange: + set_is_visible(*this, true); + /*FALLTHROUGH*/ + default: + break; + } + } + return QMainWindow::event(event); +} + bool MainWindow::is_tray_enabled() { return s.tray_enabled && QSystemTrayIcon::isSystemTrayAvailable(); diff --git a/gui/main-window.hpp b/gui/main-window.hpp index d49be9c1..02e65d4c 100644 --- a/gui/main-window.hpp +++ b/gui/main-window.hpp @@ -95,6 +95,7 @@ class MainWindow : public QMainWindow, private State void changeEvent(QEvent* e) override; void closeEvent(QCloseEvent*) override; + bool event(QEvent *event) override; bool maybe_hide_to_tray(QEvent* e); // only use in impl file since no definition in header! |