00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
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 
00060 #include "dmxclient.h"
00061 
00062 #include "globals.h"
00063 #include "scrnintstr.h"
00064 
00065 #ifdef RENDER
00066 #include "picturestr.h"
00067 #endif
00068 
00069 #ifdef GLXEXT
00070 #include <GL/glx.h>
00071 #include <GL/glxint.h>
00072 #endif
00073 
00074 typedef enum {
00075     PosNone = -1,
00076     PosAbsolute = 0,
00077     PosRightOf,
00078     PosLeftOf,
00079     PosAbove,
00080     PosBelow,
00081     PosRelative
00082 } PositionType;
00083 
00086 typedef struct _DMXInputInfo DMXInputInfo;
00087 
00090 typedef struct _DMXStatInfo DMXStatInfo;
00091 
00093 typedef struct _DMXScreenInfo {
00094     const char   *name;           
00095     int           index;          
00097     
00098 
00099     Display      *beDisplay;      
00100     int           beWidth;        
00101     int           beHeight;       
00102     int           beDepth;        
00103     int           beBPP;          
00104     int           beXDPI;         
00105     int           beYDPI;         
00107     int           beNumDepths;    
00108     int          *beDepths;       
00110     int           beNumPixmapFormats; 
00111     XPixmapFormatValues *bePixmapFormats; 
00113     int           beNumVisuals;   
00114     XVisualInfo  *beVisuals;      
00115     int           beDefVisualIndex; 
00117     int           beNumDefColormaps; 
00118     Colormap     *beDefColormaps; 
00120     Pixel         beBlackPixel;   
00121     Pixel         beWhitePixel;   
00123     
00124 
00125     Window        scrnWin;        
00126     int           scrnX;          
00127     int           scrnY;          
00128     int           scrnWidth;      
00129     int           scrnHeight;     
00130     int           scrnXSign;      
00131     int           scrnYSign;      
00134     Drawable      scrnDefDrawables[MAXFORMATS];
00135 
00136     struct _DMXScreenInfo *next;  
00137     struct _DMXScreenInfo *over;  
00139     
00140 
00141     Window        rootWin;        
00142     int           rootX;          
00143     int           rootY;          
00144     int           rootWidth;      
00145     int           rootHeight;     
00147     int           rootXOrigin;    
00148     int           rootYOrigin;    
00150     
00151 
00152     void         *shadow;         
00153     XlibGC        shadowGC;       
00154     XImage       *shadowFBImage;  
00156     
00157 
00158     int           shared;         
00160     Bool          WMRunningOnBE;
00161 
00162     Cursor        noCursor;
00163     Cursor        curCursor;
00164                                 
00165 
00166     CursorPtr     cursor;
00167     int           cursorVisible;
00168     int           cursorNotShared; 
00169 
00170     PositionType  where;            
00171     int           whereX;           
00172     int           whereY;           
00173     int           whereRefScreen;   
00175     int           savedTimeout;     
00176     int           dpmsCapable;      
00177     int           dpmsEnabled;      
00178     int           dpmsStandby;      
00179     int           dpmsSuspend;      
00180     int           dpmsOff;          
00182     DMXStatInfo  *stat;             
00183     Bool          needsSync;        
00185 #ifdef GLXEXT
00186 
00187     int           numGlxVisuals;
00188     __GLXvisualConfig *glxVisuals;
00189     int           glxMajorOpcode;
00190     int           glxErrorBase;
00191 
00193     __GLXFBConfig *fbconfigs;
00194     int           numFBConfigs;
00195 #endif
00196 
00199     CloseScreenProcPtr             CloseScreen;
00200     SaveScreenProcPtr              SaveScreen;
00201 
00202     CreateGCProcPtr                CreateGC;
00203 
00204     CreateWindowProcPtr            CreateWindow;
00205     DestroyWindowProcPtr           DestroyWindow;
00206     PositionWindowProcPtr          PositionWindow;
00207     ChangeWindowAttributesProcPtr  ChangeWindowAttributes;
00208     RealizeWindowProcPtr           RealizeWindow;
00209     UnrealizeWindowProcPtr         UnrealizeWindow;
00210     RestackWindowProcPtr           RestackWindow;
00211     WindowExposuresProcPtr         WindowExposures;
00212     CopyWindowProcPtr              CopyWindow;
00213 
00214     ResizeWindowProcPtr            ResizeWindow;
00215     ReparentWindowProcPtr          ReparentWindow;
00216 
00217     ChangeBorderWidthProcPtr       ChangeBorderWidth;
00218 
00219     GetImageProcPtr                GetImage;
00220     GetSpansProcPtr                GetSpans;
00221 
00222     CreatePixmapProcPtr            CreatePixmap;
00223     DestroyPixmapProcPtr           DestroyPixmap;
00224     BitmapToRegionProcPtr          BitmapToRegion;
00225 
00226     RealizeFontProcPtr             RealizeFont;
00227     UnrealizeFontProcPtr           UnrealizeFont;
00228 
00229     CreateColormapProcPtr          CreateColormap;
00230     DestroyColormapProcPtr         DestroyColormap;
00231     InstallColormapProcPtr         InstallColormap;
00232     StoreColorsProcPtr             StoreColors;
00233 
00234     SetShapeProcPtr                SetShape;
00235 
00236 #ifdef RENDER
00237     CreatePictureProcPtr           CreatePicture;
00238     DestroyPictureProcPtr          DestroyPicture;
00239     ChangePictureClipProcPtr       ChangePictureClip;
00240     DestroyPictureClipProcPtr      DestroyPictureClip;
00241     
00242     ChangePictureProcPtr           ChangePicture;
00243     ValidatePictureProcPtr         ValidatePicture;
00244 
00245     CompositeProcPtr               Composite;
00246     GlyphsProcPtr                  Glyphs;
00247     CompositeRectsProcPtr          CompositeRects;
00248 
00249     InitIndexedProcPtr             InitIndexed;
00250     CloseIndexedProcPtr            CloseIndexed;
00251     UpdateIndexedProcPtr           UpdateIndexed;
00252 
00253     TrapezoidsProcPtr              Trapezoids;
00254     TrianglesProcPtr               Triangles;
00255     TriStripProcPtr                TriStrip;
00256     TriFanProcPtr                  TriFan;
00257 #endif
00258 } DMXScreenInfo;
00259 
00260 
00261 extern int              dmxNumScreens;          
00262 extern DMXScreenInfo   *dmxScreens;             
00263 extern int              dmxShadowFB;            
00266 extern XErrorEvent      dmxLastErrorEvent;      
00268 extern Bool             dmxErrorOccurred;       
00270 extern Bool             dmxOffScreenOpt;        
00273 extern Bool             dmxSubdividePrimitives; 
00276 extern Bool             dmxLazyWindowCreation;  
00279 extern Bool             dmxUseXKB;              
00283 extern int              dmxDepth;               
00285 #ifdef GLXEXT
00286 extern Bool             dmxGLXProxy;            
00288 extern Bool             dmxGLXSwapGroupSupport; 
00292 extern Bool             dmxGLXSyncSwap;         
00296 extern Bool             dmxGLXFinishSwap;       
00301 #endif
00302 extern char            *dmxFontPath;            
00311 extern Bool             dmxIgnoreBadFontPaths;  
00315 extern Bool             dmxAddRemoveScreens;    
00320 #define DMX_WRAP(_entry, _newfunc, _saved, _actual)                     \
00321 do {                                                                    \
00322     (_saved)->_entry  = (_actual)->_entry;                              \
00323     (_actual)->_entry = (_newfunc);                                     \
00324 } while (0)
00325 
00327 #define DMX_UNWRAP(_entry, _saved, _actual)                             \
00328 do {                                                                    \
00329     (_actual)->_entry = (_saved)->_entry;                               \
00330 } while (0)
00331 
00332 
00333 
00334 #ifdef MAXSCREENS
00335 #define MAXSCREEN_MAKECONSTSTR1(x) #x
00336 #define MAXSCREEN_MAKECONSTSTR2(x) MAXSCREEN_MAKECONSTSTR1(x)
00337 
00338 #define MAXSCREEN_FAILED_TXT "Failed at ["                              \
00339    MAXSCREEN_MAKECONSTSTR2(__LINE__) ":" __FILE__ "] to allocate object: "
00340 
00341 #define _MAXSCREENSALLOCF(o,size,fatal)                                 \
00342     do {                                                                \
00343         if (!o) {                                                       \
00344             o = calloc((size), sizeof(*(o)));                          \
00345             if (!o && fatal) FatalError(MAXSCREEN_FAILED_TXT #o);       \
00346         }                                                               \
00347     } while (0)
00348 #define _MAXSCREENSALLOCR(o,size,retval)                                \
00349     do {                                                                \
00350         if (!o) {                                                       \
00351             o = calloc((size), sizeof(*(o)));                          \
00352             if (!o) return retval;                                      \
00353         }                                                               \
00354     } while (0)
00355         
00356 #define MAXSCREENSFREE(o)                                               \
00357     do {                                                                \
00358         if (o) free(o);                                                \
00359         o = NULL;                                                       \
00360     } while (0)
00361 
00362 #define MAXSCREENSALLOC(o)              _MAXSCREENSALLOCF(o,MAXSCREENS,  0)
00363 #define MAXSCREENSALLOC_FATAL(o)        _MAXSCREENSALLOCF(o,MAXSCREENS,  1)
00364 #define MAXSCREENSALLOC_RETURN(o,r)     _MAXSCREENSALLOCR(o,MAXSCREENS, (r))
00365 #define MAXSCREENSALLOCPLUSONE(o)       _MAXSCREENSALLOCF(o,MAXSCREENS+1,0)
00366 #define MAXSCREENSALLOCPLUSONE_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,1)
00367 #define MAXSCREENSCALLOC(o,m)           _MAXSCREENSALLOCF(o,MAXSCREENS*(m),0)
00368 #define MAXSCREENSCALLOC_FATAL(o,m)     _MAXSCREENSALLOCF(o,MAXSCREENS*(m),1)
00369 #endif
00370 
00371 #endif