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