DXGL r547 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r546‎ | r547 | r548 >
Date:01:35, 6 October 2014
Author:admin
Status:new
Tags:
Comment:
Adjust fullscreen window management.
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -643,6 +643,7 @@
644644 if(initialized)
645645 {
646646 RestoreDisplayMode();
 647+ SetCooperativeLevel(hWnd, DDSCL_NORMAL);
647648 if(clippers)
648649 {
649650 for(int i = 0; i < clippercount; i++)
@@ -1403,6 +1404,7 @@
14041405 d3ddesc = d3ddesc_default;
14051406 d3ddesc3 = d3ddesc3_default;
14061407 memcpy(stored_devices, d3ddevices, 3 * sizeof(D3DDevice));
 1408+ winstyle = winstyleex = 0;
14071409 initialized = true;
14081410 TRACE_EXIT(23,DD_OK);
14091411 return DD_OK;
@@ -1425,9 +1427,23 @@
14261428 if(hWnd && !IsWindow(hWnd)) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
14271429 if ((dwFlags & DDSCL_EXCLUSIVE) && !hWnd) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
14281430 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+ }
14291442 this->hWnd = hWnd;
1430 - winstyle = GetWindowLongPtrA(hWnd,GWL_STYLE);
1431 - winstyleex = GetWindowLongPtrA(hWnd,GWL_EXSTYLE);
 1443+ if (!winstyle && !winstyleex)
 1444+ {
 1445+ winstyle = GetWindowLongPtrA(hWnd, GWL_STYLE);
 1446+ winstyleex = GetWindowLongPtrA(hWnd, GWL_EXSTYLE);
 1447+ }
14321448 bool exclusive = false;
14331449 devwnd = false;
14341450 if(dwFlags & DDSCL_ALLOWMODEX)
@@ -1496,7 +1512,14 @@
14971513 bpp = devmode.dmBitsPerPel;
14981514 internalrefresh = primaryrefresh = screenrefresh = devmode.dmDisplayFrequency;
14991515 primarybpp = bpp;
1500 - InitGL(x,y,bpp,fullscreen,internalrefresh,hWnd,this,devwnd);
 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);
15011524 cooplevel = dwFlags;
15021525 TRACE_EXIT(23,DD_OK);
15031526 return DD_OK;
Index: ddraw/glRenderer.cpp
@@ -217,17 +217,6 @@
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);
232221 This->RenderWnd = new glRenderWindow(width,height,fullscreen,This->hWnd,glDD7,devwnd);
233222 This->inputs[0] = (void*)width;
234223 This->inputs[1] = (void*)height;
@@ -576,12 +565,6 @@
577566 void glRenderer_SetWnd(glRenderer *This, int width, int height, int bpp, int fullscreen, unsigned int frequency, HWND newwnd, BOOL devwnd)
578567 {
579568 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 - }
586569 This->inputs[0] = (void*)width;
587570 This->inputs[1] = (void*)height;
588571 This->inputs[2] = (void*)bpp;

Follow-up revisions

RevisionCommit summaryAuthorDate
r558Revert r547.admin23:17, 20 October 2014