DXGL r558 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r557‎ | r558 | r559 >
Date:23:17, 20 October 2014
Author:admin
Status:new
Tags:
Comment:
Revert r547.
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -643,7 +643,6 @@
644644 if(initialized)
645645 {
646646 RestoreDisplayMode();
647 - SetCooperativeLevel(hWnd, DDSCL_NORMAL);
648647 if(clippers)
649648 {
650649 for(int i = 0; i < clippercount; i++)
@@ -1404,7 +1403,6 @@
14051404 d3ddesc = d3ddesc_default;
14061405 d3ddesc3 = d3ddesc3_default;
14071406 memcpy(stored_devices, d3ddevices, 3 * sizeof(D3DDevice));
1408 - winstyle = winstyleex = 0;
14091407 initialized = true;
14101408 TRACE_EXIT(23,DD_OK);
14111409 return DD_OK;
@@ -1427,23 +1425,9 @@
14281426 if(hWnd && !IsWindow(hWnd)) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
14291427 if ((dwFlags & DDSCL_EXCLUSIVE) && !hWnd) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
14301428 if(dwFlags & 0xFFFFE020) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
1431 - if (((hWnd != this->hWnd) && this->hWnd) || (this->hWnd && (dwFlags & DDSCL_NORMAL)))
1432 - {
1433 - if (winstyle)
1434 - {
1435 - SetWindowLongPtrA(hWnd, GWL_STYLE, winstyle);
1436 - SetWindowLongPtrA(hWnd, GWL_EXSTYLE, winstyleex);
1437 - ShowWindow(hWnd, SW_RESTORE);
1438 - winstyle = winstyleex = 0;
1439 - SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
1440 - }
1441 - }
14421429 this->hWnd = hWnd;
1443 - if (!winstyle && !winstyleex)
1444 - {
1445 - winstyle = GetWindowLongPtrA(hWnd, GWL_STYLE);
1446 - winstyleex = GetWindowLongPtrA(hWnd, GWL_EXSTYLE);
1447 - }
 1430+ winstyle = GetWindowLongPtrA(hWnd,GWL_STYLE);
 1431+ winstyleex = GetWindowLongPtrA(hWnd,GWL_EXSTYLE);
14481432 bool exclusive = false;
14491433 devwnd = false;
14501434 if(dwFlags & DDSCL_ALLOWMODEX)
@@ -1512,14 +1496,7 @@
15131497 bpp = devmode.dmBitsPerPel;
15141498 internalrefresh = primaryrefresh = screenrefresh = devmode.dmDisplayFrequency;
15151499 primarybpp = bpp;
1516 - if (fullscreen)
1517 - {
1518 - SetWindowLongPtrA(hWnd, GWL_EXSTYLE, winstyleex & ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE));
1519 - SetWindowLongPtrA(hWnd, GWL_STYLE, (winstyle | WS_POPUP | WS_SYSMENU) & ~(WS_CAPTION | WS_THICKFRAME));
1520 - ShowWindow(hWnd, SW_MAXIMIZE);
1521 - }
1522 - SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
1523 - InitGL(x, y, bpp, fullscreen, internalrefresh, hWnd, this, devwnd);
 1500+ InitGL(x,y,bpp,fullscreen,internalrefresh,hWnd,this,devwnd);
15241501 cooplevel = dwFlags;
15251502 TRACE_EXIT(23,DD_OK);
15261503 return DD_OK;
Index: ddraw/glRenderer.cpp
@@ -217,6 +217,17 @@
218218 InitializeCriticalSection(&This->cs);
219219 This->busy = CreateEvent(NULL,FALSE,FALSE,NULL);
220220 This->start = CreateEvent(NULL,FALSE,FALSE,NULL);
 221+ if(fullscreen)
 222+ {
 223+ SetWindowLongPtrA(This->hWnd,GWL_EXSTYLE,WS_EX_APPWINDOW);
 224+ SetWindowLongPtrA(This->hWnd,GWL_STYLE,WS_OVERLAPPED);
 225+ ShowWindow(This->hWnd,SW_MAXIMIZE);
 226+ }
 227+ if(width)
 228+ {
 229+ // TODO: Adjust window rect
 230+ }
 231+ SetWindowPos(This->hWnd,HWND_TOP,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
221232 This->RenderWnd = new glRenderWindow(width,height,fullscreen,This->hWnd,glDD7,devwnd);
222233 This->inputs[0] = (void*)width;
223234 This->inputs[1] = (void*)height;
@@ -565,6 +576,12 @@
566577 void glRenderer_SetWnd(glRenderer *This, int width, int height, int bpp, int fullscreen, unsigned int frequency, HWND newwnd, BOOL devwnd)
567578 {
568579 EnterCriticalSection(&This->cs);
 580+ if(fullscreen && newwnd)
 581+ {
 582+ SetWindowLongPtrA(newwnd,GWL_EXSTYLE,WS_EX_APPWINDOW);
 583+ SetWindowLongPtrA(newwnd,GWL_STYLE,WS_OVERLAPPED);
 584+ ShowWindow(newwnd,SW_MAXIMIZE);
 585+ }
569586 This->inputs[0] = (void*)width;
570587 This->inputs[1] = (void*)height;
571588 This->inputs[2] = (void*)bpp;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r547Adjust fullscreen window management.admin01:35, 6 October 2014