The window refreshing handling when sizing/moving and/or emu paused is less hacky now.

Also fixed a slight bug with the "pause emu when main window minimized" thing: now it won't unpause the emu if it was manually paused before being minimized.
This commit is contained in:
luigi__ 2009-04-03 17:42:35 +00:00
parent 748127d658
commit a077ddf472
1 changed files with 22 additions and 6 deletions

View File

@ -179,6 +179,7 @@ TOOLSCLASS *ViewLights = NULL;
volatile BOOL execute = FALSE; volatile BOOL execute = FALSE;
volatile BOOL paused = TRUE; volatile BOOL paused = TRUE;
volatile BOOL pausedByMinimize = FALSE;
u32 glock = 0; u32 glock = 0;
BOOL click = FALSE; BOOL click = FALSE;
@ -1049,6 +1050,7 @@ void NDS_UnPause()
if (romloaded && paused) if (romloaded && paused)
{ {
paused = FALSE; paused = FALSE;
pausedByMinimize = FALSE;
execute = TRUE; execute = TRUE;
SPU_Pause(0); SPU_Pause(0);
INFO("Emulation unpaused\n"); INFO("Emulation unpaused\n");
@ -2205,6 +2207,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case WM_CREATE: case WM_CREATE:
{ {
pausedByMinimize = FALSE;
UpdateScreenRects(); UpdateScreenRects();
return 0; return 0;
} }
@ -2236,7 +2239,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
return 0; return 0;
} }
case WM_MOVING: case WM_MOVING:
SendMessage(hwnd, WM_PAINT, 0, 0x12345678); InvalidateRect(hwnd, NULL, FALSE); UpdateWindow(hwnd);
return 0; return 0;
case WM_MOVE: { case WM_MOVE: {
RECT rect; RECT rect;
@ -2248,7 +2251,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
} }
case WM_SIZING: case WM_SIZING:
{ {
SendMessage(hwnd, WM_PAINT, 0, 0x12345678); InvalidateRect(hwnd, NULL, FALSE); UpdateWindow(hwnd);
if(windowSize) if(windowSize)
{ {
windowSize = 0; windowSize = 0;
@ -2285,25 +2289,37 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{ {
case SIZE_MINIMIZED: case SIZE_MINIMIZED:
{ {
NDS_Pause(); if(!paused)
{
pausedByMinimize = TRUE;
NDS_Pause();
}
} }
break; break;
default: default:
{ {
NDS_UnPause(); if(pausedByMinimize)
NDS_UnPause();
UpdateWndRects(hwnd); UpdateWndRects(hwnd);
} }
break; break;
} }
return 0; return 0;
case WM_PAINT: case WM_PAINT:
if(paused || (lParam == 0x12345678))
{ {
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint(hwnd, &ps);
osd->update(); osd->update();
Display(); Display();
osd->clear(); osd->clear();
EndPaint(hwnd, &ps);
} }
return DefWindowProc(hwnd, message, wParam, lParam); return 0;
case WM_DROPFILES: case WM_DROPFILES:
{ {
char filename[MAX_PATH] = ""; char filename[MAX_PATH] = "";