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