quartz.h revision 4642e01f
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 "quartzPasteboard.h"
37
38#include "screenint.h"
39#include "window.h"
40
41/*------------------------------------------
42   Quartz display mode function types
43  ------------------------------------------*/
44
45/*
46 * Display mode initialization
47 */
48typedef void (*DisplayInitProc)(void);
49typedef Bool (*AddScreenProc)(int index, ScreenPtr pScreen);
50typedef Bool (*SetupScreenProc)(int index, ScreenPtr pScreen);
51typedef void (*InitInputProc)(int argc, char **argv);
52
53/*
54 * Cursor functions
55 */
56typedef Bool (*InitCursorProc)(ScreenPtr pScreen);
57
58/*
59 * Suspend and resume X11 activity
60 */
61typedef void (*SuspendScreenProc)(ScreenPtr pScreen);
62typedef void (*ResumeScreenProc)(ScreenPtr pScreen, int x, int y);
63
64/*
65 * Screen state change support
66 */
67typedef void (*AddPseudoramiXScreensProc)(int *x, int *y, int *width, int *height);
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;
117extern int quartzHasRoot, quartzEnableRootless;
118
119Bool QuartzAddScreen(int index, ScreenPtr pScreen);
120Bool QuartzSetupScreen(int index, ScreenPtr pScreen);
121void QuartzInitOutput(int argc,char **argv);
122void QuartzInitInput(int argc, char **argv);
123void QuartzInitServer(int argc, char **argv, char **envp);
124void QuartzGiveUp(void);
125void QuartzProcessEvent(xEvent *xe);
126void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
127
128void QuartzShow(int x, int y); // (x, y) = cursor loc
129void QuartzHide(void);
130void QuartzSetRootClip(BOOL enable);
131void QuartzSpaceChanged(uint32_t space_id);
132
133void QuartzSetFullscreen(Bool state);
134void QuartzSetRootless(Bool state);
135#endif
136