Defines | Functions | Variables

# dmxevents.c File Reference

`#include "dmxinputinit.h"`
`#include "dmxevents.h"`
`#include "dmxcb.h"`
`#include "dmxcommon.h"`
`#include "dmxcursor.h"`
`#include "dmxmotion.h"`
`#include "dmxsigio.h"`
`#include "dmxmap.h"`
`#include <X11/keysym.h>`
`#include "opaque.h"`
`#include "inputstr.h"`
`#include "mipointer.h"`
`#include "mi.h"`
`#include "exglobals.h"`
`#include "xkbsrv.h"`
`#include "XIstubs.h"`

## Defines
#define | DMX_EVENTS_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 | DMX_MAX_AXES 32
#define | EXTRACT_VALUATORS(ke, valuators)
## Functions
static int | dmxApplyFunctions (DMXInputInfo *dmxInput, DMXFunctionType f)
static int | dmxCheckFunctionKeys (DMXLocalInputInfoPtr dmxLocal, int type, KeySym keySym)
DMXScreenInfo * | dmxFindFirstScreen (int x, int y)
static void | enqueueMotion (DevicePtr pDev, int x, int y)
void | dmxCoreMotion (DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
static void | dmxExtMotion (DMXLocalInputInfoPtr dmxLocal, int *v, int firstAxis, int axesCount, DMXMotionType type, DMXBlockType block)
static int | dmxTranslateAndEnqueueExtEvent (DMXLocalInputInfoPtr dmxLocal, XEvent *e, DMXBlockType block)
static int | dmxGetButtonMapping (DMXLocalInputInfoPtr dmxLocal, int button)
void | dmxGetGlobalPosition (int *x, int *y)
void | dmxInvalidateGlobalPosition (void)
void | dmxMotion (DevicePtr pDev, int *v, int firstAxes, int axesCount, DMXMotionType type, DMXBlockType block)
static KeySym | dmxKeyCodeToKeySym (DMXLocalInputInfoPtr dmxLocal, KeyCode keyCode)
static KeyCode | dmxKeySymToKeyCode (DMXLocalInputInfoPtr dmxLocal, KeySym keySym, int tryFirst)
static int | dmxFixup (DevicePtr pDev, int detail, KeySym keySym)
void | dmxEnqueue (DevicePtr pDev, int type, int detail, KeySym keySym, XEvent *e, DMXBlockType block)
int | dmxCheckSpecialKeys (DevicePtr pDev, KeySym keySym)
## Variables
static int | dmxGlobalX
static int | dmxGlobalY
static int | dmxGlobalInvalid

## Detailed Description

Provide support and helper functions for enqueing events received by the low-level input drivers.

## Define Documentation

#define DMX_EVENTS_DEBUG 0

#define DMX_MAX_AXES 32

Referenced by dmxExtMotion(), and othUSBGetInfo().

#define DMXDBG0 | ( |  | f | ) |

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

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

Referenced by dmxCheckSpecialKeys(), dmxEnqueue(), and dmxKeyCodeToKeySym().

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

Referenced by dmxCheckFunctionKeys(), and dmxKeySymToKeyCode().

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

Referenced by dmxCoreMotion().

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

Referenced by dmxCoreMotion().

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

Referenced by dmxCoreMotion().

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

#define EXTRACT_VALUATORS | ( |  | ke,
|  |  | valuators |
| ) |  |  |

Value:

    valuators[0]       = ke->axis_data[0]; \
            valuators[1]       = ke->axis_data[1]; \
            valuators[2]       = ke->axis_data[2]; \
            valuators[3]       = ke->axis_data[3]; \
            valuators[4]       = ke->axis_data[4]; \
            valuators[5]       = ke->axis_data[5]; \

Referenced by dmxTranslateAndEnqueueExtEvent().

## Function Documentation

static int dmxApplyFunctions | ( | DMXInputInfo * | dmxInput,
|  | DMXFunctionType | f |
| ) |  |  | `[static]`

References _DMXLocalInputInfo::binding, _DMXInputInfo::devs, _DMXLocalInputInfo::functions, _DMXInputInfo::numDevs, and _DMXLocalInputInfo::private.

Referenced by dmxCheckFunctionKeys().

static int dmxCheckFunctionKeys | ( | DMXLocalInputInfoPtr | dmxLocal,
|  | int | type,
|  | KeySym | keySym |
| ) |  |  | `[static]`

References DMX_FUNCTION_FINE, DMX_FUNCTION_GRAB, DMX_FUNCTION_TERMINATE, dmxApplyFunctions(), DMXDBG3, dmxInfo, dmxInputs, dmxLocalCoreKeyboard, dmxLog(), _DMXLocalInputInfo::inputIdx, _DMXLocalInputInfo::pDevice, and _DMXLocalInputInfo::sendsCore.

Referenced by dmxEnqueue().

int dmxCheckSpecialKeys | ( | DevicePtr | pDev,
|  | KeySym | keySym |
| ) |  |  |

A pointer to this routine is passed to low-level input drivers so that all special keychecking is unified to this file. This function returns 0 if no special keys have been pressed. If the user has requested termination of the DMX server, -1 is returned. If the user has requested a switch to a VT, then the (1-based) number of that VT is returned.

References DMXDBG2, dmxInfo, dmxLocalCoreKeyboard, dmxLog(), and _DMXLocalInputInfo::pDevice.

Referenced by dmxCollectAll(), and dmxSigioHandler().

void dmxCoreMotion | ( | DevicePtr | pDev,
|  | int | x,
|  | int | y,
|  | int | delta,
|  | DMXBlockType | block |
| ) |  |  |

References _DMXLocalInputInfo::binding, _DMXInputInfo::detached, _DMXInputInfo::devs, DMXDBG4, DMXDBG5, DMXDBG6, dmxFindFirstScreen(), dmxGlobalHeight, dmxGlobalInvalid, dmxGlobalWidth, dmxGlobalX, dmxGlobalY, dmxInputs, dmxNumInputs, dmxScreens, dmxSigioBlock(), dmxSigioUnblock(), enqueueMotion(), _DMXScreenInfo::index, _DMXInputInfo::numDevs, _DMXLocalInputInfo::private, ProcessInputEvents(), _DMXScreenInfo::rootXOrigin, _DMXScreenInfo::rootYOrigin, _DMXLocalInputInfo::sendsCore, and _DMXLocalInputInfo::update_position.

Referenced by dmxMotion(), and dmxSetCursor().

void dmxEnqueue | ( | DevicePtr | pDev,
|  | int | type,
|  | int | detail,
|  | KeySym | keySym,
|  | XEvent * | e,
|  | DMXBlockType | block |
| ) |  |  |

Enqueue an event from the pDev device with the specified type and detail. If the event is a KeyPress or KeyRelease event, then the keySym is also specified.

FIXME: make the code do what the comment says, or remove this comment. If block is set to DMX_BLOCK, then the SIGIO handler will be blocked around calls to dmxeqEnqueue().

References dmxCheckFunctionKeys(), DMXDBG2, dmxEventName(), dmxFixup(), dmxGetButtonMapping(), dmxKeyCodeToKeySym(), dmxLocalCoreKeyboard, dmxLogInput(), dmxTranslateAndEnqueueExtEvent(), ProximityIn, and ProximityOut.

Referenced by dmxCollectAll(), and dmxSigioHandler().

static void dmxExtMotion | ( | DMXLocalInputInfoPtr | dmxLocal,
|  | int * | v,
|  | int | firstAxis,
|  | int | axesCount,
|  | DMXMotionType | type,
|  | DMXBlockType | block |
| ) |  |  | `[static]`

References DeviceMotionNotify, DeviceValuator, DMX_MAX_AXES, DMX_RELATIVE, dmxSigioBlock(), dmxSigioUnblock(), _DMXLocalInputInfo::lastX, _DMXLocalInputInfo::lastY, _DMXLocalInputInfo::pDevice, _DMXLocalInputInfo::private, and _DMXLocalInputInfo::update_position.

Referenced by dmxMotion(), and dmxTranslateAndEnqueueExtEvent().

DMXScreenInfo* dmxFindFirstScreen | ( | int | x,
|  | int | y |
| ) |  |  |

References dmxNumScreens, dmxOnScreen(), and dmxScreens.

Referenced by dmxCheckCursor(), and dmxCoreMotion().

static int dmxFixup | ( | DevicePtr | pDev,
|  | int | detail,
|  | KeySym | keySym |
| ) |  |  | `[static]`

References dmxKeyCodeToKeySym(), dmxKeySymToKeyCode(), dmxLocalCoreKeyboard, dmxLog(), and dmxWarning.

Referenced by dmxEnqueue().

static int dmxGetButtonMapping | ( | DMXLocalInputInfoPtr | dmxLocal,
|  | int | button |
| ) |  |  | `[static]`

References dmxLog(), dmxWarning, and _DMXLocalInputInfo::pDevice.

Referenced by dmxEnqueue().

void dmxGetGlobalPosition | ( | int * | x,
|  | int * | y |
| ) |  |  |

Return DMX's notion of the pointer position in the global coordinate space.

References dmxGlobalX, and dmxGlobalY.

Referenced by dmxBackendLateReInit(), dmxCheckCursor(), dmxConsoleUpdateFineCursor(), dmxHideCursor(), and dmxSetCursor().

void dmxInvalidateGlobalPosition | ( | void |  | ) |

Invalidate the global position for dmxCoreMotion.

References dmxGlobalInvalid.

Referenced by dmxBackendLateReInit().

static KeySym dmxKeyCodeToKeySym | ( | DMXLocalInputInfoPtr | dmxLocal,
|  | KeyCode | keyCode |
| ) |  |  | `[static]`

References DMXDBG2, and _DMXLocalInputInfo::pDevice.

Referenced by dmxEnqueue(), dmxFixup(), and dmxKeySymToKeyCode().

static KeyCode dmxKeySymToKeyCode | ( | DMXLocalInputInfoPtr | dmxLocal,
|  | KeySym | keySym,
|  | int | tryFirst |
| ) |  |  | `[static]`

References DMXDBG3, dmxKeyCodeToKeySym(), dmxLocalCoreKeyboard, and _DMXLocalInputInfo::pDevice.

Referenced by dmxFixup().

void dmxMotion | ( | DevicePtr | pDev,
|  | int * | v,
|  | int | firstAxes,
|  | int | axesCount,
|  | DMXMotionType | type,
|  | DMXBlockType | block |
| ) |  |  |

Enqueue a motion event for pDev. The v vector has length axesCount, and contains values for each of the axes, starting at firstAxes.

The type of the motion may be DMX_RELATIVE, DMX_ABSOLUTE, or DMX_ABSOLUTE_CONFINED (in the latter case, the pointer will not be allowed to move outside the global boundaires).

If block is set to DMX_BLOCK, then the SIGIO handler will be blocked around calls to enqueueMotion().

References DMX_ABSOLUTE, DMX_ABSOLUTE_CONFINED, DMX_RELATIVE, dmxCoreMotion(), dmxExtMotion(), dmxGlobalX, and dmxGlobalY.

Referenced by dmxCollectAll(), and dmxSigioHandler().

static int dmxTranslateAndEnqueueExtEvent | ( | DMXLocalInputInfoPtr | dmxLocal,
|  | XEvent * | e,
|  | DMXBlockType | block |
| ) |  |  | `[static]`

References ChangeDeviceNotify, DeviceFocusIn, DeviceFocusOut, _DMXLocalInputInfo::deviceId, DeviceMappingNotify, DeviceStateNotify, DeviceValuator, _DMXInputInfo::devs, DMX_ABSOLUTE, dmxExtMotion(), dmxInputs, dmxLog(), dmxMapLookup(), dmxSigioBlock(), dmxSigioUnblock(), dmxWarning, EXTRACT_VALUATORS, _DMXLocalInputInfo::inputIdx, _DMXInputInfo::numDevs, _DMXLocalInputInfo::pDevice, ProximityIn, ProximityOut, and _DMXLocalInputInfo::type.

Referenced by dmxEnqueue().

static void enqueueMotion | ( | DevicePtr | pDev,
|  | int | x,
|  | int | y |
| ) |  |  | `[static]`

Enqueue a motion event.

Referenced by dmxCoreMotion().

## Variable Documentation

int dmxGlobalInvalid`[static]`

Referenced by dmxCoreMotion(), and dmxInvalidateGlobalPosition().

int dmxGlobalX`[static]`

Referenced by dmxCoreMotion(), dmxGetGlobalPosition(), and dmxMotion().

int dmxGlobalY`[static]`

Referenced by dmxCoreMotion(), dmxGetGlobalPosition(), and dmxMotion().