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
167#include "mipict.h"
168#include "picturestr.h"
169
170#ifdef RANDR
171#include "randrstr.h"
172#endif
173
174/*
175 * Windows headers
176 */
177#include "winms.h"
178#include "winresource.h"
179
180/*
181 * Define Windows constants
182 */
183
184#define WM_TRAYICON		(WM_USER + 1000)
185#define WM_INIT_SYS_MENU	(WM_USER + 1001)
186#define WM_GIVEUP		(WM_USER + 1002)
187
188/* Local includes */
189#include "winwindow.h"
190#include "winmsg.h"
191
192/*
193 * Debugging macros
194 */
195
196#if CYGDEBUG
197#define DEBUG_MSG(str,...) \
198if (fDebugProcMsg) \
199{ \
200  char *pszTemp; \
201  int iLength; \
202  if (asprintf (&pszTemp, str, ##__VA_ARGS__) != -1) { \
203    MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \
204    free (pszTemp); \
205  } \
206}
207#else
208#define DEBUG_MSG(str,...)
209#endif
210
211#if CYGDEBUG
212#define DEBUG_FN_NAME(str) PTSTR szFunctionName = str
213#else
214#define DEBUG_FN_NAME(str)
215#endif
216
217#if CYGDEBUG || YES
218#define DEBUGVARS BOOL fDebugProcMsg = FALSE
219#else
220#define DEBUGVARS
221#endif
222
223#if CYGDEBUG || YES
224#define DEBUGPROC_MSG fDebugProcMsg = TRUE
225#else
226#define DEBUGPROC_MSG
227#endif
228
229#define PROFILEPOINT(point,thresh)\
230{\
231static unsigned int PROFPT##point = 0;\
232if (++PROFPT##point % thresh == 0)\
233ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\
234}
235
236#define DEFINE_ATOM_HELPER(func,atom_name)			\
237static Atom func (void) {					\
238    static int generation;					\
239    static Atom atom;						\
240    if (generation != serverGeneration) {			\
241	generation = serverGeneration;				\
242	atom = MakeAtom (atom_name, strlen (atom_name), TRUE);	\
243    }								\
244    return atom;						\
245}
246
247/*
248 * Typedefs for engine dependent function pointers
249 */
250
251typedef Bool (*winAllocateFBProcPtr) (ScreenPtr);
252
253typedef void (*winFreeFBProcPtr) (ScreenPtr);
254
255typedef void (*winShadowUpdateProcPtr) (ScreenPtr, shadowBufPtr);
256
257typedef Bool (*winInitScreenProcPtr) (ScreenPtr);
258
259typedef Bool (*winCloseScreenProcPtr) (ScreenPtr);
260
261typedef Bool (*winInitVisualsProcPtr) (ScreenPtr);
262
263typedef Bool (*winAdjustVideoModeProcPtr) (ScreenPtr);
264
265typedef Bool (*winCreateBoundingWindowProcPtr) (ScreenPtr);
266
267typedef Bool (*winFinishScreenInitProcPtr) (int, ScreenPtr, int, char **);
268
269typedef Bool (*winBltExposedRegionsProcPtr) (ScreenPtr);
270
271typedef Bool (*winBltExposedWindowRegionProcPtr) (ScreenPtr, WindowPtr);
272
273typedef Bool (*winActivateAppProcPtr) (ScreenPtr);
274
275typedef Bool (*winRedrawScreenProcPtr) (ScreenPtr pScreen);
276
277typedef Bool (*winRealizeInstalledPaletteProcPtr) (ScreenPtr pScreen);
278
279typedef Bool (*winInstallColormapProcPtr) (ColormapPtr pColormap);
280
281typedef Bool (*winStoreColorsProcPtr) (ColormapPtr pmap,
282                                       int ndef, xColorItem * pdefs);
283
284typedef Bool (*winCreateColormapProcPtr) (ColormapPtr pColormap);
285
286typedef Bool (*winDestroyColormapProcPtr) (ColormapPtr pColormap);
287
288typedef Bool (*winCreatePrimarySurfaceProcPtr) (ScreenPtr);
289
290typedef Bool (*winReleasePrimarySurfaceProcPtr) (ScreenPtr);
291
292typedef Bool (*winCreateScreenResourcesProc) (ScreenPtr);
293
294/*
295 * Pixmap privates
296 */
297
298typedef struct {
299    HBITMAP hBitmap;
300    void *pbBits;
301    BITMAPINFOHEADER *pbmih;
302    BOOL owned;
303} winPrivPixmapRec, *winPrivPixmapPtr;
304
305/*
306 * Colormap privates
307 */
308
309typedef struct {
310    HPALETTE hPalette;
311    LPDIRECTDRAWPALETTE lpDDPalette;
312    RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
313    PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
314} winPrivCmapRec, *winPrivCmapPtr;
315
316
317/*
318 * Windows Cursor handling.
319 */
320
321typedef struct {
322    /* from GetSystemMetrics */
323    int sm_cx;
324    int sm_cy;
325
326    BOOL visible;
327    HCURSOR handle;
328    QueryBestSizeProcPtr QueryBestSize;
329    miPointerSpriteFuncPtr spriteFuncs;
330} winCursorRec;
331
332/*
333 * Resize modes
334 */
335typedef enum {
336    resizeDefault = -1,
337    resizeNotAllowed,
338    resizeWithScrollbars,
339    resizeWithRandr
340} winResizeMode;
341
342/*
343 * Screen information structure that we need before privates are available
344 * in the server startup sequence.
345 */
346
347typedef struct {
348    ScreenPtr pScreen;
349
350    /* Did the user specify a height and width? */
351    Bool fUserGaveHeightAndWidth;
352
353    DWORD dwScreen;
354
355    int iMonitor;
356    HMONITOR hMonitor;
357    DWORD dwUserWidth;
358    DWORD dwUserHeight;
359    DWORD dwWidth;
360    DWORD dwHeight;
361    DWORD dwPaddedWidth;
362
363    /* Did the user specify a screen position? */
364    Bool fUserGavePosition;
365    DWORD dwInitialX;
366    DWORD dwInitialY;
367
368    /*
369     * dwStride is the number of whole pixels that occupy a scanline,
370     * including those pixels that are not displayed.  This is basically
371     * a rounding up of the width.
372     */
373    DWORD dwStride;
374
375    /* Offset of the screen in the window when using scrollbars */
376    DWORD dwXOffset;
377    DWORD dwYOffset;
378
379    DWORD dwBPP;
380    DWORD dwDepth;
381    DWORD dwRefreshRate;
382    char *pfb;
383    DWORD dwEngine;
384    DWORD dwEnginePreferred;
385    DWORD dwClipUpdatesNBoxes;
386#ifdef XWIN_EMULATEPSEUDO
387    Bool fEmulatePseudo;
388#endif
389    Bool fFullScreen;
390    Bool fDecoration;
391    Bool fRootless;
392    Bool fMultiWindow;
393    Bool fCompositeWM;
394    Bool fMultiMonitorOverride;
395    Bool fMultipleMonitors;
396    Bool fLessPointer;
397    winResizeMode iResizeMode;
398    Bool fNoTrayIcon;
399    int iE3BTimeout;
400    /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
401    Bool fUseWinKillKey;
402    Bool fUseUnixKillKey;
403    Bool fIgnoreInput;
404
405    /* Did the user explicitly set this screen? */
406    Bool fExplicitScreen;
407
408    /* Icons for screen window */
409    HICON hIcon;
410    HICON hIconSm;
411} winScreenInfo, *winScreenInfoPtr;
412
413/*
414 * Screen privates
415 */
416
417typedef 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    /* Privates used by multi-window */
468    pthread_t ptWMProc;
469    pthread_t ptXMsgProc;
470    void *pWMInfo;
471    Bool fRootWindowShown;
472
473    /* Privates used for any module running in a separate thread */
474    pthread_mutex_t pmServerStarted;
475    Bool fServerStarted;
476
477    /* Engine specific functions */
478    winAllocateFBProcPtr pwinAllocateFB;
479    winFreeFBProcPtr pwinFreeFB;
480    winShadowUpdateProcPtr pwinShadowUpdate;
481    winInitScreenProcPtr pwinInitScreen;
482    winCloseScreenProcPtr pwinCloseScreen;
483    winInitVisualsProcPtr pwinInitVisuals;
484    winAdjustVideoModeProcPtr pwinAdjustVideoMode;
485    winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
486    winFinishScreenInitProcPtr pwinFinishScreenInit;
487    winBltExposedRegionsProcPtr pwinBltExposedRegions;
488    winBltExposedWindowRegionProcPtr pwinBltExposedWindowRegion;
489    winActivateAppProcPtr pwinActivateApp;
490    winRedrawScreenProcPtr pwinRedrawScreen;
491    winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
492    winInstallColormapProcPtr pwinInstallColormap;
493    winStoreColorsProcPtr pwinStoreColors;
494    winCreateColormapProcPtr pwinCreateColormap;
495    winDestroyColormapProcPtr pwinDestroyColormap;
496    winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
497    winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
498    winCreateScreenResourcesProc pwinCreateScreenResources;
499
500    /* Window Procedures for Rootless mode */
501    CreateWindowProcPtr CreateWindow;
502    DestroyWindowProcPtr DestroyWindow;
503    PositionWindowProcPtr PositionWindow;
504    ChangeWindowAttributesProcPtr ChangeWindowAttributes;
505    RealizeWindowProcPtr RealizeWindow;
506    UnrealizeWindowProcPtr UnrealizeWindow;
507    ValidateTreeProcPtr ValidateTree;
508    PostValidateTreeProcPtr PostValidateTree;
509    CopyWindowProcPtr CopyWindow;
510    ClearToBackgroundProcPtr ClearToBackground;
511    ClipNotifyProcPtr ClipNotify;
512    RestackWindowProcPtr RestackWindow;
513    ReparentWindowProcPtr ReparentWindow;
514    ResizeWindowProcPtr ResizeWindow;
515    MoveWindowProcPtr MoveWindow;
516    SetShapeProcPtr SetShape;
517    ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
518
519    winCursorRec cursor;
520
521    Bool fNativeGlActive;
522} winPrivScreenRec;
523
524typedef struct {
525    void *value;
526    XID id;
527} WindowIDPairRec, *WindowIDPairPtr;
528
529/*
530 * Extern declares for general global variables
531 */
532
533#include "winglobals.h"
534
535extern winScreenInfo *g_ScreenInfo;
536extern miPointerScreenFuncRec g_winPointerCursorFuncs;
537extern DWORD g_dwEvents;
538
539#ifdef HAS_DEVWINDOWS
540extern int g_fdMessageQueue;
541#endif
542extern DevPrivateKeyRec g_iScreenPrivateKeyRec;
543
544#define g_iScreenPrivateKey  	(&g_iScreenPrivateKeyRec)
545extern DevPrivateKeyRec g_iCmapPrivateKeyRec;
546
547#define g_iCmapPrivateKey 	(&g_iCmapPrivateKeyRec)
548extern DevPrivateKeyRec g_iGCPrivateKeyRec;
549
550#define g_iGCPrivateKey 	(&g_iGCPrivateKeyRec)
551extern DevPrivateKeyRec g_iPixmapPrivateKeyRec;
552
553#define g_iPixmapPrivateKey 	(&g_iPixmapPrivateKeyRec)
554extern DevPrivateKeyRec g_iWindowPrivateKeyRec;
555
556#define g_iWindowPrivateKey 	(&g_iWindowPrivateKeyRec)
557
558extern unsigned long g_ulServerGeneration;
559extern DWORD g_dwEnginesSupported;
560extern HINSTANCE g_hInstance;
561extern int g_copyROP[];
562extern int g_patternROP[];
563extern const char *g_pszQueryHost;
564extern DeviceIntPtr g_pwinPointer;
565extern DeviceIntPtr g_pwinKeyboard;
566
567/*
568 * Extern declares for dynamically loaded library function pointers
569 */
570
571extern FARPROC g_fpDirectDrawCreate;
572extern FARPROC g_fpDirectDrawCreateClipper;
573
574/*
575 * Screen privates macros
576 */
577
578#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \
579    dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey))
580
581#define winSetScreenPriv(pScreen,v) \
582    dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v)
583
584#define winScreenPriv(pScreen) \
585	winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen)
586
587/*
588 * Colormap privates macros
589 */
590
591#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \
592    dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey))
593
594#define winSetCmapPriv(pCmap,v) \
595    dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v)
596
597#define winCmapPriv(pCmap) \
598	winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap)
599
600/*
601 * GC privates macros
602 */
603
604#define winGetGCPriv(pGC) ((winPrivGCPtr) \
605    dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey))
606
607#define winSetGCPriv(pGC,v) \
608    dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v)
609
610#define winGCPriv(pGC) \
611	winPrivGCPtr pGCPriv = winGetGCPriv(pGC)
612
613/*
614 * Pixmap privates macros
615 */
616
617#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \
618    dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey))
619
620#define winSetPixmapPriv(pPixmap,v) \
621    dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v)
622
623#define winPixmapPriv(pPixmap) \
624	winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap)
625
626/*
627 * Window privates macros
628 */
629
630#define winGetWindowPriv(pWin) ((winPrivWinPtr) \
631    dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey))
632
633#define winSetWindowPriv(pWin,v) \
634    dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v)
635
636#define winWindowPriv(pWin) \
637	winPrivWinPtr pWinPriv = winGetWindowPriv(pWin)
638
639/*
640 * wrapper macros
641 */
642#define _WIN_WRAP(priv, real, mem, func) {\
643    priv->mem = real->mem; \
644    real->mem = func; \
645}
646
647#define _WIN_UNWRAP(priv, real, mem) {\
648    real->mem = priv->mem; \
649}
650
651#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
652
653#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem)
654
655/*
656 * BEGIN DDX and DIX Function Prototypes
657 */
658
659/*
660 * winallpriv.c
661 */
662
663Bool
664 winAllocatePrivates(ScreenPtr pScreen);
665
666Bool
667 winInitCmapPrivates(ColormapPtr pCmap, int i);
668
669Bool
670 winAllocateCmapPrivates(ColormapPtr pCmap);
671
672/*
673 * winblock.c
674 */
675
676void
677
678winBlockHandler(ScreenPtr pScreen, void *pTimeout);
679
680/*
681 * winclipboardinit.c
682 */
683
684Bool
685 winInitClipboard(void);
686
687void
688 winClipboardShutdown(void);
689
690/*
691 * wincmap.c
692 */
693
694void
695 winSetColormapFunctions(ScreenPtr pScreen);
696
697Bool
698 winCreateDefColormap(ScreenPtr pScreen);
699
700/*
701 * wincreatewnd.c
702 */
703
704Bool
705 winCreateBoundingWindowFullScreen(ScreenPtr pScreen);
706
707Bool
708 winCreateBoundingWindowWindowed(ScreenPtr pScreen);
709
710/*
711 * windialogs.c
712 */
713
714void
715 winDisplayExitDialog(winPrivScreenPtr pScreenPriv);
716
717void
718 winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv);
719
720void
721 winDisplayAboutDialog(winPrivScreenPtr pScreenPriv);
722
723/*
724 * winengine.c
725 */
726
727void
728 winDetectSupportedEngines(void);
729
730Bool
731 winSetEngine(ScreenPtr pScreen);
732
733Bool
734 winGetDDProcAddresses(void);
735
736void
737 winReleaseDDProcAddresses(void);
738
739/*
740 * winerror.c
741 */
742
743#ifdef DDXOSVERRORF
744void
745OsVendorVErrorF(const char *pszFormat, va_list va_args)
746_X_ATTRIBUTE_PRINTF(1, 0);
747#endif
748
749void
750winMessageBoxF(const char *pszError, UINT uType, ...)
751_X_ATTRIBUTE_PRINTF(1, 3);
752
753/*
754 * winglobals.c
755 */
756
757void
758 winInitializeGlobals(void);
759
760/*
761 * winkeybd.c
762 */
763
764int
765 winTranslateKey(WPARAM wParam, LPARAM lParam);
766
767int
768 winKeybdProc(DeviceIntPtr pDeviceInt, int iState);
769
770void
771 winInitializeModeKeyStates(void);
772
773void
774 winRestoreModeKeyStates(void);
775
776Bool
777 winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam);
778
779void
780 winKeybdReleaseKeys(void);
781
782void
783 winSendKeyEvent(DWORD dwKey, Bool fDown);
784
785BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
786
787void
788 winFixShiftKeys(int iScanCode);
789
790/*
791 * winkeyhook.c
792 */
793
794Bool
795 winInstallKeyboardHookLL(void);
796
797void
798 winRemoveKeyboardHookLL(void);
799
800/*
801 * winmisc.c
802 */
803
804CARD8
805 winCountBits(DWORD dw);
806
807Bool
808 winUpdateFBPointer(ScreenPtr pScreen, void *pbits);
809
810/*
811 * winmouse.c
812 */
813
814int
815 winMouseProc(DeviceIntPtr pDeviceInt, int iState);
816
817int
818 winMouseWheel(int *iTotalDeltaZ, int iDeltaZ, int iButtonUp, int iButtonDown);
819
820void
821 winMouseButtonsSendEvent(int iEventType, int iButton);
822
823int
824
825winMouseButtonsHandle(ScreenPtr pScreen,
826                      int iEventType, int iButton, WPARAM wParam);
827
828void
829 winEnqueueMotion(int x, int y);
830
831/*
832 * winscrinit.c
833 */
834
835Bool
836 winScreenInit(ScreenPtr pScreen, int argc, char **argv);
837
838Bool
839 winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv);
840
841/*
842 * winshadddnl.c
843 */
844
845Bool
846 winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen);
847
848/*
849 * winshadgdi.c
850 */
851
852Bool
853 winSetEngineFunctionsShadowGDI(ScreenPtr pScreen);
854
855/*
856 * winwakeup.c
857 */
858
859void
860winWakeupHandler(ScreenPtr pScreen, int iResult);
861
862/*
863 * winwindow.c
864 */
865
866Bool
867 winCreateWindowRootless(WindowPtr pWindow);
868
869Bool
870 winDestroyWindowRootless(WindowPtr pWindow);
871
872Bool
873 winPositionWindowRootless(WindowPtr pWindow, int x, int y);
874
875Bool
876 winChangeWindowAttributesRootless(WindowPtr pWindow, unsigned long mask);
877
878Bool
879 winUnmapWindowRootless(WindowPtr pWindow);
880
881Bool
882 winMapWindowRootless(WindowPtr pWindow);
883
884void
885 winSetShapeRootless(WindowPtr pWindow, int kind);
886
887/*
888 * winmultiwindowshape.c
889 */
890
891void
892 winReshapeMultiWindow(WindowPtr pWin);
893
894void
895 winSetShapeMultiWindow(WindowPtr pWindow, int kind);
896
897void
898 winUpdateRgnMultiWindow(WindowPtr pWindow);
899
900/*
901 * winmultiwindowwindow.c
902 */
903
904Bool
905 winCreateWindowMultiWindow(WindowPtr pWindow);
906
907Bool
908 winDestroyWindowMultiWindow(WindowPtr pWindow);
909
910Bool
911 winPositionWindowMultiWindow(WindowPtr pWindow, int x, int y);
912
913Bool
914 winChangeWindowAttributesMultiWindow(WindowPtr pWindow, unsigned long mask);
915
916Bool
917 winUnmapWindowMultiWindow(WindowPtr pWindow);
918
919Bool
920 winMapWindowMultiWindow(WindowPtr pWindow);
921
922void
923 winReparentWindowMultiWindow(WindowPtr pWin, WindowPtr pPriorParent);
924
925void
926 winRestackWindowMultiWindow(WindowPtr pWin, WindowPtr pOldNextSib);
927
928void
929 winReorderWindowsMultiWindow(void);
930
931void
932
933winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w,
934                           unsigned int h, WindowPtr pSib);
935void
936
937winMoveWindowMultiWindow(WindowPtr pWin, int x, int y,
938                         WindowPtr pSib, VTKind kind);
939
940void
941
942winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt,
943                         RegionPtr oldRegion);
944
945PixmapPtr
946winCreatePixmapMultiwindow(ScreenPtr pScreen, int width, int height, int depth,
947                           unsigned usage_hint);
948Bool
949winDestroyPixmapMultiwindow(PixmapPtr pPixmap);
950
951Bool
952winModifyPixmapHeaderMultiwindow(PixmapPtr pPixmap,
953                                 int width,
954                                 int height,
955                                 int depth,
956                                 int bitsPerPixel, int devKind, void *pPixData);
957
958XID
959 winGetWindowID(WindowPtr pWin);
960
961int
962 winAdjustXWindow(WindowPtr pWin, HWND hwnd);
963
964/*
965 * winmultiwindowwndproc.c
966 */
967
968LRESULT CALLBACK
969winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
970
971/*
972 * wintrayicon.c
973 */
974
975void
976 winInitNotifyIcon(winPrivScreenPtr pScreenPriv);
977
978void
979 winDeleteNotifyIcon(winPrivScreenPtr pScreenPriv);
980
981LRESULT
982winHandleIconMessage(HWND hwnd, UINT message,
983                     WPARAM wParam, LPARAM lParam,
984                     winPrivScreenPtr pScreenPriv);
985
986/*
987 * winwndproc.c
988 */
989
990LRESULT CALLBACK
991winWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
992
993/*
994 * winwindowswm.c
995 */
996
997void
998
999winWindowsWMSendEvent(int type, unsigned int mask, int which, int arg,
1000                      Window window, int x, int y, int w, int h);
1001
1002void
1003 winWindowsWMExtensionInit(void);
1004
1005/*
1006 * wincursor.c
1007 */
1008
1009Bool
1010 winInitCursor(ScreenPtr pScreen);
1011
1012/*
1013 * winprocarg.c
1014 */
1015void
1016 winInitializeScreens(int maxscreens);
1017
1018/*
1019 * winrandr.c
1020 */
1021Bool
1022 winRandRInit(ScreenPtr pScreen);
1023void
1024
1025winDoRandRScreenSetSize(ScreenPtr pScreen,
1026                        CARD16 width,
1027                        CARD16 height, CARD32 mmWidth, CARD32 mmHeight);
1028
1029/*
1030 * winmsgwindow.c
1031 */
1032Bool
1033winCreateMsgWindowThread(void);
1034
1035/*
1036 * winos.c
1037 */
1038void
1039winOS(void);
1040
1041/*
1042 * END DDX and DIX Function Prototypes
1043 */
1044
1045#endif                          /* _WIN_H_ */
1046