1 | /* $XFree86$ */
|
---|
2 | /*
|
---|
3 | * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
|
---|
4 | *
|
---|
5 | * All Rights Reserved.
|
---|
6 | *
|
---|
7 | * Permission is hereby granted, free of charge, to any person obtaining
|
---|
8 | * a copy of this software and associated documentation files (the
|
---|
9 | * "Software"), to deal in the Software without restriction, including
|
---|
10 | * without limitation on the rights to use, copy, modify, merge,
|
---|
11 | * publish, distribute, sublicense, and/or sell copies of the Software,
|
---|
12 | * and to permit persons to whom the Software is furnished to do so,
|
---|
13 | * subject to the following conditions:
|
---|
14 | *
|
---|
15 | * The above copyright notice and this permission notice (including the
|
---|
16 | * next paragraph) shall be included in all copies or substantial
|
---|
17 | * portions of the Software.
|
---|
18 | *
|
---|
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
---|
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
22 | * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
|
---|
23 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
---|
24 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
25 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
26 | * SOFTWARE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /*
|
---|
30 | * Authors:
|
---|
31 | * Kevin E. Martin <[email protected]>
|
---|
32 | * David H. Dawes <[email protected]>
|
---|
33 | * Rickard E. (Rik) Faith <[email protected]>
|
---|
34 | *
|
---|
35 | */
|
---|
36 |
|
---|
37 | /** \file
|
---|
38 | * Main header file included by all other DMX-related files.
|
---|
39 | */
|
---|
40 |
|
---|
41 | /** \mainpage
|
---|
42 | * - <a href="http://dmx.sourceforge.net">DMX Home Page</a>
|
---|
43 | * - <a href="http://sourceforge.net/projects/dmx">DMX Project Page (on
|
---|
44 | * Source Forge)</a>
|
---|
45 | * - <a href="http://dmx.sourceforge.net/dmx.html">Distributed Multihead
|
---|
46 | * X design</a>, the design document for DMX
|
---|
47 | * - <a href="http://dmx.sourceforge.net/DMXSpec.txt">Client-to-Server
|
---|
48 | * DMX Extension to the X Protocol</a>
|
---|
49 | */
|
---|
50 |
|
---|
51 | #ifndef DMX_H
|
---|
52 | #define DMX_H
|
---|
53 |
|
---|
54 | #include "gcstruct.h"
|
---|
55 |
|
---|
56 | /* Handle client-side include files in one place. */
|
---|
57 | #include "dmxclient.h"
|
---|
58 |
|
---|
59 | #include "globals.h"
|
---|
60 | #include "scrnintstr.h"
|
---|
61 |
|
---|
62 | #ifdef RENDER
|
---|
63 | #include "picturestr.h"
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | #ifdef GLXEXT
|
---|
67 | #include <GL/glx.h>
|
---|
68 | #include <GL/glxint.h>
|
---|
69 | #endif
|
---|
70 |
|
---|
71 | typedef enum {
|
---|
72 | PosNone = -1,
|
---|
73 | PosAbsolute = 0,
|
---|
74 | PosRightOf,
|
---|
75 | PosLeftOf,
|
---|
76 | PosAbove,
|
---|
77 | PosBelow,
|
---|
78 | PosRelative
|
---|
79 | } PositionType;
|
---|
80 |
|
---|
81 | /** Provide the typedef globally, but keep the contents opaque outside
|
---|
82 | * of the input routines. \see dmxinput.h */
|
---|
83 | typedef struct _DMXInputInfo DMXInputInfo;
|
---|
84 |
|
---|
85 | /** Provide the typedef globally, but keep the contents opaque outside
|
---|
86 | * of the XSync statistic routines. \see dmxstat.c */
|
---|
87 | typedef struct _DMXStatInfo DMXStatInfo;
|
---|
88 |
|
---|
89 | /** Global structure containing information about each backend screen. */
|
---|
90 | typedef struct _DMXScreenInfo {
|
---|
91 | const char *name; /**< Name from command line or config file */
|
---|
92 | int index; /**< Index into dmxScreens global */
|
---|
93 |
|
---|
94 | /*---------- Back-end X server information ----------*/
|
---|
95 |
|
---|
96 | Display *beDisplay; /**< Back-end X server's display */
|
---|
97 | int beWidth; /**< Width of BE display */
|
---|
98 | int beHeight; /**< Height of BE display */
|
---|
99 | int beDepth; /**< Depth of BE display */
|
---|
100 | int beBPP; /**< Bits per pixel of BE display */
|
---|
101 | int beXDPI; /**< Horizontal dots per inch of BE */
|
---|
102 | int beYDPI; /**< Vertical dots per inch of BE */
|
---|
103 |
|
---|
104 | int beNumDepths; /**< Number of depths on BE server */
|
---|
105 | int *beDepths; /**< Depths from BE server */
|
---|
106 |
|
---|
107 | int beNumPixmapFormats; /**< Number of pixmap formats on BE */
|
---|
108 | XPixmapFormatValues *bePixmapFormats; /**< Pixmap formats on BE */
|
---|
109 |
|
---|
110 | int beNumVisuals; /**< Number of visuals on BE */
|
---|
111 | XVisualInfo *beVisuals; /**< Visuals from BE server */
|
---|
112 | int beDefVisualIndex; /**< Default visual index of BE */
|
---|
113 |
|
---|
114 | int beNumDefColormaps; /**< Number of default colormaps */
|
---|
115 | Colormap *beDefColormaps; /**< Default colormaps for DMX server */
|
---|
116 |
|
---|
117 | Pixel beBlackPixel; /**< Default black pixel for BE */
|
---|
118 | Pixel beWhitePixel; /**< Default white pixel for BE */
|
---|
119 |
|
---|
120 | /*---------- Screen window information ----------*/
|
---|
121 |
|
---|
122 | Window scrnWin; /**< "Screen" window on backend display */
|
---|
123 | int scrnX; /**< X offset of "screen" WRT BE display */
|
---|
124 | int scrnY; /**< Y offset of "screen" WRT BE display */
|
---|
125 | int scrnWidth; /**< Width of "screen" */
|
---|
126 | int scrnHeight; /**< Height of "screen" */
|
---|
127 | int scrnXSign; /**< X offset sign of "screen" */
|
---|
128 | int scrnYSign; /**< Y offset sign of "screen" */
|
---|
129 |
|
---|
130 | /** Default drawables for "screen" */
|
---|
131 | Drawable scrnDefDrawables[MAXFORMATS];
|
---|
132 |
|
---|
133 | struct _DMXScreenInfo *next; /**< List of "screens" on same display */
|
---|
134 | struct _DMXScreenInfo *over; /**< List of "screens" that overlap */
|
---|
135 |
|
---|
136 | /*---------- Root window information ----------*/
|
---|
137 |
|
---|
138 | Window rootWin; /**< "Root" window on backend display */
|
---|
139 | int rootX; /**< X offset of "root" window WRT "screen"*/
|
---|
140 | int rootY; /**< Y offset of "root" window WRT "screen"*/
|
---|
141 | int rootWidth; /**< Width of "root" window */
|
---|
142 | int rootHeight; /**< Height of "root" window */
|
---|
143 |
|
---|
144 | int rootXOrigin; /**< Global X origin of "root" window */
|
---|
145 | int rootYOrigin; /**< Global Y origin of "root" window */
|
---|
146 |
|
---|
147 | /*---------- Shadow framebuffer information ----------*/
|
---|
148 |
|
---|
149 | void *shadow; /**< Shadow framebuffer data (if enabled) */
|
---|
150 | XlibGC shadowGC; /**< Default GC used by shadow FB code */
|
---|
151 | XImage *shadowFBImage; /**< Screen image used by shadow FB code */
|
---|
152 |
|
---|
153 | /*---------- Other related information ----------*/
|
---|
154 |
|
---|
155 | int shared; /**< Non-zero if another Xdmx is running */
|
---|
156 |
|
---|
157 | Bool WMRunningOnBE;
|
---|
158 |
|
---|
159 | Cursor noCursor;
|
---|
160 | Cursor curCursor;
|
---|
161 | /* Support for cursors on overlapped
|
---|
162 | * backend displays. */
|
---|
163 | CursorPtr cursor;
|
---|
164 | int cursorVisible;
|
---|
165 | int cursorNotShared; /* for overlapping screens on a backend */
|
---|
166 |
|
---|
167 | PositionType where; /**< Relative layout information */
|
---|
168 | int whereX; /**< Relative layout information */
|
---|
169 | int whereY; /**< Relative layout information */
|
---|
170 | int whereRefScreen; /**< Relative layout information */
|
---|
171 |
|
---|
172 | int savedTimeout; /**< Original screen saver timeout */
|
---|
173 | int dpmsCapable; /**< Non-zero if backend is DPMS capable */
|
---|
174 | int dpmsEnabled; /**< Non-zero if DPMS enabled */
|
---|
175 | int dpmsStandby; /**< Original DPMS standby value */
|
---|
176 | int dpmsSuspend; /**< Original DPMS suspend value */
|
---|
177 | int dpmsOff; /**< Original DPMS off value */
|
---|
178 |
|
---|
179 | DMXStatInfo *stat; /**< Statistics about XSync */
|
---|
180 | Bool needsSync; /**< True if an XSync is pending */
|
---|
181 |
|
---|
182 | #ifdef GLXEXT
|
---|
183 | /** Visual information for glxProxy */
|
---|
184 | int numGlxVisuals;
|
---|
185 | __GLXvisualConfig *glxVisuals;
|
---|
186 | int glxMajorOpcode;
|
---|
187 | int glxErrorBase;
|
---|
188 |
|
---|
189 | /** FB config information for glxProxy */
|
---|
190 | __GLXFBConfig *fbconfigs;
|
---|
191 | int numFBConfigs;
|
---|
192 | #endif
|
---|
193 |
|
---|
194 | /** Function pointers to wrapped screen
|
---|
195 | * functions */
|
---|
196 | CloseScreenProcPtr CloseScreen;
|
---|
197 | SaveScreenProcPtr SaveScreen;
|
---|
198 |
|
---|
199 | CreateGCProcPtr CreateGC;
|
---|
200 |
|
---|
201 | CreateWindowProcPtr CreateWindow;
|
---|
202 | DestroyWindowProcPtr DestroyWindow;
|
---|
203 | PositionWindowProcPtr PositionWindow;
|
---|
204 | ChangeWindowAttributesProcPtr ChangeWindowAttributes;
|
---|
205 | RealizeWindowProcPtr RealizeWindow;
|
---|
206 | UnrealizeWindowProcPtr UnrealizeWindow;
|
---|
207 | RestackWindowProcPtr RestackWindow;
|
---|
208 | WindowExposuresProcPtr WindowExposures;
|
---|
209 | PaintWindowBackgroundProcPtr PaintWindowBackground;
|
---|
210 | PaintWindowBorderProcPtr PaintWindowBorder;
|
---|
211 | CopyWindowProcPtr CopyWindow;
|
---|
212 |
|
---|
213 | ResizeWindowProcPtr ResizeWindow;
|
---|
214 | ReparentWindowProcPtr ReparentWindow;
|
---|
215 |
|
---|
216 | ChangeBorderWidthProcPtr ChangeBorderWidth;
|
---|
217 |
|
---|
218 | GetImageProcPtr GetImage;
|
---|
219 | GetSpansProcPtr GetSpans;
|
---|
220 |
|
---|
221 | CreatePixmapProcPtr CreatePixmap;
|
---|
222 | DestroyPixmapProcPtr DestroyPixmap;
|
---|
223 | BitmapToRegionProcPtr BitmapToRegion;
|
---|
224 |
|
---|
225 | RealizeFontProcPtr RealizeFont;
|
---|
226 | UnrealizeFontProcPtr UnrealizeFont;
|
---|
227 |
|
---|
228 | CreateColormapProcPtr CreateColormap;
|
---|
229 | DestroyColormapProcPtr DestroyColormap;
|
---|
230 | InstallColormapProcPtr InstallColormap;
|
---|
231 | StoreColorsProcPtr StoreColors;
|
---|
232 |
|
---|
233 | #ifdef SHAPE
|
---|
234 | SetShapeProcPtr SetShape;
|
---|
235 | #endif
|
---|
236 |
|
---|
237 | #ifdef RENDER
|
---|
238 | CreatePictureProcPtr CreatePicture;
|
---|
239 | DestroyPictureProcPtr DestroyPicture;
|
---|
240 | ChangePictureClipProcPtr ChangePictureClip;
|
---|
241 | DestroyPictureClipProcPtr DestroyPictureClip;
|
---|
242 |
|
---|
243 | ChangePictureProcPtr ChangePicture;
|
---|
244 | ValidatePictureProcPtr ValidatePicture;
|
---|
245 |
|
---|
246 | CompositeProcPtr Composite;
|
---|
247 | GlyphsProcPtr Glyphs;
|
---|
248 | CompositeRectsProcPtr CompositeRects;
|
---|
249 |
|
---|
250 | InitIndexedProcPtr InitIndexed;
|
---|
251 | CloseIndexedProcPtr CloseIndexed;
|
---|
252 | UpdateIndexedProcPtr UpdateIndexed;
|
---|
253 |
|
---|
254 | TrapezoidsProcPtr Trapezoids;
|
---|
255 | TrianglesProcPtr Triangles;
|
---|
256 | TriStripProcPtr TriStrip;
|
---|
257 | TriFanProcPtr TriFan;
|
---|
258 | #endif
|
---|
259 | } DMXScreenInfo;
|
---|
260 |
|
---|
261 | /* Global variables available to all Xserver/hw/dmx routines. */
|
---|
262 | extern int dmxNumScreens; /**< Number of dmxScreens */
|
---|
263 | extern DMXScreenInfo *dmxScreens; /**< List of outputs */
|
---|
264 | extern int dmxShadowFB; /**< Non-zero if using
|
---|
265 | * shadow frame-buffer
|
---|
266 | * (deprecated) */
|
---|
267 | extern XErrorEvent dmxLastErrorEvent; /**< Last error that
|
---|
268 | * occurred */
|
---|
269 | extern Bool dmxErrorOccurred; /**< True if an error
|
---|
270 | * occurred */
|
---|
271 | extern Bool dmxOffScreenOpt; /**< True if using off
|
---|
272 | * screen
|
---|
273 | * optimizations */
|
---|
274 | extern Bool dmxSubdividePrimitives; /**< True if using the
|
---|
275 | * primitive subdivision
|
---|
276 | * optimization */
|
---|
277 | extern Bool dmxLazyWindowCreation; /**< True if using the
|
---|
278 | * lazy window creation
|
---|
279 | * optimization */
|
---|
280 | extern Bool dmxUseXKB; /**< True if the XKB
|
---|
281 | * extension should be
|
---|
282 | * used with the backend
|
---|
283 | * servers */
|
---|
284 | extern int dmxDepth; /**< Requested depth if
|
---|
285 | * non-zero */
|
---|
286 | #ifdef GLXEXT
|
---|
287 | extern Bool dmxGLXProxy; /**< True if glxProxy
|
---|
288 | * support is enabled */
|
---|
289 | extern Bool dmxGLXSwapGroupSupport; /**< True if glxProxy
|
---|
290 | * support for swap
|
---|
291 | * groups and barriers
|
---|
292 | * is enabled */
|
---|
293 | extern Bool dmxGLXSyncSwap; /**< True if glxProxy
|
---|
294 | * should force an XSync
|
---|
295 | * request after each
|
---|
296 | * swap buffers call */
|
---|
297 | extern Bool dmxGLXFinishSwap; /**< True if glxProxy
|
---|
298 | * should force a
|
---|
299 | * glFinish request
|
---|
300 | * after each swap
|
---|
301 | * buffers call */
|
---|
302 | #endif
|
---|
303 | extern char *dmxFontPath; /**< NULL if no font
|
---|
304 | * path is set on the
|
---|
305 | * command line;
|
---|
306 | * otherwise, a string
|
---|
307 | * of comma separated
|
---|
308 | * paths built from the
|
---|
309 | * command line
|
---|
310 | * specified font
|
---|
311 | * paths */
|
---|
312 | extern Bool dmxIgnoreBadFontPaths; /**< True if bad font
|
---|
313 | * paths should be
|
---|
314 | * ignored during server
|
---|
315 | * init */
|
---|
316 | extern Bool dmxAddRemoveScreens; /**< True if add and
|
---|
317 | * remove screens support
|
---|
318 | * is enabled */
|
---|
319 |
|
---|
320 | /** Wrap screen or GC function pointer */
|
---|
321 | #define DMX_WRAP(_entry, _newfunc, _saved, _actual) \
|
---|
322 | do { \
|
---|
323 | (_saved)->_entry = (_actual)->_entry; \
|
---|
324 | (_actual)->_entry = (_newfunc); \
|
---|
325 | } while (0)
|
---|
326 |
|
---|
327 | /** Unwrap screen or GC function pointer */
|
---|
328 | #define DMX_UNWRAP(_entry, _saved, _actual) \
|
---|
329 | do { \
|
---|
330 | (_actual)->_entry = (_saved)->_entry; \
|
---|
331 | } while (0)
|
---|
332 |
|
---|
333 | /* Define the MAXSCREENSALLOC/FREE macros, when MAXSCREENS patch has not
|
---|
334 | * been applied to sources. */
|
---|
335 | #ifdef MAXSCREENS
|
---|
336 | #define MAXSCREEN_MAKECONSTSTR1(x) #x
|
---|
337 | #define MAXSCREEN_MAKECONSTSTR2(x) MAXSCREEN_MAKECONSTSTR1(x)
|
---|
338 |
|
---|
339 | #define MAXSCREEN_FAILED_TXT "Failed at [" \
|
---|
340 | MAXSCREEN_MAKECONSTSTR2(__LINE__) ":" __FILE__ "] to allocate object: "
|
---|
341 |
|
---|
342 | #define _MAXSCREENSALLOCF(o,size,fatal) \
|
---|
343 | do { \
|
---|
344 | if (!o) { \
|
---|
345 | o = xalloc((size) * sizeof(*(o))); \
|
---|
346 | if (o) memset(o, 0, (size) * sizeof(*(o))); \
|
---|
347 | if (!o && fatal) FatalError(MAXSCREEN_FAILED_TXT #o); \
|
---|
348 | } \
|
---|
349 | } while (0)
|
---|
350 | #define _MAXSCREENSALLOCR(o,size,retval) \
|
---|
351 | do { \
|
---|
352 | if (!o) { \
|
---|
353 | o = xalloc((size) * sizeof(*(o))); \
|
---|
354 | if (o) memset(o, 0, (size) * sizeof(*(o))); \
|
---|
355 | if (!o) return retval; \
|
---|
356 | } \
|
---|
357 | } while (0)
|
---|
358 |
|
---|
359 | #define MAXSCREENSFREE(o) \
|
---|
360 | do { \
|
---|
361 | if (o) xfree(o); \
|
---|
362 | o = NULL; \
|
---|
363 | } while (0)
|
---|
364 |
|
---|
365 | #define MAXSCREENSALLOC(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 0)
|
---|
366 | #define MAXSCREENSALLOC_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 1)
|
---|
367 | #define MAXSCREENSALLOC_RETURN(o,r) _MAXSCREENSALLOCR(o,MAXSCREENS, (r))
|
---|
368 | #define MAXSCREENSALLOCPLUSONE(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,0)
|
---|
369 | #define MAXSCREENSALLOCPLUSONE_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,1)
|
---|
370 | #define MAXSCREENSCALLOC(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),0)
|
---|
371 | #define MAXSCREENSCALLOC_FATAL(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),1)
|
---|
372 | #endif
|
---|
373 |
|
---|
374 | #endif /* DMX_H */
|
---|