DXGL r574 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r573
|
r574
|
r575
>
Date:
16:18, 20 December 2014
Author:
admin
Status:
new
Tags:
Comment:
Minimize fullscreen window on focus loss.
Modified paths:
/ddraw/glRenderWindow.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/glRenderWindow.cpp
—
—
@@ -27,6 +27,36 @@
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
+
31
61
void WaitForObjectAndMessages(HANDLE object)
32
62
{
33
63
MSG Msg;
—
—
@@ -98,6 +128,7 @@
99
129
hWnd = CreateWindowA("DirectDrawDeviceWnd",windowname,WS_CHILD|WS_VISIBLE,0,0,rectRender.right - rectRender.left,
100
130
rectRender.bottom - rectRender.top,hParentWnd,NULL,wndclass.hInstance,this);
101
131
SetWindowPos(hWnd,HWND_TOP,0,0,rectRender.right,rectRender.bottom,SWP_SHOWWINDOW);
132
+ if (fullscreen) InstallDXGLHook(hParentWnd);
102
133
}
103
134
else
104
135
{
—
—
@@ -199,6 +230,7 @@
200
231
}
201
232
else return SendMessage(hParent,msg,wParam,lParam);
202
233
case WM_CLOSE:
234
+ if (fullscreen) UninstallDXGLHook(hParentWnd);
203
235
DestroyWindow(hWnd);
204
236
return 0;
205
237
case WM_DESTROY:
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version