static Bool winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen) { winScreenPriv(pScreen); winDebug ("winReleasePrimarySurfaceShadowDDNL - Hello\n"); /* Release the primary surface and clipper, if they exist */ if (pScreenPriv->pddsPrimary4) { /* * Detach the clipper from the primary surface. * NOTE: We do this explicity for clarity. The Clipper is not released. */ IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, NULL); winDebug ("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n"); /* Release the primary surface */ IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4); pScreenPriv->pddsPrimary4 = NULL; } winDebug ("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n"); return TRUE; }
static HRESULT WINAPI ddrawex_surface4_SetClipper(IDirectDrawSurface4 *iface, IDirectDrawClipper *clipper) { struct ddrawex_surface *surface = impl_from_IDirectDrawSurface4(iface); TRACE("iface %p, clipper %p.\n", iface, clipper); return IDirectDrawSurface4_SetClipper(surface->parent, clipper); }
static Bool winCreatePrimarySurfaceShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); HRESULT ddrval = DD_OK; DDSURFACEDESC2 ddsd; winDebug("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n"); /* Describe the primary surface */ ZeroMemory(&ddsd, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; /* Create the primary surface */ ddrval = IDirectDraw4_CreateSurface(pScreenPriv->pdd4, &ddsd, &pScreenPriv->pddsPrimary4, NULL); pScreenPriv->fRetryCreateSurface = FALSE; if (FAILED(ddrval)) { if (ddrval == DDERR_NOEXCLUSIVEMODE) { /* Recreating the surface failed. Mark screen to retry later */ pScreenPriv->fRetryCreateSurface = TRUE; winDebug("winCreatePrimarySurfaceShadowDDNL - Could not create " "primary surface: DDERR_NOEXCLUSIVEMODE\n"); } else { ErrorF("winCreatePrimarySurfaceShadowDDNL - Could not create " "primary surface: %08x\n", (unsigned int) ddrval); } return FALSE; } #if 1 winDebug("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n"); #endif /* Attach our clipper to our primary surface handle */ ddrval = IDirectDrawSurface4_SetClipper(pScreenPriv->pddsPrimary4, pScreenPriv->pddcPrimary); if (FAILED(ddrval)) { ErrorF("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper " "failed: %08x\n", (unsigned int) ddrval); return FALSE; } #if 1 winDebug("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary " "surface\n"); #endif /* Everything was correct */ return TRUE; }
Bool winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen) { winScreenPriv(pScreen); HRESULT ddrval = DD_OK; DDSURFACEDESC2 ddsd; ErrorF ("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n"); /* Describe the primary surface */ ZeroMemory (&ddsd, sizeof (ddsd)); ddsd.dwSize = sizeof (ddsd); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; /* Create the primary surface */ ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4, &ddsd, &pScreenPriv->pddsPrimary4, NULL); if (FAILED (ddrval)) { ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create primary " "surface: %08x\n", ddrval); return FALSE; } #if 1 ErrorF ("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n"); #endif /* Attach our clipper to our primary surface handle */ ddrval = IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, pScreenPriv->pddcPrimary); if (FAILED (ddrval)) { ErrorF ("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper " "failed: %08x\n", ddrval); return FALSE; } #if 1 ErrorF ("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary " "surface\n"); #endif /* Everything was correct */ return TRUE; }
static Bool winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; Bool fReturn; #if CYGDEBUG winDebug ("winCloseScreenShadowDDNL - Freeing screen resources\n"); #endif /* Flag that the screen is closed */ pScreenPriv->fClosed = TRUE; pScreenPriv->fActive = FALSE; /* Call the wrapped CloseScreen procedure */ WIN_UNWRAP(CloseScreen); fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); /* Free the screen DC */ ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); /* Delete the window property */ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); /* Free the shadow surface, if there is one */ if (pScreenPriv->pddsShadow4) { IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4); free (pScreenInfo->pfb); pScreenInfo->pfb = NULL; pScreenPriv->pddsShadow4 = NULL; } /* Detach the clipper from the primary surface and release the clipper. */ 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) { IDirectDraw4_RestoreDisplayMode (pScreenPriv->pdd4); IDirectDraw4_Release (pScreenPriv->pdd4); pScreenPriv->pdd4 = NULL; } /* Free the DirectDraw object, if there is one */ if (pScreenPriv->pdd) { IDirectDraw_Release (pScreenPriv->pdd); pScreenPriv->pdd = NULL; } /* Delete tray icon, if we have one */ if (!pScreenInfo->fNoTrayIcon) winDeleteNotifyIcon (pScreenPriv); /* Free the exit confirmation dialog box, if it exists */ if (g_hDlgExit != NULL) { DestroyWindow (g_hDlgExit); g_hDlgExit = NULL; } /* Kill our window */ if (pScreenPriv->hwndScreen) { DestroyWindow (pScreenPriv->hwndScreen); pScreenPriv->hwndScreen = NULL; } #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) /* Destroy the thread startup mutex */ pthread_mutex_destroy (&pScreenPriv->pmServerStarted); #endif /* Kill our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; /* Invalidate the ScreenInfo's fb pointer */ pScreenInfo->pfb = NULL; /* Free the screen privates for this screen */ free ((pointer) pScreenPriv); return fReturn; }
Bool winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; Bool fReturn; #if CYGDEBUG ErrorF ("winCloseScreenShadowDDNL - Freeing screen resources\n"); #endif /* Flag that the screen is closed */ pScreenPriv->fClosed = TRUE; pScreenPriv->fActive = FALSE; /* Call the wrapped CloseScreen procedure */ pScreen->CloseScreen = pScreenPriv->CloseScreen; fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); /* Free the screen DC */ ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); /* Delete the window property */ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); /* Free the shadow surface, if there is one */ if (pScreenPriv->pddsShadow4) { IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4); free (pScreenInfo->pfb); pScreenInfo->pfb = NULL; pScreenPriv->pddsShadow4 = NULL; } /* Detach the clipper from the primary surface and release the clipper. */ 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) { IDirectDraw4_RestoreDisplayMode (pScreenPriv->pdd4); IDirectDraw4_Release (pScreenPriv->pdd4); pScreenPriv->pdd4 = NULL; } /* Free the DirectDraw object, if there is one */ if (pScreenPriv->pdd) { IDirectDraw_Release (pScreenPriv->pdd); pScreenPriv->pdd = NULL; } /* Kill our window */ if (pScreenPriv->hwndScreen) { DestroyWindow (pScreenPriv->hwndScreen); pScreenPriv->hwndScreen = NULL; } /* Destroy the thread startup mutex */ pthread_mutex_destroy (&pScreenPriv->pmServerStarted); /* Kill our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; /* Invalidate the ScreenInfo's fb pointer */ pScreenInfo->pfb = NULL; /* Free the screen privates for this screen */ free ((pointer) pScreenPriv); return fReturn; }