#ifndef INPUT_H
#define INPUT_H
#include "misc.h"
#include "screenint.h"
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "window.h"
#define DEVICE_INIT 0
#define DEVICE_ON 1
#define DEVICE_OFF 2
#define DEVICE_CLOSE 3
#define POINTER_RELATIVE (1 << 1)
#define POINTER_ABSOLUTE (1 << 2)
#define POINTER_ACCELERATE (1 << 3)
#define POINTER_SCREEN (1 << 4)
#define PtrAccelNoOp 0
#define PtrAccelPredictable 1
#define PtrAccelLightweight 2
#define PtrAccelDefault PtrAccelPredictable
#define MAX_VALUATORS 36
#define MAX_VALUATOR_EVENTS 6
#define NO_AXIS_LIMITS -1
#define MAP_LENGTH 256
#define DOWN_LENGTH 32
#define NullGrab ((GrabPtr)NULL)
#define PointerRootWin ((WindowPtr)PointerRoot)
#define NoneWin ((WindowPtr)None)
#define NullDevice ((DevicePtr)NULL)
#ifndef FollowKeyboard
#define FollowKeyboard 3
#endif
#ifndef FollowKeyboardWin
#define FollowKeyboardWin ((WindowPtr) FollowKeyboard)
#endif
#ifndef RevertToFollowKeyboard
#define RevertToFollowKeyboard 3
#endif
#define SEMAPHORE_FIELD_SET(win, dev, field) \
(win)->field[(dev)->id/8] |= (1 << ((dev)->id % 8)); \
#define SEMAPHORE_FIELD_UNSET(win, dev, field) \
(win)->field[(dev)->id/8] &= ~(1 << ((dev)->id % 8));
#define FOCUS_SEMAPHORE_SET(win, dev) \
SEMAPHORE_FIELD_SET(win, dev, focusinout);
#define FOCUS_SEMAPHORE_UNSET(win, dev) \
SEMAPHORE_FIELD_UNSET(win, dev, focusinout);
#define FOCUS_SEMAPHORE_ISSET(win, dev) \
(win)->focusinout[(dev)->id/8] & (1 << ((dev)->id % 8))
typedef unsigned long Leds;
typedef struct _OtherClients *OtherClientsPtr;
typedef struct _InputClients *InputClientsPtr;
typedef struct _DeviceIntRec *DeviceIntPtr;
typedef struct _ClassesRec *ClassesPtr;
typedef struct _EventList {
xEvent* event;
int evlen;
} EventList, *EventListPtr;
extern EventListPtr InputEventList;
extern int InputEventListLen;
typedef int (*DeviceProc)(
DeviceIntPtr ,
int );
typedef void (*ProcessInputProc)(
xEventPtr ,
DeviceIntPtr ,
int );
typedef Bool (*DeviceHandleProc)(
DeviceIntPtr ,
void*
);
typedef void (*DeviceUnwrapProc)(
DeviceIntPtr ,
DeviceHandleProc ,
void*
);
typedef void (*PointerAccelSchemeProc)(
DeviceIntPtr ,
int ,
int ,
int* ,
int );
typedef void (*DeviceCallbackProc)(
DeviceIntPtr );
typedef struct _DeviceRec {
pointer devicePrivate;
ProcessInputProc processInputProc;
ProcessInputProc realInputProc;
ProcessInputProc enqueueInputProc;
Bool on;
} DeviceRec, *DevicePtr;
typedef struct {
int click, bell, bell_pitch, bell_duration;
Bool autoRepeat;
unsigned char autoRepeats[32];
Leds leds;
unsigned char id;
} KeybdCtrl;
typedef struct {
KeySym *map;
KeyCode minKeyCode,
maxKeyCode;
int mapWidth;
} KeySymsRec, *KeySymsPtr;
typedef struct {
int num, den, threshold;
unsigned char id;
} PtrCtrl;
typedef struct {
int resolution, min_value, max_value;
int integer_displayed;
unsigned char id;
} IntegerCtrl;
typedef struct {
int max_symbols, num_symbols_supported;
int num_symbols_displayed;
KeySym *symbols_supported;
KeySym *symbols_displayed;
unsigned char id;
} StringCtrl;
typedef struct {
int percent, pitch, duration;
unsigned char id;
} BellCtrl;
typedef struct {
Leds led_values;
Mask led_mask;
unsigned char id;
} LedCtrl;
extern KeybdCtrl defaultKeyboardControl;
extern PtrCtrl defaultPointerControl;
typedef struct _InputOption {
char *key;
char *value;
struct _InputOption *next;
} InputOption;
extern void InitCoreDevices(void);
extern DeviceIntPtr AddInputDevice(
ClientPtr ,
DeviceProc ,
Bool );
extern Bool EnableDevice(
DeviceIntPtr );
extern Bool ActivateDevice(
DeviceIntPtr );
extern Bool DisableDevice(
DeviceIntPtr );
extern int InitAndStartDevices(void);
extern void CloseDownDevices(void);
extern void UndisplayDevices(void);
extern int RemoveDevice(
DeviceIntPtr );
extern int NumMotionEvents(void);
extern void RegisterPointerDevice(
DeviceIntPtr );
extern void RegisterKeyboardDevice(
DeviceIntPtr );
extern int dixLookupDevice(
DeviceIntPtr * ,
int ,
ClientPtr ,
Mask );
extern void QueryMinMaxKeyCodes(
KeyCode* ,
KeyCode* );
extern Bool SetKeySymsMap(
KeySymsPtr ,
KeySymsPtr );
extern Bool InitKeyClassDeviceStruct(
DeviceIntPtr ,
KeySymsPtr ,
CARD8 []);
extern Bool InitButtonClassDeviceStruct(
DeviceIntPtr ,
int ,
CARD8* );
extern Bool InitValuatorClassDeviceStruct(
DeviceIntPtr ,
int ,
int ,
int );
extern Bool InitPointerAccelerationScheme(
DeviceIntPtr ,
int );
extern Bool InitAbsoluteClassDeviceStruct(
DeviceIntPtr );
extern Bool InitFocusClassDeviceStruct(
DeviceIntPtr );
typedef void (*BellProcPtr)(
int ,
DeviceIntPtr ,
pointer ,
int);
typedef void (*KbdCtrlProcPtr)(
DeviceIntPtr ,
KeybdCtrl * );
extern Bool InitKbdFeedbackClassDeviceStruct(
DeviceIntPtr ,
BellProcPtr ,
KbdCtrlProcPtr );
typedef void (*PtrCtrlProcPtr)(
DeviceIntPtr ,
PtrCtrl * );
extern Bool InitPtrFeedbackClassDeviceStruct(
DeviceIntPtr ,
PtrCtrlProcPtr );
typedef void (*StringCtrlProcPtr)(
DeviceIntPtr ,
StringCtrl * );
extern Bool InitStringFeedbackClassDeviceStruct(
DeviceIntPtr ,
StringCtrlProcPtr ,
int ,
int ,
KeySym* );
typedef void (*BellCtrlProcPtr)(
DeviceIntPtr ,
BellCtrl * );
extern Bool InitBellFeedbackClassDeviceStruct(
DeviceIntPtr ,
BellProcPtr ,
BellCtrlProcPtr );
typedef void (*LedCtrlProcPtr)(
DeviceIntPtr ,
LedCtrl * );
extern Bool InitLedFeedbackClassDeviceStruct(
DeviceIntPtr ,
LedCtrlProcPtr );
typedef void (*IntegerCtrlProcPtr)(
DeviceIntPtr ,
IntegerCtrl * );
extern Bool InitIntegerFeedbackClassDeviceStruct(
DeviceIntPtr ,
IntegerCtrlProcPtr );
extern Bool InitPointerDeviceStruct(
DevicePtr ,
CARD8* ,
int ,
PtrCtrlProcPtr ,
int ,
int );
extern Bool InitKeyboardDeviceStruct(
DevicePtr ,
KeySymsPtr ,
CARD8 [],
BellProcPtr ,
KbdCtrlProcPtr );
extern void SendMappingNotify(
DeviceIntPtr ,
unsigned int ,
unsigned int ,
unsigned int ,
ClientPtr );
extern Bool BadDeviceMap(
BYTE* ,
int ,
unsigned ,
unsigned ,
XID* );
extern Bool AllModifierKeysAreUp(
DeviceIntPtr ,
CARD8* ,
int ,
CARD8* ,
int );
extern void NoteLedState(
DeviceIntPtr ,
int ,
Bool );
extern void MaybeStopHint(
DeviceIntPtr ,
ClientPtr );
extern void ProcessPointerEvent(
xEventPtr ,
DeviceIntPtr ,
int );
extern void ProcessKeyboardEvent(
xEventPtr ,
DeviceIntPtr ,
int );
#ifdef XKB
extern void CoreProcessPointerEvent(
xEventPtr ,
DeviceIntPtr ,
int ) _X_DEPRECATED;
extern _X_DEPRECATED void CoreProcessKeyboardEvent(
xEventPtr ,
DeviceIntPtr ,
int ) _X_DEPRECATED;
#endif
extern Bool LegalModifier(
unsigned int ,
DeviceIntPtr );
extern void ProcessInputEvents(void);
extern void InitInput(
int ,
char ** );
extern int GetMaximumEventsNum(void);
extern int GetEventList(EventListPtr* list);
extern EventListPtr InitEventList(int num_events);
extern void SetMinimumEventSize(EventListPtr list,
int num_events,
int min_size);
extern void FreeEventList(EventListPtr list, int num_events);
extern void CreateClassesChangedEvent(EventListPtr event,
DeviceIntPtr master,
DeviceIntPtr slave);
extern int GetPointerEvents(
EventListPtr events,
DeviceIntPtr pDev,
int type,
int buttons,
int flags,
int first_valuator,
int num_valuators,
int *valuators);
extern int GetKeyboardEvents(
EventListPtr events,
DeviceIntPtr pDev,
int type,
int key_code);
extern int GetKeyboardValuatorEvents(
EventListPtr events,
DeviceIntPtr pDev,
int type,
int key_code,
int first_valuator,
int num_valuator,
int *valuators);
extern int GetProximityEvents(
EventListPtr events,
DeviceIntPtr pDev,
int type,
int first_valuator,
int num_valuators,
int *valuators);
extern void PostSyntheticMotion(
DeviceIntPtr pDev,
int x,
int y,
int screen,
unsigned long time);
extern int GetMotionHistorySize(
void);
extern void AllocateMotionHistory(
DeviceIntPtr pDev);
extern int GetMotionHistory(
DeviceIntPtr pDev,
xTimecoord **buff,
unsigned long start,
unsigned long stop,
ScreenPtr pScreen,
BOOL core);
extern int AttachDevice(ClientPtr client,
DeviceIntPtr slave,
DeviceIntPtr master);
extern DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
extern int AllocMasterDevice(ClientPtr client,
char* name,
DeviceIntPtr* ptr,
DeviceIntPtr* keybd);
extern void DeepCopyDeviceClasses(DeviceIntPtr from,
DeviceIntPtr to);
extern int NewInputDeviceRequest(
InputOption *options,
DeviceIntPtr *dev);
extern void DeleteInputDeviceRequest(
DeviceIntPtr dev);
extern void DDXRingBell(
int volume,
int pitch,
int duration);
#endif