1 /* 2 *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. 3 * 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: 11 * 12 *The above copyright notice and this permission notice shall be 13 *included in all copies or substantial portions of the Software. 14 * 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. 22 * 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. 27 * 28 * Authors: Dakshinamurthy Karra 29 * Suhaib M Siddiqi 30 * Peter Busch 31 * Harold L Hunt II 32 * Kensuke Matsuzaki 33 */ 34 35 #ifndef _WIN_H_ 36 #define _WIN_H_ 37 38 #ifndef NO 39 #define NO 0 40 #endif 41 #ifndef YES 42 #define YES 1 43 #endif 44 45 /* We can handle WM_MOUSEHWHEEL even though _WIN32_WINNT < 0x0600 */ 46 #ifndef WM_MOUSEHWHEEL 47 #define WM_MOUSEHWHEEL 0x020E 48 #endif 49 50 /* Turn debug messages on or off */ 51 #ifndef CYGDEBUG 52 #define CYGDEBUG NO 53 #endif 54 55 #define WIN_DEFAULT_BPP 0 56 #define WIN_DEFAULT_WHITEPIXEL 255 57 #define WIN_DEFAULT_BLACKPIXEL 0 58 #define WIN_DEFAULT_LINEBIAS 0 59 #define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */ 60 #define WIN_DEFAULT_DPI 96 61 #define WIN_DEFAULT_REFRESH 0 62 #define WIN_DEFAULT_WIN_KILL TRUE 63 #define WIN_DEFAULT_UNIX_KILL FALSE 64 #define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0 65 #ifdef XWIN_EMULATEPSEUDO 66 #define WIN_DEFAULT_EMULATE_PSEUDO FALSE 67 #endif 68 #define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE 69 70 /* 71 * Windows only supports 256 color palettes 72 */ 73 #define WIN_NUM_PALETTE_ENTRIES 256 74 75 /* 76 * Number of times to call Restore in an attempt to restore the primary surface 77 */ 78 #define WIN_REGAIN_SURFACE_RETRIES 1 79 80 /* 81 * Build a supported display depths mask by shifting one to the left 82 * by the number of bits in the supported depth. 83 */ 84 #define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \ 85 | (1 << (16 - 1)) | (1 << (15 - 1)) \ 86 | (1 << ( 8 - 1))) 87 #define WIN_CHECK_DEPTH YES 88 89 /* 90 * Timer IDs for WM_TIMER 91 */ 92 #define WIN_E3B_TIMER_ID 1 93 #define WIN_POLLING_MOUSE_TIMER_ID 2 94 95 #define MOUSE_POLLING_INTERVAL 50 96 97 #define WIN_E3B_OFF -1 98 #define WIN_E3B_DEFAULT 0 99 100 #define WIN_FD_INVALID -1 101 102 #define WIN_SERVER_NONE 0x0L /* 0 */ 103 #define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */ 104 #define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */ 105 106 #define AltMapIndex Mod1MapIndex 107 #define NumLockMapIndex Mod2MapIndex 108 #define AltLangMapIndex Mod3MapIndex 109 #define KanaMapIndex Mod4MapIndex 110 #define ScrollLockMapIndex Mod5MapIndex 111 112 #define WIN_MOD_LALT 0x00000001 113 #define WIN_MOD_RALT 0x00000002 114 #define WIN_MOD_LCONTROL 0x00000004 115 #define WIN_MOD_RCONTROL 0x00000008 116 117 #define WIN_24BPP_MASK_RED 0x00FF0000 118 #define WIN_24BPP_MASK_GREEN 0x0000FF00 119 #define WIN_24BPP_MASK_BLUE 0x000000FF 120 121 #define WIN_MAX_KEYS_PER_KEY 4 122 123 #define NONAMELESSUNION 124 125 #include <sys/types.h> 126 #include <sys/stat.h> 127 #include <stdio.h> 128 129 #include <errno.h> 130 #define HANDLE void * 131 #include <pthread.h> 132 #undef HANDLE 133 134 #ifdef HAVE_MMAP 135 #include <sys/mman.h> 136 #ifndef MAP_FILE 137 #define MAP_FILE 0 138 #endif /* MAP_FILE */ 139 #endif /* HAVE_MMAP */ 140 141 #include <X11/X.h> 142 #include <X11/Xproto.h> 143 #include <X11/Xos.h> 144 #include <X11/Xprotostr.h> 145 #include "scrnintstr.h" 146 #include "pixmapstr.h" 147 #include "pixmap.h" 148 #include "region.h" 149 #include "gcstruct.h" 150 #include "colormap.h" 151 #include "colormapst.h" 152 #include "miscstruct.h" 153 #include "servermd.h" 154 #include "windowstr.h" 155 #include "mi.h" 156 #include "micmap.h" 157 #include "mifillarc.h" 158 #include "mifpoly.h" 159 #include "input.h" 160 #include "mipointer.h" 161 #include "X11/keysym.h" 162 #include "micoord.h" 163 #include "miline.h" 164 #include "shadow.h" 165 #include "fb.h" 166 #ifdef XWIN_MULTIWINDOWEXTWM 167 #include "rootless.h" 168 #endif 169 170 #include "mipict.h" 171 #include "picturestr.h" 172 173 #ifdef RANDR 174 #include "randrstr.h" 175 #endif 176 177 /* 178 * Windows headers 179 */ 180 #include "winms.h" 181 #include "winresource.h" 182 183 /* 184 * Define Windows constants 185 */ 186 187 #define WM_TRAYICON (WM_USER + 1000) 188 #define WM_INIT_SYS_MENU (WM_USER + 1001) 189 #define WM_GIVEUP (WM_USER + 1002) 190 191 /* Local includes */ 192 #include "winwindow.h" 193 #include "winmsg.h" 194 195 /* 196 * Debugging macros 197 */ 198 199 #if CYGDEBUG 200 #define DEBUG_MSG(str,...) \ 201 if (fDebugProcMsg) \ 202 { \ 203 char *pszTemp; \ 204 int iLength; \ 205 if (asprintf (&pszTemp, str, ##__VA_ARGS__) != -1) { \ 206 MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \ 207 free (pszTemp); \ 208 } \ 209 } 210 #else 211 #define DEBUG_MSG(str,...) 212 #endif 213 214 #if CYGDEBUG 215 #define DEBUG_FN_NAME(str) PTSTR szFunctionName = str 216 #else 217 #define DEBUG_FN_NAME(str) 218 #endif 219 220 #if CYGDEBUG || YES 221 #define DEBUGVARS BOOL fDebugProcMsg = FALSE 222 #else 223 #define DEBUGVARS 224 #endif 225 226 #if CYGDEBUG || YES 227 #define DEBUGPROC_MSG fDebugProcMsg = TRUE 228 #else 229 #define DEBUGPROC_MSG 230 #endif 231 232 #define PROFILEPOINT(point,thresh)\ 233 {\ 234 static unsigned int PROFPT##point = 0;\ 235 if (++PROFPT##point % thresh == 0)\ 236 ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\ 237 } 238 239 #define DEFINE_ATOM_HELPER(func,atom_name) \ 240 static Atom func (void) { \ 241 static int generation; \ 242 static Atom atom; \ 243 if (generation != serverGeneration) { \ 244 generation = serverGeneration; \ 245 atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \ 246 } \ 247 return atom; \ 248 } 249 250 /* 251 * Typedefs for engine dependent function pointers 252 */ 253 254 typedef Bool (*winAllocateFBProcPtr) (ScreenPtr); 255 256 typedef void (*winFreeFBProcPtr) (ScreenPtr); 257 258 typedef void (*winShadowUpdateProcPtr) (ScreenPtr, shadowBufPtr); 259 260 typedef Bool (*winInitScreenProcPtr) (ScreenPtr); 261 262 typedef Bool (*winCloseScreenProcPtr) (ScreenPtr); 263 264 typedef Bool (*winInitVisualsProcPtr) (ScreenPtr); 265 266 typedef Bool (*winAdjustVideoModeProcPtr) (ScreenPtr); 267 268 typedef Bool (*winCreateBoundingWindowProcPtr) (ScreenPtr); 269 270 typedef Bool (*winFinishScreenInitProcPtr) (int, ScreenPtr, int, char **); 271 272 typedef Bool (*winBltExposedRegionsProcPtr) (ScreenPtr); 273 274 typedef Bool (*winActivateAppProcPtr) (ScreenPtr); 275 276 typedef Bool (*winRedrawScreenProcPtr) (ScreenPtr pScreen); 277 278 typedef Bool (*winRealizeInstalledPaletteProcPtr) (ScreenPtr pScreen); 279 280 typedef Bool (*winInstallColormapProcPtr) (ColormapPtr pColormap); 281 282 typedef Bool (*winStoreColorsProcPtr) (ColormapPtr pmap, 283 int ndef, xColorItem * pdefs); 284 285 typedef Bool (*winCreateColormapProcPtr) (ColormapPtr pColormap); 286 287 typedef Bool (*winDestroyColormapProcPtr) (ColormapPtr pColormap); 288 289 typedef Bool (*winCreatePrimarySurfaceProcPtr) (ScreenPtr); 290 291 typedef Bool (*winReleasePrimarySurfaceProcPtr) (ScreenPtr); 292 293 typedef Bool (*winCreateScreenResourcesProc) (ScreenPtr); 294 295 /* 296 * Pixmap privates 297 */ 298 299 typedef struct { 300 HDC hdcSelected; 301 HBITMAP hBitmap; 302 BYTE *pbBits; 303 DWORD dwScanlineBytes; 304 BITMAPINFOHEADER *pbmih; 305 } winPrivPixmapRec, *winPrivPixmapPtr; 306 307 /* 308 * Colormap privates 309 */ 310 311 typedef struct { 312 HPALETTE hPalette; 313 LPDIRECTDRAWPALETTE lpDDPalette; 314 RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES]; 315 PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES]; 316 } winPrivCmapRec, *winPrivCmapPtr; 317 318 319 /* 320 * Windows Cursor handling. 321 */ 322 323 typedef struct { 324 /* from GetSystemMetrics */ 325 int sm_cx; 326 int sm_cy; 327 328 BOOL visible; 329 HCURSOR handle; 330 QueryBestSizeProcPtr QueryBestSize; 331 miPointerSpriteFuncPtr spriteFuncs; 332 } winCursorRec; 333 334 /* 335 * Resize modes 336 */ 337 typedef enum { 338 resizeDefault = -1, 339 resizeNotAllowed, 340 resizeWithScrollbars, 341 resizeWithRandr 342 } winResizeMode; 343 344 /* 345 * Screen information structure that we need before privates are available 346 * in the server startup sequence. 347 */ 348 349 typedef struct { 350 ScreenPtr pScreen; 351 352 /* Did the user specify a height and width? */ 353 Bool fUserGaveHeightAndWidth; 354 355 DWORD dwScreen; 356 357 int iMonitor; 358 HMONITOR hMonitor; 359 DWORD dwUserWidth; 360 DWORD dwUserHeight; 361 DWORD dwWidth; 362 DWORD dwHeight; 363 DWORD dwPaddedWidth; 364 365 /* Did the user specify a screen position? */ 366 Bool fUserGavePosition; 367 DWORD dwInitialX; 368 DWORD dwInitialY; 369 370 /* 371 * dwStride is the number of whole pixels that occupy a scanline, 372 * including those pixels that are not displayed. This is basically 373 * a rounding up of the width. 374 */ 375 DWORD dwStride; 376 377 /* Offset of the screen in the window when using scrollbars */ 378 DWORD dwXOffset; 379 DWORD dwYOffset; 380 381 DWORD dwBPP; 382 DWORD dwDepth; 383 DWORD dwRefreshRate; 384 char *pfb; 385 DWORD dwEngine; 386 DWORD dwEnginePreferred; 387 DWORD dwClipUpdatesNBoxes; 388 #ifdef XWIN_EMULATEPSEUDO 389 Bool fEmulatePseudo; 390 #endif 391 Bool fFullScreen; 392 Bool fDecoration; 393 #ifdef XWIN_MULTIWINDOWEXTWM 394 Bool fMWExtWM; 395 #endif 396 Bool fRootless; 397 Bool fMultiWindow; 398 Bool fMultiMonitorOverride; 399 Bool fMultipleMonitors; 400 Bool fLessPointer; 401 winResizeMode iResizeMode; 402 Bool fNoTrayIcon; 403 int iE3BTimeout; 404 /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */ 405 Bool fUseWinKillKey; 406 Bool fUseUnixKillKey; 407 Bool fIgnoreInput; 408 409 /* Did the user explicitly set this screen? */ 410 Bool fExplicitScreen; 411 } winScreenInfo, *winScreenInfoPtr; 412 413 /* 414 * Screen privates 415 */ 416 417 typedef struct _winPrivScreenRec { 418 winScreenInfoPtr pScreenInfo; 419 420 Bool fEnabled; 421 Bool fClosed; 422 Bool fActive; 423 Bool fBadDepth; 424 425 int iDeltaZ; 426 int iDeltaV; 427 428 int iConnectedClients; 429 430 CloseScreenProcPtr CloseScreen; 431 432 DWORD dwRedMask; 433 DWORD dwGreenMask; 434 DWORD dwBlueMask; 435 DWORD dwBitsPerRGB; 436 437 DWORD dwModeKeyStates; 438 439 /* Handle to icons that must be freed */ 440 HICON hiconNotifyIcon; 441 442 /* Palette management */ 443 ColormapPtr pcmapInstalled; 444 445 /* Pointer to the root visual so we only have to look it up once */ 446 VisualPtr pRootVisual; 447 448 /* 3 button emulation variables */ 449 int iE3BCachedPress; 450 Bool fE3BFakeButton2Sent; 451 452 /* Privates used by shadow fb GDI engine */ 453 HBITMAP hbmpShadow; 454 HDC hdcScreen; 455 HDC hdcShadow; 456 HWND hwndScreen; 457 BITMAPINFOHEADER *pbmih; 458 459 /* Privates used by shadow fb DirectDraw Nonlocking engine */ 460 LPDIRECTDRAW pdd; 461 LPDIRECTDRAW4 pdd4; 462 LPDIRECTDRAWSURFACE4 pddsShadow4; 463 LPDIRECTDRAWSURFACE4 pddsPrimary4; 464 LPDIRECTDRAWCLIPPER pddcPrimary; 465 BOOL fRetryCreateSurface; 466 467 #ifdef XWIN_MULTIWINDOWEXTWM 468 /* Privates used by multi-window external window manager */ 469 RootlessFrameID widTop; 470 Bool fRestacking; 471 #endif 472 473 /* Privates used by multi-window */ 474 pthread_t ptWMProc; 475 pthread_t ptXMsgProc; 476 void *pWMInfo; 477 478 /* Privates used by both multi-window and rootless */ 479 Bool fRootWindowShown; 480 481 /* Privates used for any module running in a seperate thread */ 482 pthread_mutex_t pmServerStarted; 483 Bool fServerStarted; 484 485 /* Engine specific functions */ 486 winAllocateFBProcPtr pwinAllocateFB; 487 winFreeFBProcPtr pwinFreeFB; 488 winShadowUpdateProcPtr pwinShadowUpdate; 489 winInitScreenProcPtr pwinInitScreen; 490 winCloseScreenProcPtr pwinCloseScreen; 491 winInitVisualsProcPtr pwinInitVisuals; 492 winAdjustVideoModeProcPtr pwinAdjustVideoMode; 493 winCreateBoundingWindowProcPtr pwinCreateBoundingWindow; 494 winFinishScreenInitProcPtr pwinFinishScreenInit; 495 winBltExposedRegionsProcPtr pwinBltExposedRegions; 496 winActivateAppProcPtr pwinActivateApp; 497 winRedrawScreenProcPtr pwinRedrawScreen; 498 winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette; 499 winInstallColormapProcPtr pwinInstallColormap; 500 winStoreColorsProcPtr pwinStoreColors; 501 winCreateColormapProcPtr pwinCreateColormap; 502 winDestroyColormapProcPtr pwinDestroyColormap; 503 winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface; 504 winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface; 505 winCreateScreenResourcesProc pwinCreateScreenResources; 506 507 /* Window Procedures for Rootless mode */ 508 CreateWindowProcPtr CreateWindow; 509 DestroyWindowProcPtr DestroyWindow; 510 PositionWindowProcPtr PositionWindow; 511 ChangeWindowAttributesProcPtr ChangeWindowAttributes; 512 RealizeWindowProcPtr RealizeWindow; 513 UnrealizeWindowProcPtr UnrealizeWindow; 514 ValidateTreeProcPtr ValidateTree; 515 PostValidateTreeProcPtr PostValidateTree; 516 CopyWindowProcPtr CopyWindow; 517 ClearToBackgroundProcPtr ClearToBackground; 518 ClipNotifyProcPtr ClipNotify; 519 RestackWindowProcPtr RestackWindow; 520 ReparentWindowProcPtr ReparentWindow; 521 ResizeWindowProcPtr ResizeWindow; 522 MoveWindowProcPtr MoveWindow; 523 SetShapeProcPtr SetShape; 524 525 winCursorRec cursor; 526 527 Bool fNativeGlActive; 528 } winPrivScreenRec; 529 530 #ifdef XWIN_MULTIWINDOWEXTWM 531 typedef struct { 532 RootlessWindowPtr pFrame; 533 HWND hWnd; 534 int dwWidthBytes; 535 BITMAPINFOHEADER *pbmihShadow; 536 HBITMAP hbmpShadow; 537 HDC hdcShadow; 538 HDC hdcScreen; 539 BOOL fResized; 540 BOOL fRestackingNow; 541 BOOL fClose; 542 BOOL fMovingOrSizing; 543 BOOL fDestroyed; //for debug 544 char *pfb; 545 } win32RootlessWindowRec, *win32RootlessWindowPtr; 546 #endif 547 548 typedef struct { 549 void *value; 550 XID id; 551 } WindowIDPairRec, *WindowIDPairPtr; 552 553 /* 554 * Extern declares for general global variables 555 */ 556 557 #include "winglobals.h" 558 559 extern winScreenInfo *g_ScreenInfo; 560 extern miPointerScreenFuncRec g_winPointerCursorFuncs; 561 extern DWORD g_dwEvents; 562 563 #ifdef HAS_DEVWINDOWS 564 extern int g_fdMessageQueue; 565 #endif 566 extern DevPrivateKeyRec g_iScreenPrivateKeyRec; 567 568 #define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec) 569 extern DevPrivateKeyRec g_iCmapPrivateKeyRec; 570 571 #define g_iCmapPrivateKey (&g_iCmapPrivateKeyRec) 572 extern DevPrivateKeyRec g_iGCPrivateKeyRec; 573 574 #define g_iGCPrivateKey (&g_iGCPrivateKeyRec) 575 extern DevPrivateKeyRec g_iPixmapPrivateKeyRec; 576 577 #define g_iPixmapPrivateKey (&g_iPixmapPrivateKeyRec) 578 extern DevPrivateKeyRec g_iWindowPrivateKeyRec; 579 580 #define g_iWindowPrivateKey (&g_iWindowPrivateKeyRec) 581 582 extern unsigned long g_ulServerGeneration; 583 extern DWORD g_dwEnginesSupported; 584 extern HINSTANCE g_hInstance; 585 extern int g_copyROP[]; 586 extern int g_patternROP[]; 587 extern const char *g_pszQueryHost; 588 extern DeviceIntPtr g_pwinPointer; 589 extern DeviceIntPtr g_pwinKeyboard; 590 591 /* 592 * Extern declares for dynamically loaded library function pointers 593 */ 594 595 extern FARPROC g_fpDirectDrawCreate; 596 extern FARPROC g_fpDirectDrawCreateClipper; 597 598 /* 599 * Screen privates macros 600 */ 601 602 #define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \ 603 dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey)) 604 605 #define winSetScreenPriv(pScreen,v) \ 606 dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v) 607 608 #define winScreenPriv(pScreen) \ 609 winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen) 610 611 /* 612 * Colormap privates macros 613 */ 614 615 #define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \ 616 dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey)) 617 618 #define winSetCmapPriv(pCmap,v) \ 619 dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v) 620 621 #define winCmapPriv(pCmap) \ 622 winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap) 623 624 /* 625 * GC privates macros 626 */ 627 628 #define winGetGCPriv(pGC) ((winPrivGCPtr) \ 629 dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey)) 630 631 #define winSetGCPriv(pGC,v) \ 632 dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v) 633 634 #define winGCPriv(pGC) \ 635 winPrivGCPtr pGCPriv = winGetGCPriv(pGC) 636 637 /* 638 * Pixmap privates macros 639 */ 640 641 #define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \ 642 dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey)) 643 644 #define winSetPixmapPriv(pPixmap,v) \ 645 dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v) 646 647 #define winPixmapPriv(pPixmap) \ 648 winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap) 649 650 /* 651 * Window privates macros 652 */ 653 654 #define winGetWindowPriv(pWin) ((winPrivWinPtr) \ 655 dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey)) 656 657 #define winSetWindowPriv(pWin,v) \ 658 dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v) 659 660 #define winWindowPriv(pWin) \ 661 winPrivWinPtr pWinPriv = winGetWindowPriv(pWin) 662 663 /* 664 * wrapper macros 665 */ 666 #define _WIN_WRAP(priv, real, mem, func) {\ 667 priv->mem = real->mem; \ 668 real->mem = func; \ 669 } 670 671 #define _WIN_UNWRAP(priv, real, mem) {\ 672 real->mem = priv->mem; \ 673 } 674 675 #define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func) 676 677 #define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem) 678 679 /* 680 * BEGIN DDX and DIX Function Prototypes 681 */ 682 683 /* 684 * winallpriv.c 685 */ 686 687 Bool 688 winAllocatePrivates(ScreenPtr pScreen); 689 690 Bool 691 winInitCmapPrivates(ColormapPtr pCmap, int i); 692 693 Bool 694 winAllocateCmapPrivates(ColormapPtr pCmap); 695 696 /* 697 * winauth.c 698 */ 699 700 Bool 701 winGenerateAuthorization(void); 702 void winSetAuthorization(void); 703 704 /* 705 * winblock.c 706 */ 707 708 void 709 710 winBlockHandler(ScreenPtr pScreen, void *pTimeout); 711 712 /* 713 * winclipboardinit.c 714 */ 715 716 Bool 717 winInitClipboard(void); 718 719 void 720 winClipboardShutdown(void); 721 722 /* 723 * wincmap.c 724 */ 725 726 void 727 winSetColormapFunctions(ScreenPtr pScreen); 728 729 Bool 730 winCreateDefColormap(ScreenPtr pScreen); 731 732 /* 733 * wincreatewnd.c 734 */ 735 736 Bool 737 winCreateBoundingWindowFullScreen(ScreenPtr pScreen); 738 739 Bool 740 winCreateBoundingWindowWindowed(ScreenPtr pScreen); 741 742 /* 743 * windialogs.c 744 */ 745 746 void 747 winDisplayExitDialog(winPrivScreenPtr pScreenPriv); 748 749 void 750 winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv); 751 752 void 753 winDisplayAboutDialog(winPrivScreenPtr pScreenPriv); 754 755 /* 756 * winengine.c 757 */ 758 759 void 760 winDetectSupportedEngines(void); 761 762 Bool 763 winSetEngine(ScreenPtr pScreen); 764 765 Bool 766 winGetDDProcAddresses(void); 767 768 void 769 winReleaseDDProcAddresses(void); 770 771 /* 772 * winerror.c 773 */ 774 775 #ifdef DDXOSVERRORF 776 void 777 OsVendorVErrorF(const char *pszFormat, va_list va_args) 778 _X_ATTRIBUTE_PRINTF(1, 0); 779 #endif 780 781 void 782 winMessageBoxF(const char *pszError, UINT uType, ...) 783 _X_ATTRIBUTE_PRINTF(1, 3); 784 785 /* 786 * winglobals.c 787 */ 788 789 void 790 winInitializeGlobals(void); 791 792 /* 793 * winkeybd.c 794 */ 795 796 int 797 winTranslateKey(WPARAM wParam, LPARAM lParam); 798 799 int 800 winKeybdProc(DeviceIntPtr pDeviceInt, int iState); 801 802 void 803 winInitializeModeKeyStates(void); 804 805 void 806 winRestoreModeKeyStates(void); 807 808 Bool 809 winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam); 810 811 void 812 winKeybdReleaseKeys(void); 813 814 void 815 winSendKeyEvent(DWORD dwKey, Bool fDown); 816 817 BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam); 818 819 void 820 winFixShiftKeys(int iScanCode); 821 822 /* 823 * winkeyhook.c 824 */ 825 826 Bool 827 winInstallKeyboardHookLL(void); 828 829 void 830 winRemoveKeyboardHookLL(void); 831 832 /* 833 * winmisc.c 834 */ 835 836 CARD8 837 winCountBits(DWORD dw); 838 839 Bool 840 winUpdateFBPointer(ScreenPtr pScreen, void *pbits); 841 842 /* 843 * winmouse.c 844 */ 845 846 int 847 winMouseProc(DeviceIntPtr pDeviceInt, int iState); 848 849 int 850 winMouseWheel(int *iTotalDeltaZ, int iDeltaZ, int iButtonUp, int iButtonDown); 851 852 void 853 winMouseButtonsSendEvent(int iEventType, int iButton); 854 855 int 856 857 winMouseButtonsHandle(ScreenPtr pScreen, 858 int iEventType, int iButton, WPARAM wParam); 859 860 void 861 winEnqueueMotion(int x, int y); 862 863 /* 864 * winscrinit.c 865 */ 866 867 Bool 868 winScreenInit(ScreenPtr pScreen, int argc, char **argv); 869 870 Bool 871 winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv); 872 873 /* 874 * winshadddnl.c 875 */ 876 877 Bool 878 winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen); 879 880 /* 881 * winshadgdi.c 882 */ 883 884 Bool 885 winSetEngineFunctionsShadowGDI(ScreenPtr pScreen); 886 887 /* 888 * winwakeup.c 889 */ 890 891 void 892 winWakeupHandler(ScreenPtr pScreen, int iResult); 893 894 /* 895 * winwindow.c 896 */ 897 898 Bool 899 winCreateWindowRootless(WindowPtr pWindow); 900 901 Bool 902 winDestroyWindowRootless(WindowPtr pWindow); 903 904 Bool 905 winPositionWindowRootless(WindowPtr pWindow, int x, int y); 906 907 Bool 908 winChangeWindowAttributesRootless(WindowPtr pWindow, unsigned long mask); 909 910 Bool 911 winUnmapWindowRootless(WindowPtr pWindow); 912 913 Bool 914 winMapWindowRootless(WindowPtr pWindow); 915 916 void 917 winSetShapeRootless(WindowPtr pWindow, int kind); 918 919 /* 920 * winmultiwindowshape.c 921 */ 922 923 void 924 winReshapeMultiWindow(WindowPtr pWin); 925 926 void 927 winSetShapeMultiWindow(WindowPtr pWindow, int kind); 928 929 void 930 winUpdateRgnMultiWindow(WindowPtr pWindow); 931 932 /* 933 * winmultiwindowwindow.c 934 */ 935 936 Bool 937 winCreateWindowMultiWindow(WindowPtr pWindow); 938 939 Bool 940 winDestroyWindowMultiWindow(WindowPtr pWindow); 941 942 Bool 943 winPositionWindowMultiWindow(WindowPtr pWindow, int x, int y); 944 945 Bool 946 winChangeWindowAttributesMultiWindow(WindowPtr pWindow, unsigned long mask); 947 948 Bool 949 winUnmapWindowMultiWindow(WindowPtr pWindow); 950 951 Bool 952 winMapWindowMultiWindow(WindowPtr pWindow); 953 954 void 955 winReparentWindowMultiWindow(WindowPtr pWin, WindowPtr pPriorParent); 956 957 void 958 winRestackWindowMultiWindow(WindowPtr pWin, WindowPtr pOldNextSib); 959 960 void 961 winReorderWindowsMultiWindow(void); 962 963 void 964 965 winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w, 966 unsigned int h, WindowPtr pSib); 967 void 968 969 winMoveWindowMultiWindow(WindowPtr pWin, int x, int y, 970 WindowPtr pSib, VTKind kind); 971 972 void 973 974 winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt, 975 RegionPtr oldRegion); 976 977 XID 978 winGetWindowID(WindowPtr pWin); 979 980 int 981 winAdjustXWindow(WindowPtr pWin, HWND hwnd); 982 983 /* 984 * winmultiwindowwndproc.c 985 */ 986 987 LRESULT CALLBACK 988 winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); 989 990 /* 991 * wintrayicon.c 992 */ 993 994 void 995 winInitNotifyIcon(winPrivScreenPtr pScreenPriv); 996 997 void 998 winDeleteNotifyIcon(winPrivScreenPtr pScreenPriv); 999 1000 LRESULT 1001 winHandleIconMessage(HWND hwnd, UINT message, 1002 WPARAM wParam, LPARAM lParam, 1003 winPrivScreenPtr pScreenPriv); 1004 1005 /* 1006 * winwndproc.c 1007 */ 1008 1009 LRESULT CALLBACK 1010 winWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 1011 1012 #ifdef XWIN_MULTIWINDOWEXTWM 1013 /* 1014 * winwin32rootless.c 1015 */ 1016 1017 Bool 1018 1019 winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, 1020 int newX, int newY, RegionPtr pShape); 1021 1022 void 1023 winMWExtWMDestroyFrame(RootlessFrameID wid); 1024 1025 void 1026 1027 winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY); 1028 1029 void 1030 1031 winMWExtWMResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, 1032 int newX, int newY, unsigned int newW, unsigned int newH, 1033 unsigned int gravity); 1034 1035 void 1036 winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid); 1037 1038 void 1039 winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape); 1040 1041 void 1042 winMWExtWMUnmapFrame(RootlessFrameID wid); 1043 1044 void 1045 1046 winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow); 1047 1048 void 1049 winMWExtWMStopDrawing(RootlessFrameID wid, Bool flush); 1050 1051 void 1052 winMWExtWMUpdateRegion(RootlessFrameID wid, RegionPtr pDamage); 1053 1054 void 1055 1056 winMWExtWMDamageRects(RootlessFrameID wid, int count, const BoxRec * rects, 1057 int shift_x, int shift_y); 1058 1059 void 1060 winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin); 1061 1062 void 1063 1064 winMWExtWMCopyBytes(unsigned int width, unsigned int height, 1065 const void *src, unsigned int srcRowBytes, 1066 void *dst, unsigned int dstRowBytes); 1067 1068 void 1069 1070 winMWExtWMCopyWindow(RootlessFrameID wid, int dstNrects, 1071 const BoxRec * dstRects, int dx, int dy); 1072 #endif 1073 1074 #ifdef XWIN_MULTIWINDOWEXTWM 1075 /* 1076 * winwin32rootlesswindow.c 1077 */ 1078 1079 void 1080 winMWExtWMReorderWindows(ScreenPtr pScreen); 1081 1082 void 1083 winMWExtWMMoveXWindow(WindowPtr pWin, int x, int y); 1084 1085 void 1086 winMWExtWMResizeXWindow(WindowPtr pWin, int w, int h); 1087 1088 void 1089 winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h); 1090 1091 void 1092 1093 winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv, 1094 winScreenInfoPtr pScreenInfo); 1095 1096 wBOOL CALLBACK winMWExtWMDecorateWindow(HWND hwnd, LPARAM lParam); 1097 1098 void 1099 winMWExtWMRestackWindows(ScreenPtr pScreen); 1100 #endif 1101 1102 #ifdef XWIN_MULTIWINDOWEXTWM 1103 /* 1104 * winwin32rootlesswndproc.c 1105 */ 1106 1107 LRESULT CALLBACK 1108 winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); 1109 #endif 1110 1111 /* 1112 * winwindowswm.c 1113 */ 1114 1115 void 1116 1117 winWindowsWMSendEvent(int type, unsigned int mask, int which, int arg, 1118 Window window, int x, int y, int w, int h); 1119 1120 void 1121 winWindowsWMExtensionInit(void); 1122 1123 /* 1124 * wincursor.c 1125 */ 1126 1127 Bool 1128 winInitCursor(ScreenPtr pScreen); 1129 1130 /* 1131 * winprocarg.c 1132 */ 1133 void 1134 winInitializeScreens(int maxscreens); 1135 1136 /* 1137 * winrandr.c 1138 */ 1139 Bool 1140 winRandRInit(ScreenPtr pScreen); 1141 void 1142 1143 winDoRandRScreenSetSize(ScreenPtr pScreen, 1144 CARD16 width, 1145 CARD16 height, CARD32 mmWidth, CARD32 mmHeight); 1146 1147 /* 1148 * winmsgwindow.c 1149 */ 1150 Bool 1151 winCreateMsgWindowThread(void); 1152 1153 /* 1154 * winos.c 1155 */ 1156 void 1157 winOS(void); 1158 1159 /* 1160 * END DDX and DIX Function Prototypes 1161 */ 1162 1163 #endif /* _WIN_H_ */ 1164