# dmxinit.c File Reference

`#include "dmx.h"`
`#include "dmxinit.h"`
`#include "dmxsync.h"`
`#include "dmxlog.h"`
`#include "dmxinput.h"`
`#include "dmxscrinit.h"`
`#include "dmxcursor.h"`
`#include "dmxfont.h"`
`#include "config/dmxconfig.h"`
`#include "dmxcb.h"`
`#include "dmxprop.h"`
`#include "dmxstat.h"`
`#include "dmxpict.h"`
`#include <X11/Xos.h>`
`#include "dixstruct.h"`
`#include <signal.h>`

## Defines

#define | DMX_ERROR_BUF_SIZE 256

## Functions

static int | dmxErrorHandler (Display *dpy, XErrorEvent *ev)
Bool | dmxOpenDisplay (DMXScreenInfo *dmxScreen)
void | dmxSetErrorHandler (DMXScreenInfo *dmxScreen)
static void | dmxPrintScreenInfo (DMXScreenInfo *dmxScreen)
void | dmxGetScreenAttribs (DMXScreenInfo *dmxScreen)
Bool | dmxGetVisualInfo (DMXScreenInfo *dmxScreen)
void | dmxGetColormaps (DMXScreenInfo *dmxScreen)
void | dmxGetPixmapFormats (DMXScreenInfo *dmxScreen)
static Bool | dmxSetPixmapFormats (ScreenInfo *pScreenInfo, DMXScreenInfo *dmxScreen)
void | dmxCheckForWM (DMXScreenInfo *dmxScreen)
static void | dmxDisplayInit (DMXScreenInfo *dmxScreen)
static const char * | dmxExecOS (void)
static const char * | dmxBuildCompiler (void)
static const char * | dmxExecHost (void)
void | InitOutput (ScreenInfo *pScreenInfo, int argc, char *argv[])
static void | dmxSetDefaultFontPath (char *fp)
void | AbortDDX (void)
void | ddxGiveUp (void)
void | OsVendorInit (void)
void | OsVendorFatalError (void)
int | ddxProcessArgument (int argc, char *argv[], int i)
void | ddxUseMsg (void)

## Variables

int | dmxNumScreens
DMXScreenInfo * | dmxScreens
int | dmxNumInputs
DMXInputInfo * | dmxInputs
int | dmxShadowFB = FALSE
XErrorEvent | dmxLastErrorEvent
Bool | dmxErrorOccurred = FALSE
char * | dmxFontPath = NULL
Bool | dmxOffScreenOpt = TRUE
Bool | dmxSubdividePrimitives = TRUE
Bool | dmxLazyWindowCreation = TRUE
Bool | dmxUseXKB = TRUE
int | dmxDepth = 0
static Bool | dmxGLXProxy = FALSE
Bool | dmxIgnoreBadFontPaths = FALSE
Bool | dmxAddRemoveScreens = FALSE

## Detailed Description

Provide expected functions for initialization from the ddx layer and global variables for the DMX server.

## Define Documentation

#define DMX_ERROR_BUF_SIZE 256

Referenced by dmxErrorHandler().

## Function Documentation

void AbortDDX | ( | void |  | ) |

This function is called in Xserver/os/utils.c from AbortServer(). We must ensure that backend and console state is restored in the event the server shutdown wasn't clean.

References _DMXScreenInfo::beDisplay, and dmxNumScreens.

Referenced by ddxGiveUp().

void ddxGiveUp | ( | void |  | ) |

This function is called in Xserver/dix/main.c from main() when dispatchException & DE_TERMINATE (which is the only way to exit the main loop without an interruption.

References AbortDDX().

int ddxProcessArgument | ( | int | argc,
|  | char * | argv[],
|  | int | i
| ) |  |

Process our command line arguments.

References dmxAddRemoveScreens, dmxConfigSetMaxScreens(), dmxConfigSetXkbLayout(), dmxConfigSetXkbModel(), dmxConfigSetXkbOptions(), dmxConfigSetXkbRules(), dmxConfigSetXkbVariant(), dmxConfigStoreConfig(), dmxConfigStoreDisplay(), dmxConfigStoreFile(), dmxConfigStoreInput(), dmxConfigStoreXInput(), dmxCursorNoMulti(), dmxDepth, dmxGLXProxy, dmxIgnoreBadFontPaths, dmxLazyWindowCreation, dmxLog(), dmxOffScreenOpt, dmxSetDefaultFontPath(), dmxShadowFB, dmxStatActivate(), dmxSubdividePrimitives, dmxSyncActivate(), dmxUseXKB, and dmxWarning.

void ddxUseMsg | ( | void |  | ) |

Provide succinct usage information for the DMX server.

static const char* dmxBuildCompiler | ( | void |  | ) | `[static]`

Referenced by InitOutput().

void dmxCheckForWM | ( | DMXScreenInfo * | dmxScreen | ) |

References _DMXScreenInfo::beDisplay, and _DMXScreenInfo::WMRunningOnBE.

Referenced by dmxAttachScreen(), and dmxDisplayInit().

static void dmxDisplayInit | ( | DMXScreenInfo * | dmxScreen | ) | `[static]`

Initialize the display and collect relevant information about the display properties

References dmxCheckForWM(), dmxFatal, dmxGetColormaps(), dmxGetPixmapFormats(), dmxGetScreenAttribs(), dmxGetVisualInfo(), dmxLog(), dmxOpenDisplay(), dmxSetErrorHandler(), and _DMXScreenInfo::name.

Referenced by InitOutput().

static int dmxErrorHandler | ( | Display * | dpy,
|  | XErrorEvent * | ev
| ) |  | `[static]`

References DMX_ERROR_BUF_SIZE, dmxErrorOccurred, dmxLastErrorEvent, dmxLog(), and dmxWarning.

Referenced by dmxSetErrorHandler().

static const char* dmxExecHost | ( | void |  | ) | `[static]`

Referenced by InitOutput().

static const char* dmxExecOS | ( | void |  | ) | `[static]`

Referenced by InitOutput().

void dmxGetColormaps | ( | DMXScreenInfo * | dmxScreen | ) |

References _DMXScreenInfo::beBlackPixel, _DMXScreenInfo::beDefColormaps, _DMXScreenInfo::beDisplay, _DMXScreenInfo::beNumDefColormaps, _DMXScreenInfo::beNumVisuals, _DMXScreenInfo::beVisuals, and _DMXScreenInfo::beWhitePixel.

Referenced by dmxAttachScreen(), and dmxDisplayInit().

void dmxGetPixmapFormats | ( | DMXScreenInfo * | dmxScreen | ) |

References _DMXScreenInfo::beDepths, _DMXScreenInfo::beDisplay, _DMXScreenInfo::beNumDepths, _DMXScreenInfo::beNumPixmapFormats, and _DMXScreenInfo::bePixmapFormats.

Referenced by dmxAttachScreen(), and dmxDisplayInit().

void dmxGetScreenAttribs | ( | DMXScreenInfo * | dmxScreen | ) |

References _DMXScreenInfo::beBPP, _DMXScreenInfo::beDepth, _DMXScreenInfo::beDisplay, _DMXScreenInfo::beHeight, _DMXScreenInfo::beWidth, _DMXScreenInfo::beXDPI, _DMXScreenInfo::beYDPI, dmxLogOutput(), dmxLogOutputWarning(), dmxPrintScreenInfo(), _DMXScreenInfo::rootHeight, _DMXScreenInfo::rootWidth, _DMXScreenInfo::rootX, _DMXScreenInfo::rootY, _DMXScreenInfo::scrnHeight, _DMXScreenInfo::scrnWidth, _DMXScreenInfo::scrnX, _DMXScreenInfo::scrnXSign, _DMXScreenInfo::scrnY, and _DMXScreenInfo::scrnYSign.

Referenced by dmxAttachScreen(), and dmxDisplayInit().

Bool dmxGetVisualInfo | ( | DMXScreenInfo * | dmxScreen | ) |

References _DMXScreenInfo::beDefVisualIndex, _DMXScreenInfo::beDisplay, _DMXScreenInfo::beNumVisuals, _DMXScreenInfo::beVisuals, dmxDepth, and dmxLogVisual().

Referenced by dmxAttachScreen(), and dmxDisplayInit().

Bool dmxOpenDisplay | ( | DMXScreenInfo * | dmxScreen | ) |

References _DMXScreenInfo::beDisplay, dmxPropertyDisplay(), and _DMXScreenInfo::name.

Referenced by dmxAttachScreen(), and dmxDisplayInit().

static void dmxPrintScreenInfo | ( | DMXScreenInfo * | dmxScreen | ) | `[static]`

References _DMXScreenInfo::beDisplay, dmxLogOutput(), dmxLogOutputCont(), dmxLogOutputWarning(), and _DMXScreenInfo::WMRunningOnBE.

Referenced by dmxGetScreenAttribs().

static void dmxSetDefaultFontPath | ( | char * | fp | ) | `[static]`

References dmxFontPath.

Referenced by ddxProcessArgument().

void dmxSetErrorHandler | ( | DMXScreenInfo * | dmxScreen | ) |

References dmxErrorHandler().

Referenced by dmxAttachScreen(), and dmxDisplayInit().

static Bool dmxSetPixmapFormats | ( | ScreenInfo * | pScreenInfo,
|  | DMXScreenInfo * | dmxScreen
| ) |  | `[static]`

References _DMXScreenInfo::beDepths, _DMXScreenInfo::beDisplay, _DMXScreenInfo::beNumDepths, _DMXScreenInfo::beNumPixmapFormats, and _DMXScreenInfo::bePixmapFormats.

Referenced by InitOutput().

void InitOutput | ( | ScreenInfo * | pScreenInfo,
|  | int | argc,
|  | char * | argv[]
| ) |  |

This routine is called in Xserver/dix/main.c from main().

References _DMXScreenInfo::beDisplay, _DMXScreenInfo::beNumVisuals, _DMXScreenInfo::beVisuals, DMX_NO_RECOMPUTE_BOUNDING_BOX, dmxAddRemoveScreens, dmxBuildCompiler(), dmxComputeWidthHeight(), dmxConfigConfigure(), dmxConnectionBlockCallback(), dmxDisplayInit(), dmxExecHost(), dmxExecOS(), dmxFatal, dmxGeneration, dmxGLXProxy, dmxInfo, dmxInitFonts(), dmxInitOrigins(), dmxInitOverlap(), dmxInitRender(), dmxInputFree(), dmxLazyWindowCreation, dmxLog(), dmxNumInputs, dmxNumScreens, dmxOffScreenOpt, dmxScreenInit(), dmxSetPixmapFormats(), dmxShadowFB, dmxStatFree(), dmxStatInit(), dmxSyncInit(), dmxWarning, GetGLXFBConfigs(), GetGLXVisualConfigs(), GetGLXVisualConfigsFromFBConfigs(), _DMXScreenInfo::stat, VENDOR_RELEASE, VENDOR_STRING, dmxGlxVisualPrivate::x_visual_class, and dmxGlxVisualPrivate::x_visual_depth.

void OsVendorFatalError | ( | void |  | ) |

This function is called in Xserver/os/utils.c from FatalError() and VFatalError(). (Note that setting the function pointer OsVendorVErrorFProc will cause VErrorF() (which is called by the two routines mentioned here, as well as by others) to use the referenced routine instead of vfprintf().)

Referenced by VFatalError().

void OsVendorInit | ( | void |  | ) |

This function is called in Xserver/os/osinit.c from OsInit().

## Variable Documentation

Bool dmxAddRemoveScreens = FALSE

True if add and remove screens support is enabled

Referenced by ddxProcessArgument(), dmxAttachScreen(), dmxDetachScreen(), and InitOutput().

int dmxDepth = 0

Requested depth if non-zero

Referenced by ddxProcessArgument(), and dmxGetVisualInfo().

Bool dmxErrorOccurred = FALSE

True if an error occurred

Referenced by dmxErrorHandler().

char* dmxFontPath = NULL

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

Referenced by dmxBELoadFont(), and dmxSetDefaultFontPath().

Bool dmxGLXProxy = FALSE`[static]`

Referenced by ddxProcessArgument(), and InitOutput().

Bool dmxIgnoreBadFontPaths = FALSE

True if bad font paths should be ignored during server init

Referenced by ddxProcessArgument(), and dmxBELoadFont().

DMXInputInfo* dmxInputs

List of inputs

Referenced by dmxAddDevice(), dmxAdjustCursorBoundaries(), dmxBackendInitPrivate(), dmxBlockHandler(), dmxChangePointerControl(), dmxCheckFunctionKeys(), dmxCommonCopyPrivate(), dmxConfigAddInput(), dmxConsoleInit(), dmxCoreMotion(), dmxDump(), dmxGetInputAttributes(), dmxGetInputCount(), dmxInputAttachBackend(), dmxInputAttachConsole(), dmxInputDetach(), dmxInputDetachAll(), dmxInputLocateId(), dmxInputLogDevices(), dmxKeyboardBellProc(), dmxKeyboardKbdCtrlProc(), dmxSigioDisableInput(), dmxSigioEnableInput(), dmxSigioHandler(), dmxTranslateAndEnqueueExtEvent(), dmxUpdateWindowInfo(), dmxWakeupHandler(), InitInput(), and ProcessInputEvents().

XErrorEvent dmxLastErrorEvent

Last error that occurred

Referenced by dmxErrorHandler().

Bool dmxLazyWindowCreation = TRUE

True if using the lazy window creation optimization

Referenced by ddxProcessArgument(), dmxCreateWindow(), and InitOutput().

int dmxNumInputs

Number of dmxInputs

Referenced by dmxAdjustCursorBoundaries(), dmxChangePointerControl(), dmxConfigAddInput(), dmxConfigConfigInputs(), dmxCoreMotion(), dmxDump(), dmxGetInputAttributes(), dmxGetInputCount(), dmxInputAttachBackend(), dmxInputAttachConsole(), dmxInputDetach(), dmxInputDetachAll(), dmxInputLocateId(), dmxInputLogDevices(), dmxKeyboardBellProc(), dmxKeyboardKbdCtrlProc(), dmxSigioDisableInput(), dmxSigioEnableInput(), dmxSigioHandler(), dmxUpdateWindowInfo(), InitInput(), InitOutput(), and ProcessInputEvents().

int dmxNumScreens

Number of dmxScreens

Referenced by AbortDDX(), dmxBackendInitPrivate(), dmxBackendSameDisplay(), dmxCheckCursor(), dmxComputeScreenOrigins(), dmxComputeWidthHeight(), dmxConfigAddDisplay(), dmxConfigConfigInputs(), dmxConfigCopyFromWall(), dmxConfigFromCommandLine(), dmxConfigSetMaxScreens(), dmxConsoleComputeWidthHeight(), dmxConsoleDraw(), dmxConsoleDrawWindows(), dmxCursorOffScreen(), dmxFindFirstScreen(), dmxFindPointerScreen(), dmxGetNumScreens(), dmxGetScreenAttributes(), dmxInitOrigins(), dmxInitOverlap(), dmxInputAttachBackend(), dmxInputInit(), dmxProcRenderAddGlyphs(), dmxProcRenderCreateGlyphSet(), dmxProcRenderFreeGlyphs(), dmxProcRenderFreeGlyphSet(), dmxProcSetFontPath(), dmxPropertyCheckOtherWindows(), dmxReInitOrigins(), dmxSLCreate(), dmxSLFindNext(), dmxStatCallback(), dmxSyncCallback(), dmxTryComputeScreenOrigins(), and InitOutput().

Bool dmxOffScreenOpt = TRUE

True if using off screen optimizations

Referenced by ddxProcessArgument(), and InitOutput().

DMXScreenInfo* dmxScreens

List of outputs

Referenced by _dmxMoveCursor(), _dmxRealizeCursor(), _dmxSetCursor(), _dmxUnrealizeCursor(), dmxAttachScreen(), dmxBackendFindOverlapping(), dmxBackendInitPrivate(), dmxBackendOffscreen(), dmxBackendProcessInput(), dmxBackendUpdatePosition(), dmxBECloseScreen(), dmxBECreateColormap(), dmxBECreateCursor(), dmxBECreateGC(), dmxBECreateGlyphSet(), dmxBECreatePixmap(), dmxBECreateWindowTree(), dmxBEDestroyWindow(), dmxBEFreeColormap(), dmxBEFreeCursor(), dmxBEFreeFont(), dmxBEFreeGC(), dmxBEFreeGlyphSet(), dmxBEFreePicture(), dmxBEFreePixmap(), dmxBELoadFont(), dmxBERestorePixmap(), dmxBERestoreRenderGlyph(), dmxBESavePixmap(), dmxBEScreenInit(), dmxBitmapToRegion(), dmxChangeBorderWidth(), dmxChangeClip(), dmxChangeGC(), dmxChangePicture(), dmxChangePictureClip(), dmxChangeWindowAttributes(), dmxCheckCursor(), dmxCloseScreen(), dmxColormapFromDefaultVisual(), dmxCommonMouOn(), dmxCommonSaveState(), dmxComposite(), dmxCompositeRects(), dmxComputeScreenOrigins(), dmxComputeWidthHeight(), dmxConfigAddDisplay(), dmxConfigConfigInputs(), dmxConfigCopyFromWall(), dmxConfigFromCommandLine(), dmxConnectionBlockCallback(), dmxConsoleDraw(), dmxCopyArea(), dmxCopyGC(), dmxCopyPlane(), dmxCopyWindow(), dmxCoreMotion(), dmxCreateAndRealizeWindow(), dmxCreateColormap(), dmxCreateGC(), dmxCreateNonRootWindow(), dmxCreatePicture(), dmxCreatePixmap(), dmxCreateRootWindow(), dmxCreateWindow(), dmxCursorOffScreen(), dmxDestroyClip(), dmxDestroyColormap(), dmxDestroyGC(), dmxDestroyPicture(), dmxDestroyPictureClip(), dmxDestroyPixmap(), dmxDestroyWindow(), dmxDetachScreen(), dmxDoCreatePicture(), dmxDoRestackWindow(), dmxDoSetShape(), dmxFillPolygon(), dmxFindAlternatePixmap(), dmxFindFirstScreen(), dmxGetImage(), dmxGetScreenAttributes(), dmxImageText16(), dmxImageText8(), dmxInitOrigins(), dmxInitOverlap(), dmxInputAttachBackend(), dmxInputInit(), dmxInstallColormap(), dmxLookupVisual(), dmxLookupVisualFromID(), dmxMoveCursor(), dmxPictureInit(), dmxPolyArc(), dmxPolyFillArc(), dmxPolyFillRect(), dmxPolylines(), dmxPolyPoint(), dmxPolyRectangle(), dmxPolySegment(), dmxPolyText16(), dmxPolyText8(), dmxPositionWindow(), dmxProcRenderAddGlyphs(), dmxProcRenderCompositeGlyphs(), dmxProcRenderCreateGlyphSet(), dmxProcRenderFreeGlyphs(), dmxProcRenderFreeGlyphSet(), dmxProcRenderSetPictureFilter(), dmxProcRenderSetPictureTransform(), dmxProcSetFontPath(), dmxPropertyCheckOtherWindows(), dmxPutImage(), dmxRealizeCursor(), dmxRealizeFont(), dmxRealizeWindow(), dmxReInitOrigins(), dmxReparentWindow(), dmxResizeRootWindow(), dmxResizeScreenWindow(), dmxResizeWindow(), dmxRestackWindow(), dmxSaveScreen(), dmxScreenInit(), dmxSetCursor(), dmxSetShape(), dmxShadowUpdateProc(), dmxStatCallback(), dmxStoreColors(), dmxSyncCallback(), dmxTrapezoids(), dmxTriangles(), dmxTriFan(), dmxTriStrip(), dmxTryComputeScreenOrigins(), dmxUnrealizeCursor(), dmxUnrealizeFont(), dmxUnrealizeWindow(), dmxUpdateScreenResources(), dmxValidatePicture(), and dmxWindowExposures().

int dmxShadowFB = FALSE

Non-zero if using shadow frame-buffer (deprecated)

Referenced by ddxProcessArgument(), dmxBECloseScreen(), dmxBEScreenInit(), dmxCloseScreen(), dmxCommonMouOn(), dmxPictureInit(), dmxScreenInit(), and InitOutput().

Bool dmxSubdividePrimitives = TRUE

True if using the primitive subdivision optimization

Referenced by ddxProcessArgument(), and dmxPutImage().

Bool dmxUseXKB = TRUE

True if the XKB extension should be used with the backend servers

Referenced by ddxProcessArgument(), and dmxCommonSaveState().