Index: ddraw/glRenderer.cpp |
— | — | @@ -223,12 +223,18 @@ |
224 | 224 | {
|
225 | 225 | switch (dxglcfg.fullmode)
|
226 | 226 | {
|
227 | | - case 0:
|
| 227 | + case 0: // Fullscreen
|
| 228 | + winstyle = GetWindowLongPtrA(This->hWnd, GWL_STYLE);
|
| 229 | + winstyleex = GetWindowLongPtrA(This->hWnd, GWL_EXSTYLE);
|
| 230 | + SetWindowLongPtrA(This->hWnd, GWL_EXSTYLE, winstyleex & ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE));
|
| 231 | + SetWindowLongPtrA(This->hWnd, GWL_STYLE, (winstyle | WS_POPUP) & ~(WS_CAPTION | WS_THICKFRAME | WS_BORDER));
|
| 232 | + ShowWindow(This->hWnd, SW_MAXIMIZE);
|
| 233 | + break;
|
228 | 234 | case 1: // Fullscreen
|
229 | 235 | winstyle = GetWindowLongPtrA(This->hWnd, GWL_STYLE);
|
230 | 236 | winstyleex = GetWindowLongPtrA(This->hWnd, GWL_EXSTYLE);
|
231 | 237 | SetWindowLongPtrA(This->hWnd, GWL_EXSTYLE, winstyleex & ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE));
|
232 | | - SetWindowLongPtrA(This->hWnd, GWL_STYLE, (winstyle | WS_POPUP | WS_SYSMENU) & ~(WS_CAPTION | WS_THICKFRAME));
|
| 238 | + SetWindowLongPtrA(This->hWnd, GWL_STYLE, winstyle & ~(WS_CAPTION | WS_THICKFRAME | WS_BORDER | WS_POPUP));
|
233 | 239 | ShowWindow(This->hWnd, SW_MAXIMIZE);
|
234 | 240 | break;
|
235 | 241 | case 2: // Windowed
|
— | — | @@ -610,14 +616,20 @@ |
611 | 617 | {
|
612 | 618 | switch (dxglcfg.fullmode)
|
613 | 619 | {
|
614 | | - case 0:
|
615 | | - case 1: // Fullscreen
|
| 620 | + case 0: // Fullscreen
|
616 | 621 | winstyle = GetWindowLongPtrA(newwnd, GWL_STYLE);
|
617 | 622 | winstyleex = GetWindowLongPtrA(newwnd, GWL_EXSTYLE);
|
618 | 623 | SetWindowLongPtrA(newwnd, GWL_EXSTYLE, winstyleex & ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE));
|
619 | | - SetWindowLongPtrA(newwnd, GWL_STYLE, (winstyle | WS_POPUP | WS_SYSMENU) & ~(WS_CAPTION | WS_THICKFRAME));
|
| 624 | + SetWindowLongPtrA(newwnd, GWL_STYLE, (winstyle | WS_POPUP) & ~(WS_CAPTION | WS_THICKFRAME | WS_BORDER));
|
620 | 625 | ShowWindow(newwnd, SW_MAXIMIZE);
|
621 | 626 | break;
|
| 627 | + case 1: // Borderless Fullscreen
|
| 628 | + winstyle = GetWindowLongPtrA(newwnd, GWL_STYLE);
|
| 629 | + winstyleex = GetWindowLongPtrA(newwnd, GWL_EXSTYLE);
|
| 630 | + SetWindowLongPtrA(newwnd, GWL_EXSTYLE, winstyleex & ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE));
|
| 631 | + SetWindowLongPtrA(newwnd, GWL_STYLE, winstyle & ~(WS_CAPTION | WS_THICKFRAME | WS_BORDER | WS_POPUP));
|
| 632 | + ShowWindow(newwnd, SW_MAXIMIZE);
|
| 633 | + break;
|
622 | 634 | case 2: // Windowed
|
623 | 635 | winstyle = GetWindowLongPtrA(newwnd, GWL_STYLE);
|
624 | 636 | winstyleex = GetWindowLongPtrA(newwnd, GWL_EXSTYLE);
|
Index: ddraw/hooks.c |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | // temporary references to C++ C-linked stuff
|
25 | 25 | void glDirectDraw7_UnrestoreDisplayMode(LPDIRECTDRAW7 lpDD7);
|
26 | 26 | void glDirectDraw7_SetWindowSize(LPDIRECTDRAW7 lpDD7, DWORD dwWidth, DWORD dwHeight);
|
| 27 | +void glDirectDraw7_GetSizes(LPDIRECTDRAW7 lpDD7, LONG *sizes);
|
27 | 28 | extern DXGLCFG dxglcfg;
|
28 | 29 |
|
29 | 30 | const TCHAR *wndprop = _T("DXGLWndProc");
|
— | — | @@ -252,6 +253,11 @@ |
253 | 254 | {
|
254 | 255 | WNDPROC parentproc;
|
255 | 256 | HWND_HOOK *wndhook;
|
| 257 | + STYLESTRUCT *style;
|
| 258 | + RECT r1, r2;
|
| 259 | + LONG sizes[6];
|
| 260 | + BOOL fixstyle = FALSE;
|
| 261 | + LONG winstyle, exstyle;
|
256 | 262 | LPDIRECTDRAW7 lpDD7;
|
257 | 263 | wndhook = GetWndHook(hWnd);
|
258 | 264 | if (!wndhook)
|
— | — | @@ -276,6 +282,64 @@ |
277 | 283 | }
|
278 | 284 | }
|
279 | 285 | break;
|
| 286 | + case WM_STYLECHANGED:
|
| 287 | + style = lParam;
|
| 288 | + if (style->styleNew == style->styleOld) break;
|
| 289 | + if (wParam == GWL_STYLE)
|
| 290 | + {
|
| 291 | + switch (dxglcfg.fullmode)
|
| 292 | + {
|
| 293 | + case 0:
|
| 294 | + // Fix fullscreen mode
|
| 295 | + if (lpDD7)
|
| 296 | + {
|
| 297 | + glDirectDraw7_GetSizes(lpDD7, sizes);
|
| 298 | + GetWindowRect(hWnd, &r1);
|
| 299 | + GetClientRect(hWnd, &r2);
|
| 300 | + winstyle = GetWindowLong(hWnd, GWL_STYLE);
|
| 301 | + exstyle = GetWindowLong(hWnd, GWL_EXSTYLE);
|
| 302 | + if (!(winstyle & WS_POPUP)) fixstyle = TRUE;
|
| 303 | + if (winstyle & (WS_CAPTION | WS_THICKFRAME | WS_BORDER)) fixstyle = TRUE;
|
| 304 | + if (winstyle & (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)) fixstyle = TRUE;
|
| 305 | + if (!((r1.left == 0) && (r1.top == 0) && (r2.right == sizes[4]) && (r2.bottom == sizes[5]))) fixstyle = TRUE;
|
| 306 | + if (fixstyle)
|
| 307 | + {
|
| 308 | + SetWindowLongPtrA(hWnd, GWL_EXSTYLE, exstyle & ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE));
|
| 309 | + SetWindowLongPtrA(hWnd, GWL_STYLE, (winstyle | WS_POPUP) & ~(WS_CAPTION | WS_THICKFRAME | WS_BORDER));
|
| 310 | + SetWindowPos(hWnd, NULL, 0, 0, sizes[4], sizes[5], SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
| 311 | + }
|
| 312 | + }
|
| 313 | + break;
|
| 314 | + case 1:
|
| 315 | + // Fix borderless mode
|
| 316 | + if (lpDD7)
|
| 317 | + {
|
| 318 | + glDirectDraw7_GetSizes(lpDD7, sizes);
|
| 319 | + GetWindowRect(hWnd, &r1);
|
| 320 | + GetClientRect(hWnd, &r2);
|
| 321 | + winstyle = GetWindowLong(hWnd, GWL_STYLE);
|
| 322 | + exstyle = GetWindowLong(hWnd, GWL_EXSTYLE);
|
| 323 | + if (winstyle & (WS_CAPTION | WS_THICKFRAME | WS_BORDER | WS_POPUP)) fixstyle = TRUE;
|
| 324 | + if (winstyle & (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)) fixstyle = TRUE;
|
| 325 | + if (!((r1.left == 0) && (r1.top == 0) && (r2.right == sizes[4]) && (r2.bottom == sizes[5]))) fixstyle = TRUE;
|
| 326 | + if (fixstyle)
|
| 327 | + {
|
| 328 | + SetWindowLongPtrA(hWnd, GWL_EXSTYLE, exstyle & ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE));
|
| 329 | + SetWindowLongPtrA(hWnd, GWL_STYLE, winstyle & ~(WS_CAPTION | WS_THICKFRAME | WS_BORDER | WS_POPUP));
|
| 330 | + SetWindowPos(hWnd, NULL, 0, 0, sizes[4], sizes[5], SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
| 331 | + }
|
| 332 | + }
|
| 333 | + break;
|
| 334 | + break;
|
| 335 | + case 2:
|
| 336 | + // Fix non-resizable window mode
|
| 337 | + break;
|
| 338 | + case 3:
|
| 339 | + // Fix resizable window mode
|
| 340 | + break;
|
| 341 | + }
|
| 342 | + }
|
| 343 | + break;
|
280 | 344 | case WM_SYSCOMMAND:
|
281 | 345 | if (wParam == SC_RESTORE)
|
282 | 346 | {
|
— | — | @@ -290,6 +354,7 @@ |
291 | 355 | if (lpDD7) glDirectDraw7_SetWindowSize(lpDD7, LOWORD(lParam), HIWORD(lParam));
|
292 | 356 | }
|
293 | 357 | }
|
| 358 | + break;
|
294 | 359 | }
|
295 | 360 | return CallWindowProc(parentproc, hWnd, uMsg, wParam, lParam);
|
296 | 361 | }
|