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 | PaintWindowBackgroundProcPtr PaintWindowBackground;
|
---|
213 | PaintWindowBorderProcPtr PaintWindowBorder;
|
---|
214 | CopyWindowProcPtr CopyWindow;
|
---|
215 |
|
---|
216 | ResizeWindowProcPtr ResizeWindow;
|
---|
217 | ReparentWindowProcPtr ReparentWindow;
|
---|
218 |
|
---|
219 | ChangeBorderWidthProcPtr ChangeBorderWidth;
|
---|
220 |
|
---|
221 | GetImageProcPtr GetImage;
|
---|
222 | GetSpansProcPtr GetSpans;
|
---|
223 |
|
---|
224 | CreatePixmapProcPtr CreatePixmap;
|
---|
225 | DestroyPixmapProcPtr DestroyPixmap;
|
---|
226 | BitmapToRegionProcPtr BitmapToRegion;
|
---|
227 |
|
---|
228 | RealizeFontProcPtr RealizeFont;
|
---|
229 | UnrealizeFontProcPtr UnrealizeFont;
|
---|
230 |
|
---|
231 | CreateColormapProcPtr CreateColormap;
|
---|
232 | DestroyColormapProcPtr DestroyColormap;
|
---|
233 | InstallColormapProcPtr InstallColormap;
|
---|
234 | StoreColorsProcPtr StoreColors;
|
---|
235 |
|
---|
236 | #ifdef SHAPE
|
---|
237 | SetShapeProcPtr SetShape;
|
---|
238 | #endif
|
---|
239 |
|
---|
240 | #ifdef RENDER
|
---|
241 | CreatePictureProcPtr CreatePicture;
|
---|
242 | DestroyPictureProcPtr DestroyPicture;
|
---|
243 | ChangePictureClipProcPtr ChangePictureClip;
|
---|
244 | DestroyPictureClipProcPtr DestroyPictureClip;
|
---|
245 |
|
---|
246 | ChangePictureProcPtr ChangePicture;
|
---|
247 | ValidatePictureProcPtr ValidatePicture;
|
---|
248 |
|
---|
249 | CompositeProcPtr Composite;
|
---|
250 | GlyphsProcPtr Glyphs;
|
---|
251 | CompositeRectsProcPtr CompositeRects;
|
---|
252 |
|
---|
253 | InitIndexedProcPtr InitIndexed;
|
---|
254 | CloseIndexedProcPtr CloseIndexed;
|
---|
255 | UpdateIndexedProcPtr UpdateIndexed;
|
---|
256 |
|
---|
257 | TrapezoidsProcPtr Trapezoids;
|
---|
258 | TrianglesProcPtr Triangles;
|
---|
259 | TriStripProcPtr TriStrip;
|
---|
260 | TriFanProcPtr TriFan;
|
---|
261 | #endif
|
---|
262 | } DMXScreenInfo;
|
---|
263 |
|
---|
264 | /* Global variables available to all Xserver/hw/dmx routines. */
|
---|
265 | extern int dmxNumScreens; /**< Number of dmxScreens */
|
---|
266 | extern DMXScreenInfo *dmxScreens; /**< List of outputs */
|
---|
267 | extern int dmxShadowFB; /**< Non-zero if using
|
---|
268 | * shadow frame-buffer
|
---|
269 | * (deprecated) */
|
---|
270 | extern XErrorEvent dmxLastErrorEvent; /**< Last error that
|
---|
271 | * occurred */
|
---|
272 | extern Bool dmxErrorOccurred; /**< True if an error
|
---|
273 | * occurred */
|
---|
274 | extern Bool dmxOffScreenOpt; /**< True if using off
|
---|
275 | * screen
|
---|
276 | * optimizations */
|
---|
277 | extern Bool dmxSubdividePrimitives; /**< True if using the
|
---|
278 | * primitive subdivision
|
---|
279 | * optimization */
|
---|
280 | extern Bool dmxLazyWindowCreation; /**< True if using the
|
---|
281 | * lazy window creation
|
---|
282 | * optimization */
|
---|
283 | extern Bool dmxUseXKB; /**< True if the XKB
|
---|
284 | * extension should be
|
---|
285 | * used with the backend
|
---|
286 | * servers */
|
---|
287 | extern int dmxDepth; /**< Requested depth if
|
---|
288 | * non-zero */
|
---|
289 | #ifdef GLXEXT
|
---|
290 | extern Bool dmxGLXProxy; /**< True if glxProxy
|
---|
291 | * support is enabled */
|
---|
292 | extern Bool dmxGLXSwapGroupSupport; /**< True if glxProxy
|
---|
293 | * support for swap
|
---|
294 | * groups and barriers
|
---|
295 | * is enabled */
|
---|
296 | extern Bool dmxGLXSyncSwap; /**< True if glxProxy
|
---|
297 | * should force an XSync
|
---|
298 | * request after each
|
---|
299 | * swap buffers call */
|
---|
300 | extern Bool dmxGLXFinishSwap; /**< True if glxProxy
|
---|
301 | * should force a
|
---|
302 | * glFinish request
|
---|
303 | * after each swap
|
---|
304 | * buffers call */
|
---|
305 | #endif
|
---|
306 | extern char *dmxFontPath; /**< NULL if no font
|
---|
307 | * path is set on the
|
---|
308 | * command line;
|
---|
309 | * otherwise, a string
|
---|
310 | * of comma separated
|
---|
311 | * paths built from the
|
---|
312 | * command line
|
---|
313 | * specified font
|
---|
314 | * paths */
|
---|
315 | extern Bool dmxIgnoreBadFontPaths; /**< True if bad font
|
---|
316 | * paths should be
|
---|
317 | * ignored during server
|
---|
318 | * init */
|
---|
319 | extern Bool dmxAddRemoveScreens; /**< True if add and
|
---|
320 | * remove screens support
|
---|
321 | * is enabled */
|
---|
322 |
|
---|
323 | /** Wrap screen or GC function pointer */
|
---|
324 | #define DMX_WRAP(_entry, _newfunc, _saved, _actual) \
|
---|
325 | do { \
|
---|
326 | (_saved)->_entry = (_actual)->_entry; \
|
---|
327 | (_actual)->_entry = (_newfunc); \
|
---|
328 | } while (0)
|
---|
329 |
|
---|
330 | /** Unwrap screen or GC function pointer */
|
---|
331 | #define DMX_UNWRAP(_entry, _saved, _actual) \
|
---|
332 | do { \
|
---|
333 | (_actual)->_entry = (_saved)->_entry; \
|
---|
334 | } while (0)
|
---|
335 |
|
---|
336 | /* Define the MAXSCREENSALLOC/FREE macros, when MAXSCREENS patch has not
|
---|
337 | * been applied to sources. */
|
---|
338 | #ifdef MAXSCREENS
|
---|
339 | #define MAXSCREEN_MAKECONSTSTR1(x) #x
|
---|
340 | #define MAXSCREEN_MAKECONSTSTR2(x) MAXSCREEN_MAKECONSTSTR1(x)
|
---|
341 |
|
---|
342 | #define MAXSCREEN_FAILED_TXT "Failed at [" \
|
---|
343 | MAXSCREEN_MAKECONSTSTR2(__LINE__) ":" __FILE__ "] to allocate object: "
|
---|
344 |
|
---|
345 | #define _MAXSCREENSALLOCF(o,size,fatal) \
|
---|
346 | do { \
|
---|
347 | if (!o) { \
|
---|
348 | o = xalloc((size) * sizeof(*(o))); \
|
---|
349 | if (o) memset(o, 0, (size) * sizeof(*(o))); \
|
---|
350 | if (!o && fatal) FatalError(MAXSCREEN_FAILED_TXT #o); \
|
---|
351 | } \
|
---|
352 | } while (0)
|
---|
353 | #define _MAXSCREENSALLOCR(o,size,retval) \
|
---|
354 | do { \
|
---|
355 | if (!o) { \
|
---|
356 | o = xalloc((size) * sizeof(*(o))); \
|
---|
357 | if (o) memset(o, 0, (size) * sizeof(*(o))); \
|
---|
358 | if (!o) return retval; \
|
---|
359 | } \
|
---|
360 | } while (0)
|
---|
361 |
|
---|
362 | #define MAXSCREENSFREE(o) \
|
---|
363 | do { \
|
---|
364 | if (o) xfree(o); \
|
---|
365 | o = NULL; \
|
---|
366 | } while (0)
|
---|
367 |
|
---|
368 | #define MAXSCREENSALLOC(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 0)
|
---|
369 | #define MAXSCREENSALLOC_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 1)
|
---|
370 | #define MAXSCREENSALLOC_RETURN(o,r) _MAXSCREENSALLOCR(o,MAXSCREENS, (r))
|
---|
371 | #define MAXSCREENSALLOCPLUSONE(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,0)
|
---|
372 | #define MAXSCREENSALLOCPLUSONE_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,1)
|
---|
373 | #define MAXSCREENSCALLOC(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),0)
|
---|
374 | #define MAXSCREENSCALLOC_FATAL(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),1)
|
---|
375 | #endif
|
---|
376 |
|
---|
377 | #endif /* DMX_H */
|
---|