| Index: Help/html/config/advanced/defaultwindowposition.htmlbody |
| — | — | @@ -5,4 +5,13 @@ |
| 6 | 6 | <h3>Centered</h3>
|
| 7 | 7 | <p>Locates the window in the center of the display.</p>
|
| 8 | 8 | <h3>Saved position</h3>
|
| 9 | | -<p>Uses the position stored in “Remembered window position” to position the window, using logical window coordinates.</p> |
| \ No newline at end of file |
| | 9 | +<p>Uses the position stored in “Remembered window position” to position the window, using logical window coordinates.</p>
|
| | 10 | +<h3>Top left</h3>
|
| | 11 | +<p>Locates the window at the top left of the display.</p>
|
| | 12 | +<h3>Windows default</h3>
|
| | 13 | +<p>
|
| | 14 | + Allows Windows to select the position to place the window.<br />
|
| | 15 | + <span style="font-size: 8pt;">
|
| | 16 | + <em>Top left and Windows default options are available in DXGL 0.5.14 and later.</em>
|
| | 17 | + </span>
|
| | 18 | +</p> |
| \ No newline at end of file |
| Index: ddraw/dllmain.cpp |
| — | — | @@ -18,6 +18,7 @@ |
| 19 | 19 | #include "common.h"
|
| 20 | 20 | #include "ddraw.h"
|
| 21 | 21 | #include "hooks.h"
|
| | 22 | +#include "util.h"
|
| 22 | 23 | ATOM WindowClass = NULL;
|
| 23 | 24 | CRITICAL_SECTION dll_cs = {NULL,0,0,NULL,NULL,0};
|
| 24 | 25 | BOOL APIENTRY DllMain( HMODULE hModule,
|
| — | — | @@ -42,6 +43,7 @@ |
| 43 | 44 | ZeroMemory(&hook_cs, sizeof(CRITICAL_SECTION));
|
| 44 | 45 | DeleteCriticalSection(&dll_cs);
|
| 45 | 46 | ZeroMemory(&dll_cs, sizeof(CRITICAL_SECTION));
|
| | 47 | + if (wndclassdxgltempatom) UnregisterDXGLTempWindowClass();
|
| 46 | 48 | break;
|
| 47 | 49 | }
|
| 48 | 50 | return TRUE;
|
| Index: ddraw/glRenderer.cpp |
| — | — | @@ -1687,6 +1687,7 @@ |
| 1688 | 1688 | InitializeCriticalSection(&This->cs);
|
| 1689 | 1689 | This->busy = CreateEvent(NULL,FALSE,FALSE,NULL);
|
| 1690 | 1690 | This->start = CreateEvent(NULL,FALSE,FALSE,NULL);
|
| | 1691 | + HWND hTempWnd;
|
| 1691 | 1692 | if(fullscreen)
|
| 1692 | 1693 | {
|
| 1693 | 1694 | switch (dxglcfg.fullmode)
|
| — | — | @@ -1733,6 +1734,21 @@ |
| 1734 | 1735 | wndrect.bottom -= wndrect.top;
|
| 1735 | 1736 | wndrect.top = 0;
|
| 1736 | 1737 | }
|
| | 1738 | + else if (dxglcfg.WindowPosition == 3)
|
| | 1739 | + {
|
| | 1740 | + if (!wndclassdxgltempatom) RegisterDXGLTempWindowClass();
|
| | 1741 | + wndrect.left = wndrect.top = 0;
|
| | 1742 | + wndrect.right = dxglcfg.WindowWidth;
|
| | 1743 | + wndrect.bottom = dxglcfg.WindowHeight;
|
| | 1744 | + AdjustWindowRectEx(&wndrect, (winstyle | WS_OVERLAPPEDWINDOW) & ~(WS_THICKFRAME | WS_MAXIMIZEBOX), FALSE,
|
| | 1745 | + (winstyleex | WS_EX_APPWINDOW));
|
| | 1746 | + hTempWnd = CreateWindow(wndclassdxgltemp.lpszClassName, _T("DXGL Sizing Window"),
|
| | 1747 | + (winstyle | WS_OVERLAPPEDWINDOW) & ~(WS_THICKFRAME | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE),
|
| | 1748 | + CW_USEDEFAULT, CW_USEDEFAULT, wndrect.right - wndrect.left, wndrect.bottom - wndrect.top, NULL, NULL,
|
| | 1749 | + GetModuleHandle(NULL), NULL);
|
| | 1750 | + GetWindowRect(hTempWnd, &wndrect);
|
| | 1751 | + DestroyWindow(hTempWnd);
|
| | 1752 | + }
|
| 1737 | 1753 | else
|
| 1738 | 1754 | {
|
| 1739 | 1755 | screenx = GetSystemMetrics(SM_CXSCREEN);
|
| — | — | @@ -1772,6 +1788,19 @@ |
| 1773 | 1789 | wndrect.bottom -= wndrect.top;
|
| 1774 | 1790 | wndrect.top = 0;
|
| 1775 | 1791 | }
|
| | 1792 | + else if (dxglcfg.WindowPosition == 3)
|
| | 1793 | + {
|
| | 1794 | + if (!wndclassdxgltempatom) RegisterDXGLTempWindowClass();
|
| | 1795 | + wndrect.left = wndrect.top = 0;
|
| | 1796 | + wndrect.right = dxglcfg.WindowWidth;
|
| | 1797 | + wndrect.bottom = dxglcfg.WindowHeight;
|
| | 1798 | + AdjustWindowRectEx(&wndrect, (winstyle | WS_OVERLAPPEDWINDOW), FALSE, (winstyleex | WS_EX_APPWINDOW));
|
| | 1799 | + hTempWnd = CreateWindow(wndclassdxgltemp.lpszClassName, _T("DXGL Sizing Window"),
|
| | 1800 | + ((winstyle | WS_OVERLAPPEDWINDOW) & ~(WS_POPUP | WS_VISIBLE)), CW_USEDEFAULT, CW_USEDEFAULT,
|
| | 1801 | + wndrect.right - wndrect.left, wndrect.bottom - wndrect.top, NULL, NULL, GetModuleHandle(NULL), NULL);
|
| | 1802 | + GetWindowRect(hTempWnd, &wndrect);
|
| | 1803 | + DestroyWindow(hTempWnd);
|
| | 1804 | + }
|
| 1776 | 1805 | else
|
| 1777 | 1806 | {
|
| 1778 | 1807 | screenx = GetSystemMetrics(SM_CXSCREEN);
|
| — | — | @@ -1809,6 +1838,18 @@ |
| 1810 | 1839 | wndrect.right = dxglcfg.WindowWidth;
|
| 1811 | 1840 | wndrect.bottom = dxglcfg.WindowHeight;
|
| 1812 | 1841 | }
|
| | 1842 | + else if (dxglcfg.WindowPosition == 3)
|
| | 1843 | + {
|
| | 1844 | + if (!wndclassdxgltempatom) RegisterDXGLTempWindowClass();
|
| | 1845 | + wndrect.left = wndrect.top = 0;
|
| | 1846 | + wndrect.right = dxglcfg.WindowWidth;
|
| | 1847 | + wndrect.bottom = dxglcfg.WindowHeight;
|
| | 1848 | + hTempWnd = CreateWindow(wndclassdxgltemp.lpszClassName, _T("DXGL Sizing Window"),
|
| | 1849 | + winstyle & ~(WS_CAPTION | WS_THICKFRAME | WS_BORDER | WS_POPUP | WS_VISIBLE), CW_USEDEFAULT, CW_USEDEFAULT,
|
| | 1850 | + wndrect.right - wndrect.left, wndrect.bottom - wndrect.top, NULL, NULL, GetModuleHandle(NULL), NULL);
|
| | 1851 | + GetWindowRect(hTempWnd, &wndrect);
|
| | 1852 | + DestroyWindow(hTempWnd);
|
| | 1853 | + }
|
| 1813 | 1854 | else
|
| 1814 | 1855 | {
|
| 1815 | 1856 | screenx = GetSystemMetrics(SM_CXSCREEN);
|
| — | — | @@ -2225,7 +2266,7 @@ |
| 2226 | 2267 | SetWindowLongPtrA(newwnd, GWL_EXSTYLE, winstyleex | WS_EX_APPWINDOW);
|
| 2227 | 2268 | SetWindowLongPtrA(newwnd, GWL_STYLE, (winstyle | WS_OVERLAPPEDWINDOW) & ~(WS_THICKFRAME | WS_MAXIMIZEBOX | WS_POPUP));
|
| 2228 | 2269 | ShowWindow(newwnd, SW_NORMAL);
|
| 2229 | | - if (dxglcfg.WindowPosition == 1)
|
| | 2270 | + if ((dxglcfg.WindowPosition == 1) || (dxglcfg.WindowPosition == 3))
|
| 2230 | 2271 | {
|
| 2231 | 2272 | GetWindowRect(newwnd, &wndrect);
|
| 2232 | 2273 | if (GetMenu(newwnd)) hasmenu = TRUE;
|
| — | — | @@ -2278,7 +2319,7 @@ |
| 2279 | 2320 | GetWindowPlacement(newwnd, &wndplace);
|
| 2280 | 2321 | if(wndplace.showCmd == SW_SHOWMAXIMIZED) ShowWindow(newwnd, SW_SHOWMAXIMIZED);
|
| 2281 | 2322 | else ShowWindow(newwnd, SW_NORMAL);
|
| 2282 | | - if (dxglcfg.WindowPosition == 1)
|
| | 2323 | + if ((dxglcfg.WindowPosition == 1) || (dxglcfg.WindowPosition == 3))
|
| 2283 | 2324 | {
|
| 2284 | 2325 | wndrect = wndplace.rcNormalPosition;
|
| 2285 | 2326 | GetWindowRect(newwnd, &wndrect2);
|
| — | — | @@ -2362,7 +2403,8 @@ |
| 2363 | 2404 | ShowWindow(newwnd, SW_NORMAL);
|
| 2364 | 2405 | screenx = GetSystemMetrics(SM_CXSCREEN);
|
| 2365 | 2406 | screeny = GetSystemMetrics(SM_CYSCREEN);
|
| 2366 | | - if (dxglcfg.WindowPosition == 1) GetWindowRect(newwnd, &wndrect);
|
| | 2407 | + if ((dxglcfg.WindowPosition == 1) || (dxglcfg.WindowPosition == 3))
|
| | 2408 | + GetWindowRect(newwnd, &wndrect);
|
| 2367 | 2409 | else if (dxglcfg.WindowPosition == 2)
|
| 2368 | 2410 | {
|
| 2369 | 2411 | wndrect.left = 0;
|
| Index: ddraw/util.c |
| — | — | @@ -164,4 +164,38 @@ |
| 165 | 165 | if ((dxglcfg.BltScale == 2) || (dxglcfg.BltScale == 3) || (dxglcfg.BltScale == 4))
|
| 166 | 166 | return TRUE;
|
| 167 | 167 | else return FALSE;
|
| 168 | | -} |
| \ No newline at end of file |
| | 168 | +}
|
| | 169 | +
|
| | 170 | +WNDCLASSEX wndclassdxgltemp =
|
| | 171 | +{
|
| | 172 | + sizeof(WNDCLASSEX),
|
| | 173 | + 0,
|
| | 174 | + DefWindowProc,
|
| | 175 | + 0,0,
|
| | 176 | + NULL,
|
| | 177 | + NULL,NULL,
|
| | 178 | + (HBRUSH)COLOR_WINDOW,
|
| | 179 | + NULL,
|
| | 180 | + _T("DXGLTempSizingWindowClass"),
|
| | 181 | + NULL
|
| | 182 | +};
|
| | 183 | +ATOM wndclassdxgltempatom = NULL;
|
| | 184 | +
|
| | 185 | +void RegisterDXGLTempWindowClass()
|
| | 186 | +{
|
| | 187 | + if (!wndclassdxgltempatom)
|
| | 188 | + {
|
| | 189 | + if (!wndclassdxgltemp.hInstance) wndclassdxgltemp.hInstance = GetModuleHandle(NULL);
|
| | 190 | + if (!wndclassdxgltemp.hCursor) wndclassdxgltemp.hCursor = LoadCursor(NULL, IDC_ARROW);
|
| | 191 | + wndclassdxgltempatom = RegisterClassEx(&wndclassdxgltemp);
|
| | 192 | + }
|
| | 193 | +}
|
| | 194 | +
|
| | 195 | +void UnregisterDXGLTempWindowClass()
|
| | 196 | +{
|
| | 197 | + if (wndclassdxgltempatom)
|
| | 198 | + {
|
| | 199 | + UnregisterClass(wndclassdxgltemp.lpszClassName, GetModuleHandle(NULL));
|
| | 200 | + wndclassdxgltempatom = NULL;
|
| | 201 | + }
|
| | 202 | +}
|
| Index: ddraw/util.h |
| — | — | @@ -29,6 +29,12 @@ |
| 30 | 30 | BOOL comp_bltfx(DDBLTFX *a, DDBLTFX *b, DWORD flags);
|
| 31 | 31 | BOOL IsAlphaCKey();
|
| 32 | 32 |
|
| | 33 | +extern WNDCLASSEX wndclassdxgltemp;
|
| | 34 | +extern ATOM wndclassdxgltempatom;
|
| | 35 | +
|
| | 36 | +void RegisterDXGLTempWindowClass();
|
| | 37 | +void UnregisterDXGLTempWindowClass();
|
| | 38 | +
|
| 33 | 39 | #ifdef __cplusplus
|
| 34 | 40 | }
|
| 35 | 41 | #endif
|
| Index: dxglcfg/dxglcfg.cpp |
| — | — | @@ -2667,7 +2667,6 @@ |
| 2668 | 2668 | DS_3DLOOK | DS_CONTEXTHELP | DS_SHELLFONT | WS_CAPTION | WS_SYSMENU,
|
| 2669 | 2669 | CW_USEDEFAULT, CW_USEDEFAULT, r.right-r.left,r.bottom-r.top,NULL,NULL,
|
| 2670 | 2670 | GetModuleHandle(NULL), NULL);
|
| 2671 | | - error = GetLastError();
|
| 2672 | 2671 | GetWindowRect(hTempWnd, &r);
|
| 2673 | 2672 | SetWindowPos(hWnd, HWND_TOP,r.left,r.top,0,0, SWP_NOSIZE);
|
| 2674 | 2673 | DestroyWindow(hTempWnd);
|
| — | — | @@ -3154,6 +3153,8 @@ |
| 3155 | 3154 | SendDlgItemMessage(hTabs[3], IDC_WINDOWPOS, CB_ADDSTRING, 0, (LPARAM)buffer);
|
| 3156 | 3155 | _tcscpy(buffer, _T("Top left"));
|
| 3157 | 3156 | SendDlgItemMessage(hTabs[3], IDC_WINDOWPOS, CB_ADDSTRING, 0, (LPARAM)buffer);
|
| | 3157 | + _tcscpy(buffer, _T("Windows default"));
|
| | 3158 | + SendDlgItemMessage(hTabs[3], IDC_WINDOWPOS, CB_ADDSTRING, 0, (LPARAM)buffer);
|
| 3158 | 3159 | SendDlgItemMessage(hTabs[3], IDC_WINDOWPOS, CB_SETCURSEL, cfg->WindowPosition, 0);
|
| 3159 | 3160 | // Remember window position
|
| 3160 | 3161 | if (cfg->RememberWindowPosition) SendDlgItemMessage(hTabs[3], IDC_REMEMBERWINDOWPOS, BM_SETCHECK, BST_CHECKED, 0);
|