xref: /OK3568_Linux_fs/external/xserver/hw/xquartz/quartz.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * quartz.h
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * External interface of the Quartz display modes seen by the generic, mode
5*4882a593Smuzhiyun  * independent parts of the Darwin X server.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Copyright (c) 2002-2012 Apple Inc. All rights reserved.
8*4882a593Smuzhiyun  * Copyright (c) 2001-2003 Greg Parker and Torrey T. Lyons.
9*4882a593Smuzhiyun  *                 All Rights Reserved.
10*4882a593Smuzhiyun  *
11*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining a
12*4882a593Smuzhiyun  * copy of this software and associated documentation files (the "Software"),
13*4882a593Smuzhiyun  * to deal in the Software without restriction, including without limitation
14*4882a593Smuzhiyun  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15*4882a593Smuzhiyun  * and/or sell copies of the Software, and to permit persons to whom the
16*4882a593Smuzhiyun  * Software is furnished to do so, subject to the following conditions:
17*4882a593Smuzhiyun  *
18*4882a593Smuzhiyun  * The above copyright notice and this permission notice shall be included in
19*4882a593Smuzhiyun  * all copies or substantial portions of the Software.
20*4882a593Smuzhiyun  *
21*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22*4882a593Smuzhiyun  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23*4882a593Smuzhiyun  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24*4882a593Smuzhiyun  * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
25*4882a593Smuzhiyun  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26*4882a593Smuzhiyun  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27*4882a593Smuzhiyun  * DEALINGS IN THE SOFTWARE.
28*4882a593Smuzhiyun  *
29*4882a593Smuzhiyun  * Except as contained in this notice, the name(s) of the above copyright
30*4882a593Smuzhiyun  * holders shall not be used in advertising or otherwise to promote the sale,
31*4882a593Smuzhiyun  * use or other dealings in this Software without prior written authorization.
32*4882a593Smuzhiyun  */
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun #ifndef _QUARTZ_H
35*4882a593Smuzhiyun #define _QUARTZ_H
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #include <X11/Xdefs.h>
38*4882a593Smuzhiyun #include "privates.h"
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun #include "screenint.h"
41*4882a593Smuzhiyun #include "window.h"
42*4882a593Smuzhiyun #include "pixmap.h"
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun /*------------------------------------------
45*4882a593Smuzhiyun    Quartz display mode function types
46*4882a593Smuzhiyun    ------------------------------------------*/
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun /*
49*4882a593Smuzhiyun  * Display mode initialization
50*4882a593Smuzhiyun  */
51*4882a593Smuzhiyun typedef void (*DisplayInitProc)(void);
52*4882a593Smuzhiyun typedef Bool (*AddScreenProc)(int index, ScreenPtr pScreen);
53*4882a593Smuzhiyun typedef Bool (*SetupScreenProc)(int index, ScreenPtr pScreen);
54*4882a593Smuzhiyun typedef void (*InitInputProc)(int argc, char **argv);
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun /*
57*4882a593Smuzhiyun  * Cursor functions
58*4882a593Smuzhiyun  */
59*4882a593Smuzhiyun typedef Bool (*InitCursorProc)(ScreenPtr pScreen);
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun /*
62*4882a593Smuzhiyun  * Suspend and resume X11 activity
63*4882a593Smuzhiyun  */
64*4882a593Smuzhiyun typedef void (*SuspendScreenProc)(ScreenPtr pScreen);
65*4882a593Smuzhiyun typedef void (*ResumeScreenProc)(ScreenPtr pScreen);
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun /*
68*4882a593Smuzhiyun  * Screen state change support
69*4882a593Smuzhiyun  */
70*4882a593Smuzhiyun typedef void (*AddPseudoramiXScreensProc)
71*4882a593Smuzhiyun     (int *x, int *y, int *width, int *height, ScreenPtr pScreen);
72*4882a593Smuzhiyun typedef void (*UpdateScreenProc)(ScreenPtr pScreen);
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun /*
75*4882a593Smuzhiyun  * Rootless helper functions
76*4882a593Smuzhiyun  */
77*4882a593Smuzhiyun typedef Bool (*IsX11WindowProc)(int windowNumber);
78*4882a593Smuzhiyun typedef void (*HideWindowsProc)(Bool hide);
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun /*
81*4882a593Smuzhiyun  * Rootless functions for optional export to GLX layer
82*4882a593Smuzhiyun  */
83*4882a593Smuzhiyun typedef void * (*FrameForWindowProc)(WindowPtr pWin, Bool create);
84*4882a593Smuzhiyun typedef WindowPtr (*TopLevelParentProc)(WindowPtr pWindow);
85*4882a593Smuzhiyun typedef Bool (*CreateSurfaceProc)
86*4882a593Smuzhiyun     (ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
87*4882a593Smuzhiyun     unsigned int client_id, unsigned int *surface_id,
88*4882a593Smuzhiyun     unsigned int key[2], void (*notify)(void *arg, void *data),
89*4882a593Smuzhiyun     void *notify_data);
90*4882a593Smuzhiyun typedef Bool (*DestroySurfaceProc)
91*4882a593Smuzhiyun     (ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
92*4882a593Smuzhiyun     void (*notify)(void *arg, void *data), void *notify_data);
93*4882a593Smuzhiyun 
94*4882a593Smuzhiyun /*
95*4882a593Smuzhiyun  * Quartz display mode function list
96*4882a593Smuzhiyun  */
97*4882a593Smuzhiyun typedef struct _QuartzModeProcs {
98*4882a593Smuzhiyun     DisplayInitProc DisplayInit;
99*4882a593Smuzhiyun     AddScreenProc AddScreen;
100*4882a593Smuzhiyun     SetupScreenProc SetupScreen;
101*4882a593Smuzhiyun     InitInputProc InitInput;
102*4882a593Smuzhiyun 
103*4882a593Smuzhiyun     InitCursorProc InitCursor;
104*4882a593Smuzhiyun 
105*4882a593Smuzhiyun     SuspendScreenProc SuspendScreen;
106*4882a593Smuzhiyun     ResumeScreenProc ResumeScreen;
107*4882a593Smuzhiyun 
108*4882a593Smuzhiyun     AddPseudoramiXScreensProc AddPseudoramiXScreens;
109*4882a593Smuzhiyun     UpdateScreenProc UpdateScreen;
110*4882a593Smuzhiyun 
111*4882a593Smuzhiyun     IsX11WindowProc IsX11Window;
112*4882a593Smuzhiyun     HideWindowsProc HideWindows;
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun     FrameForWindowProc FrameForWindow;
115*4882a593Smuzhiyun     TopLevelParentProc TopLevelParent;
116*4882a593Smuzhiyun     CreateSurfaceProc CreateSurface;
117*4882a593Smuzhiyun     DestroySurfaceProc DestroySurface;
118*4882a593Smuzhiyun } QuartzModeProcsRec, *QuartzModeProcsPtr;
119*4882a593Smuzhiyun 
120*4882a593Smuzhiyun extern QuartzModeProcsPtr quartzProcs;
121*4882a593Smuzhiyun 
122*4882a593Smuzhiyun extern Bool XQuartzFullscreenVisible; /* Are the windows visible (predicated on !rootless) */
123*4882a593Smuzhiyun extern Bool XQuartzServerVisible;     /* Is the server visible ... TODO: Refactor to "active" */
124*4882a593Smuzhiyun extern Bool XQuartzEnableKeyEquivalents;
125*4882a593Smuzhiyun extern Bool XQuartzRootlessDefault;  /* Is our default mode rootless? */
126*4882a593Smuzhiyun extern Bool XQuartzIsRootless;       /* Is our current mode rootless (or FS)? */
127*4882a593Smuzhiyun extern Bool XQuartzFullscreenMenu;   /* Show the menu bar (autohide) while in FS */
128*4882a593Smuzhiyun extern Bool XQuartzFullscreenDisableHotkeys;
129*4882a593Smuzhiyun extern Bool XQuartzOptionSendsAlt;   /* Alt or Mode_switch? */
130*4882a593Smuzhiyun 
131*4882a593Smuzhiyun extern int32_t XQuartzShieldingWindowLevel; /* CGShieldingWindowLevel() or 0 */
132*4882a593Smuzhiyun 
133*4882a593Smuzhiyun // Other shared data
134*4882a593Smuzhiyun extern DevPrivateKeyRec quartzScreenKeyRec;
135*4882a593Smuzhiyun #define quartzScreenKey (&quartzScreenKeyRec)
136*4882a593Smuzhiyun extern int aquaMenuBarHeight;
137*4882a593Smuzhiyun 
138*4882a593Smuzhiyun // Name of GLX bundle for native OpenGL
139*4882a593Smuzhiyun extern const char      *quartzOpenGLBundle;
140*4882a593Smuzhiyun 
141*4882a593Smuzhiyun Bool
142*4882a593Smuzhiyun QuartzAddScreen(int index, ScreenPtr pScreen);
143*4882a593Smuzhiyun Bool
144*4882a593Smuzhiyun QuartzSetupScreen(int index, ScreenPtr pScreen);
145*4882a593Smuzhiyun void
146*4882a593Smuzhiyun QuartzInitOutput(int argc, char **argv);
147*4882a593Smuzhiyun void
148*4882a593Smuzhiyun QuartzInitInput(int argc, char **argv);
149*4882a593Smuzhiyun void
150*4882a593Smuzhiyun QuartzInitServer(int argc, char **argv, char **envp);
151*4882a593Smuzhiyun void
152*4882a593Smuzhiyun QuartzGiveUp(void);
153*4882a593Smuzhiyun void
154*4882a593Smuzhiyun QuartzProcessEvent(xEvent *xe);
155*4882a593Smuzhiyun void
156*4882a593Smuzhiyun QuartzUpdateScreens(void);
157*4882a593Smuzhiyun 
158*4882a593Smuzhiyun void
159*4882a593Smuzhiyun QuartzShow(void);
160*4882a593Smuzhiyun void
161*4882a593Smuzhiyun QuartzHide(void);
162*4882a593Smuzhiyun void
163*4882a593Smuzhiyun QuartzSetRootClip(int mode);
164*4882a593Smuzhiyun void
165*4882a593Smuzhiyun QuartzSpaceChanged(uint32_t space_id);
166*4882a593Smuzhiyun 
167*4882a593Smuzhiyun void
168*4882a593Smuzhiyun QuartzSetRootless(Bool state);
169*4882a593Smuzhiyun void
170*4882a593Smuzhiyun QuartzShowFullscreen(Bool state);
171*4882a593Smuzhiyun 
172*4882a593Smuzhiyun int
173*4882a593Smuzhiyun server_main(int argc, char **argv, char **envp);
174*4882a593Smuzhiyun #endif
175