diff --git a/qt/src/EmuMainWindow.cpp b/qt/src/EmuMainWindow.cpp index 8b996672..94677508 100644 --- a/qt/src/EmuMainWindow.cpp +++ b/qt/src/EmuMainWindow.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "EmuMainWindow.hpp" @@ -470,6 +471,22 @@ bool EmuMainWindow::event(QEvent *event) app->pause(); } break; + case QEvent::WindowStateChange: + { + auto scevent = (QWindowStateChangeEvent *)event; + if (!(scevent->oldState() & Qt::WindowMinimized) && windowState() & Qt::WindowMinimized) + { + minimized_pause = true; + app->pause(); + } + else if (minimized_pause && !(windowState() & Qt::WindowMinimized)) + { + minimized_pause = false; + app->unpause(); + } + + break; + } case QEvent::MouseMove: if (!cursor_visible) { diff --git a/qt/src/EmuMainWindow.hpp b/qt/src/EmuMainWindow.hpp index e26b41fd..dcc0832f 100644 --- a/qt/src/EmuMainWindow.hpp +++ b/qt/src/EmuMainWindow.hpp @@ -46,6 +46,7 @@ class EmuMainWindow : public QMainWindow bool manual_pause = false; bool focus_pause = false; + bool minimized_pause = false; bool using_stacked_widget = false; QMenu *load_state_menu; QMenu *save_state_menu;