summaryrefslogtreecommitdiffhomepage
path: root/gui/main-window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/main-window.cpp')
-rw-r--r--gui/main-window.cpp29
1 files changed, 29 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();