Merge pull request #3 from RipleyTom/OpenGLFix

Fix openGL
This commit is contained in:
Megamouse 2017-07-20 22:29:46 +02:00 committed by Ivan
parent f8c2e198c5
commit e93fbc6900
2 changed files with 11 additions and 11 deletions

View File

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

View File

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