Minimized fix.

This commit is contained in:
BearOso 2023-07-11 15:15:51 -05:00
parent 8a4732c9f2
commit 177a802186
2 changed files with 18 additions and 0 deletions

View File

@ -6,6 +6,7 @@
#include <QtEvents>
#include <QGuiApplication>
#include <QStackedWidget>
#include <qnamespace.h>
#include <qpa/qplatformnativeinterface.h>
#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)
{

View File

@ -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;