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 | } DMXScreenInfo;
|
---|
253 |
|
---|
254 | /* Global variables available to all Xserver/hw/dmx routines. */
|
---|
255 | extern int dmxNumScreens; /**< Number of dmxScreens */
|
---|
256 | extern DMXScreenInfo *dmxScreens; /**< List of outputs */
|
---|
257 | extern int dmxShadowFB; /**< Non-zero if using
|
---|
258 | * shadow frame-buffer
|
---|
259 | * (deprecated) */
|
---|
260 | extern XErrorEvent dmxLastErrorEvent; /**< Last error that
|
---|
261 | * occurred */
|
---|
262 | extern Bool dmxErrorOccurred; /**< True if an error
|
---|
263 | * occurred */
|
---|
264 | extern Bool dmxOffScreenOpt; /**< True if using off
|
---|
265 | * screen
|
---|
266 | * optimizations */
|
---|
267 | extern Bool dmxSubdividePrimitives; /**< True if using the
|
---|
268 | * primitive subdivision
|
---|
269 | * optimization */
|
---|
270 | extern Bool dmxLazyWindowCreation; /**< True if using the
|
---|
271 | * lazy window creation
|
---|
272 | * optimization */
|
---|
273 | extern Bool dmxUseXKB; /**< True if the XKB
|
---|
274 | * extension should be
|
---|
275 | * used with the backend
|
---|
276 | * servers */
|
---|
277 | extern int dmxDepth; /**< Requested depth if
|
---|
278 | * non-zero */
|
---|
279 | #ifdef GLXEXT
|
---|
280 | extern Bool dmxGLXProxy; /**< True if glxProxy
|
---|
281 | * support is enabled */
|
---|
282 | extern Bool dmxGLXSwapGroupSupport; /**< True if glxProxy
|
---|
283 | * support for swap
|
---|
284 | * groups and barriers
|
---|
285 | * is enabled */
|
---|
286 | extern Bool dmxGLXSyncSwap; /**< True if glxProxy
|
---|
287 | * should force an XSync
|
---|
288 | * request after each
|
---|
289 | * swap buffers call */
|
---|
290 | extern Bool dmxGLXFinishSwap; /**< True if glxProxy
|
---|
291 | * should force a
|
---|
292 | * glFinish request
|
---|
293 | * after each swap
|
---|
294 | * buffers call */
|
---|
295 | #endif
|
---|
296 | extern char *dmxFontPath; /**< NULL if no font
|
---|
297 | * path is set on the
|
---|
298 | * command line;
|
---|
299 | * otherwise, a string
|
---|
300 | * of comma separated
|
---|
301 | * paths built from the
|
---|
302 | * command line
|
---|
303 | * specified font
|
---|
304 | * paths */
|
---|
305 | extern Bool dmxIgnoreBadFontPaths; /**< True if bad font
|
---|
306 | * paths should be
|
---|
307 | * ignored during server
|
---|
308 | * init */
|
---|
309 | extern Bool dmxAddRemoveScreens; /**< True if add and
|
---|
310 | * remove screens support
|
---|
311 | * is enabled */
|
---|
312 |
|
---|
313 | /** Wrap screen or GC function pointer */
|
---|
314 | #define DMX_WRAP(_entry, _newfunc, _saved, _actual) \
|
---|
315 | do { \
|
---|
316 | (_saved)->_entry = (_actual)->_entry; \
|
---|
317 | (_actual)->_entry = (_newfunc); \
|
---|
318 | } while (0)
|
---|
319 |
|
---|
320 | /** Unwrap screen or GC function pointer */
|
---|
321 | #define DMX_UNWRAP(_entry, _saved, _actual) \
|
---|
322 | do { \
|
---|
323 | (_actual)->_entry = (_saved)->_entry; \
|
---|
324 | } while (0)
|
---|
325 |
|
---|
326 | /* Define the MAXSCREENSALLOC/FREE macros, when MAXSCREENS patch has not
|
---|
327 | * been applied to sources. */
|
---|
328 | #ifdef MAXSCREENS
|
---|
329 | #define MAXSCREEN_MAKECONSTSTR1(x) #x
|
---|
330 | #define MAXSCREEN_MAKECONSTSTR2(x) MAXSCREEN_MAKECONSTSTR1(x)
|
---|
331 |
|
---|
332 | #define MAXSCREEN_FAILED_TXT "Failed at [" \
|
---|
333 | MAXSCREEN_MAKECONSTSTR2(__LINE__) ":" __FILE__ "] to allocate object: "
|
---|
334 |
|
---|
335 | #define _MAXSCREENSALLOCF(o,size,fatal) \
|
---|
336 | do { \
|
---|
337 | if (!o) { \
|
---|
338 | o = calloc((size), sizeof(*(o))); \
|
---|
339 | if (!o && fatal) FatalError(MAXSCREEN_FAILED_TXT #o); \
|
---|
340 | } \
|
---|
341 | } while (0)
|
---|
342 | #define _MAXSCREENSALLOCR(o,size,retval) \
|
---|
343 | do { \
|
---|
344 | if (!o) { \
|
---|
345 | o = calloc((size), sizeof(*(o))); \
|
---|
346 | if (!o) return retval; \
|
---|
347 | } \
|
---|
348 | } while (0)
|
---|
349 |
|
---|
350 | #define MAXSCREENSFREE(o) \
|
---|
351 | do { \
|
---|
352 | free(o); \
|
---|
353 | o = NULL; \
|
---|
354 | } while (0)
|
---|
355 |
|
---|
356 | #define MAXSCREENSALLOC(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 0)
|
---|
357 | #define MAXSCREENSALLOC_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 1)
|
---|
358 | #define MAXSCREENSALLOC_RETURN(o,r) _MAXSCREENSALLOCR(o,MAXSCREENS, (r))
|
---|
359 | #define MAXSCREENSALLOCPLUSONE(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,0)
|
---|
360 | #define MAXSCREENSALLOCPLUSONE_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,1)
|
---|
361 | #define MAXSCREENSCALLOC(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),0)
|
---|
362 | #define MAXSCREENSCALLOC_FATAL(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),1)
|
---|
363 | #endif
|
---|
364 |
|
---|
365 | extern DevPrivateKeyRec dmxGCPrivateKeyRec;
|
---|
366 | #define dmxGCPrivateKey (&dmxGCPrivateKeyRec) /**< Private index for GCs */
|
---|
367 |
|
---|
368 | extern DevPrivateKeyRec dmxWinPrivateKeyRec;
|
---|
369 | #define dmxWinPrivateKey (&dmxWinPrivateKeyRec) /**< Private index for Windows */
|
---|
370 |
|
---|
371 | extern DevPrivateKeyRec dmxPixPrivateKeyRec;
|
---|
372 | #define dmxPixPrivateKey (&dmxPixPrivateKeyRec) /**< Private index for Pixmaps */
|
---|
373 |
|
---|
374 | extern int dmxFontPrivateIndex; /**< Private index for Fonts */
|
---|
375 |
|
---|
376 | extern DevPrivateKeyRec dmxScreenPrivateKeyRec;
|
---|
377 | #define dmxScreenPrivateKey (&dmxScreenPrivateKeyRec) /**< Private index for Screens */
|
---|
378 |
|
---|
379 | extern DevPrivateKeyRec dmxColormapPrivateKeyRec;
|
---|
380 | #define dmxColormapPrivateKey (&dmxColormapPrivateKeyRec) /**< Private index for Colormaps */
|
---|
381 |
|
---|
382 | extern DevPrivateKeyRec dmxPictPrivateKeyRec;
|
---|
383 | #define dmxPictPrivateKey (&dmxPictPrivateKeyRec) /**< Private index for Picts */
|
---|
384 |
|
---|
385 | extern DevPrivateKeyRec dmxGlyphSetPrivateKeyRec;
|
---|
386 | #define dmxGlyphSetPrivateKey (&dmxGlyphSetPrivateKeyRec) /**< Private index for GlyphSets */
|
---|
387 |
|
---|
388 | #endif /* DMX_H */
|
---|