diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-07-28 16:23:55 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-07-28 16:23:55 +0200 |
commit | 7a60015ba99125b493d1cb85afc072bcebb97681 (patch) | |
tree | c161b23b42e46cac98093f8cb0940fe35c42e0a1 /gui/main-window.cpp | |
parent | 720026a79cd6aa33c4180f2241425cdd8829b36b (diff) |
gui: don't update the main window if it's hidden
Diffstat (limited to 'gui/main-window.cpp')
-rw-r--r-- | gui/main-window.cpp | 29 |
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(); |