First import
[xorg_rtime.git] / xorg-server-1.4 / hw / xwin / winpfbdd.c
blob13fc1058de32bb16a7816dc2af6418e3d64e5719
1 /*
2 *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
4 *Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 *"Software"), to deal in the Software without restriction, including
7 *without limitation the rights to use, copy, modify, merge, publish,
8 *distribute, sublicense, and/or sell copies of the Software, and to
9 *permit persons to whom the Software is furnished to do so, subject to
10 *the following conditions:
12 *The above copyright notice and this permission notice shall be
13 *included in all copies or substantial portions of the Software.
15 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
19 *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *Except as contained in this notice, the name of the XFree86 Project
24 *shall not be used in advertising or otherwise to promote the sale, use
25 *or other dealings in this Software without prior written authorization
26 *from the XFree86 Project.
28 * Authors: Dakshinamurthy Karra
29 * Suhaib M Siddiqi
30 * Peter Busch
31 * Harold L Hunt II
34 #ifdef HAVE_XWIN_CONFIG_H
35 #include <xwin-config.h>
36 #endif
37 #include "win.h"
41 * External symbols
44 extern const GUID _IID_IDirectDraw2;
45 extern HWND g_hDlgExit;
49 * Local function prototypes
52 static Bool
53 winAllocateFBPrimaryDD (ScreenPtr pScreen);
55 static Bool
56 winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen);
58 static Bool
59 winInitVisualsPrimaryDD (ScreenPtr pScreen);
61 static Bool
62 winAdjustVideoModePrimaryDD (ScreenPtr pScreen);
64 static Bool
65 winActivateAppPrimaryDD (ScreenPtr pScreen);
67 static Bool
68 winHotKeyAltTabPrimaryDD (ScreenPtr pScreen);
72 * Create a DirectDraw primary surface
75 static Bool
76 winAllocateFBPrimaryDD (ScreenPtr pScreen)
78 winScreenPriv(pScreen);
79 winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
80 HRESULT ddrval = DD_OK;
81 DDSURFACEDESC ddsd;
82 DDSURFACEDESC *pddsdPrimary = NULL;
83 DDSURFACEDESC *pddsdOffscreen = NULL;
84 RECT rcClient;
86 ErrorF ("winAllocateFBPrimaryDD\n");
88 /* Get client area location in screen coords */
89 GetClientRect (pScreenPriv->hwndScreen, &rcClient);
90 MapWindowPoints (pScreenPriv->hwndScreen,
91 HWND_DESKTOP,
92 (LPPOINT)&rcClient, 2);
94 /* Create a DirectDraw object, store the address at lpdd */
95 ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
96 if (ddrval != DD_OK)
97 FatalError ("winAllocateFBPrimaryDD - Could not start DirectDraw\n");
99 /* Get a DirectDraw2 interface pointer */
100 ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd,
101 &IID_IDirectDraw2,
102 (LPVOID*) &pScreenPriv->pdd2);
103 if (FAILED (ddrval))
105 ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
106 (unsigned int) ddrval);
107 return FALSE;
111 ErrorF ("winAllocateFBPrimaryDD - Created and initialized DD\n");
113 /* Are we windowed or fullscreen? */
114 if (pScreenInfo->fFullScreen)
116 /* Full screen mode */
117 ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2,
118 pScreenPriv->hwndScreen,
119 DDSCL_FULLSCREEN
120 | DDSCL_EXCLUSIVE);
121 if (FAILED (ddrval))
122 FatalError ("winAllocateFBPrimaryDD - Could not set "
123 "cooperative level\n");
125 /* Change the video mode to the mode requested */
126 ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2,
127 pScreenInfo->dwWidth,
128 pScreenInfo->dwHeight,
129 pScreenInfo->dwBPP,
130 pScreenInfo->dwRefreshRate,
132 if (FAILED (ddrval))
133 FatalError ("winAllocateFBPrimaryDD - Could not set "
134 "full screen display mode\n");
136 else
138 /* Windowed mode */
139 ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2,
140 pScreenPriv->hwndScreen,
141 DDSCL_NORMAL);
142 if (FAILED (ddrval))
143 FatalError ("winAllocateFBPrimaryDD - Could not set "
144 "cooperative level\n");
147 /* Describe the primary surface */
148 ZeroMemory (&ddsd, sizeof (ddsd));
149 ddsd.dwSize = sizeof (ddsd);
150 ddsd.dwFlags = DDSD_CAPS;
151 ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
153 /* Create the primary surface */
154 ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2,
155 &ddsd,
156 &pScreenPriv->pddsPrimary,
157 NULL);
158 if (FAILED (ddrval))
159 FatalError ("winAllocateFBPrimaryDD - Could not create primary "
160 "surface %08x\n", (unsigned int) ddrval);
162 ErrorF ("winAllocateFBPrimaryDD - Created primary\n");
164 /* Allocate a DD surface description for our screen privates */
165 pddsdPrimary = pScreenPriv->pddsdPrimary
166 = malloc (sizeof (DDSURFACEDESC));
167 if (pddsdPrimary == NULL)
168 FatalError ("winAllocateFBPrimaryDD - Could not allocate surface "
169 "description memory\n");
170 ZeroMemory (pddsdPrimary, sizeof (*pddsdPrimary));
171 pddsdPrimary->dwSize = sizeof (*pddsdPrimary);
173 /* Describe the offscreen surface to be created */
175 * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
176 * as drawing, locking, and unlocking take forever
177 * with video memory surfaces. In addition,
178 * video memory is a somewhat scarce resource,
179 * so you shouldn't be allocating video memory when
180 * you have the option of using system memory instead.
182 ZeroMemory (&ddsd, sizeof (ddsd));
183 ddsd.dwSize = sizeof (ddsd);
184 ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
185 ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
186 ddsd.dwHeight = pScreenInfo->dwHeight;
187 ddsd.dwWidth = pScreenInfo->dwWidth;
189 /* Create the shadow surface */
190 ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2,
191 &ddsd,
192 &pScreenPriv->pddsOffscreen,
193 NULL);
194 if (ddrval != DD_OK)
195 FatalError ("winAllocateFBPrimaryDD - Could not create shadow "
196 "surface\n");
198 ErrorF ("winAllocateFBPrimaryDD - Created offscreen\n");
200 /* Allocate a DD surface description for our screen privates */
201 pddsdOffscreen = pScreenPriv->pddsdOffscreen
202 = malloc (sizeof (DDSURFACEDESC));
203 if (pddsdOffscreen == NULL)
204 FatalError ("winAllocateFBPrimaryDD - Could not allocate surface "
205 "description memory\n");
206 ZeroMemory (pddsdOffscreen, sizeof (*pddsdOffscreen));
207 pddsdOffscreen->dwSize = sizeof (*pddsdOffscreen);
209 ErrorF ("winAllocateFBPrimaryDD - Locking primary\n");
211 /* Lock the primary surface */
212 ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary,
213 pScreenInfo->fFullScreen ? NULL:&rcClient,
214 pddsdPrimary,
215 DDLOCK_WAIT,
216 NULL);
217 if (ddrval != DD_OK || pddsdPrimary->lpSurface == NULL)
218 FatalError ("winAllocateFBPrimaryDD - Could not lock "
219 "primary surface\n");
221 ErrorF ("winAllocateFBPrimaryDD - Locked primary\n");
223 /* We don't know how to deal with anything other than RGB */
224 if (!(pddsdPrimary->ddpfPixelFormat.dwFlags & DDPF_RGB))
225 FatalError ("winAllocateFBPrimaryDD - Color format other than RGB\n");
227 /* Grab the pitch from the surface desc */
228 pScreenInfo->dwStride = (pddsdPrimary->u1.lPitch * 8)
229 / pScreenInfo->dwBPP;
231 /* Save the pointer to our surface memory */
232 pScreenInfo->pfb = pddsdPrimary->lpSurface;
234 /* Grab the color depth and masks from the surface description */
235 pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask;
236 pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask;
237 pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask;
239 ErrorF ("winAllocateFBPrimaryDD - Returning\n");
241 return TRUE;
246 * Call the wrapped CloseScreen function.
248 * Free our resources and private structures.
251 static Bool
252 winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen)
254 winScreenPriv(pScreen);
255 winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
256 Bool fReturn;
258 ErrorF ("winCloseScreenPrimaryDD - Freeing screen resources\n");
260 /* Flag that the screen is closed */
261 pScreenPriv->fClosed = TRUE;
262 pScreenPriv->fActive = FALSE;
264 /* Call the wrapped CloseScreen procedure */
265 WIN_UNWRAP(CloseScreen);
266 fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
268 /* Delete the window property */
269 RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
271 /* Free the offscreen surface, if there is one */
272 if (pScreenPriv->pddsOffscreen)
274 IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, NULL);
275 IDirectDrawSurface2_Release (pScreenPriv->pddsOffscreen);
276 pScreenPriv->pddsOffscreen = NULL;
279 /* Release the primary surface, if there is one */
280 if (pScreenPriv->pddsPrimary)
282 IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, NULL);
283 IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
284 pScreenPriv->pddsPrimary = NULL;
287 /* Free the DirectDraw object, if there is one */
288 if (pScreenPriv->pdd)
290 IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd);
291 IDirectDraw2_Release (pScreenPriv->pdd);
292 pScreenPriv->pdd = NULL;
295 /* Delete tray icon, if we have one */
296 if (!pScreenInfo->fNoTrayIcon)
297 winDeleteNotifyIcon (pScreenPriv);
299 /* Free the exit confirmation dialog box, if it exists */
300 if (g_hDlgExit != NULL)
302 DestroyWindow (g_hDlgExit);
303 g_hDlgExit = NULL;
306 /* Kill our window */
307 if (pScreenPriv->hwndScreen)
309 DestroyWindow (pScreenPriv->hwndScreen);
310 pScreenPriv->hwndScreen = NULL;
313 /* Kill our screeninfo's pointer to the screen */
314 pScreenInfo->pScreen = NULL;
316 /* Invalidate the ScreenInfo's fb pointer */
317 pScreenInfo->pfb = NULL;
319 /* Free the screen privates for this screen */
320 free ((pointer) pScreenPriv);
322 return fReturn;
327 * Tell mi what sort of visuals we need.
329 * Generally we only need one visual, as our screen can only
330 * handle one format at a time, I believe. You may want
331 * to verify that last sentence.
334 static Bool
335 winInitVisualsPrimaryDD (ScreenPtr pScreen)
337 winScreenPriv(pScreen);
338 winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
339 DWORD dwRedBits, dwGreenBits, dwBlueBits;
341 /* Count the number of ones in each color mask */
342 dwRedBits = winCountBits (pScreenPriv->dwRedMask);
343 dwGreenBits = winCountBits (pScreenPriv->dwGreenMask);
344 dwBlueBits = winCountBits (pScreenPriv->dwBlueMask);
346 /* Store the maximum number of ones in a color mask as the bitsPerRGB */
347 if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
348 pScreenPriv->dwBitsPerRGB = dwRedBits;
349 else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
350 pScreenPriv->dwBitsPerRGB = dwGreenBits;
351 else
352 pScreenPriv->dwBitsPerRGB = dwBlueBits;
354 ErrorF ("winInitVisualsPrimaryDD - Masks: %08x %08x %08x bpRGB: %d\n",
355 (unsigned int) pScreenPriv->dwRedMask,
356 (unsigned int) pScreenPriv->dwGreenMask,
357 (unsigned int) pScreenPriv->dwBlueMask,
358 (int) pScreenPriv->dwBitsPerRGB);
360 /* Create a single visual according to the Windows screen depth */
361 switch (pScreenInfo->dwDepth)
363 case 24:
364 case 16:
365 case 15:
366 if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
367 TrueColorMask,
368 pScreenPriv->dwBitsPerRGB,
369 TrueColor,
370 pScreenPriv->dwRedMask,
371 pScreenPriv->dwGreenMask,
372 pScreenPriv->dwBlueMask))
374 ErrorF ("winInitVisualsPrimaryDD - "
375 "miSetVisualTypesAndMasks failed\n");
376 return FALSE;
378 break;
380 case 8:
381 #if CYGDEBUG
382 winDebug ("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
383 #endif /* CYGDEBUG */
384 if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
385 PseudoColorMask,
386 pScreenPriv->dwBitsPerRGB,
387 PseudoColor,
388 pScreenPriv->dwRedMask,
389 pScreenPriv->dwGreenMask,
390 pScreenPriv->dwBlueMask))
392 ErrorF ("winInitVisualsPrimaryDD - "
393 "miSetVisualTypesAndMasks failed\n");
394 return FALSE;
396 #if CYGDEBUG
397 winDebug ("winInitVisualsPrimaryDD - Returned from "
398 "miSetVisualTypesAndMasks\n");
399 #endif /* CYGDEBUG */
400 break;
402 default:
403 ErrorF ("winInitVisualsPrimaryDD - Unknown screen depth\n");
404 return FALSE;
407 ErrorF ("winInitVisualsPrimaryDD - Returning\n");
409 return TRUE;
413 static Bool
414 winAdjustVideoModePrimaryDD (ScreenPtr pScreen)
416 winScreenPriv(pScreen);
417 winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
418 HDC hdc = NULL;
419 DWORD dwBPP;
421 /* We're in serious trouble if we can't get a DC */
422 hdc = GetDC (NULL);
423 if (hdc == NULL)
425 ErrorF ("winAdjustVideoModePrimaryDD - GetDC failed\n");
426 return FALSE;
429 /* Query GDI for current display depth */
430 dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
432 /* DirectDraw can only change the depth in fullscreen mode */
433 if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
435 /* No -depth parameter passed, let the user know the depth being used */
436 ErrorF ("winAdjustVideoModePrimaryDD - Using Windows display "
437 "depth of %d bits per pixel\n", (int) dwBPP);
439 /* Use GDI's depth */
440 pScreenInfo->dwBPP = dwBPP;
442 else if (pScreenInfo->fFullScreen
443 && pScreenInfo->dwBPP != dwBPP)
445 /* FullScreen, and GDI depth differs from -depth parameter */
446 ErrorF ("winAdjustVideoModePrimaryDD - FullScreen, using command "
447 "line depth: %d\n", (int) pScreenInfo->dwBPP);
449 else if (dwBPP != pScreenInfo->dwBPP)
451 /* Windowed, and GDI depth differs from -depth parameter */
452 ErrorF ("winAdjustVideoModePrimaryDD - Windowed, command line "
453 "depth: %d, using depth: %d\n",
454 (int) pScreenInfo->dwBPP, (int) dwBPP);
456 /* We'll use GDI's depth */
457 pScreenInfo->dwBPP = dwBPP;
460 /* Release our DC */
461 ReleaseDC (NULL, hdc);
463 return TRUE;
468 * We need to blit our offscreen fb to
469 * the screen when we are activated, and we need to point
470 * the fb code back to the primary surface memory.
473 static Bool
474 winActivateAppPrimaryDD (ScreenPtr pScreen)
476 winScreenPriv(pScreen);
477 winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
478 RECT rcSrc, rcClient;
479 HRESULT ddrval = DD_OK;
481 /* Check for errors */
482 if (pScreenPriv == NULL
483 || pScreenPriv->pddsPrimary == NULL
484 || pScreenPriv->pddsOffscreen == NULL)
485 return FALSE;
487 /* Check for do-nothing */
488 if (!pScreenPriv->fActive)
489 return TRUE;
491 /* We are activating */
492 ddrval = IDirectDrawSurface2_IsLost (pScreenPriv->pddsOffscreen);
493 if (ddrval == DD_OK)
495 IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen,
496 NULL);
498 * We don't check for an error from Unlock, because it
499 * doesn't matter if the Unlock failed.
503 /* Restore both surfaces, just cause I like it that way */
504 IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen);
505 IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary);
507 /* Get client area in screen coords */
508 GetClientRect (pScreenPriv->hwndScreen, &rcClient);
509 MapWindowPoints (pScreenPriv->hwndScreen,
510 HWND_DESKTOP,
511 (LPPOINT)&rcClient, 2);
513 /* Setup a source rectangle */
514 rcSrc.left = 0;
515 rcSrc.top = 0;
516 rcSrc.right = pScreenInfo->dwWidth;
517 rcSrc.bottom = pScreenInfo->dwHeight;
519 ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
520 &rcClient,
521 pScreenPriv->pddsOffscreen,
522 &rcSrc,
523 DDBLT_WAIT,
524 NULL);
525 if (ddrval != DD_OK)
526 FatalError ("winActivateAppPrimaryDD () - Failed blitting offscreen "
527 "surface to primary surface %08x\n", (unsigned int) ddrval);
529 /* Lock the primary surface */
530 ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary,
531 &rcClient,
532 pScreenPriv->pddsdPrimary,
533 DDLOCK_WAIT,
534 NULL);
535 if (ddrval != DD_OK
536 || pScreenPriv->pddsdPrimary->lpSurface == NULL)
537 FatalError ("winActivateAppPrimaryDD () - Could not lock "
538 "primary surface\n");
540 /* Notify FB of the new memory pointer */
541 winUpdateFBPointer (pScreen,
542 pScreenPriv->pddsdPrimary->lpSurface);
545 * Register the Alt-Tab combo as a hotkey so we can copy
546 * the primary framebuffer before the display mode changes
548 RegisterHotKey (pScreenPriv->hwndScreen, 1, MOD_ALT, 9);
550 return TRUE;
555 * Handle the Alt+Tab hotkey.
557 * We need to save the primary fb to an offscreen fb when
558 * we get deactivated, and point the fb code at the offscreen
559 * fb for the duration of the deactivation.
562 static Bool
563 winHotKeyAltTabPrimaryDD (ScreenPtr pScreen)
565 winScreenPriv(pScreen);
566 winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
567 RECT rcClient, rcSrc;
568 HRESULT ddrval = DD_OK;
570 ErrorF ("\nwinHotKeyAltTabPrimaryDD\n\n");
572 /* Alt+Tab was pressed, we will lose focus very soon */
573 pScreenPriv->fActive = FALSE;
575 /* Check for error conditions */
576 if (pScreenPriv->pddsPrimary == NULL
577 || pScreenPriv->pddsOffscreen == NULL)
578 return FALSE;
580 /* Get client area in screen coords */
581 GetClientRect (pScreenPriv->hwndScreen, &rcClient);
582 MapWindowPoints (pScreenPriv->hwndScreen,
583 HWND_DESKTOP,
584 (LPPOINT)&rcClient, 2);
586 /* Did we loose the primary surface? */
587 ddrval = IDirectDrawSurface2_IsLost (pScreenPriv->pddsPrimary);
588 if (ddrval == DD_OK)
590 ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary,
591 NULL);
592 if (FAILED (ddrval))
593 FatalError ("winHotKeyAltTabPrimaryDD - Failed unlocking primary "
594 "surface\n");
597 /* Setup a source rectangle */
598 rcSrc.left = 0;
599 rcSrc.top = 0;
600 rcSrc.right = pScreenInfo->dwWidth;
601 rcSrc.bottom = pScreenInfo->dwHeight;
603 /* Blit the primary surface to the offscreen surface */
604 ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen,
605 NULL, /* should be rcDest */
606 pScreenPriv->pddsPrimary,
607 NULL,
608 DDBLT_WAIT,
609 NULL);
610 if (ddrval == DDERR_SURFACELOST)
612 IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen);
613 IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary);
615 /* Blit the primary surface to the offscreen surface */
616 ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen,
617 NULL,
618 pScreenPriv->pddsPrimary,
619 NULL,
620 DDBLT_WAIT,
621 NULL);
622 if (FAILED (ddrval))
623 FatalError ("winHotKeyAltTabPrimaryDD - Failed blitting primary "
624 "surface to offscreen surface: %08x\n",
625 (unsigned int) ddrval);
627 else
629 FatalError ("winHotKeyAltTabPrimaryDD - Unknown error from "
630 "Blt: %08dx\n", (unsigned int) ddrval);
633 /* Lock the offscreen surface */
634 ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsOffscreen,
635 NULL,
636 pScreenPriv->pddsdOffscreen,
637 DDLOCK_WAIT,
638 NULL);
639 if (ddrval != DD_OK
640 || pScreenPriv->pddsdPrimary->lpSurface == NULL)
641 FatalError ("winHotKeyAltTabPrimaryDD - Could not lock "
642 "offscreen surface\n");
644 /* Notify FB of the new memory pointer */
645 winUpdateFBPointer (pScreen,
646 pScreenPriv->pddsdOffscreen->lpSurface);
648 /* Unregister our hotkey */
649 UnregisterHotKey (pScreenPriv->hwndScreen, 1);
651 return TRUE;
655 /* Set engine specific functions */
656 Bool
657 winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen)
659 winScreenPriv(pScreen);
660 winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
662 /* Set our pointers */
663 pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD;
664 pScreenPriv->pwinShadowUpdate
665 = (winShadowUpdateProcPtr) (void (*)(void))NoopDDA;
666 pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD;
667 pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD;
668 pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD;
669 if (pScreenInfo->fFullScreen)
670 pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen;
671 else
672 pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
673 pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
674 pScreenPriv->pwinBltExposedRegions
675 = (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA;
676 pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD;
677 pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD;
678 #ifdef XWIN_MULTIWINDOW
679 pScreenPriv->pwinFinishCreateWindowsWindow =
680 (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
681 #endif
683 return TRUE;