Index: dxglcfg2 |
Property changes on: dxglcfg2 |
___________________________________________________________________ |
Added: svn:global-ignores |
## -0,0 +1 ## |
| 1 | +Debug No MSVCRT |
Index: ddraw/ddraw.vcxproj |
— | — | @@ -285,6 +285,7 @@ |
286 | 286 | <ClInclude Include="glRenderer.h" />
|
287 | 287 | <ClInclude Include="glRenderWindow.h" />
|
288 | 288 | <ClInclude Include="glUtil.h" />
|
| 289 | + <ClInclude Include="hooks.h" />
|
289 | 290 | <ClInclude Include="include\d3d.h" />
|
290 | 291 | <ClInclude Include="include\d3dcaps.h" />
|
291 | 292 | <ClInclude Include="include\d3dtypes.h" />
|
— | — | @@ -366,6 +367,14 @@ |
367 | 368 | <ClCompile Include="glRenderer.cpp" />
|
368 | 369 | <ClCompile Include="glRenderWindow.cpp" />
|
369 | 370 | <ClCompile Include="glUtil.cpp" />
|
| 371 | + <ClCompile Include="hooks.c">
|
| 372 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Trace|Win32'">NotUsing</PrecompiledHeader>
|
| 373 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">NotUsing</PrecompiledHeader>
|
| 374 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
| 375 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
| 376 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'">NotUsing</PrecompiledHeader>
|
| 377 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug No MSVCRT|Win32'">NotUsing</PrecompiledHeader>
|
| 378 | + </ClCompile>
|
370 | 379 | <ClCompile Include="matrix.c">
|
371 | 380 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Trace|Win32'">NotUsing</PrecompiledHeader>
|
372 | 381 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">NotUsing</PrecompiledHeader>
|
Index: ddraw/ddraw.vcxproj.filters |
— | — | @@ -143,6 +143,9 @@ |
144 | 144 | <ClInclude Include="glDirectDrawGammaControl.h">
|
145 | 145 | <Filter>Header Files</Filter>
|
146 | 146 | </ClInclude>
|
| 147 | + <ClInclude Include="hooks.h">
|
| 148 | + <Filter>Header Files</Filter>
|
| 149 | + </ClInclude>
|
147 | 150 | </ItemGroup>
|
148 | 151 | <ItemGroup>
|
149 | 152 | <ClCompile Include="ddraw.cpp">
|
— | — | @@ -241,6 +244,9 @@ |
242 | 245 | <ClCompile Include="glDirectDrawGammaControl.cpp">
|
243 | 246 | <Filter>Source Files</Filter>
|
244 | 247 | </ClCompile>
|
| 248 | + <ClCompile Include="hooks.c">
|
| 249 | + <Filter>Source Files</Filter>
|
| 250 | + </ClCompile>
|
245 | 251 | </ItemGroup>
|
246 | 252 | <ItemGroup>
|
247 | 253 | <ResourceCompile Include="ddraw.rc">
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -31,6 +31,7 @@ |
32 | 32 | #include "glDirectDrawPalette.h"
|
33 | 33 | #include "glRenderer.h"
|
34 | 34 | #include "../common/version.h"
|
| 35 | +#include "hooks.h"
|
35 | 36 |
|
36 | 37 | const DDDEVICEIDENTIFIER2 devid_default = {
|
37 | 38 | "ddraw.dll",
|
— | — | @@ -1436,6 +1437,7 @@ |
1437 | 1438 | SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
1438 | 1439 | }
|
1439 | 1440 | }*/ // Currently breaks The Settlers IV
|
| 1441 | + if (this->hWnd && fullscreen) UninstallDXGLFullscreenHook(this->hWnd);
|
1440 | 1442 | this->hWnd = hWnd;
|
1441 | 1443 | if (!winstyle && !winstyleex)
|
1442 | 1444 | {
|
— | — | @@ -1511,6 +1513,7 @@ |
1512 | 1514 | internalrefresh = primaryrefresh = screenrefresh = devmode.dmDisplayFrequency;
|
1513 | 1515 | primarybpp = bpp;
|
1514 | 1516 | InitGL(x,y,bpp,fullscreen,internalrefresh,hWnd,this,devwnd);
|
| 1517 | + if (fullscreen) InstallDXGLFullscreenHook(hWnd);
|
1515 | 1518 | cooplevel = dwFlags;
|
1516 | 1519 | TRACE_EXIT(23,DD_OK);
|
1517 | 1520 | return DD_OK;
|
Index: ddraw/glRenderWindow.cpp |
— | — | @@ -27,36 +27,6 @@ |
28 | 28 | bool hotkeyregistered = false;
|
29 | 29 | #endif
|
30 | 30 |
|
31 | | -const TCHAR *wndprop = _T("DXGLWndProc");
|
32 | | -
|
33 | | -LRESULT CALLBACK DXGLWndHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
34 | | -void InstallDXGLHook(HWND hWnd)
|
35 | | -{
|
36 | | - if (GetProp(hWnd, wndprop)) return;
|
37 | | - SetProp(hWnd, wndprop, (HANDLE)GetWindowLongPtr(hWnd, GWLP_WNDPROC));
|
38 | | - SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)DXGLWndHookProc);
|
39 | | -}
|
40 | | -void UninstallDXGLHook(HWND hWnd)
|
41 | | -{
|
42 | | - if (!GetProp(hWnd, wndprop)) return;
|
43 | | - SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)GetProp(hWnd, wndprop));
|
44 | | - RemoveProp(hWnd, wndprop);
|
45 | | -}
|
46 | | -LRESULT CALLBACK DXGLWndHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
47 | | -{
|
48 | | - WNDPROC parentproc = (WNDPROC)GetProp(hWnd, wndprop);
|
49 | | - switch (uMsg)
|
50 | | - {
|
51 | | - case WM_DESTROY:
|
52 | | - UninstallDXGLHook(hWnd);
|
53 | | - break;
|
54 | | - case WM_ACTIVATEAPP:
|
55 | | - if (!wParam) ShowWindow(hWnd, SW_MINIMIZE);
|
56 | | - break;
|
57 | | - }
|
58 | | - return parentproc(hWnd,uMsg,wParam,lParam);
|
59 | | -}
|
60 | | -
|
61 | 31 | void WaitForObjectAndMessages(HANDLE object)
|
62 | 32 | {
|
63 | 33 | MSG Msg;
|
— | — | @@ -128,7 +98,6 @@ |
129 | 99 | hWnd = CreateWindowA("DirectDrawDeviceWnd",windowname,WS_CHILD|WS_VISIBLE,0,0,rectRender.right - rectRender.left,
|
130 | 100 | rectRender.bottom - rectRender.top,hParentWnd,NULL,wndclass.hInstance,this);
|
131 | 101 | SetWindowPos(hWnd,HWND_TOP,0,0,rectRender.right,rectRender.bottom,SWP_SHOWWINDOW);
|
132 | | - if (fullscreen) InstallDXGLHook(hParentWnd);
|
133 | 102 | }
|
134 | 103 | else
|
135 | 104 | {
|
— | — | @@ -230,7 +199,6 @@ |
231 | 200 | }
|
232 | 201 | else return SendMessage(hParent,msg,wParam,lParam);
|
233 | 202 | case WM_CLOSE:
|
234 | | - if (fullscreen) UninstallDXGLHook(hParentWnd);
|
235 | 203 | DestroyWindow(hWnd);
|
236 | 204 | return 0;
|
237 | 205 | case WM_DESTROY:
|
Index: ddraw/hooks.c |
— | — | @@ -0,0 +1,49 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2014 William Feely
|
| 4 | +
|
| 5 | +// This library is free software; you can redistribute it and/or
|
| 6 | +// modify it under the terms of the GNU Lesser General Public
|
| 7 | +// License as published by the Free Software Foundation; either
|
| 8 | +// version 2.1 of the License, or (at your option) any later version.
|
| 9 | +
|
| 10 | +// This library is distributed in the hope that it will be useful,
|
| 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +// Lesser General Public License for more details.
|
| 14 | +
|
| 15 | +// You should have received a copy of the GNU Lesser General Public
|
| 16 | +// License along with this library; if not, write to the Free Software
|
| 17 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 18 | +
|
| 19 | +#include "common.h"
|
| 20 | +#include "hooks.h"
|
| 21 | +
|
| 22 | +const TCHAR *wndprop = _T("DXGLWndProc");
|
| 23 | +
|
| 24 | +void InstallDXGLFullscreenHook(HWND hWnd)
|
| 25 | +{
|
| 26 | + HANDLE wndproc = GetWindowLongPtr(hWnd, GWLP_WNDPROC);
|
| 27 | + if (GetProp(hWnd, wndprop)) return;
|
| 28 | + SetProp(hWnd, wndprop, wndproc);
|
| 29 | + SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)DXGLWndHookProc);
|
| 30 | +}
|
| 31 | +void UninstallDXGLFullscreenHook(HWND hWnd)
|
| 32 | +{
|
| 33 | + if (!GetProp(hWnd, wndprop)) return;
|
| 34 | + SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)GetProp(hWnd, wndprop));
|
| 35 | + RemoveProp(hWnd, wndprop);
|
| 36 | +}
|
| 37 | +LRESULT CALLBACK DXGLWndHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
| 38 | +{
|
| 39 | + WNDPROC parentproc = (WNDPROC)GetProp(hWnd, wndprop);
|
| 40 | + switch (uMsg)
|
| 41 | + {
|
| 42 | + case WM_DESTROY:
|
| 43 | + UninstallDXGLFullscreenHook(hWnd);
|
| 44 | + break;
|
| 45 | + case WM_ACTIVATEAPP:
|
| 46 | + if (!wParam) ShowWindow(hWnd, SW_MINIMIZE);
|
| 47 | + break;
|
| 48 | + }
|
| 49 | + return CallWindowProc(parentproc, hWnd, uMsg, wParam, lParam);
|
| 50 | +}
|
Index: ddraw/hooks.h |
— | — | @@ -0,0 +1,32 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2014 William Feely
|
| 4 | +
|
| 5 | +// This library is free software; you can redistribute it and/or
|
| 6 | +// modify it under the terms of the GNU Lesser General Public
|
| 7 | +// License as published by the Free Software Foundation; either
|
| 8 | +// version 2.1 of the License, or (at your option) any later version.
|
| 9 | +
|
| 10 | +// This library is distributed in the hope that it will be useful,
|
| 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +// Lesser General Public License for more details.
|
| 14 | +
|
| 15 | +// You should have received a copy of the GNU Lesser General Public
|
| 16 | +// License along with this library; if not, write to the Free Software
|
| 17 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 18 | +#pragma once
|
| 19 | +#ifndef __HOOKS_H
|
| 20 | +#define __HOOKS_H
|
| 21 | +#ifdef __cplusplus
|
| 22 | +extern "C" {
|
| 23 | +#endif
|
| 24 | +
|
| 25 | +LRESULT CALLBACK DXGLWndHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
| 26 | +void InstallDXGLFullscreenHook(HWND hWnd);
|
| 27 | +void UninstallDXGLFullscreenHook(HWND hWnd);
|
| 28 | +
|
| 29 | +#ifdef __cplusplus
|
| 30 | +}
|
| 31 | +#endif
|
| 32 | +
|
| 33 | +#endif //__HOOKS_H |
\ No newline at end of file |