1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

Pass only the minimal amount of window messages to game wndproc

This commit is contained in:
Toni Spets 2010-11-21 17:50:20 +02:00
parent c07d836578
commit 158344348d

13
main.c
View File

@ -256,6 +256,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_DESTROY:
return ddraw->WndProc(hWnd, uMsg, wParam, lParam);
case WM_SYSCOMMAND:
if(wParam == SC_CLOSE)
{
@ -273,9 +275,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
case WM_NCACTIVATE:
/* game's drawing loop stops when it inactivates, so don't */
DefWindowProc(hWnd, uMsg, wParam, lParam);
if(wParam == FALSE)
{
mouse_unlock();
@ -292,7 +291,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
ShowWindow(ddraw->hWnd, SW_RESTORE);
}
}
return 0;
break;
case WM_KEYDOWN:
if(wParam == VK_CONTROL || wParam == VK_TAB)
{
@ -310,7 +309,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
}
#endif
break;
return ddraw->WndProc(hWnd, uMsg, wParam, lParam);
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
@ -321,10 +320,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return 0;
}
lParam = MAKELPARAM(ddraw->cursor.x, ddraw->cursor.y);
break;
return ddraw->WndProc(hWnd, uMsg, wParam, lParam);
}
return ddraw->WndProc(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
HRESULT __stdcall ddraw_SetCooperativeLevel(IDirectDrawImpl *This, HWND hWnd, DWORD dwFlags)