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