Fix D3D window close

Fix D3D window close
This commit is contained in:
Andy Vandijck 2025-07-07 12:44:50 +02:00
parent d49e6a31e2
commit e018c1c41a
2 changed files with 12 additions and 1 deletions

View File

@ -1254,8 +1254,10 @@ void GameArea::OnIdle(wxIdleEvent& event)
w = panel->GetWindow();
if (panel->d3dframe != NULL)
if (panel->d3dframe != NULL) {
panel->d3dframe->Bind(VBAM_EVT_USER_INPUT, &GameArea::OnUserInput, this);
panel->d3dframe->Bind(wxEVT_CLOSE_WINDOW, &GameArea::OnD3DClose, this);
}
// set up event handlers
w->Bind(VBAM_EVT_USER_INPUT, &GameArea::OnUserInput, this);
@ -1410,6 +1412,14 @@ static Display* GetX11Display() {
}
#endif // __WXGTK__
void GameArea::OnD3DClose(wxCloseEvent& ev)
{
(void)ev;
delete panel->d3dframe;
panel->d3dframe = NULL;
}
void GameArea::OnUserInput(widgets::UserInputEvent& event) {
bool emulated_key_pressed = false;
for (const auto& event_data : event.data()) {

View File

@ -546,6 +546,7 @@ protected:
void EraseBackground(wxEraseEvent& ev);
void OnSize(wxSizeEvent& ev);
void OnKillFocus(wxFocusEvent& ev);
void OnD3DClose(wxCloseEvent& ev);
#ifndef NO_FFMPEG
recording::MediaRecorder snd_rec, vid_rec;