Index: ddraw/glDirectDraw.cpp |
— | — | @@ -1513,7 +1513,7 @@ |
1514 | 1514 | internalrefresh = primaryrefresh = screenrefresh = devmode.dmDisplayFrequency;
|
1515 | 1515 | primarybpp = bpp;
|
1516 | 1516 | InitGL(x,y,bpp,fullscreen,internalrefresh,hWnd,this,devwnd);
|
1517 | | - if (fullscreen) InstallDXGLFullscreenHook(hWnd);
|
| 1517 | + if (fullscreen) InstallDXGLFullscreenHook(hWnd,this);
|
1518 | 1518 | cooplevel = dwFlags;
|
1519 | 1519 | TRACE_EXIT(23,DD_OK);
|
1520 | 1520 | return DD_OK;
|
— | — | @@ -1587,6 +1587,12 @@ |
1588 | 1588 | TRACE_ENTER(6,14,this,8,dwWidth,8,dwHeight,8,dwBPP,8,dwRefreshRate,9,dwFlags);
|
1589 | 1589 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1590 | 1590 | if (dwFlags & 0xFFFFFFFE) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 1591 | + if ((dwWidth == -1) && (dwHeight == -1) && (dwBPP == -1) && (dwRefreshRate == -1))
|
| 1592 | + {
|
| 1593 | + WaitForVerticalBlank(0, NULL);
|
| 1594 | + WaitForVerticalBlank(0, NULL);
|
| 1595 | + TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 1596 | + }
|
1591 | 1597 | if ((dwBPP != 4) && (dwBPP != 8) && (dwBPP != 15) && (dwBPP != 16) && (dwBPP != 24) && (dwBPP != 32))
|
1592 | 1598 | TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
1593 | 1599 | if (!fullscreen) TRACE_RET(HRESULT, 23, DDERR_NOEXCLUSIVEMODE);
|
Index: ddraw/hooks.c |
— | — | @@ -19,12 +19,14 @@ |
20 | 20 | #include "hooks.h"
|
21 | 21 |
|
22 | 22 | const TCHAR *wndprop = _T("DXGLWndProc");
|
| 23 | +const TCHAR *wndpropdd7 = _T("DXGLWndDD7");
|
23 | 24 |
|
24 | | -void InstallDXGLFullscreenHook(HWND hWnd)
|
| 25 | +void InstallDXGLFullscreenHook(HWND hWnd, LPDIRECTDRAW7 lpDD7)
|
25 | 26 | {
|
26 | 27 | HANDLE wndproc = GetWindowLongPtr(hWnd, GWLP_WNDPROC);
|
27 | 28 | if (GetProp(hWnd, wndprop)) return;
|
28 | 29 | SetProp(hWnd, wndprop, wndproc);
|
| 30 | + SetProp(hWnd, wndpropdd7, lpDD7);
|
29 | 31 | SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)DXGLWndHookProc);
|
30 | 32 | }
|
31 | 33 | void UninstallDXGLFullscreenHook(HWND hWnd)
|
— | — | @@ -32,10 +34,12 @@ |
33 | 35 | if (!GetProp(hWnd, wndprop)) return;
|
34 | 36 | SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)GetProp(hWnd, wndprop));
|
35 | 37 | RemoveProp(hWnd, wndprop);
|
| 38 | + RemoveProp(hWnd, wndpropdd7);
|
36 | 39 | }
|
37 | 40 | LRESULT CALLBACK DXGLWndHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
38 | 41 | {
|
39 | 42 | WNDPROC parentproc = (WNDPROC)GetProp(hWnd, wndprop);
|
| 43 | + LPDIRECTDRAW7 lpDD7 = GetProp(hWnd, wndpropdd7);
|
40 | 44 | switch (uMsg)
|
41 | 45 | {
|
42 | 46 | case WM_DESTROY:
|
— | — | @@ -42,7 +46,11 @@ |
43 | 47 | UninstallDXGLFullscreenHook(hWnd);
|
44 | 48 | break;
|
45 | 49 | case WM_ACTIVATEAPP:
|
46 | | - if (!wParam) ShowWindow(hWnd, SW_MINIMIZE);
|
| 50 | + if (!wParam)
|
| 51 | + {
|
| 52 | + ShowWindow(hWnd, SW_MINIMIZE);
|
| 53 | + if (lpDD7) IDirectDraw7_SetDisplayMode(lpDD7, -1, -1, -1, -1, 0);
|
| 54 | + }
|
47 | 55 | break;
|
48 | 56 | }
|
49 | 57 | return CallWindowProc(parentproc, hWnd, uMsg, wParam, lParam);
|
Index: ddraw/hooks.h |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | #endif
|
24 | 24 |
|
25 | 25 | LRESULT CALLBACK DXGLWndHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
26 | | -void InstallDXGLFullscreenHook(HWND hWnd);
|
| 26 | +void InstallDXGLFullscreenHook(HWND hWnd, LPDIRECTDRAW7 lpDD7);
|
27 | 27 | void UninstallDXGLFullscreenHook(HWND hWnd);
|
28 | 28 |
|
29 | 29 | #ifdef __cplusplus
|