- Main Page
- Data Structures
- Files

- File List
- Globals

Defines | Functions
dmxcommon.h File Reference

Go to the source code of this file.

## Defines
#define | DMX_COMMON_OTHER
#define | DMX_COMMON_XKB
#define | DMX_COMMON_PRIVATE
#define | GETONLYPRIVFROMPRIVATE myPrivate *priv = private
#define | GETPRIVFROMPRIVATE
#define | GETDMXLOCALFROMPDEVICE
#define | GETDMXINPUTFROMPRIV DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]
#define | GETDMXINPUTFROMPDEVICE
#define | GETDMXLOCALFROMPDEV DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate
#define | GETDMXINPUTFROMPDEV
#define | GETPRIVFROMPDEV
#define | DMX_KEYBOARD_EVENT_MASK (KeyPressMask | KeyReleaseMask | KeymapStateMask)
#define | DMX_POINTER_EVENT_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
## Functions
void | dmxCommonKbdGetInfo (DevicePtr pDev, DMXLocalInitInfoPtr info)
void | dmxCommonKbdGetMap (DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
void | dmxCommonKbdCtrl (DevicePtr pDev, KeybdCtrl *ctrl)
void | dmxCommonKbdBell (DevicePtr pDev, int percent, int volume, int pitch, int duration)
int | dmxCommonKbdOn (DevicePtr pDev)
void | dmxCommonKbdOff (DevicePtr pDev)
void | dmxCommonMouGetMap (DevicePtr pDev, unsigned char *map, int *nButtons)
void | dmxCommonMouCtrl (DevicePtr pDev, PtrCtrl *ctrl)
int | dmxCommonMouOn (DevicePtr pDev)
void | dmxCommonMouOff (DevicePtr pDev)
int | dmxFindPointerScreen (int x, int y)
int | dmxCommonOthOn (DevicePtr pDev)
void | dmxCommonOthOff (DevicePtr pDev)
void | dmxCommonOthGetInfo (DevicePtr pDev, DMXLocalInitInfoPtr info)
pointer | dmxCommonCopyPrivate (DeviceIntPtr pDevice)
void | dmxCommonSaveState (pointer private)
void | dmxCommonRestoreState (pointer private)

## Detailed Description

Interface to functions used by backend and console input devices.

See also:
  dmxcommon.c
  dmxbackend.c
  dmxconsole.c

## Define Documentation

#define DMX_COMMON_OTHER

Value:

    Display                 *display;       \
        Window                  window;         \
        DMXScreenInfo           *be;            \
        DMXLocalInputInfoPtr    dmxLocal;       \
        int                     initPointerX;   \
        int                     initPointerY;   \
        long                    eventMask;      \
        KeybdCtrl               kctrl;          \
        PtrCtrl                 mctrl;          \
        int                     kctrlset;       \
        int                     mctrlset;       \
        KeybdCtrl               savedKctrl;     \
        XModifierKeymap         *savedModMap;   \
        int                     stateSaved

#define DMX_COMMON_PRIVATE

Value:

    DMX_COMMON_XKB;                         \
        XDevice                 *xi

#define DMX_COMMON_XKB

Value:

    DMX_COMMON_OTHER;                       \
        XkbDescPtr              xkb;            \
        XkbIndicatorRec         savedIndicators

#define DMX_KEYBOARD_EVENT_MASK (KeyPressMask | KeyReleaseMask | KeymapStateMask)

Referenced by dmxCommonKbdOff(), and dmxCommonKbdOn().

#define DMX_POINTER_EVENT_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)

Referenced by dmxCommonMouOff(), and dmxCommonMouOn().

#define GETDMXINPUTFROMPDEV

Value:

    GETDMXLOCALFROMPDEV;                                                \
        DMXInputInfo         *dmxInput = &dmxInputs[dmxLocal->inputIdx]

Referenced by dmxCheckSpecialKeys(), and dmxEnqueue().

#define GETDMXINPUTFROMPDEVICE

Value:

    GETDMXLOCALFROMPDEVICE;                                             \
        DMXInputInfo         *dmxInput = &dmxInputs[dmxLocal->inputIdx]

Referenced by dmxDeviceOnOff(), and dmxKeyboardOn().

#define GETDMXINPUTFROMPRIV DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]

Referenced by dmxBackendCollectEvents(), dmxCloseConsole(), dmxCommonKbdGetInfo(), dmxCommonMouOff(), dmxCommonMouOn(), dmxCommonOthGetInfo(), dmxCommonOthOn(), dmxConsoleCollectEvents(), and dmxConsoleDraw().

#define GETDMXLOCALFROMPDEV DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate

Referenced by dmxFixup(), dmxMotion(), and enqueueMotion().

#define GETDMXLOCALFROMPDEVICE

Value:

    DevicePtr            pDev      = &pDevice->public;                  \
        DMXLocalInputInfoPtr dmxLocal  = pDev->devicePrivate

Referenced by dmxBackendCreatePrivate(), dmxChangePointerControl(), dmxCommonCopyPrivate(), dmxConsoleCreatePrivate(), dmxKeyboardBellProc(), dmxKeyboardKbdCtrlProc(), dmxPointerGetMotionEvents(), and dmxPointerPutMotionEvent().

#define GETONLYPRIVFROMPRIVATE myPrivate *priv = private

Referenced by dmxConsoleDrawWindows(), dmxConsoleFunctions(), dmxConsoleUpdateInfo(), and dmxConsoleUpdatePosition().

#define GETPRIVFROMPDEV

Value:

    GETDMXLOCALFROMPDEV;                                                \
        myPrivate            *priv     = dmxLocal->private

Referenced by dmxBackendCollectEvents(), dmxBackendInit(), dmxBackendInitPrivate(), dmxBackendLateReInit(), dmxCommonKbdBell(), dmxCommonKbdCtrl(), dmxCommonKbdGetInfo(), dmxCommonKbdGetMap(), dmxCommonKbdOff(), dmxCommonKbdOn(), dmxCommonMouCtrl(), dmxCommonMouGetMap(), dmxCommonMouOff(), dmxCommonMouOn(), dmxCommonOthGetInfo(), dmxCommonOthOff(), dmxCommonOthOn(), dmxConsoleCollectEvents(), dmxConsoleInit(), dmxConsoleMouGetInfo(), and dmxConsoleReInit().

#define GETPRIVFROMPRIVATE

Value:

    GETONLYPRIVFROMPRIVATE;                                             \
        DMXInputInfo         *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]

Referenced by dmxBackendProcessInput(), dmxBackendUpdatePosition(), dmxCommonRestoreState(), and dmxCommonSaveState().

## Function Documentation

pointer dmxCommonCopyPrivate | ( | DeviceIntPtr | pDevice | ) |

Returns a pointer to the private area for the device that comes just prior to pDevice in the current dmxInput device list. This is used as the private area for the current device in some situations (e.g., when a keyboard and mouse form a pair that should share the same private area). If the requested private area cannot be located, then NULL is returned.

References _DMXInputInfo::devs, dmxInputs, GETDMXLOCALFROMPDEVICE, _DMXInputInfo::numDevs, and _DMXLocalInputInfo::private.

void dmxCommonKbdBell | ( | DevicePtr | pDev,
|  | int | percent,
|  | int | volume,
|  | int | pitch,
|  | int | duration
| ) |  |

Sound they keyboard bell.

References GETPRIVFROMPDEV.

void dmxCommonKbdCtrl | ( | DevicePtr | pDev,
|  | KeybdCtrl * | ctrl
| ) |  |

Update the keyboard control.

References dmxCommonKbdSetCtrl(), dmxCommonSaveState(), and GETPRIVFROMPDEV.

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

Fill in the XKEYBOARD parts of the info structure for the specified pDev.

References dmxCommonRestoreState(), dmxCommonSaveState(), dmxLogInput(), _DMXLocalInitInfo::freenames, GETDMXINPUTFROMPRIV, GETPRIVFROMPDEV, NAME, and _DMXLocalInitInfo::names.

Referenced by dmxBackendKbdGetInfo(), and dmxConsoleKbdGetInfo().

void dmxCommonKbdGetMap | ( | DevicePtr | pDev,
|  | KeySymsPtr | pKeySyms,
|  | CARD8 * | pModMap
| ) |  |

Get the keyboard mapping.

References GETPRIVFROMPDEV.

Referenced by dmxBackendKbdGetInfo(), and dmxConsoleKbdGetInfo().

void dmxCommonKbdOff | ( | DevicePtr | pDev | ) |

Turn pDev off.

References DMX_KEYBOARD_EVENT_MASK, dmxCommonRestoreState(), and GETPRIVFROMPDEV.

int dmxCommonKbdOn | ( | DevicePtr | pDev | ) |

Turn pDev on (i.e., take input from pDev).

References DMX_KEYBOARD_EVENT_MASK, dmxCommonSaveState(), and GETPRIVFROMPDEV.

void dmxCommonMouCtrl | ( | DevicePtr | pDev,
|  | PtrCtrl * | ctrl
| ) |  |

Update the mouse control.

References dmxCommonMouSetCtrl(), and GETPRIVFROMPDEV.

void dmxCommonMouGetMap | ( | DevicePtr | pDev,
|  | unsigned char * | map,
|  | int * | nButtons
| ) |  |

Obtain the mouse button mapping.

References DMX_MAX_BUTTONS, and GETPRIVFROMPDEV.

Referenced by dmxBackendMouGetInfo(), and dmxConsoleMouGetInfo().

void dmxCommonMouOff | ( | DevicePtr | pDev | ) |

Turn pDev off.

References DMX_POINTER_EVENT_MASK, dmxCommonRemoveEnabledDevice(), dmxCommonXSelect(), dmxPropertyIterate(), GETDMXINPUTFROMPRIV, and GETPRIVFROMPDEV.

int dmxCommonMouOn | ( | DevicePtr | pDev | ) |

Turn pDev on (i.e., take input from pDev).

References DMX_POINTER_EVENT_MASK, dmxCommonAddEnabledDevice(), dmxCommonXSelect(), dmxPropertyIterate(), dmxScreens, dmxShadowFB, dmxSync(), GETDMXINPUTFROMPRIV, and GETPRIVFROMPDEV.

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

Fill the info structure with information needed to initialize pDev.

References _DMXLocalInitInfo::buttonClass, display, dmxInputExtensionErrorHandler(), _DMXLocalInitInfo::focusClass, GETDMXINPUTFROMPRIV, GETPRIVFROMPDEV, _DMXLocalInitInfo::kbdFeedbackClass, _DMXLocalInitInfo::keyboard, _DMXLocalInitInfo::keyClass, _DMXLocalInitInfo::keySyms, _DMXLocalInitInfo::maxres, _DMXLocalInitInfo::maxval, _DMXLocalInitInfo::minres, _DMXLocalInitInfo::minval, _DMXLocalInitInfo::numAbsAxes, _DMXLocalInitInfo::numButtons, _DMXLocalInitInfo::numRelAxes, _DMXLocalInitInfo::proximityClass, _DMXLocalInitInfo::ptrFeedbackClass, _DMXLocalInitInfo::res, and _DMXLocalInitInfo::valuatorClass.

void dmxCommonOthOff | ( | DevicePtr | pDev | ) |

Turn pDev off.

References GETPRIVFROMPDEV.

int dmxCommonOthOn | ( | DevicePtr | pDev | ) |

Turn pDev on (i.e., take input from pDev).

References ADD, ChangeDeviceNotify, DeviceFocusIn, DeviceFocusOut, DeviceMappingNotify, DeviceMotionNotify, DeviceStateNotify, DMX_MAX_XINPUT_EVENT_TYPES, dmxLog(), dmxWarning, GETDMXINPUTFROMPRIV, GETPRIVFROMPDEV, ProximityIn, and ProximityOut.

void dmxCommonRestoreState | ( | pointer | private | ) |

This routine restores all the information saved by dmxCommonSaveState.

References dmxCommonKbdSetCtrl(), DMXDBG0, dmxLog(), dmxLogInput(), dmxWarning, and GETPRIVFROMPRIVATE.

Referenced by dmxBackendCollectEvents(), dmxCloseConsole(), dmxCommonKbdGetInfo(), dmxCommonKbdOff(), and dmxConsoleCollectEvents().

void dmxCommonSaveState | ( | pointer | private | ) |

This routine saves and resets some important state for the backend and console device drivers:

- the modifier map is saved and set to 0 (so DMX controls the LEDs)
- the key click, bell, led, and repeat masks are saved and set to the values that DMX claims to be using

This routine and dmxCommonRestoreState are used when the pointer enters and leaves the console window, or when the backend window is active or not active (for a full-screen window, this only happens at server startup and server shutdown).

References dmxCommonKbdSetCtrl(), DMXDBG0, dmxLogInput(), dmxScreens, dmxSync(), dmxUseXKB, and GETPRIVFROMPRIVATE.

Referenced by dmxBackendCollectEvents(), dmxCommonKbdCtrl(), dmxCommonKbdGetInfo(), dmxCommonKbdOn(), and dmxConsoleCollectEvents().

int dmxFindPointerScreen | ( | int | x,
|  | int | y
| ) |  |

Given the global coordinates x and y, determine the screen with the lowest number on which those coordinates lie. If they are not on any screen, return -1. The number returned is an index into dmxScreenInfo and is between -1 and dmxNumScreens - 1, inclusive.

References dmxNumScreens.