From 7a33acfa3b972189640b9ca17297d69c4cae5cfa Mon Sep 17 00:00:00 2001 From: cxgeorge <> Date: Mon, 5 Aug 2002 05:02:25 +0000 Subject: [PATCH] fix init fullscrn hang problem --- panda/src/wdxdisplay/wdxGraphicsWindow.cxx | 9 +++++++-- panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx | 9 ++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx index af7209b072..3c6e862978 100644 --- a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx +++ b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx @@ -2022,11 +2022,16 @@ CreateScreenBuffersAndDevice(DXScreenData &Display) { } */ - - DX_DECLARE_CLEAN(DDCAPS,DDCaps); pDD->GetCaps(&DDCaps,NULL); + // if window is not foreground in exclusive mode, ddraw thinks you are 'not active', so + // it changes your WM_ACTIVATEAPP from true to false, causing us + // to go into a 'wait-for WM_ACTIVATEAPP true' loop, and the event never comes so we hang + // in fullscreen wait. + + SetForegroundWindow(Display.hWnd); + if(dx_full_screen) { // Setup to create the primary surface w/backbuffer DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd) diff --git a/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx b/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx index 641dd4c7b8..22eb1528cc 100644 --- a/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx +++ b/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx @@ -2434,7 +2434,14 @@ CreateScreenBuffersAndDevice(DXScreenData &Display) { assert(pPresParams->SwapEffect == D3DSWAPEFFECT_DISCARD); // only valid effect for multisample #endif - ClearToBlack(GetDesktopWindow(),_props); + + // if window is not foreground in exclusive mode, ddraw thinks you are 'not active', so + // it changes your WM_ACTIVATEAPP from true to false, causing us + // to go into a 'wait-for WM_ACTIVATEAPP true' loop, and the event never comes so we hang + // in fullscreen wait. + + SetForegroundWindow(Display.hWnd); + ClearToBlack(Display.hWnd,_props); hr = pD3D8->CreateDevice(Display.CardIDNum, D3DDEVTYPE_HAL, _pParentWindowGroup->_hParentWindow, dwBehaviorFlags, pPresParams, &Display.pD3DDevice);