# dmx.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
    00003  *
    00004  * All Rights Reserved.
    00005  *
    00006  * Permission is hereby granted, free of charge, to any person obtaining
    00007  * a copy of this software and associated documentation files (the
    00008  * "Software"), to deal in the Software without restriction, including
    00009  * without limitation on the rights to use, copy, modify, merge,
    00010  * publish, distribute, sublicense, and/or sell copies of the Software,
    00011  * and to permit persons to whom the Software is furnished to do so,
    00012  * subject to the following conditions:
    00013  *
    00014  * The above copyright notice and this permission notice (including the
    00015  * next paragraph) shall be included in all copies or substantial
    00016  * portions of the Software.
    00017  *
    00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00019  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    00021  * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
    00022  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
    00023  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    00024  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    00025  * SOFTWARE.
    00026  */
    00027
    00028 /*
    00029  * Authors:
    00030  *   Kevin E. Martin <kem@redhat.com>
    00031  *   David H. Dawes <dawes@xfree86.org>
    00032  *   Rickard E. (Rik) Faith <faith@redhat.com>
    00033  *
    00034  */
    00035
    00050 #ifndef DMX_H
    00051 #define DMX_H
    00052
    00053 #if HAVE_DMX_CONFIG_H
    00054 #include <dmx-config.h>
    00055 #endif
    00056
    00057 #include "gcstruct.h"
    00058
    00059 /* Handle client-side include files in one place. */
    00060 #include "dmxclient.h"
    00061
    00062 #include "globals.h"
    00063 #include "scrnintstr.h"
    00064
    00065 #include "picturestr.h"
    00066
    00067 #ifdef GLXEXT
    00068 #include <GL/glx.h>
    00069 #include <GL/glxint.h>
    00070 #endif
    00071
    00072 typedef enum {
    00073     PosNone = -1,
    00074     PosAbsolute = 0,
    00075     PosRightOf,
    00076     PosLeftOf,
    00077     PosAbove,
    00078     PosBelow,
    00079     PosRelative
    00080 } PositionType;
    00081
    00084 typedef struct _DMXInputInfo DMXInputInfo;
    00085
    00088 typedef struct _DMXStatInfo DMXStatInfo;
    00089
    00091 typedef struct _DMXScreenInfo {
    00092     const char   *name;
    00093     int           index;
    00095     /*---------- Back-end X server information ----------*/
    00096
    00097     Display      *beDisplay;
    00098     int           beWidth;
    00099     int           beHeight;
    00100     int           beDepth;
    00101     int           beBPP;
    00102     int           beXDPI;
    00103     int           beYDPI;
    00105     int           beNumDepths;
    00106     int          *beDepths;
    00108     int           beNumPixmapFormats;
    00109     XPixmapFormatValues *bePixmapFormats;
    00111     int           beNumVisuals;
    00112     XVisualInfo  *beVisuals;
    00113     int           beDefVisualIndex;
    00115     int           beNumDefColormaps;
    00116     Colormap     *beDefColormaps;
    00118     Pixel         beBlackPixel;
    00119     Pixel         beWhitePixel;
    00121     /*---------- Screen window information ----------*/
    00122
    00123     Window        scrnWin;
    00124     int           scrnX;
    00125     int           scrnY;
    00126     int           scrnWidth;
    00127     int           scrnHeight;
    00128     int           scrnXSign;
    00129     int           scrnYSign;
    00132     Drawable      scrnDefDrawables[MAXFORMATS];
    00133
    00134     struct _DMXScreenInfo *next;
    00135     struct _DMXScreenInfo *over;
    00137     /*---------- Root window information ----------*/
    00138
    00139     Window        rootWin;
    00140     int           rootX;
    00141     int           rootY;
    00142     int           rootWidth;
    00143     int           rootHeight;
    00145     int           rootXOrigin;
    00146     int           rootYOrigin;
    00148     /*---------- Shadow framebuffer information ----------*/
    00149
    00150     void         *shadow;
    00151     XlibGC        shadowGC;
    00152     XImage       *shadowFBImage;
    00154     /*---------- Other related information ----------*/
    00155
    00156     int           shared;
    00158     Bool          WMRunningOnBE;
    00159
    00160     Cursor        noCursor;
    00161     Cursor        curCursor;
    00162                                 /* Support for cursors on overlapped
    00163                                  * backend displays. */
    00164     CursorPtr     cursor;
    00165     int           cursorVisible;
    00166     int           cursorNotShared; /* for overlapping screens on a backend */
    00167
    00168     PositionType  where;
    00169     int           whereX;
    00170     int           whereY;
    00171     int           whereRefScreen;
    00173     int           savedTimeout;
    00174     int           dpmsCapable;
    00175     int           dpmsEnabled;
    00176     int           dpmsStandby;
    00177     int           dpmsSuspend;
    00178     int           dpmsOff;
    00180     DMXStatInfo  *stat;
    00181     Bool          needsSync;
    00183 #ifdef GLXEXT
    00184
    00185     int           numGlxVisuals;
    00186     __GLXvisualConfig *glxVisuals;
    00187     int           glxMajorOpcode;
    00188     int           glxErrorBase;
    00189
    00191     __GLXFBConfig *fbconfigs;
    00192     int           numFBConfigs;
    00193 #endif
    00194
    00197     CloseScreenProcPtr             CloseScreen;
    00198     SaveScreenProcPtr              SaveScreen;
    00199
    00200     CreateGCProcPtr                CreateGC;
    00201
    00202     CreateWindowProcPtr            CreateWindow;
    00203     DestroyWindowProcPtr           DestroyWindow;
    00204     PositionWindowProcPtr          PositionWindow;
    00205     ChangeWindowAttributesProcPtr  ChangeWindowAttributes;
    00206     RealizeWindowProcPtr           RealizeWindow;
    00207     UnrealizeWindowProcPtr         UnrealizeWindow;
    00208     RestackWindowProcPtr           RestackWindow;
    00209     WindowExposuresProcPtr         WindowExposures;
    00210     CopyWindowProcPtr              CopyWindow;
    00211
    00212     ResizeWindowProcPtr            ResizeWindow;
    00213     ReparentWindowProcPtr          ReparentWindow;
    00214
    00215     ChangeBorderWidthProcPtr       ChangeBorderWidth;
    00216
    00217     GetImageProcPtr                GetImage;
    00218     GetSpansProcPtr                GetSpans;
    00219
    00220     CreatePixmapProcPtr            CreatePixmap;
    00221     DestroyPixmapProcPtr           DestroyPixmap;
    00222     BitmapToRegionProcPtr          BitmapToRegion;
    00223
    00224     RealizeFontProcPtr             RealizeFont;
    00225     UnrealizeFontProcPtr           UnrealizeFont;
    00226
    00227     CreateColormapProcPtr          CreateColormap;
    00228     DestroyColormapProcPtr         DestroyColormap;
    00229     InstallColormapProcPtr         InstallColormap;
    00230     StoreColorsProcPtr             StoreColors;
    00231
    00232     SetShapeProcPtr                SetShape;
    00233
    00234     CreatePictureProcPtr           CreatePicture;
    00235     DestroyPictureProcPtr          DestroyPicture;
    00236     ChangePictureClipProcPtr       ChangePictureClip;
    00237     DestroyPictureClipProcPtr      DestroyPictureClip;
    00238
    00239     ChangePictureProcPtr           ChangePicture;
    00240     ValidatePictureProcPtr         ValidatePicture;
    00241
    00242     CompositeProcPtr               Composite;
    00243     GlyphsProcPtr                  Glyphs;
    00244     CompositeRectsProcPtr          CompositeRects;
    00245
    00246     InitIndexedProcPtr             InitIndexed;
    00247     CloseIndexedProcPtr            CloseIndexed;
    00248     UpdateIndexedProcPtr           UpdateIndexed;
    00249
    00250     TrapezoidsProcPtr              Trapezoids;
    00251     TrianglesProcPtr               Triangles;
    00252     TriStripProcPtr                TriStrip;
    00253     TriFanProcPtr                  TriFan;
    00254 } DMXScreenInfo;
    00255
    00256 /* Global variables available to all Xserver/hw/dmx routines. */
    00257 extern int              dmxNumScreens;
    00258 extern DMXScreenInfo   *dmxScreens;
    00259 extern int              dmxShadowFB;
    00262 extern XErrorEvent      dmxLastErrorEvent;
    00264 extern Bool             dmxErrorOccurred;
    00266 extern Bool             dmxOffScreenOpt;
    00269 extern Bool             dmxSubdividePrimitives;
    00272 extern Bool             dmxLazyWindowCreation;
    00275 extern Bool             dmxUseXKB;
    00279 extern int              dmxDepth;
    00281 #ifdef GLXEXT
    00282 extern Bool             dmxGLXProxy;
    00284 extern Bool             dmxGLXSwapGroupSupport;
    00288 extern Bool             dmxGLXSyncSwap;
    00292 extern Bool             dmxGLXFinishSwap;
    00297 #endif
    00298 extern char            *dmxFontPath;
    00307 extern Bool             dmxIgnoreBadFontPaths;
    00311 extern Bool             dmxAddRemoveScreens;
    00316 #define DMX_WRAP(_entry, _newfunc, _saved, _actual)                     \
    00317 do {                                                                    \
    00318     (_saved)->_entry  = (_actual)->_entry;                              \
    00319     (_actual)->_entry = (_newfunc);                                     \
    00320 } while (0)
    00321
    00323 #define DMX_UNWRAP(_entry, _saved, _actual)                             \
    00324 do {                                                                    \
    00325     (_actual)->_entry = (_saved)->_entry;                               \
    00326 } while (0)
    00327
    00328 /* Define the MAXSCREENSALLOC/FREE macros, when MAXSCREENS patch has not
    00329  * been applied to sources. */
    00330 #ifdef MAXSCREENS
    00331 #define MAXSCREEN_MAKECONSTSTR1(x) #x
    00332 #define MAXSCREEN_MAKECONSTSTR2(x) MAXSCREEN_MAKECONSTSTR1(x)
    00333
    00334 #define MAXSCREEN_FAILED_TXT "Failed at ["                              \
    00335    MAXSCREEN_MAKECONSTSTR2(__LINE__) ":" __FILE__ "] to allocate object: "
    00336
    00337 #define _MAXSCREENSALLOCF(o,size,fatal)                                 \
    00338     do {                                                                \
    00339         if (!o) {                                                       \
    00340             o = calloc((size), sizeof(*(o)));                          \
    00341             if (!o && fatal) FatalError(MAXSCREEN_FAILED_TXT #o);       \
    00342         }                                                               \
    00343     } while (0)
    00344 #define _MAXSCREENSALLOCR(o,size,retval)                                \
    00345     do {                                                                \
    00346         if (!o) {                                                       \
    00347             o = calloc((size), sizeof(*(o)));                          \
    00348             if (!o) return retval;                                      \
    00349         }                                                               \
    00350     } while (0)
    00351
    00352 #define MAXSCREENSFREE(o)                                               \
    00353     do {                                                                \
    00354         free(o);                                                \
    00355         o = NULL;                                                       \
    00356     } while (0)
    00357
    00358 #define MAXSCREENSALLOC(o)              _MAXSCREENSALLOCF(o,MAXSCREENS,  0)
    00359 #define MAXSCREENSALLOC_FATAL(o)        _MAXSCREENSALLOCF(o,MAXSCREENS,  1)
    00360 #define MAXSCREENSALLOC_RETURN(o,r)     _MAXSCREENSALLOCR(o,MAXSCREENS, (r))
    00361 #define MAXSCREENSALLOCPLUSONE(o)       _MAXSCREENSALLOCF(o,MAXSCREENS+1,0)
    00362 #define MAXSCREENSALLOCPLUSONE_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,1)
    00363 #define MAXSCREENSCALLOC(o,m)           _MAXSCREENSALLOCF(o,MAXSCREENS*(m),0)
    00364 #define MAXSCREENSCALLOC_FATAL(o,m)     _MAXSCREENSALLOCF(o,MAXSCREENS*(m),1)
    00365 #endif
    00366
    00367 extern DevPrivateKeyRec dmxGCPrivateKeyRec;
    00368 #define dmxGCPrivateKey (&dmxGCPrivateKeyRec)
    00370 extern DevPrivateKeyRec dmxWinPrivateKeyRec;
    00371 #define dmxWinPrivateKey (&dmxWinPrivateKeyRec)
    00373 extern DevPrivateKeyRec dmxPixPrivateKeyRec;
    00374 #define dmxPixPrivateKey (&dmxPixPrivateKeyRec)
    00376 extern int dmxFontPrivateIndex;
    00378 extern DevPrivateKeyRec dmxScreenPrivateKeyRec;
    00379 #define dmxScreenPrivateKey (&dmxScreenPrivateKeyRec)
    00381 extern DevPrivateKeyRec dmxColormapPrivateKeyRec;
    00382 #define dmxColormapPrivateKey (&dmxColormapPrivateKeyRec)
    00384 extern DevPrivateKeyRec dmxPictPrivateKeyRec;
    00385 #define dmxPictPrivateKey (&dmxPictPrivateKeyRec)
    00387 extern DevPrivateKeyRec dmxGlyphSetPrivateKeyRec;
    00388 #define dmxGlyphSetPrivateKey (&dmxGlyphSetPrivateKeyRec)
    00390 #endif /* DMX_H */