1706f2543Smrg/*
2706f2543Smrg * quartz.h
3706f2543Smrg *
4706f2543Smrg * External interface of the Quartz display modes seen by the generic, mode
5706f2543Smrg * independent parts of the Darwin X server.
6706f2543Smrg *
7706f2543Smrg * Copyright (c) 2001-2003 Greg Parker and Torrey T. Lyons.
8706f2543Smrg *                 All Rights Reserved.
9706f2543Smrg *
10706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining a
11706f2543Smrg * copy of this software and associated documentation files (the "Software"),
12706f2543Smrg * to deal in the Software without restriction, including without limitation
13706f2543Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14706f2543Smrg * and/or sell copies of the Software, and to permit persons to whom the
15706f2543Smrg * Software is furnished to do so, subject to the following conditions:
16706f2543Smrg *
17706f2543Smrg * The above copyright notice and this permission notice shall be included in
18706f2543Smrg * all copies or substantial portions of the Software.
19706f2543Smrg *
20706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21706f2543Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22706f2543Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23706f2543Smrg * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
24706f2543Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25706f2543Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26706f2543Smrg * DEALINGS IN THE SOFTWARE.
27706f2543Smrg *
28706f2543Smrg * Except as contained in this notice, the name(s) of the above copyright
29706f2543Smrg * holders shall not be used in advertising or otherwise to promote the sale,
30706f2543Smrg * use or other dealings in this Software without prior written authorization.
31706f2543Smrg */
32706f2543Smrg
33706f2543Smrg#ifndef _QUARTZ_H
34706f2543Smrg#define _QUARTZ_H
35706f2543Smrg
36706f2543Smrg#include "screenint.h"
37706f2543Smrg#include "window.h"
38706f2543Smrg#include "pixmap.h"
39706f2543Smrg
40706f2543Smrg/*------------------------------------------
41706f2543Smrg   Quartz display mode function types
42706f2543Smrg  ------------------------------------------*/
43706f2543Smrg
44706f2543Smrg/*
45706f2543Smrg * Display mode initialization
46706f2543Smrg */
47706f2543Smrgtypedef void (*DisplayInitProc)(void);
48706f2543Smrgtypedef Bool (*AddScreenProc)(int index, ScreenPtr pScreen);
49706f2543Smrgtypedef Bool (*SetupScreenProc)(int index, ScreenPtr pScreen);
50706f2543Smrgtypedef void (*InitInputProc)(int argc, char **argv);
51706f2543Smrg
52706f2543Smrg/*
53706f2543Smrg * Cursor functions
54706f2543Smrg */
55706f2543Smrgtypedef Bool (*InitCursorProc)(ScreenPtr pScreen);
56706f2543Smrg
57706f2543Smrg/*
58706f2543Smrg * Suspend and resume X11 activity
59706f2543Smrg */
60706f2543Smrgtypedef void (*SuspendScreenProc)(ScreenPtr pScreen);
61706f2543Smrgtypedef void (*ResumeScreenProc)(ScreenPtr pScreen);
62706f2543Smrg
63706f2543Smrg/*
64706f2543Smrg * Screen state change support
65706f2543Smrg */
66706f2543Smrgtypedef void (*AddPseudoramiXScreensProc)
67706f2543Smrg    (int *x, int *y, int *width, int *height, ScreenPtr pScreen);
68706f2543Smrgtypedef void (*UpdateScreenProc)(ScreenPtr pScreen);
69706f2543Smrg
70706f2543Smrg/*
71706f2543Smrg * Rootless helper functions
72706f2543Smrg */
73706f2543Smrgtypedef Bool (*IsX11WindowProc)(void *nsWindow, int windowNumber);
74706f2543Smrgtypedef void (*HideWindowsProc)(Bool hide);
75706f2543Smrg
76706f2543Smrg/*
77706f2543Smrg * Rootless functions for optional export to GLX layer
78706f2543Smrg */
79706f2543Smrgtypedef void * (*FrameForWindowProc)(WindowPtr pWin, Bool create);
80706f2543Smrgtypedef WindowPtr (*TopLevelParentProc)(WindowPtr pWindow);
81706f2543Smrgtypedef Bool (*CreateSurfaceProc)
82706f2543Smrg    (ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
83706f2543Smrg     unsigned int client_id, unsigned int *surface_id,
84706f2543Smrg     unsigned int key[2], void (*notify) (void *arg, void *data),
85706f2543Smrg     void *notify_data);
86706f2543Smrgtypedef Bool (*DestroySurfaceProc)
87706f2543Smrg    (ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
88706f2543Smrg     void (*notify) (void *arg, void *data), void *notify_data);
89706f2543Smrg
90706f2543Smrg/*
91706f2543Smrg * Quartz display mode function list
92706f2543Smrg */
93706f2543Smrgtypedef struct _QuartzModeProcs {
94706f2543Smrg    DisplayInitProc DisplayInit;
95706f2543Smrg    AddScreenProc AddScreen;
96706f2543Smrg    SetupScreenProc SetupScreen;
97706f2543Smrg    InitInputProc InitInput;
98706f2543Smrg
99706f2543Smrg    InitCursorProc InitCursor;
100706f2543Smrg
101706f2543Smrg    SuspendScreenProc SuspendScreen;
102706f2543Smrg    ResumeScreenProc ResumeScreen;
103706f2543Smrg
104706f2543Smrg    AddPseudoramiXScreensProc AddPseudoramiXScreens;
105706f2543Smrg    UpdateScreenProc UpdateScreen;
106706f2543Smrg
107706f2543Smrg    IsX11WindowProc IsX11Window;
108706f2543Smrg    HideWindowsProc HideWindows;
109706f2543Smrg
110706f2543Smrg    FrameForWindowProc FrameForWindow;
111706f2543Smrg    TopLevelParentProc TopLevelParent;
112706f2543Smrg    CreateSurfaceProc CreateSurface;
113706f2543Smrg    DestroySurfaceProc DestroySurface;
114706f2543Smrg} QuartzModeProcsRec, *QuartzModeProcsPtr;
115706f2543Smrg
116706f2543Smrgextern QuartzModeProcsPtr quartzProcs;
117706f2543Smrg
118706f2543Smrgextern Bool XQuartzFullscreenVisible; /* Are the windows visible (predicated on !rootless) */
119706f2543Smrgextern Bool XQuartzServerVisible;     /* Is the server visible ... TODO: Refactor to "active" */
120706f2543Smrgextern Bool XQuartzEnableKeyEquivalents;
121706f2543Smrgextern Bool XQuartzRootlessDefault;  /* Is our default mode rootless? */
122706f2543Smrgextern Bool XQuartzIsRootless;       /* Is our current mode rootless (or FS)? */
123706f2543Smrgextern Bool XQuartzFullscreenMenu;   /* Show the menu bar (autohide) while in FS */
124706f2543Smrgextern Bool XQuartzFullscreenDisableHotkeys;
125706f2543Smrgextern Bool XQuartzOptionSendsAlt;   /* Alt or Mode_switch? */
126706f2543Smrg
127706f2543Smrgextern int32_t XQuartzShieldingWindowLevel; /* CGShieldingWindowLevel() or 0 */
128706f2543Smrg
129706f2543SmrgBool QuartzAddScreen(int index, ScreenPtr pScreen);
130706f2543SmrgBool QuartzSetupScreen(int index, ScreenPtr pScreen);
131706f2543Smrgvoid QuartzInitOutput(int argc,char **argv);
132706f2543Smrgvoid QuartzInitInput(int argc, char **argv);
133706f2543Smrgvoid QuartzInitServer(int argc, char **argv, char **envp);
134706f2543Smrgvoid QuartzGiveUp(void);
135706f2543Smrgvoid QuartzProcessEvent(xEvent *xe);
136706f2543Smrgvoid QuartzUpdateScreens(void);
137706f2543Smrg
138706f2543Smrgvoid QuartzShow(void);
139706f2543Smrgvoid QuartzHide(void);
140706f2543Smrgvoid QuartzSetRootClip(BOOL enable);
141706f2543Smrgvoid QuartzSpaceChanged(uint32_t space_id);
142706f2543Smrg
143706f2543Smrgvoid QuartzSetRootless(Bool state);
144706f2543Smrgvoid QuartzShowFullscreen(Bool state);
145706f2543Smrg
146706f2543Smrgint server_main(int argc, char **argv, char **envp);
147706f2543Smrg#endif
148