win32: Flush message queue between driver changes.

This commit is contained in:
BearOso 2023-02-22 19:14:05 -06:00
parent d8584b9d94
commit 1d0dab45da
2 changed files with 20 additions and 8 deletions

View File

@ -147,7 +147,11 @@ void COpenGL::DeInitialize()
wglDeleteContext(hRC);
hRC = NULL;
}
if (hDC)
{
ReleaseDC(hWnd, hDC);
hDC = NULL;
}
hWnd = NULL;
afterRenderWidth = 0;
afterRenderHeight = 0;

View File

@ -98,6 +98,15 @@ void WinChangeWindowSize(unsigned int newWidth, unsigned int newHeight)
S9xDisplayOutput->ChangeRenderSize(newWidth,newHeight);
}
static void FlushMessageQueue()
{
for (MSG msg; PeekMessage(&msg, GUI.hWnd, 0, 0, PM_NOREMOVE);)
{
GetMessage(&msg, GUI.hWnd, 0, 0);
DispatchMessage(&msg);
}
}
/* WinDisplayReset
initializes the currently selected display output and
reinitializes the core graphics rendering
@ -107,8 +116,7 @@ returns true if successful, false otherwise
bool WinDisplayReset(void)
{
S9xDisplayOutput->DeInitialize();
if (S9xDisplayOutput == (IS9xDisplayOutput *)&VulkanDriver && GUI.outputMethod == OPENGL)
Sleep(500);
FlushMessageQueue();
switch(GUI.outputMethod) {
default: