diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c index b14d0a962..00d7a379f 100644 --- a/hw/xwin/winshaddd.c +++ b/hw/xwin/winshaddd.c @@ -514,25 +514,16 @@ winFreeFBShadowDD (ScreenPtr pScreen) pScreenPriv->pddsShadow = NULL; } - /* Detach the clipper from the primary surface and release the clipper. */ + /* Detach the clipper from the primary surface and release the primary surface, if there is one */ + winReleasePrimarySurfaceShadowDD(pScreen); + + /* Release the clipper object */ if (pScreenPriv->pddcPrimary) { - /* Detach the clipper */ - IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, - NULL); - - /* Release the clipper object */ IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); pScreenPriv->pddcPrimary = NULL; } - /* Release the primary surface, if there is one */ - if (pScreenPriv->pddsPrimary) - { - IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary); - pScreenPriv->pddsPrimary = NULL; - } - /* Free the DirectDraw2 object, if there is one */ if (pScreenPriv->pdd2) { @@ -577,6 +568,10 @@ winShadowUpdateDD (ScreenPtr pScreen, if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) || pScreenPriv->fBadDepth) return; + /* Return immediately if we didn't get needed surfaces */ + if (!pScreenPriv->pddsPrimary || !pScreenPriv->pddsShadow) + return; + /* Get the origin of the window in the screen coords */ ptOrigin.x = pScreenInfo->dwXOffset; ptOrigin.y = pScreenInfo->dwYOffset; diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c index c74a2ff14..0a0b4ae13 100644 --- a/hw/xwin/winshadddnl.c +++ b/hw/xwin/winshadddnl.c @@ -546,25 +546,16 @@ winFreeFBShadowDDNL(ScreenPtr pScreen) pScreenPriv->pddsShadow4 = NULL; } - /* Detach the clipper from the primary surface and release the clipper. */ + /* Detach the clipper from the primary surface and release the primary surface, if there is one */ + winReleasePrimarySurfaceShadowDDNL(pScreen); + + /* Release the clipper object */ if (pScreenPriv->pddcPrimary) { - /* Detach the clipper */ - IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, - NULL); - - /* Release the clipper object */ IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); pScreenPriv->pddcPrimary = NULL; } - /* Release the primary surface, if there is one */ - if (pScreenPriv->pddsPrimary4) - { - IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4); - pScreenPriv->pddsPrimary4 = NULL; - } - /* Free the DirectDraw4 object, if there is one */ if (pScreenPriv->pdd4) { @@ -658,6 +649,10 @@ winShadowUpdateDDNL (ScreenPtr pScreen, if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) || pScreenPriv->fBadDepth) return; + /* Return immediately if we didn't get needed surfaces */ + if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4) + return; + /* Get the origin of the window in the screen coords */ ptOrigin.x = pScreenInfo->dwXOffset; ptOrigin.y = pScreenInfo->dwYOffset; diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index dd8f27edb..bccd6f9f2 100644 --- a/hw/xwin/winwndproc.c +++ b/hw/xwin/winwndproc.c @@ -231,18 +231,7 @@ winWindowProc (HWND hwnd, UINT message, (this is probably usually the case so that might be an overoptimization) */ - - /* - * We can simply recreate the same-sized primary surface when - * the display dimensions change. - */ { - -#if CYGDEBUG - winDebug ("winWindowProc - WM_DISPLAYCHANGE - Recreated " - "primary surface\n"); -#endif - /* In rootless modes which are monitor or virtual desktop size use RandR to resize the X screen @@ -311,13 +300,8 @@ winWindowProc (HWND hwnd, UINT message, else { /* - If we get here, we are either windowed and using the GDI engine - or windowed and non-fullscreen using any engine - */ - - /* - * For ddraw engines, we need to (try to) recreate the same-sized primary surface - * when display dimensions change (but not depth, that is disruptive) + * We can simply recreate the same-sized primary surface when + * the display dimensions change. */ /*