| Index: ddraw/glDirectDraw.cpp |
| — | — | @@ -643,6 +643,7 @@ |
| 644 | 644 | if(initialized)
|
| 645 | 645 | {
|
| 646 | 646 | RestoreDisplayMode();
|
| | 647 | + SetCooperativeLevel(hWnd, DDSCL_NORMAL);
|
| 647 | 648 | if(clippers)
|
| 648 | 649 | {
|
| 649 | 650 | for(int i = 0; i < clippercount; i++)
|
| — | — | @@ -1403,6 +1404,7 @@ |
| 1404 | 1405 | d3ddesc = d3ddesc_default;
|
| 1405 | 1406 | d3ddesc3 = d3ddesc3_default;
|
| 1406 | 1407 | memcpy(stored_devices, d3ddevices, 3 * sizeof(D3DDevice));
|
| | 1408 | + winstyle = winstyleex = 0;
|
| 1407 | 1409 | initialized = true;
|
| 1408 | 1410 | TRACE_EXIT(23,DD_OK);
|
| 1409 | 1411 | return DD_OK;
|
| — | — | @@ -1425,9 +1427,23 @@ |
| 1426 | 1428 | if(hWnd && !IsWindow(hWnd)) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
| 1427 | 1429 | if ((dwFlags & DDSCL_EXCLUSIVE) && !hWnd) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 1428 | 1430 | 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 | + }
|
| 1429 | 1442 | 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 | + }
|
| 1432 | 1448 | bool exclusive = false;
|
| 1433 | 1449 | devwnd = false;
|
| 1434 | 1450 | if(dwFlags & DDSCL_ALLOWMODEX)
|
| — | — | @@ -1496,7 +1512,14 @@ |
| 1497 | 1513 | bpp = devmode.dmBitsPerPel;
|
| 1498 | 1514 | internalrefresh = primaryrefresh = screenrefresh = devmode.dmDisplayFrequency;
|
| 1499 | 1515 | 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);
|
| 1501 | 1524 | cooplevel = dwFlags;
|
| 1502 | 1525 | TRACE_EXIT(23,DD_OK);
|
| 1503 | 1526 | return DD_OK;
|
| Index: ddraw/glRenderer.cpp |
| — | — | @@ -217,17 +217,6 @@ |
| 218 | 218 | InitializeCriticalSection(&This->cs);
|
| 219 | 219 | This->busy = CreateEvent(NULL,FALSE,FALSE,NULL);
|
| 220 | 220 | 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);
|
| 232 | 221 | This->RenderWnd = new glRenderWindow(width,height,fullscreen,This->hWnd,glDD7,devwnd);
|
| 233 | 222 | This->inputs[0] = (void*)width;
|
| 234 | 223 | This->inputs[1] = (void*)height;
|
| — | — | @@ -576,12 +565,6 @@ |
| 577 | 566 | void glRenderer_SetWnd(glRenderer *This, int width, int height, int bpp, int fullscreen, unsigned int frequency, HWND newwnd, BOOL devwnd)
|
| 578 | 567 | {
|
| 579 | 568 | 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 | | - }
|
| 586 | 569 | This->inputs[0] = (void*)width;
|
| 587 | 570 | This->inputs[1] = (void*)height;
|
| 588 | 571 | This->inputs[2] = (void*)bpp;
|