winnativegdi.c revision 706f2543
1706f2543Smrg/* 2706f2543Smrg *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. 3706f2543Smrg * 4706f2543Smrg *Permission is hereby granted, free of charge, to any person obtaining 5706f2543Smrg * a copy of this software and associated documentation files (the 6706f2543Smrg *"Software"), to deal in the Software without restriction, including 7706f2543Smrg *without limitation the rights to use, copy, modify, merge, publish, 8706f2543Smrg *distribute, sublicense, and/or sell copies of the Software, and to 9706f2543Smrg *permit persons to whom the Software is furnished to do so, subject to 10706f2543Smrg *the following conditions: 11706f2543Smrg * 12706f2543Smrg *The above copyright notice and this permission notice shall be 13706f2543Smrg *included in all copies or substantial portions of the Software. 14706f2543Smrg * 15706f2543Smrg *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16706f2543Smrg *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17706f2543Smrg *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18706f2543Smrg *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR 19706f2543Smrg *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 20706f2543Smrg *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21706f2543Smrg *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22706f2543Smrg * 23706f2543Smrg *Except as contained in this notice, the name of the XFree86 Project 24706f2543Smrg *shall not be used in advertising or otherwise to promote the sale, use 25706f2543Smrg *or other dealings in this Software without prior written authorization 26706f2543Smrg *from the XFree86 Project. 27706f2543Smrg * 28706f2543Smrg * Authors: Harold L Hunt II 29706f2543Smrg */ 30706f2543Smrg 31706f2543Smrg#ifdef HAVE_XWIN_CONFIG_H 32706f2543Smrg#include <xwin-config.h> 33706f2543Smrg#endif 34706f2543Smrg#include "win.h" 35706f2543Smrg 36706f2543Smrg 37706f2543Smrg/* 38706f2543Smrg * Local function prototypes 39706f2543Smrg */ 40706f2543Smrg 41706f2543Smrgstatic Bool 42706f2543SmrgwinAllocateFBNativeGDI (ScreenPtr pScreen); 43706f2543Smrg 44706f2543Smrgstatic void 45706f2543SmrgwinShadowUpdateNativeGDI (ScreenPtr pScreen, 46706f2543Smrg shadowBufPtr pBuf); 47706f2543Smrg 48706f2543Smrgstatic Bool 49706f2543SmrgwinCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen); 50706f2543Smrg 51706f2543Smrgstatic Bool 52706f2543SmrgwinInitVisualsNativeGDI (ScreenPtr pScreen); 53706f2543Smrg 54706f2543Smrgstatic Bool 55706f2543SmrgwinAdjustVideoModeNativeGDI (ScreenPtr pScreen); 56706f2543Smrg 57706f2543Smrg#if 0 58706f2543Smrgstatic Bool 59706f2543SmrgwinBltExposedRegionsNativeGDI (ScreenPtr pScreen); 60706f2543Smrg#endif 61706f2543Smrg 62706f2543Smrgstatic Bool 63706f2543SmrgwinActivateAppNativeGDI (ScreenPtr pScreen); 64706f2543Smrg 65706f2543Smrgstatic Bool 66706f2543SmrgwinRedrawScreenNativeGDI (ScreenPtr pScreen); 67706f2543Smrg 68706f2543Smrgstatic Bool 69706f2543SmrgwinRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen); 70706f2543Smrg 71706f2543Smrgstatic Bool 72706f2543SmrgwinInstallColormapNativeGDI (ColormapPtr pColormap); 73706f2543Smrg 74706f2543Smrgstatic Bool 75706f2543SmrgwinStoreColorsNativeGDI (ColormapPtr pmap, 76706f2543Smrg int ndef, 77706f2543Smrg xColorItem *pdefs); 78706f2543Smrg 79706f2543Smrgstatic Bool 80706f2543SmrgwinCreateColormapNativeGDI (ColormapPtr pColormap); 81706f2543Smrg 82706f2543Smrgstatic Bool 83706f2543SmrgwinDestroyColormapNativeGDI (ColormapPtr pColormap); 84706f2543Smrg 85706f2543Smrg 86706f2543Smrg 87706f2543Smrgstatic Bool 88706f2543SmrgwinAllocateFBNativeGDI (ScreenPtr pScreen) 89706f2543Smrg{ 90706f2543Smrg FatalError ("winAllocateFBNativeGDI\n"); 91706f2543Smrg 92706f2543Smrg return TRUE; 93706f2543Smrg} 94706f2543Smrg 95706f2543Smrgstatic void 96706f2543SmrgwinFreeFBNativeGDI (ScreenPtr pScreen) 97706f2543Smrg{ 98706f2543Smrg FatalError ("winFreeFBNativeGDI\n"); 99706f2543Smrg} 100706f2543Smrg 101706f2543Smrg 102706f2543Smrgstatic Bool 103706f2543SmrgwinInitScreenNativeGDI(ScreenPtr pScreen) 104706f2543Smrg{ 105706f2543Smrg FatalError ("winInitScreenNativeGDI\n"); 106706f2543Smrg} 107706f2543Smrg 108706f2543Smrg/* 109706f2543Smrg * We wrap whatever CloseScreen procedure was specified by fb; 110706f2543Smrg * a pointer to said procedure is stored in our privates. 111706f2543Smrg */ 112706f2543Smrg 113706f2543Smrgstatic Bool 114706f2543SmrgwinCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen) 115706f2543Smrg{ 116706f2543Smrg winScreenPriv(pScreen); 117706f2543Smrg winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; 118706f2543Smrg 119706f2543Smrg ErrorF ("winCloseScreenNativeGDI - Freeing screen resources\n"); 120706f2543Smrg 121706f2543Smrg /* Flag that the screen is closed */ 122706f2543Smrg pScreenPriv->fClosed = TRUE; 123706f2543Smrg pScreenPriv->fActive = FALSE; 124706f2543Smrg 125706f2543Smrg /* 126706f2543Smrg * NOTE: mi doesn't use a CloseScreen procedure, so we do not 127706f2543Smrg * need to call a wrapped procedure here. 128706f2543Smrg */ 129706f2543Smrg 130706f2543Smrg /* Delete the window property */ 131706f2543Smrg RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); 132706f2543Smrg 133706f2543Smrg ErrorF ("winCloseScreenNativeGDI - Destroying window\n"); 134706f2543Smrg 135706f2543Smrg /* Delete tray icon, if we have one */ 136706f2543Smrg if (!pScreenInfo->fNoTrayIcon) 137706f2543Smrg winDeleteNotifyIcon (pScreenPriv); 138706f2543Smrg 139706f2543Smrg /* Free the exit confirmation dialog box, if it exists */ 140706f2543Smrg if (g_hDlgExit != NULL) 141706f2543Smrg { 142706f2543Smrg DestroyWindow (g_hDlgExit); 143706f2543Smrg g_hDlgExit = NULL; 144706f2543Smrg } 145706f2543Smrg 146706f2543Smrg /* Kill our window */ 147706f2543Smrg if (pScreenPriv->hwndScreen) 148706f2543Smrg { 149706f2543Smrg DestroyWindow (pScreenPriv->hwndScreen); 150706f2543Smrg pScreenPriv->hwndScreen = NULL; 151706f2543Smrg } 152706f2543Smrg 153706f2543Smrg /* Invalidate our screeninfo's pointer to the screen */ 154706f2543Smrg pScreenInfo->pScreen = NULL; 155706f2543Smrg 156706f2543Smrg /* Free the screen privates for this screen */ 157706f2543Smrg free (pScreenPriv); 158706f2543Smrg 159706f2543Smrg ErrorF ("winCloseScreenNativeGDI - Returning\n"); 160706f2543Smrg 161706f2543Smrg return TRUE; 162706f2543Smrg} 163706f2543Smrg 164706f2543Smrg 165706f2543Smrgstatic void 166706f2543SmrgwinShadowUpdateNativeGDI (ScreenPtr pScreen, 167706f2543Smrg shadowBufPtr pBuf) 168706f2543Smrg{ 169706f2543Smrg FatalError ("winShadowUpdateNativeGDI\n"); 170706f2543Smrg return; 171706f2543Smrg} 172706f2543Smrg 173706f2543Smrg 174706f2543Smrgstatic Bool 175706f2543SmrgwinInitVisualsNativeGDI (ScreenPtr pScreen) 176706f2543Smrg{ 177706f2543Smrg winScreenPriv(pScreen); 178706f2543Smrg winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; 179706f2543Smrg 180706f2543Smrg /* Set the bitsPerRGB and bit masks */ 181706f2543Smrg switch (pScreenInfo->dwDepth) 182706f2543Smrg { 183706f2543Smrg case 24: 184706f2543Smrg pScreenPriv->dwBitsPerRGB = 8; 185706f2543Smrg pScreenPriv->dwRedMask = 0x00FF0000; 186706f2543Smrg pScreenPriv->dwGreenMask = 0x0000FF00; 187706f2543Smrg pScreenPriv->dwBlueMask = 0x000000FF; 188706f2543Smrg break; 189706f2543Smrg 190706f2543Smrg case 16: 191706f2543Smrg pScreenPriv->dwBitsPerRGB = 6; 192706f2543Smrg pScreenPriv->dwRedMask = 0xF800; 193706f2543Smrg pScreenPriv->dwGreenMask = 0x07E0; 194706f2543Smrg pScreenPriv->dwBlueMask = 0x001F; 195706f2543Smrg break; 196706f2543Smrg 197706f2543Smrg case 15: 198706f2543Smrg pScreenPriv->dwBitsPerRGB = 5; 199706f2543Smrg pScreenPriv->dwRedMask = 0x7C00; 200706f2543Smrg pScreenPriv->dwGreenMask = 0x03E0; 201706f2543Smrg pScreenPriv->dwBlueMask = 0x001F; 202706f2543Smrg break; 203706f2543Smrg 204706f2543Smrg case 8: 205706f2543Smrg pScreenPriv->dwBitsPerRGB = 8; 206706f2543Smrg pScreenPriv->dwRedMask = 0; 207706f2543Smrg pScreenPriv->dwGreenMask = 0; 208706f2543Smrg pScreenPriv->dwBlueMask = 0; 209706f2543Smrg break; 210706f2543Smrg 211706f2543Smrg default: 212706f2543Smrg ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n"); 213706f2543Smrg return FALSE; 214706f2543Smrg break; 215706f2543Smrg } 216706f2543Smrg 217706f2543Smrg /* Tell the user how many bits per RGB we are using */ 218706f2543Smrg ErrorF ("winInitVisualsNativeGDI - Using dwBitsPerRGB: %d\n", 219706f2543Smrg (int) pScreenPriv->dwBitsPerRGB); 220706f2543Smrg 221706f2543Smrg /* Create a single visual according to the Windows screen depth */ 222706f2543Smrg switch (pScreenInfo->dwDepth) 223706f2543Smrg { 224706f2543Smrg case 24: 225706f2543Smrg case 16: 226706f2543Smrg case 15: 227706f2543Smrg if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, 228706f2543Smrg TrueColorMask, 229706f2543Smrg pScreenPriv->dwBitsPerRGB, 230706f2543Smrg TrueColor, 231706f2543Smrg pScreenPriv->dwRedMask, 232706f2543Smrg pScreenPriv->dwGreenMask, 233706f2543Smrg pScreenPriv->dwBlueMask)) 234706f2543Smrg { 235706f2543Smrg ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n"); 236706f2543Smrg return FALSE; 237706f2543Smrg } 238706f2543Smrg break; 239706f2543Smrg 240706f2543Smrg case 8: 241706f2543Smrg ErrorF ("winInitVisuals - Calling miSetVisualTypesAndMasks\n"); 242706f2543Smrg if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, 243706f2543Smrg StaticColorMask, 244706f2543Smrg pScreenPriv->dwBitsPerRGB, 245706f2543Smrg StaticColor, 246706f2543Smrg pScreenPriv->dwRedMask, 247706f2543Smrg pScreenPriv->dwGreenMask, 248706f2543Smrg pScreenPriv->dwBlueMask)) 249706f2543Smrg { 250706f2543Smrg ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n"); 251706f2543Smrg return FALSE; 252706f2543Smrg } 253706f2543Smrg break; 254706f2543Smrg 255706f2543Smrg default: 256706f2543Smrg ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n"); 257706f2543Smrg return FALSE; 258706f2543Smrg } 259706f2543Smrg 260706f2543Smrg#if 1 261706f2543Smrg ErrorF ("winInitVisualsNativeGDI - Returning\n"); 262706f2543Smrg#endif 263706f2543Smrg 264706f2543Smrg return TRUE; 265706f2543Smrg} 266706f2543Smrg 267706f2543Smrg 268706f2543Smrg/* Adjust the video mode */ 269706f2543Smrgstatic Bool 270706f2543SmrgwinAdjustVideoModeNativeGDI (ScreenPtr pScreen) 271706f2543Smrg{ 272706f2543Smrg winScreenPriv(pScreen); 273706f2543Smrg winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; 274706f2543Smrg HDC hdc = NULL; 275706f2543Smrg DWORD dwBPP; 276706f2543Smrg 277706f2543Smrg hdc = GetDC (NULL); 278706f2543Smrg 279706f2543Smrg /* We're in serious trouble if we can't get a DC */ 280706f2543Smrg if (hdc == NULL) 281706f2543Smrg { 282706f2543Smrg ErrorF ("winAdjustVideoModeNativeGDI - GetDC () failed\n"); 283706f2543Smrg return FALSE; 284706f2543Smrg } 285706f2543Smrg 286706f2543Smrg /* Query GDI for current display depth */ 287706f2543Smrg dwBPP = GetDeviceCaps (hdc, BITSPIXEL); 288706f2543Smrg pScreenInfo->dwDepth = GetDeviceCaps (hdc, PLANES); 289706f2543Smrg 290706f2543Smrg switch (pScreenInfo->dwDepth) { 291706f2543Smrg case 24: 292706f2543Smrg case 16: 293706f2543Smrg case 15: 294706f2543Smrg case 8: 295706f2543Smrg break; 296706f2543Smrg default: 297706f2543Smrg if (dwBPP == 32) 298706f2543Smrg pScreenInfo->dwDepth = 24; 299706f2543Smrg else 300706f2543Smrg pScreenInfo->dwDepth = dwBPP; 301706f2543Smrg break; 302706f2543Smrg } 303706f2543Smrg 304706f2543Smrg /* GDI cannot change the screen depth, so we'll use GDI's depth */ 305706f2543Smrg pScreenInfo->dwBPP = dwBPP; 306706f2543Smrg 307706f2543Smrg /* Release our DC */ 308706f2543Smrg ReleaseDC (NULL, hdc); 309706f2543Smrg 310706f2543Smrg return TRUE; 311706f2543Smrg} 312706f2543Smrg 313706f2543Smrg 314706f2543Smrgstatic Bool 315706f2543SmrgwinActivateAppNativeGDI (ScreenPtr pScreen) 316706f2543Smrg{ 317706f2543Smrg winScreenPriv(pScreen); 318706f2543Smrg winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; 319706f2543Smrg 320706f2543Smrg /* 321706f2543Smrg * Are we active? 322706f2543Smrg * Are we fullscreen? 323706f2543Smrg */ 324706f2543Smrg if (pScreenPriv != NULL 325706f2543Smrg && pScreenPriv->fActive 326706f2543Smrg && pScreenInfo->fFullScreen) 327706f2543Smrg { 328706f2543Smrg /* 329706f2543Smrg * Activating, attempt to bring our window 330706f2543Smrg * to the top of the display 331706f2543Smrg */ 332706f2543Smrg ShowWindow (pScreenPriv->hwndScreen, SW_RESTORE); 333706f2543Smrg } 334706f2543Smrg 335706f2543Smrg /* 336706f2543Smrg * Are we inactive? 337706f2543Smrg * Are we fullscreen? 338706f2543Smrg */ 339706f2543Smrg if (pScreenPriv != NULL 340706f2543Smrg && !pScreenPriv->fActive 341706f2543Smrg && pScreenInfo->fFullScreen) 342706f2543Smrg { 343706f2543Smrg /* 344706f2543Smrg * Deactivating, stuff our window onto the 345706f2543Smrg * task bar. 346706f2543Smrg */ 347706f2543Smrg ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE); 348706f2543Smrg } 349706f2543Smrg 350706f2543Smrg return TRUE; 351706f2543Smrg} 352706f2543Smrg 353706f2543Smrg 354706f2543SmrgHBITMAP 355706f2543SmrgwinCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth, 356706f2543Smrg BYTE **ppbBits, BITMAPINFO **ppbmi) 357706f2543Smrg{ 358706f2543Smrg BITMAPINFOHEADER *pbmih = NULL; 359706f2543Smrg HBITMAP hBitmap = NULL; 360706f2543Smrg BITMAPINFO *pbmi = NULL; 361706f2543Smrg 362706f2543Smrg /* Don't create an invalid bitmap */ 363706f2543Smrg if (iWidth == 0 364706f2543Smrg || iHeight == 0 365706f2543Smrg || iDepth == 0) 366706f2543Smrg { 367706f2543Smrg ErrorF ("\nwinCreateDIBNativeGDI - Invalid specs w %d h %d d %d\n\n", 368706f2543Smrg iWidth, iHeight, iDepth); 369706f2543Smrg return NULL; 370706f2543Smrg } 371706f2543Smrg 372706f2543Smrg /* Allocate bitmap info header */ 373706f2543Smrg pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) 374706f2543Smrg + 256 * sizeof (RGBQUAD)); 375706f2543Smrg if (pbmih == NULL) 376706f2543Smrg { 377706f2543Smrg ErrorF ("winCreateDIBNativeGDI - malloc () failed\n"); 378706f2543Smrg return FALSE; 379706f2543Smrg } 380706f2543Smrg ZeroMemory (pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); 381706f2543Smrg 382706f2543Smrg /* Describe bitmap to be created */ 383706f2543Smrg pbmih->biSize = sizeof (BITMAPINFOHEADER); 384706f2543Smrg pbmih->biWidth = iWidth; 385706f2543Smrg pbmih->biHeight = -iHeight; 386706f2543Smrg pbmih->biPlanes = 1; 387706f2543Smrg pbmih->biBitCount = iDepth; 388706f2543Smrg pbmih->biCompression = BI_RGB; 389706f2543Smrg pbmih->biSizeImage = 0; 390706f2543Smrg pbmih->biXPelsPerMeter = 0; 391706f2543Smrg pbmih->biYPelsPerMeter = 0; 392706f2543Smrg pbmih->biClrUsed = 0; 393706f2543Smrg pbmih->biClrImportant = 0; 394706f2543Smrg 395706f2543Smrg /* Setup color table for mono DIBs */ 396706f2543Smrg if (iDepth == 1) 397706f2543Smrg { 398706f2543Smrg pbmi = (BITMAPINFO*) pbmih; 399706f2543Smrg pbmi->bmiColors[1].rgbBlue = 255; 400706f2543Smrg pbmi->bmiColors[1].rgbGreen = 255; 401706f2543Smrg pbmi->bmiColors[1].rgbRed = 255; 402706f2543Smrg } 403706f2543Smrg 404706f2543Smrg /* Create a DIB with a bit pointer */ 405706f2543Smrg hBitmap = CreateDIBSection (NULL, 406706f2543Smrg (BITMAPINFO *) pbmih, 407706f2543Smrg DIB_RGB_COLORS, 408706f2543Smrg (void **) ppbBits, 409706f2543Smrg NULL, 410706f2543Smrg 0); 411706f2543Smrg if (hBitmap == NULL) 412706f2543Smrg { 413706f2543Smrg ErrorF ("winCreateDIBNativeGDI - CreateDIBSection () failed\n"); 414706f2543Smrg return NULL; 415706f2543Smrg } 416706f2543Smrg 417706f2543Smrg /* Free the bitmap info header memory */ 418706f2543Smrg if (ppbmi != NULL) 419706f2543Smrg { 420706f2543Smrg /* Store the address of the BMIH in the ppbmih parameter */ 421706f2543Smrg *ppbmi = (BITMAPINFO *) pbmih; 422706f2543Smrg } 423706f2543Smrg else 424706f2543Smrg { 425706f2543Smrg free (pbmih); 426706f2543Smrg pbmih = NULL; 427706f2543Smrg } 428706f2543Smrg 429706f2543Smrg return hBitmap; 430706f2543Smrg} 431706f2543Smrg 432706f2543Smrg 433706f2543Smrg#if 0 434706f2543Smrgstatic Bool 435706f2543SmrgwinBltExposedRegionsNativeGDI (ScreenPtr pScreen) 436706f2543Smrg{ 437706f2543Smrg 438706f2543Smrg return TRUE; 439706f2543Smrg} 440706f2543Smrg#endif 441706f2543Smrg 442706f2543Smrg 443706f2543Smrgstatic Bool 444706f2543SmrgwinRedrawScreenNativeGDI (ScreenPtr pScreen) 445706f2543Smrg{ 446706f2543Smrg FatalError ("winRedrawScreenNativeGDI\n"); 447706f2543Smrg return TRUE; 448706f2543Smrg} 449706f2543Smrg 450706f2543Smrg 451706f2543Smrgstatic Bool 452706f2543SmrgwinRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen) 453706f2543Smrg{ 454706f2543Smrg FatalError ("winRealizeInstalledPaletteNativeGDI\n"); 455706f2543Smrg return TRUE; 456706f2543Smrg} 457706f2543Smrg 458706f2543Smrg 459706f2543Smrgstatic Bool 460706f2543SmrgwinInstallColormapNativeGDI (ColormapPtr pColormap) 461706f2543Smrg{ 462706f2543Smrg FatalError ("winInstallColormapNativeGDI\n"); 463706f2543Smrg return TRUE; 464706f2543Smrg} 465706f2543Smrg 466706f2543Smrg 467706f2543Smrgstatic Bool 468706f2543SmrgwinStoreColorsNativeGDI (ColormapPtr pmap, 469706f2543Smrg int ndef, 470706f2543Smrg xColorItem *pdefs) 471706f2543Smrg{ 472706f2543Smrg FatalError ("winStoreColorsNativeGDI\n"); 473706f2543Smrg return TRUE; 474706f2543Smrg} 475706f2543Smrg 476706f2543Smrg 477706f2543Smrgstatic Bool 478706f2543SmrgwinCreateColormapNativeGDI (ColormapPtr pColormap) 479706f2543Smrg{ 480706f2543Smrg FatalError ("winCreateColormapNativeGDI\n"); 481706f2543Smrg return TRUE; 482706f2543Smrg} 483706f2543Smrg 484706f2543Smrg 485706f2543Smrgstatic Bool 486706f2543SmrgwinDestroyColormapNativeGDI (ColormapPtr pColormap) 487706f2543Smrg{ 488706f2543Smrg FatalError ("winDestroyColormapNativeGDI\n"); 489706f2543Smrg return TRUE; 490706f2543Smrg} 491706f2543Smrg 492706f2543Smrg 493706f2543Smrg/* Set engine specific funtions */ 494706f2543SmrgBool 495706f2543SmrgwinSetEngineFunctionsNativeGDI (ScreenPtr pScreen) 496706f2543Smrg{ 497706f2543Smrg winScreenPriv(pScreen); 498706f2543Smrg winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; 499706f2543Smrg 500706f2543Smrg /* Set our pointers */ 501706f2543Smrg pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI; 502706f2543Smrg pScreenPriv->pwinFreeFB = winFreeFBNativeGDI; 503706f2543Smrg pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI; 504706f2543Smrg pScreenPriv->pwinInitScreen = winInitScreenNativeGDI; 505706f2543Smrg pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI; 506706f2543Smrg pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI; 507706f2543Smrg pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI; 508706f2543Smrg if (pScreenInfo->fFullScreen) 509706f2543Smrg pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; 510706f2543Smrg else 511706f2543Smrg pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; 512706f2543Smrg pScreenPriv->pwinFinishScreenInit = winFinishScreenInitNativeGDI; 513706f2543Smrg /* 514706f2543Smrg * WARNING: Do not set the BltExposedRegions procedure pointer to anything 515706f2543Smrg * other than NULL until a working painting procedure is in place. 516706f2543Smrg * Else, winWindowProc will get stuck in an infinite loop because 517706f2543Smrg * Windows expects the BeginPaint and EndPaint functions to be called 518706f2543Smrg * before a WM_PAINT message can be removed from the queue. We are 519706f2543Smrg * using NULL here as a signal for winWindowProc that it should 520706f2543Smrg * not signal that the WM_PAINT message has been processed. 521706f2543Smrg */ 522706f2543Smrg pScreenPriv->pwinBltExposedRegions = NULL; 523706f2543Smrg pScreenPriv->pwinActivateApp = winActivateAppNativeGDI; 524706f2543Smrg pScreenPriv->pwinRedrawScreen = winRedrawScreenNativeGDI; 525706f2543Smrg pScreenPriv->pwinRealizeInstalledPalette = 526706f2543Smrg winRealizeInstalledPaletteNativeGDI; 527706f2543Smrg pScreenPriv->pwinInstallColormap = winInstallColormapNativeGDI; 528706f2543Smrg pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI; 529706f2543Smrg pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI; 530706f2543Smrg pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI; 531706f2543Smrg pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA; 532706f2543Smrg 533706f2543Smrg return TRUE; 534706f2543Smrg} 535