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 | #ifdef RENDER
|
---|
66 | #include "picturestr.h"
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | #ifdef GLXEXT
|
---|
70 | #include <GL/glx.h>
|
---|
71 | #include <GL/glxint.h>
|
---|
72 | #endif
|
---|
73 |
|
---|
74 | typedef enum {
|
---|
75 | PosNone = -1,
|
---|
76 | PosAbsolute = 0,
|
---|
77 | PosRightOf,
|
---|
78 | PosLeftOf,
|
---|
79 | PosAbove,
|
---|
80 | PosBelow,
|
---|
81 | PosRelative
|
---|
82 | } PositionType;
|
---|
83 |
|
---|
84 | /** Provide the typedef globally, but keep the contents opaque outside
|
---|
85 | * of the input routines. \see dmxinput.h */
|
---|
86 | typedef struct _DMXInputInfo DMXInputInfo;
|
---|
87 |
|
---|
88 | /** Provide the typedef globally, but keep the contents opaque outside
|
---|
89 | * of the XSync statistic routines. \see dmxstat.c */
|
---|
90 | typedef struct _DMXStatInfo DMXStatInfo;
|
---|
91 |
|
---|
92 | /** Global structure containing information about each backend screen. */
|
---|
93 | typedef struct _DMXScreenInfo {
|
---|
94 | const char *name; /**< Name from command line or config file */
|
---|
95 | int index; /**< Index into dmxScreens global */
|
---|
96 |
|
---|
97 | /*---------- Back-end X server information ----------*/
|
---|
98 |
|
---|
99 | Display *beDisplay; /**< Back-end X server's display */
|
---|
100 | int beWidth; /**< Width of BE display */
|
---|
101 | int beHeight; /**< Height of BE display */
|
---|
102 | int beDepth; /**< Depth of BE display */
|
---|
103 | int beBPP; /**< Bits per pixel of BE display */
|
---|
104 | int beXDPI; /**< Horizontal dots per inch of BE */
|
---|
105 | int beYDPI; /**< Vertical dots per inch of BE */
|
---|
106 |
|
---|
107 | int beNumDepths; /**< Number of depths on BE server */
|
---|
108 | int *beDepths; /**< Depths from BE server */
|
---|
109 |
|
---|
110 | int beNumPixmapFormats; /**< Number of pixmap formats on BE */
|
---|
111 | XPixmapFormatValues *bePixmapFormats; /**< Pixmap formats on BE */
|
---|
112 |
|
---|
113 | int beNumVisuals; /**< Number of visuals on BE */
|
---|
114 | XVisualInfo *beVisuals; /**< Visuals from BE server */
|
---|
115 | int beDefVisualIndex; /**< Default visual index of BE */
|
---|
116 |
|
---|
117 | int beNumDefColormaps; /**< Number of default colormaps */
|
---|
118 | Colormap *beDefColormaps; /**< Default colormaps for DMX server */
|
---|
119 |
|
---|
120 | Pixel beBlackPixel; /**< Default black pixel for BE */
|
---|
121 | Pixel beWhitePixel; /**< Default white pixel for BE */
|
---|
122 |
|
---|
123 | /*---------- Screen window information ----------*/
|
---|
124 |
|
---|
125 | Window scrnWin; /**< "Screen" window on backend display */
|
---|
126 | int scrnX; /**< X offset of "screen" WRT BE display */
|
---|
127 | int scrnY; /**< Y offset of "screen" WRT BE display */
|
---|
128 | int scrnWidth; /**< Width of "screen" */
|
---|
129 | int scrnHeight; /**< Height of "screen" */
|
---|
130 | int scrnXSign; /**< X offset sign of "screen" */
|
---|
131 | int scrnYSign; /**< Y offset sign of "screen" */
|
---|
132 |
|
---|
133 | /** Default drawables for "screen" */
|
---|
134 | Drawable scrnDefDrawables[MAXFORMATS];
|
---|
135 |
|
---|
136 | struct _DMXScreenInfo *next; /**< List of "screens" on same display */
|
---|
137 | struct _DMXScreenInfo *over; /**< List of "screens" that overlap */
|
---|
138 |
|
---|
139 | /*---------- Root window information ----------*/
|
---|
140 |
|
---|
141 | Window rootWin; /**< "Root" window on backend display */
|
---|
142 | int rootX; /**< X offset of "root" window WRT "screen"*/
|
---|
143 | int rootY; /**< Y offset of "root" window WRT "screen"*/
|
---|
144 | int rootWidth; /**< Width of "root" window */
|
---|
145 | int rootHeight; /**< Height of "root" window */
|
---|
146 |
|
---|
147 | int rootXOrigin; /**< Global X origin of "root" window */
|
---|
148 | int rootYOrigin; /**< Global Y origin of "root" window */
|
---|
149 |
|
---|
150 | /*---------- Shadow framebuffer information ----------*/
|
---|
151 |
|
---|
152 | void *shadow; /**< Shadow framebuffer data (if enabled) */
|
---|
153 | XlibGC shadowGC; /**< Default GC used by shadow FB code */
|
---|
154 | XImage *shadowFBImage; /**< Screen image used by shadow FB code */
|
---|
155 |
|
---|
156 | /*---------- Other related information ----------*/
|
---|
157 |
|
---|
158 | int shared; /**< Non-zero if another Xdmx is running */
|
---|
159 |
|
---|
160 | Bool WMRunningOnBE;
|
---|
161 |
|
---|
162 | Cursor noCursor;
|
---|
163 | Cursor curCursor;
|
---|
164 | /* Support for cursors on overlapped
|
---|
165 | * backend displays. */
|
---|
166 | CursorPtr cursor;
|
---|
167 | int cursorVisible;
|
---|
168 | int cursorNotShared; /* for overlapping screens on a backend */
|
---|
169 |
|
---|
170 | PositionType where; /**< Relative layout information */
|
---|
171 | int whereX; /**< Relative layout information */
|
---|
172 | int whereY; /**< Relative layout information */
|
---|
173 | int whereRefScreen; /**< Relative layout information */
|
---|
174 |
|
---|
175 | int savedTimeout; /**< Original screen saver timeout */
|
---|
176 | int dpmsCapable; /**< Non-zero if backend is DPMS capable */
|
---|
177 | int dpmsEnabled; /**< Non-zero if DPMS enabled */
|
---|
178 | int dpmsStandby; /**< Original DPMS standby value */
|
---|
179 | int dpmsSuspend; /**< Original DPMS suspend value */
|
---|
180 | int dpmsOff; /**< Original DPMS off value */
|
---|
181 |
|
---|
182 | DMXStatInfo *stat; /**< Statistics about XSync */
|
---|
183 | Bool needsSync; /**< True if an XSync is pending */
|
---|
184 |
|
---|
185 | #ifdef GLXEXT
|
---|
186 | /** Visual information for glxProxy */
|
---|
187 | int numGlxVisuals;
|
---|
188 | __GLXvisualConfig *glxVisuals;
|
---|
189 | int glxMajorOpcode;
|
---|
190 | int glxErrorBase;
|
---|
191 |
|
---|
192 | /** FB config information for glxProxy */
|
---|
193 | __GLXFBConfig *fbconfigs;
|
---|
194 | int numFBConfigs;
|
---|
195 | #endif
|
---|
196 |
|
---|
197 | /** Function pointers to wrapped screen
|
---|
198 | * functions */
|
---|
199 | CloseScreenProcPtr CloseScreen;
|
---|
200 | SaveScreenProcPtr SaveScreen;
|
---|
201 |
|
---|
202 | CreateGCProcPtr CreateGC;
|
---|
203 |
|
---|
204 | CreateWindowProcPtr CreateWindow;
|
---|
205 | DestroyWindowProcPtr DestroyWindow;
|
---|
206 | PositionWindowProcPtr PositionWindow;
|
---|
207 | ChangeWindowAttributesProcPtr ChangeWindowAttributes;
|
---|
208 | RealizeWindowProcPtr RealizeWindow;
|
---|
209 | UnrealizeWindowProcPtr UnrealizeWindow;
|
---|
210 | RestackWindowProcPtr RestackWindow;
|
---|
211 | WindowExposuresProcPtr WindowExposures;
|
---|
212 | CopyWindowProcPtr CopyWindow;
|
---|
213 |
|
---|
214 | ResizeWindowProcPtr ResizeWindow;
|
---|
215 | ReparentWindowProcPtr ReparentWindow;
|
---|
216 |
|
---|
217 | ChangeBorderWidthProcPtr ChangeBorderWidth;
|
---|
218 |
|
---|
219 | GetImageProcPtr GetImage;
|
---|
220 | GetSpansProcPtr GetSpans;
|
---|
221 |
|
---|
222 | CreatePixmapProcPtr CreatePixmap;
|
---|
223 | DestroyPixmapProcPtr DestroyPixmap;
|
---|
224 | BitmapToRegionProcPtr BitmapToRegion;
|
---|
225 |
|
---|
226 | RealizeFontProcPtr RealizeFont;
|
---|
227 | UnrealizeFontProcPtr UnrealizeFont;
|
---|
228 |
|
---|
229 | CreateColormapProcPtr CreateColormap;
|
---|
230 | DestroyColormapProcPtr DestroyColormap;
|
---|
231 | InstallColormapProcPtr InstallColormap;
|
---|
232 | StoreColorsProcPtr StoreColors;
|
---|
233 |
|
---|
234 | SetShapeProcPtr SetShape;
|
---|
235 |
|
---|
236 | #ifdef RENDER
|
---|
237 | CreatePictureProcPtr CreatePicture;
|
---|
238 | DestroyPictureProcPtr DestroyPicture;
|
---|
239 | ChangePictureClipProcPtr ChangePictureClip;
|
---|
240 | DestroyPictureClipProcPtr DestroyPictureClip;
|
---|
241 |
|
---|
242 | ChangePictureProcPtr ChangePicture;
|
---|
243 | ValidatePictureProcPtr ValidatePicture;
|
---|
244 |
|
---|
245 | CompositeProcPtr Composite;
|
---|
246 | GlyphsProcPtr Glyphs;
|
---|
247 | CompositeRectsProcPtr CompositeRects;
|
---|
248 |
|
---|
249 | InitIndexedProcPtr InitIndexed;
|
---|
250 | CloseIndexedProcPtr CloseIndexed;
|
---|
251 | UpdateIndexedProcPtr UpdateIndexed;
|
---|
252 |
|
---|
253 | TrapezoidsProcPtr Trapezoids;
|
---|
254 | TrianglesProcPtr Triangles;
|
---|
255 | TriStripProcPtr TriStrip;
|
---|
256 | TriFanProcPtr TriFan;
|
---|
257 | #endif
|
---|
258 | } DMXScreenInfo;
|
---|
259 |
|
---|
260 | /* Global variables available to all Xserver/hw/dmx routines. */
|
---|
261 | extern int dmxNumScreens; /**< Number of dmxScreens */
|
---|
262 | extern DMXScreenInfo *dmxScreens; /**< List of outputs */
|
---|
263 | extern int dmxShadowFB; /**< Non-zero if using
|
---|
264 | * shadow frame-buffer
|
---|
265 | * (deprecated) */
|
---|
266 | extern XErrorEvent dmxLastErrorEvent; /**< Last error that
|
---|
267 | * occurred */
|
---|
268 | extern Bool dmxErrorOccurred; /**< True if an error
|
---|
269 | * occurred */
|
---|
270 | extern Bool dmxOffScreenOpt; /**< True if using off
|
---|
271 | * screen
|
---|
272 | * optimizations */
|
---|
273 | extern Bool dmxSubdividePrimitives; /**< True if using the
|
---|
274 | * primitive subdivision
|
---|
275 | * optimization */
|
---|
276 | extern Bool dmxLazyWindowCreation; /**< True if using the
|
---|
277 | * lazy window creation
|
---|
278 | * optimization */
|
---|
279 | extern Bool dmxUseXKB; /**< True if the XKB
|
---|
280 | * extension should be
|
---|
281 | * used with the backend
|
---|
282 | * servers */
|
---|
283 | extern int dmxDepth; /**< Requested depth if
|
---|
284 | * non-zero */
|
---|
285 | #ifdef GLXEXT
|
---|
286 | extern Bool dmxGLXProxy; /**< True if glxProxy
|
---|
287 | * support is enabled */
|
---|
288 | extern Bool dmxGLXSwapGroupSupport; /**< True if glxProxy
|
---|
289 | * support for swap
|
---|
290 | * groups and barriers
|
---|
291 | * is enabled */
|
---|
292 | extern Bool dmxGLXSyncSwap; /**< True if glxProxy
|
---|
293 | * should force an XSync
|
---|
294 | * request after each
|
---|
295 | * swap buffers call */
|
---|
296 | extern Bool dmxGLXFinishSwap; /**< True if glxProxy
|
---|
297 | * should force a
|
---|
298 | * glFinish request
|
---|
299 | * after each swap
|
---|
300 | * buffers call */
|
---|
301 | #endif
|
---|
302 | extern char *dmxFontPath; /**< NULL if no font
|
---|
303 | * path is set on the
|
---|
304 | * command line;
|
---|
305 | * otherwise, a string
|
---|
306 | * of comma separated
|
---|
307 | * paths built from the
|
---|
308 | * command line
|
---|
309 | * specified font
|
---|
310 | * paths */
|
---|
311 | extern Bool dmxIgnoreBadFontPaths; /**< True if bad font
|
---|
312 | * paths should be
|
---|
313 | * ignored during server
|
---|
314 | * init */
|
---|
315 | extern Bool dmxAddRemoveScreens; /**< True if add and
|
---|
316 | * remove screens support
|
---|
317 | * is enabled */
|
---|
318 |
|
---|
319 | /** Wrap screen or GC function pointer */
|
---|
320 | #define DMX_WRAP(_entry, _newfunc, _saved, _actual) \
|
---|
321 | do { \
|
---|
322 | (_saved)->_entry = (_actual)->_entry; \
|
---|
323 | (_actual)->_entry = (_newfunc); \
|
---|
324 | } while (0)
|
---|
325 |
|
---|
326 | /** Unwrap screen or GC function pointer */
|
---|
327 | #define DMX_UNWRAP(_entry, _saved, _actual) \
|
---|
328 | do { \
|
---|
329 | (_actual)->_entry = (_saved)->_entry; \
|
---|
330 | } while (0)
|
---|
331 |
|
---|
332 | /* Define the MAXSCREENSALLOC/FREE macros, when MAXSCREENS patch has not
|
---|
333 | * been applied to sources. */
|
---|
334 | #ifdef MAXSCREENS
|
---|
335 | #define MAXSCREEN_MAKECONSTSTR1(x) #x
|
---|
336 | #define MAXSCREEN_MAKECONSTSTR2(x) MAXSCREEN_MAKECONSTSTR1(x)
|
---|
337 |
|
---|
338 | #define MAXSCREEN_FAILED_TXT "Failed at [" \
|
---|
339 | MAXSCREEN_MAKECONSTSTR2(__LINE__) ":" __FILE__ "] to allocate object: "
|
---|
340 |
|
---|
341 | #define _MAXSCREENSALLOCF(o,size,fatal) \
|
---|
342 | do { \
|
---|
343 | if (!o) { \
|
---|
344 | o = calloc((size), sizeof(*(o))); \
|
---|
345 | if (!o && fatal) FatalError(MAXSCREEN_FAILED_TXT #o); \
|
---|
346 | } \
|
---|
347 | } while (0)
|
---|
348 | #define _MAXSCREENSALLOCR(o,size,retval) \
|
---|
349 | do { \
|
---|
350 | if (!o) { \
|
---|
351 | o = calloc((size), sizeof(*(o))); \
|
---|
352 | if (!o) return retval; \
|
---|
353 | } \
|
---|
354 | } while (0)
|
---|
355 |
|
---|
356 | #define MAXSCREENSFREE(o) \
|
---|
357 | do { \
|
---|
358 | if (o) free(o); \
|
---|
359 | o = NULL; \
|
---|
360 | } while (0)
|
---|
361 |
|
---|
362 | #define MAXSCREENSALLOC(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 0)
|
---|
363 | #define MAXSCREENSALLOC_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 1)
|
---|
364 | #define MAXSCREENSALLOC_RETURN(o,r) _MAXSCREENSALLOCR(o,MAXSCREENS, (r))
|
---|
365 | #define MAXSCREENSALLOCPLUSONE(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,0)
|
---|
366 | #define MAXSCREENSALLOCPLUSONE_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,1)
|
---|
367 | #define MAXSCREENSCALLOC(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),0)
|
---|
368 | #define MAXSCREENSCALLOC_FATAL(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),1)
|
---|
369 | #endif
|
---|
370 |
|
---|
371 | #endif /* DMX_H */
|
---|