Defines | Functions | Variables

# dmxprop.c File Reference

`#include "dmx.h"`
`#include "dmxprop.h"`
`#include "dmxlog.h"`

## Defines
#define | DMX_ATOMNAME "DMX_NAME"
#define | DMX_IDENT "Xdmx"
## Functions
static int | dmxPropertyErrorHandler (Display *dpy, XErrorEvent *ev)
static const unsigned char * | dmxPropertyIdentifier (void)
void * | dmxPropertyIterate (DMXScreenInfo *start, void *(*f)(DMXScreenInfo *dmxScreen, void *), void *closure)
static int | dmxPropertyCheckOtherServers (DMXScreenInfo *dmxScreen, Atom atom)
static DMXScreenInfo * | dmxPropertyCheckOtherWindows (DMXScreenInfo *dmxScreen, Atom atom)
int | dmxPropertyDisplay (DMXScreenInfo *dmxScreen)
int | dmxPropertySameDisplay (DMXScreenInfo *dmxScreen, const char *name)
void | dmxPropertyWindow (DMXScreenInfo *dmxScreen)
## Variables
char * | display

## Detailed Description

It is possible for one of the DMX "backend displays" to actually be smaller than the dimensions of the backend X server. Therefore, it is possible for more than one of the DMX "backend displays" to be physically located on the same backend X server. This situation must be detected so that cursor motion can be handled in an expected fashion.

We could analyze the names used for the DMX "backend displays" (e.g., the names passed to the -display command-line parameter), but there are many possible names for a single X display, and failing to detect sameness leads to very unexpected results. Therefore, whenever the DMX server opens a window on a backend X server, a property value is queried and set on that backend to detect when another window is already open on that server.

Further, it is possible that two different DMX server instantiations both have windows on the same physical backend X server. This case is also detected so that pointer input is not taken from that particular backend X server.

The routines in this file handle the property management.

## Define Documentation

#define DMX_ATOMNAME "DMX_NAME"

Holds the window id of all DMX windows on the backend X server.

Referenced by dmxPropertyDisplay(), dmxPropertySameDisplay(), and dmxPropertyWindow().

#define DMX_IDENT "Xdmx"

The identification string of this DMX server

Referenced by dmxPropertyCheckOtherServers(), and dmxPropertyIdentifier().

## Function Documentation

static int dmxPropertyCheckOtherServers | ( | DMXScreenInfo * | dmxScreen,
|  | Atom | atom |
| ) |  |  | `[static]`

Returns 0 if this is the only Xdmx session on the display; 1 otherwise.

References _DMXScreenInfo::beDisplay, DMX_IDENT, dmxLogOutput(), dmxLogOutputWarning(), dmxPropertyErrorHandler(), and _DMXScreenInfo::name.

Referenced by dmxPropertyDisplay().

static DMXScreenInfo* dmxPropertyCheckOtherWindows | ( | DMXScreenInfo * | dmxScreen,
|  | Atom | atom |
| ) |  |  | `[static]`

Returns NULL if this is the only Xdmx window on the display. Otherwise, returns a pointer to the dmxScreen of the other windows on the display.

References _DMXScreenInfo::beDisplay, dmxDebug, dmxLog(), dmxNumScreens, dmxPropertyErrorHandler(), dmxPropertyIdentifier(), dmxScreens, and _DMXScreenInfo::name.

Referenced by dmxPropertyWindow().

int dmxPropertyDisplay | ( | DMXScreenInfo * | dmxScreen | ) |

Returns 0 if this is the only Xdmx session on the display; 1 otherwise.

References _DMXScreenInfo::beDisplay, DMX_ATOMNAME, dmxPropertyCheckOtherServers(), dmxPropertyIdentifier(), and _DMXScreenInfo::shared.

Referenced by dmxOpenDisplay().

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

Referenced by dmxPropertyCheckOtherServers(), and dmxPropertyCheckOtherWindows().

static const unsigned char* dmxPropertyIdentifier | ( | void |  | ) | `[static]`

References display, and DMX_IDENT.

Referenced by dmxPropertyCheckOtherWindows(), dmxPropertyDisplay(), and dmxPropertyWindow().

void* dmxPropertyIterate | ( | DMXScreenInfo * | start,
|  | void *(*)(DMXScreenInfo *dmxScreen, void *) | f,
|  | void * | closure |
| ) |  |  |

Starting with the start screen, iterate over all of the screens on the same physical X server as start, calling f with the screen and the closure. (The common case is that start is the only DMX window on the backend X server.)

References _DMXScreenInfo::beDisplay, dmxDebug, dmxLog(), and _DMXScreenInfo::next.

Referenced by dmxBackendFindWindow(), dmxBackendGetEvent(), dmxBackendPendingMotionEvent(), dmxBackendSameDisplay(), dmxCommonMouOff(), dmxCommonMouOn(), and dmxInitOverlap().

int dmxPropertySameDisplay | ( | DMXScreenInfo * | dmxScreen,
|  | const char * | name |
| ) |  |  |

Returns 1 if the dmxScreen and the display in name are on the same display, or 0 otherwise. We can't just compare the display names because there can be multiple synonyms for the same display, some of which cannot be determined without accessing the display itself (e.g., domain aliases or machines with multiple NICs).

References _DMXScreenInfo::beDisplay, DMX_ATOMNAME, dmxDebug, dmxLog(), dmxWarning, and _DMXScreenInfo::name.

Referenced by dmxBackendInitPrivate(), and dmxInputInit().

void dmxPropertyWindow | ( | DMXScreenInfo * | dmxScreen | ) |

Prints a log message if dmxScreen is on the same backend X server as some other DMX backend (output) screen. Modifies the property (DMX_ATOMNAME) on the backend X server to reflect the creation of dmxScreen.

The root window of the backend X server holds a list of window ids for all DMX windows (on this DMX server or some other DMX server).

This list can then be iterated, and the property for each window can be examined. This property contains the following tuple (no quotes):

"#DMX_IDENT:<hostname running DMX>:<display name of DMX>,<screen number>"

References _DMXScreenInfo::beDisplay, DMX_ATOMNAME, dmxDebug, dmxLog(), dmxPropertyCheckOtherWindows(), dmxPropertyIdentifier(), _DMXScreenInfo::index, _DMXScreenInfo::name, _DMXScreenInfo::next, and _DMXScreenInfo::scrnWin.

Referenced by dmxBEScreenInit().

## Variable Documentation

char* display

Referenced by dmxCommonOthGetInfo(), dmxConfigCanvasInput(), dmxInputScanForExtensions(), dmxPropertyIdentifier(), and dmxVDLRead().