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