diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index ddb602e46d..eacfc2740f 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -34,7 +34,8 @@ gs_frame::gs_frame(const QString& title, int w, int h, QIcon appIcon) resize(w, h); - setVisibility(QWindow::Visibility::AutomaticVisibility); + setVisibility(Hidden); + create(); // Change cursor when in fullscreen. connect(this, &QWindow::visibilityChanged, this, &gs_frame::HandleCursor); @@ -97,7 +98,7 @@ void gs_frame::OnFullScreen() void gs_frame::close() { Emu.Stop(); - Emu.CallAfter([=]() {QWindow::close(); deleteLater(); }); + Emu.CallAfter([=]() { deleteLater(); }); } bool gs_frame::shown() @@ -215,13 +216,12 @@ void gs_frame::HandleCursor(QWindow::Visibility visibility) } } -/** Override qt hideEvent. - * For some reason beyond me, hitting X hides the game window instead of closes. To remedy this, I forcefully murder it for commiting this transgression. - * Closing the window has a side-effect of also stopping the emulator. -*/ -void gs_frame::hideEvent(QHideEvent* ev) +bool gs_frame::event(QEvent* ev) { - Q_UNUSED(ev); - - close(); + if (ev->type()==QEvent::Close) + { + close(); + return true; + } + return false; } diff --git a/rpcs3/rpcs3qt/gs_frame.h b/rpcs3/rpcs3qt/gs_frame.h index eaf711c4b6..da83298794 100644 --- a/rpcs3/rpcs3qt/gs_frame.h +++ b/rpcs3/rpcs3qt/gs_frame.h @@ -39,7 +39,7 @@ protected: int client_width() override; int client_height() override; - void hideEvent(QHideEvent* ev) override; + bool event(QEvent* ev) override; private Q_SLOTS: void HandleCursor(QWindow::Visibility visibility); };