#include "dmxinputinit.h"
#include "dmxcommon.h"
#include "dmxconsole.h"
#include "dmxprop.h"
#include "dmxsync.h"
#include "dmxmap.h"
#include "inputstr.h"
#include "input.h"
#include <X11/keysym.h>
#include "mipointer.h"
#include "scrnintstr.h"
#include <unistd.h>
Data Structures | |
struct | _myPrivate |
Defines | |
#define | DMX_STATE_DEBUG 0 |
#define | DMXDBG0(f) |
#define | NAME(x) priv->xkb->names->x ? XGetAtomName(priv->display,priv->xkb->names->x) : NULL |
#define | ADD(type) |
Typedefs | |
typedef struct _myPrivate | myPrivate |
Functions | |
static void | dmxCommonKbdSetAR (Display *display, unsigned char *old, unsigned char *new) |
static void | dmxCommonKbdSetLeds (Display *display, unsigned long new) |
static void | dmxCommonKbdSetCtrl (Display *display, KeybdCtrl *old, KeybdCtrl *new) |
static void | dmxCommonMouSetCtrl (Display *display, PtrCtrl *old, PtrCtrl *new) |
void | dmxCommonKbdCtrl (DevicePtr pDev, KeybdCtrl *ctrl) |
void | dmxCommonMouCtrl (DevicePtr pDev, PtrCtrl *ctrl) |
void | dmxCommonKbdBell (DevicePtr pDev, int percent, int volume, int pitch, int duration) |
void | dmxCommonKbdGetMap (DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) |
void | dmxCommonKbdGetInfo (DevicePtr pDev, DMXLocalInitInfoPtr info) |
int | dmxCommonKbdOn (DevicePtr pDev) |
void | dmxCommonKbdOff (DevicePtr pDev) |
int | dmxCommonOthOn (DevicePtr pDev) |
void | dmxCommonOthOff (DevicePtr pDev) |
void | dmxCommonOthGetInfo (DevicePtr pDev, DMXLocalInitInfoPtr info) |
void | dmxCommonMouGetMap (DevicePtr pDev, unsigned char *map, int *nButtons) |
static void * | dmxCommonXSelect (DMXScreenInfo *dmxScreen, void *closure) |
static void * | dmxCommonAddEnabledDevice (DMXScreenInfo *dmxScreen, void *closure) |
static void * | dmxCommonRemoveEnabledDevice (DMXScreenInfo *dmxScreen, void *closure) |
int | dmxCommonMouOn (DevicePtr pDev) |
void | dmxCommonMouOff (DevicePtr pDev) |
int | dmxFindPointerScreen (int x, int y) |
pointer | dmxCommonCopyPrivate (DeviceIntPtr pDevice) |
void | dmxCommonSaveState (pointer private) |
void | dmxCommonRestoreState (pointer private) |
This file implements common routines used by the backend and console input devices.
#define ADD | ( | type | ) |
if (count < DMX_MAX_XINPUT_EVENT_TYPES) { \ type(priv->xi, event_type[count], event_list[count]); \ if (event_type[count]) { \ dmxMapInsert(dmxLocal, event_type[count], XI_##type); \ ++count; \ } \ } else { \ dmxLog(dmxWarning, "More than %d event types for %s\n", \ DMX_MAX_XINPUT_EVENT_TYPES, dmxInput->name); \ }
Referenced by dmxCommonOthOn().
#define DMX_STATE_DEBUG 0 |
#define DMXDBG0 | ( | f | ) |
#define NAME | ( | x | ) | priv->xkb->names->x ? XGetAtomName(priv->display,priv->xkb->names->x) : NULL |
Referenced by dmxCommonKbdGetInfo().
typedef struct _myPrivate myPrivate |
Each device has a private area that is visible only from inside the driver code.
static void* dmxCommonAddEnabledDevice | ( | DMXScreenInfo * | dmxScreen, | |
void * | closure | |||
) | [static] |
References _DMXScreenInfo::beDisplay.
Referenced by dmxCommonMouOn().
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.
static void dmxCommonKbdSetAR | ( | Display * | display, | |
unsigned char * | old, | |||
unsigned char * | new | |||
) | [static] |
Referenced by dmxCommonKbdSetCtrl().
static void dmxCommonKbdSetCtrl | ( | Display * | display, | |
KeybdCtrl * | old, | |||
KeybdCtrl * | new | |||
) | [static] |
References dmxCommonKbdSetAR(), and dmxCommonKbdSetLeds().
Referenced by dmxCommonKbdCtrl(), dmxCommonRestoreState(), and dmxCommonSaveState().
static void dmxCommonKbdSetLeds | ( | Display * | display, | |
unsigned long | new | |||
) | [static] |
Referenced by dmxCommonKbdSetCtrl().
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.
static void dmxCommonMouSetCtrl | ( | Display * | display, | |
PtrCtrl * | old, | |||
PtrCtrl * | new | |||
) | [static] |
Referenced by dmxCommonMouCtrl().
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.
static void* dmxCommonRemoveEnabledDevice | ( | DMXScreenInfo * | dmxScreen, | |
void * | closure | |||
) | [static] |
References _DMXScreenInfo::beDisplay.
Referenced by dmxCommonMouOff().
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:
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().
static void* dmxCommonXSelect | ( | DMXScreenInfo * | dmxScreen, | |
void * | closure | |||
) | [static] |
References _DMXScreenInfo::beDisplay, and _DMXScreenInfo::scrnWin.
Referenced by dmxCommonMouOff(), and dmxCommonMouOn().
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.