Functions | Variables

# dmxextension.c File Reference

`#include <stdlib.h>`
`#include "dmx.h"`
`#include "dmxinit.h"`
`#include "dmxextension.h"`
`#include "dmxwindow.h"`
`#include "dmxcb.h"`
`#include "dmxcursor.h"`
`#include "dmxpixmap.h"`
`#include "dmxgc.h"`
`#include "dmxfont.h"`
`#include "dmxcmap.h"`
`#include "dmxpict.h"`
`#include "dmxinput.h"`
`#include "dmxsync.h"`
`#include "dmxscrinit.h"`
`#include "input/dmxinputinit.h"`
`#include "windowstr.h"`
`#include "inputstr.h"`
`#include <X11/extensions/dmxproto.h>`
`#include "cursorstr.h"`

## Functions
Bool | dmxGetScreenAttributes (int physical, DMXScreenAttributesPtr attr)
Bool | dmxGetWindowAttributes (WindowPtr pWindow, DMXWindowAttributesPtr attr)
void | dmxGetDesktopAttributes (DMXDesktopAttributesPtr attr)
int | dmxGetInputCount (void)
int | dmxGetInputAttributes (int deviceId, DMXInputAttributesPtr attr)
static void | dmxAdjustCursorBoundaries (void)
int | dmxAddInput (DMXInputAttributesPtr attr, int *id)
int | dmxRemoveInput (int id)
unsigned long | dmxGetNumScreens (void)
void | dmxForceWindowCreation (WindowPtr pWindow)
void | dmxFlushPendingSyncs (void)
void | dmxUpdateScreenResources (ScreenPtr pScreen, int x, int y, int w, int h)
static void | dmxBECreateScratchGCs (int scrnNum)
static void | dmxBERestorePixmap (PixmapPtr pPixmap)
static void | dmxBECreateResources (pointer value, XID id, RESTYPE type, pointer n)
static void | dmxBECreateWindowTree (int idx)
static void | dmxForceExposures (int idx)
static Bool | dmxCompareScreens (DMXScreenInfo *new, DMXScreenInfo *old)
static void | dmxBERestoreRenderPict (pointer value, XID id, pointer n)
static void | dmxBERestoreRenderGlyph (pointer value, XID id, pointer n)
int | dmxAttachScreen (int idx, DMXScreenAttributesPtr attr)
static void | dmxBESavePixmap (PixmapPtr pPixmap)
static void | dmxBEDestroyResources (pointer value, XID id, RESTYPE type, pointer n)
static void | dmxBEDestroyScratchGCs (int scrnNum)
static void | dmxBEDestroyWindowTree (int idx)
int | dmxDetachScreen (int idx)
## Variables
FontPtr | defaultFont

## Detailed Description

This file provides the only interface to the X server extension support in programs/Xserver/Xext. Those programs should only include dmxext.h

## Function Documentation

int dmxAddInput | ( | DMXInputAttributesPtr | attr,
|  | int * | id |
| ) |  |  |

Add an input with the specified attributes. If the input is added, the physical id is returned in deviceId.

References dmxAdjustCursorBoundaries(), dmxInputAttachBackend(), dmxInputAttachConsole(), dmxSync(), DMXInputAttributesRec::inputType, DMXInputAttributesRec::name, DMXInputAttributesRec::physicalScreen, and DMXInputAttributesRec::sendsCore.

Referenced by ProcDMXAddInput().

static void dmxAdjustCursorBoundaries | ( | void |  | ) | `[static]`

Reinitialized the cursor boundaries.

References _DMXInputInfo::detached, DMX_NO_RECOMPUTE_BOUNDING_BOX, dmxCheckCursor(), dmxComputeWidthHeight(), dmxConnectionBlockCallback(), dmxInitOverlap(), dmxInputLateReInit(), dmxInputReInit(), dmxInputs, dmxNumInputs, and dmxReInitOrigins().

Referenced by dmxAddInput(), and dmxDetachScreen().

int dmxAttachScreen | ( | int | idx,
|  | DMXScreenAttributesPtr | attr |
| ) |  |  |

Reattach previously detached back-end screen.

References _DMXScreenInfo::beDepths, _DMXScreenInfo::beDisplay, _DMXScreenInfo::bePixmapFormats, _DMXScreenInfo::beVisuals, defaultFont, DMXScreenAttributesRec::displayName, dmxAddRemoveScreens, dmxBECreatePixmap(), dmxBECreateResources(), dmxBECreateScratchGCs(), dmxBECreateWindowTree(), dmxBELoadFont(), dmxBERestorePixmap(), dmxBERestoreRenderGlyph(), dmxBERestoreRenderPict(), dmxBEScreenInit(), dmxCheckForWM(), dmxCompareScreens(), dmxConfigureScreenWindows(), dmxForceExposures(), dmxGetColormaps(), dmxGetPixmapFormats(), dmxGetScreenAttribs(), dmxGetVisualInfo(), dmxLog(), dmxLogOutput(), dmxOpenDisplay(), dmxScreens, dmxSetErrorHandler(), dmxSync(), dmxWarning, and _DMXScreenInfo::name.

Referenced by ProcDMXAddScreen().

static void dmxBECreateResources | ( | pointer | value,
|  | XID | id,
|  | RESTYPE | type,
|  | pointer | n |
| ) |  |  | `[static]`

Create resources on the back-end server. This function is called from dmxAttachScreen() via the dix layer's FindAllResources function. It walks all resources, compares them to the screen number passed in as n and calls the appropriate DMX function to create the associated resource on the back-end server.

References defaultFont, dmxBECreateColormap(), dmxBECreateCursor(), dmxBECreateGC(), dmxBECreatePixmap(), dmxBEFreeGlyphSet(), dmxBELoadFont(), dmxBERestorePixmap(), and dmxChangeGC().

Referenced by dmxAttachScreen().

static void dmxBECreateScratchGCs | ( | int | scrnNum | ) | `[static]`

Create the scratch GCs per depth.

References dmxBECreateGC().

Referenced by dmxAttachScreen().

static void dmxBECreateWindowTree | ( | int | idx | ) | `[static]`

Create window hierachy on back-end server. The window tree is created in a special order (bottom most subwindow first) so that the dmxCreateNonRootWindow() function does not need to recursively call itself to create each window's parents. This is required so that we have the opportunity to create each window's border and background pixmaps (where appropriate) before the window is created.

References _DMXScreenInfo::beDisplay, _dmxWinPriv::cmap, DMX_GET_WINDOW_PRIV, dmxBECreatePixmap(), dmxBERestorePixmap(), dmxCreateAndRealizeWindow(), dmxCreateRootWindow(), dmxGetDefaultWindowAttributes(), dmxScreens, _dmxWinPriv::mapped, _dmxWinPriv::offscreen, _DMXScreenInfo::rootWin, _dmxWinPriv::visual, and _dmxWinPriv::window.

Referenced by dmxAttachScreen().

static void dmxBEDestroyResources | ( | pointer | value,
|  | XID | id,
|  | RESTYPE | type,
|  | pointer | n |
| ) |  |  | `[static]`

Destroy resources on the back-end server. This function is called from dmxDetachScreen() via the dix layer's FindAllResources function. It walks all resources, compares them to the screen number passed in as n and calls the appropriate DMX function to free the associated resource on the back-end server.

References dmxBEFreeColormap(), dmxBEFreeCursor(), dmxBEFreeFont(), dmxBEFreeGC(), dmxBEFreeGlyphSet(), dmxBEFreePicture(), dmxBEFreePixmap(), and dmxBESavePixmap().

Referenced by dmxDetachScreen().

static void dmxBEDestroyScratchGCs | ( | int | scrnNum | ) | `[static]`

Destroy the scratch GCs that are created per depth.

References dmxBEFreeGC().

Referenced by dmxDetachScreen().

static void dmxBEDestroyWindowTree | ( | int | idx | ) | `[static]`

Destroy window hierachy on back-end server. To ensure that all XDestroyWindow() calls succeed, they must be performed in a bottom up order so that windows are not destroyed before their children. XDestroyWindow(), which is called from dmxBEDestroyWindow(), will destroy a window as well as all of it's children.

References dmxBEDestroyWindow(), dmxBEFreePixmap(), and dmxBESavePixmap().

Referenced by dmxDetachScreen().

static void dmxBERestorePixmap | ( | PixmapPtr | pPixmap | ) | `[static]`

Restore the pixmap image either from another screen or from an image that was saved when the screen was previously detached.

References _DMXScreenInfo::beDisplay, _DMXScreenInfo::beNumPixmapFormats, _DMXScreenInfo::bePixmapFormats, _dmxPixPriv::detachedImage, DMX_GET_PIXMAP_PRIV, dmxLog(), dmxScreens, dmxWarning, _dmxPixPriv::pixmap, and _DMXScreenInfo::scrnDefDrawables.

Referenced by dmxAttachScreen(), dmxBECreateResources(), dmxBECreateWindowTree(), and dmxBERestoreRenderPict().

static void dmxBERestoreRenderGlyph | ( | pointer | value,
|  | XID | id,
|  | pointer | n |
| ) |  |  | `[static]`

Restore Render's glyphs

References _DMXScreenInfo::beDisplay, DMX_GET_GLYPH_PRIV, dmxBECreateGlyphSet(), dmxLog(), dmxScreens, dmxWarning, _dmxGlyphPriv::glyphSets, and pos.

Referenced by dmxAttachScreen().

static void dmxBERestoreRenderPict | ( | pointer | value,
|  | XID | id,
|  | pointer | n |
| ) |  |  | `[static]`

Restore Render's picture

References dmxBECreatePicture(), dmxBECreatePixmap(), and dmxBERestorePixmap().

Referenced by dmxAttachScreen().

static void dmxBESavePixmap | ( | PixmapPtr | pPixmap | ) | `[static]`

Save the pixmap image only when there is not another screen with that pixmap from which the image can be read when the screen is reattached. To do this, we first try to find a pixmap on another screen corresponding to the one we are trying to save. If we find one, then we do not need to save the image data since during reattachment, the image data can be read from that other pixmap. However, if we do not find one, then we need to save the image data. The common case for these are for the default stipple and root tile.

References _DMXScreenInfo::beDisplay, _dmxPixPriv::detachedImage, DMX_GET_PIXMAP_PRIV, dmxLog(), dmxScreens, dmxWarning, and _dmxPixPriv::pixmap.

Referenced by dmxBEDestroyResources(), dmxBEDestroyWindowTree(), and dmxDetachScreen().

static Bool dmxCompareScreens | ( | DMXScreenInfo * | new,
|  | DMXScreenInfo * | old |
| ) |  |  | `[static]`

Compare the new and old screens to see if they are compatible.

References _DMXScreenInfo::beBPP, _DMXScreenInfo::beDefVisualIndex, _DMXScreenInfo::beDepth, _DMXScreenInfo::beDepths, _DMXScreenInfo::beHeight, _DMXScreenInfo::beNumDepths, _DMXScreenInfo::beNumPixmapFormats, _DMXScreenInfo::beNumVisuals, _DMXScreenInfo::bePixmapFormats, _DMXScreenInfo::beVisuals, and _DMXScreenInfo::beWidth.

Referenced by dmxAttachScreen().

int dmxDetachScreen | ( | int | idx | ) |

Detach back-end screen.

References _DMXScreenInfo::beDisplay, dmxAddRemoveScreens, dmxAdjustCursorBoundaries(), dmxBECloseScreen(), dmxBEDestroyResources(), dmxBEDestroyScratchGCs(), dmxBEDestroyWindowTree(), dmxBEFreePixmap(), dmxBESavePixmap(), dmxInputDetachAll(), dmxLog(), dmxLogOutput(), dmxScreens, and dmxWarning.

Referenced by ProcDMXRemoveScreen().

void dmxFlushPendingSyncs | ( | void |  | ) |

Flush pending syncs for all screens.

References dmxSync().

Referenced by ProcDMXForceWindowCreation(), ProcDMXGetWindowAttributes(), and ProcDMXSync().

static void dmxForceExposures | ( | int | idx | ) | `[static]`

Referenced by dmxAttachScreen().

void dmxForceWindowCreation | ( | WindowPtr | pWindow | ) |

Make sure that dmxCreateAndRealizeWindow has been called for pWindow.

References DMX_GET_WINDOW_PRIV, dmxCreateAndRealizeWindow(), and _dmxWinPriv::window.

Referenced by ProcDMXForceWindowCreation().

void dmxGetDesktopAttributes | ( | DMXDesktopAttributesPtr | attr | ) |

References dmxGlobalHeight, dmxGlobalWidth, DMXDesktopAttributesRec::height, DMXDesktopAttributesRec::shiftX, DMXDesktopAttributesRec::shiftY, and DMXDesktopAttributesRec::width.

Referenced by ProcDMXChangeDesktopAttributes(), and ProcDMXGetDesktopAttributes().

int dmxGetInputAttributes | ( | int | deviceId,
|  | DMXInputAttributesPtr | attr |
| ) |  |  |

Return information about the device with id = deviceId. This information is primarily for the ProcDMXGetInputAttributes() function, which does not have access to the appropriate data structure.

References _DMXInputInfo::detached, DMXInputAttributesRec::detached, _DMXLocalInputInfo::deviceId, _DMXInputInfo::devs, DMX_LOCAL_TYPE_BACKEND, DMX_LOCAL_TYPE_COMMON, DMX_LOCAL_TYPE_CONSOLE, DMX_LOCAL_TYPE_LOCAL, dmxInputs, dmxNumInputs, _DMXLocalInputInfo::extType, DMXInputAttributesRec::inputType, _DMXLocalInputInfo::isCore, DMXInputAttributesRec::isCore, _DMXInputInfo::name, DMXInputAttributesRec::name, _DMXInputInfo::numDevs, _DMXLocalInputInfo::pDevice, DMXInputAttributesRec::physicalId, DMXInputAttributesRec::physicalScreen, _DMXInputInfo::scrnIdx, _DMXLocalInputInfo::sendsCore, and DMXInputAttributesRec::sendsCore.

Referenced by ProcDMXGetInputAttributes().

int dmxGetInputCount | ( | void |  | ) |

Return the total number of devices, not just dmxNumInputs. The number returned should be the same as that returned by XListInputDevices.

References dmxInputs, and dmxNumInputs.

Referenced by dmxInputLogDevices(), and ProcDMXGetInputCount().

unsigned long dmxGetNumScreens | ( | void |  | ) |

Return the value of dmxNumScreens -- the total number of backend screens in use (these are logical screens and may be larger than the number of backend displays).

References dmxNumScreens.

Referenced by ProcDMXGetScreenAttributes(), and ProcDMXGetScreenCount().

Bool dmxGetScreenAttributes | ( | int | physical,
|  | DMXScreenAttributesPtr | attr |
| ) |  |  |

This routine provides information to the DMX protocol extension about a particular screen.

References DMXScreenAttributesRec::displayName, dmxNumScreens, dmxScreens, _DMXScreenInfo::index, DMXScreenAttributesRec::logicalScreen, _DMXScreenInfo::name, _DMXScreenInfo::rootHeight, _DMXScreenInfo::rootWidth, DMXScreenAttributesRec::rootWindowHeight, DMXScreenAttributesRec::rootWindowWidth, DMXScreenAttributesRec::rootWindowXoffset, DMXScreenAttributesRec::rootWindowXorigin, DMXScreenAttributesRec::rootWindowYoffset, DMXScreenAttributesRec::rootWindowYorigin, _DMXScreenInfo::rootX, _DMXScreenInfo::rootXOrigin, _DMXScreenInfo::rootY, _DMXScreenInfo::rootYOrigin, DMXScreenAttributesRec::screenWindowHeight, DMXScreenAttributesRec::screenWindowWidth, DMXScreenAttributesRec::screenWindowXoffset, DMXScreenAttributesRec::screenWindowYoffset, _DMXScreenInfo::scrnHeight, _DMXScreenInfo::scrnWidth, _DMXScreenInfo::scrnX, and _DMXScreenInfo::scrnY.

Referenced by ProcDMXAddScreen(), ProcDMXChangeScreensAttributes(), and ProcDMXGetScreenAttributes().

Bool dmxGetWindowAttributes | ( | WindowPtr | pWindow,
|  | DMXWindowAttributesPtr | attr |
| ) |  |  |

This routine provides information to the DMX protocol extension about a particular window.

References DMX_GET_WINDOW_PRIV, _dmxWinPriv::offscreen, DMXWindowAttributesRec::pos, DMXWindowAttributesRec::screen, DMXWindowAttributesRec::vis, _dmxWinPriv::window, and DMXWindowAttributesRec::window.

Referenced by dmxPopulate().

int dmxRemoveInput | ( | int | id | ) |

Remove the input with physical id id.

References dmxInputDetachId().

Referenced by ProcDMXRemoveInput().

void dmxUpdateScreenResources | ( | ScreenPtr | pScreen,
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h |
| ) |  |  |

Update DMX's screen resources to match those of the newly moved and/or resized "root" window.

References _DMXScreenInfo::beXDPI, _DMXScreenInfo::beYDPI, and dmxScreens.

Referenced by dmxCreateWindow().

## Variable Documentation

FontPtr defaultFont

Referenced by dmxAttachScreen(), and dmxBECreateResources().