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