# dmxbackend.c File Reference

`#include "dmxinputinit.h"`
`#include "dmxbackend.h"`
`#include "dmxcommon.h"`
`#include "dmxconsole.h"`
`#include "dmxcursor.h"`
`#include "dmxprop.h"`
`#include "dmxsync.h"`
`#include "dmxcb.h"`
`#include "dmxevents.h"`
`#include "ChkNotMaskEv.h"`
`#include "inputstr.h"`
`#include "input.h"`
`#include <X11/keysym.h>`
`#include "mipointer.h"`
`#include "scrnintstr.h"`
`#include "windowstr.h"`

## Data Structures

struct | _myPrivate

## Defines

#define | DMX_BACKEND_DEBUG 0
#define | DMXDBG0(f)
#define | DMXDBG1(f, a)
#define | DMXDBG2(f, a, b)
#define | DMXDBG3(f, a, b, c)
#define | DMXDBG4(f, a, b, c, d)
#define | DMXDBG5(f, a, b, c, d, e)
#define | DMXDBG6(f, a, b, c, d, e, g)
#define | DMXDBG7(f, a, b, c, d, e, g, h)
#define | DMXDBG8(f, a, b, c, d, e, g, h, i)
#define | DMXDBG9(f, a, b, c, d, e, g, h, i, j)

## Typedefs

typedef struct _myPrivate | myPrivate

## Functions

pointer | dmxBackendCreatePrivate (DeviceIntPtr pDevice)
void | dmxBackendDestroyPrivate (pointer private)
static void * | dmxBackendTestScreen (DMXScreenInfo *dmxScreen, void *closure)
static int | dmxBackendSameDisplay (myPrivate *priv, long screen)
static void * | dmxBackendTestEvents (DMXScreenInfo *dmxScreen, void *closure)
static void * | dmxBackendTestMotionEvent (DMXScreenInfo *dmxScreen, void *closure)
static DMXScreenInfo * | dmxBackendGetEvent (myPrivate *priv, XEvent *X)
static DMXScreenInfo * | dmxBackendPendingMotionEvent (myPrivate *priv, int save)
static void * | dmxBackendTestWindow (DMXScreenInfo *dmxScreen, void *closure)
static DMXScreenInfo * | dmxBackendFindWindow (myPrivate *priv, Window win)
static int | dmxBackendFindOverlapping (myPrivate *priv, int screen, int x, int y)
static int | dmxBackendOffscreen (int screen, int x, int y)
void | dmxBackendUpdatePosition (pointer private, int x, int y)
void | dmxBackendCollectEvents (DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block)
void | dmxBackendProcessInput (pointer private)
static void | dmxBackendComputeCenter (myPrivate *priv)
static DMXScreenInfo * | dmxBackendInitPrivate (DevicePtr pDev)
void | dmxBackendLateReInit (DevicePtr pDev)
void | dmxBackendInit (DevicePtr pDev)
void | dmxBackendMouGetInfo (DevicePtr pDev, DMXLocalInitInfoPtr info)
void | dmxBackendKbdGetInfo (DevicePtr pDev, DMXLocalInitInfoPtr info)
int | dmxBackendFunctions (pointer private, DMXFunctionType function)

## Detailed Description

These routines support taking input from devices on the backend (output) displays.

See also:
  dmxcommon.c.

## Define Documentation

#define DMX_BACKEND_DEBUG 0

#define DMXDBG0 | ( |  | f | ) |

Referenced by dmxBackendUpdatePosition().

#define DMXDBG1 | ( |  | f,
|  |  | a
| ) |  |

Referenced by dmxBackendLateReInit().

#define DMXDBG2 | ( |  | f,
|  |  | a,
|  |  | b
| ) |  |

Referenced by dmxBackendCollectEvents(), and dmxBackendUpdatePosition().

#define DMXDBG3 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c
| ) |  |

#define DMXDBG4 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  |

Referenced by dmxBackendCollectEvents(), and dmxBackendProcessInput().

#define DMXDBG5 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e
| ) |  |

Referenced by dmxBackendCollectEvents(), and dmxBackendUpdatePosition().

#define DMXDBG6 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | g
| ) |  |

Referenced by dmxBackendProcessInput().

#define DMXDBG7 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | g,
|  |  | h
| ) |  |

Referenced by dmxBackendCollectEvents().

#define DMXDBG8 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | g,
|  |  | h,
|  |  | i
| ) |  |

Referenced by dmxBackendCollectEvents().

#define DMXDBG9 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | g,
|  |  | h,
|  |  | i,
|  |  | j
| ) |  |

Referenced by dmxBackendCollectEvents(), and dmxBackendUpdatePosition().

## Typedef Documentation

typedef struct _myPrivate myPrivate

## Function Documentation

void dmxBackendCollectEvents | ( | DevicePtr | pDev,
|  | dmxMotionProcPtr | motion,
|  | dmxEnqueueProcPtr | enqueue,
|  | dmxCheckSpecialProcPtr | checkspecial,
|  | DMXBlockType | block
| ) |  |

Get events from the X queue on the backend servers and put the events into the DMX event queue.

References _DMXScreenInfo::beDisplay, DMX_ABSOLUTE, DMX_RELATIVE, dmxBackendFindWindow(), dmxBackendGetEvent(), dmxBackendPendingMotionEvent(), dmxCommonRestoreState(), dmxCommonSaveState(), DMXDBG2, DMXDBG4, DMXDBG5, DMXDBG7, DMXDBG8, DMXDBG9, dmxError, dmxFatal, dmxLog(), dmxSync(), GETDMXINPUTFROMPRIV, GETPRIVFROMPDEV, _DMXScreenInfo::index, _DMXScreenInfo::name, _DMXScreenInfo::rootHeight, _DMXScreenInfo::rootWidth, _DMXScreenInfo::rootX, _DMXScreenInfo::rootXOrigin, _DMXScreenInfo::rootY, _DMXScreenInfo::rootYOrigin, and _DMXScreenInfo::scrnWin.

static void dmxBackendComputeCenter | ( | myPrivate * | priv | ) | `[static]`

References _myPrivate::centerX, and _myPrivate::centerY.

Referenced by dmxBackendInit(), and dmxBackendLateReInit().

pointer dmxBackendCreatePrivate | ( | DeviceIntPtr | pDevice | ) |

Create and return a private data structure.

References GETDMXLOCALFROMPDEVICE.

void dmxBackendDestroyPrivate | ( | pointer | private | ) |

Destroy the private data structure. No checking is performed to verify that the structure was actually created by dmxBackendCreatePrivate.

static int dmxBackendFindOverlapping | ( | myPrivate * | priv,
|  | int | screen,
|  | int | x,
|  | int | y
| ) |  | `[static]`

References dmxOnScreen(), dmxScreens, _DMXScreenInfo::index, _myPrivate::myScreen, and _DMXScreenInfo::over.

Referenced by dmxBackendUpdatePosition().

static DMXScreenInfo* dmxBackendFindWindow | ( | myPrivate * | priv,
|  | Window | win
| ) |  | `[static]`

References dmxBackendTestWindow(), and dmxPropertyIterate().

Referenced by dmxBackendCollectEvents().

int dmxBackendFunctions | ( | pointer | private,
|  | DMXFunctionType | function
| ) |  |

Process DMXFunctionType functions. The only function handled here is to acknowledge a pending server shutdown.

References DMX_FUNCTION_TERMINATE.

static DMXScreenInfo* dmxBackendGetEvent | ( | myPrivate * | priv,
|  | XEvent * | X
| ) |  | `[static]`

References dmxBackendTestEvents(), and dmxPropertyIterate().

Referenced by dmxBackendCollectEvents().

void dmxBackendInit | ( | DevicePtr | pDev | ) |

Initialized the backend device described by pDev.

References DMX_LOCAL_KEYBOARD, DMX_LOCAL_MOUSE, dmxBackendComputeCenter(), dmxBackendInitPrivate(), dmxBackendSameDisplay(), GETPRIVFROMPDEV, and _DMXScreenInfo::index.

static DMXScreenInfo* dmxBackendInitPrivate | ( | DevicePtr | pDev | ) | `[static]`

References _DMXScreenInfo::beDisplay, dmxFatal, dmxInputs, dmxLog(), dmxNumScreens, dmxPropertySameDisplay(), dmxScreens, GETPRIVFROMPDEV, _DMXInputInfo::name, and _DMXScreenInfo::scrnWin.

Referenced by dmxBackendInit(), dmxBackendLateReInit(), and dmxBackendMouGetInfo().

void dmxBackendKbdGetInfo | ( | DevicePtr | pDev,
|  | DMXLocalInitInfoPtr | info
| ) |  |

Get information about the backend keyboard (for initialization).

References dmxCommonKbdGetInfo(), dmxCommonKbdGetMap(), _DMXLocalInitInfo::focusClass, _DMXLocalInitInfo::freemap, _DMXLocalInitInfo::kbdFeedbackClass, _DMXLocalInitInfo::keyboard, _DMXLocalInitInfo::keyClass, _DMXLocalInitInfo::keySyms, and _DMXLocalInitInfo::modMap.

void dmxBackendLateReInit | ( | DevicePtr | pDev | ) |

Re-initialized the backend device described by pDev (after a reconfig).

References dmxBackendComputeCenter(), dmxBackendInitPrivate(), dmxBackendSameDisplay(), dmxBackendUpdatePosition(), DMXDBG1, dmxGetGlobalPosition(), dmxInvalidateGlobalPosition(), and GETPRIVFROMPDEV.

void dmxBackendMouGetInfo | ( | DevicePtr | pDev,
|  | DMXLocalInitInfoPtr | info
| ) |  |

Get information about the backend pointer (for initialization).

References _DMXScreenInfo::beHeight, _DMXScreenInfo::beWidth, _DMXLocalInitInfo::buttonClass, dmxBackendInitPrivate(), dmxCommonMouGetMap(), _DMXLocalInitInfo::map, _DMXLocalInitInfo::maxres, _DMXLocalInitInfo::maxval, _DMXLocalInitInfo::minres, _DMXLocalInitInfo::minval, _DMXLocalInitInfo::numButtons, _DMXLocalInitInfo::numRelAxes, _DMXLocalInitInfo::ptrFeedbackClass, _DMXLocalInitInfo::res, and _DMXLocalInitInfo::valuatorClass.

static int dmxBackendOffscreen | ( | int | screen,
|  | int | x,
|  | int | y
| ) |  | `[static]`

References dmxOnScreen(), and dmxScreens.

Referenced by dmxBackendUpdatePosition().

static DMXScreenInfo* dmxBackendPendingMotionEvent | ( | myPrivate * | priv,
|  | int | save
| ) |  | `[static]`

References _DMXScreenInfo::beDisplay, dmxBackendTestMotionEvent(), and dmxPropertyIterate().

Referenced by dmxBackendCollectEvents(), and dmxBackendUpdatePosition().

void dmxBackendProcessInput | ( | pointer | private | ) |

Called after input events are processed from the DMX queue. No event processing actually takes place here, but this is a convenient place to update the pointer.

References DMXDBG4, DMXDBG6, dmxScreens, dmxSync(), and GETPRIVFROMPRIVATE.

static int dmxBackendSameDisplay | ( | myPrivate * | priv,
|  | long | screen
| ) |  | `[static]`

References dmxBackendTestScreen(), dmxNumScreens, dmxPropertyIterate(), and _myPrivate::myScreen.

Referenced by dmxBackendInit(), dmxBackendLateReInit(), and dmxBackendUpdatePosition().

static void* dmxBackendTestEvents | ( | DMXScreenInfo * | dmxScreen,
|  | void * | closure
| ) |  | `[static]`

References _DMXScreenInfo::beDisplay, and XCheckNotMaskEvent().

Referenced by dmxBackendGetEvent().

static void* dmxBackendTestMotionEvent | ( | DMXScreenInfo * | dmxScreen,
|  | void * | closure
| ) |  | `[static]`

References _DMXScreenInfo::beDisplay.

Referenced by dmxBackendPendingMotionEvent().

static void* dmxBackendTestScreen | ( | DMXScreenInfo * | dmxScreen,
|  | void * | closure
| ) |  | `[static]`

References _DMXScreenInfo::index.

Referenced by dmxBackendSameDisplay().

static void* dmxBackendTestWindow | ( | DMXScreenInfo * | dmxScreen,
|  | void * | closure
| ) |  | `[static]`

References _DMXScreenInfo::scrnWin.

Referenced by dmxBackendFindWindow().

void dmxBackendUpdatePosition | ( | pointer | private,
|  | int | x,
|  | int | y
| ) |  |

This routine is called from dmxCoreMotion for each motion event. x and y are global coordinants.

References dmxBackendFindOverlapping(), dmxBackendOffscreen(), dmxBackendPendingMotionEvent(), dmxBackendSameDisplay(), dmxCheckCursor(), dmxConsoleCapture(), dmxConsoleUncapture(), DMXDBG0, DMXDBG2, DMXDBG5, DMXDBG9, dmxHideCursor(), dmxScreens, dmxSync(), and GETPRIVFROMPRIVATE.

Referenced by dmxBackendLateReInit().