input.h revision f78b12e570284aa8291f4ca1add24937fd107403
/************************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
#ifndef INPUT_H
#define INPUT_H
#include "misc.h"
#include "screenint.h"
#include <stdint.h>
#include "window.h" /* for WindowPtr */
#include "xkbrules.h"
#include "events.h"
#define DEVICE_INIT 0
#define DEVICE_ON 1
#define DEVICE_OFF 2
#define DEVICE_CLOSE 3
/*int constants for pointer acceleration schemes*/
#define PtrAccelNoOp 0
#define PtrAccelPredictable 1
#define PtrAccelLightweight 2
#define PtrAccelDefault PtrAccelPredictable
#define MAX_VALUATORS 36
/* Maximum number of valuators, divided by six, rounded up, to get number
* of events. */
#define MAX_VALUATOR_EVENTS 6
#define NO_AXIS_LIMITS -1
#define MAP_LENGTH 256
#ifndef FollowKeyboard
#define FollowKeyboard 3
#endif
#ifndef FollowKeyboardWin
#endif
#ifndef RevertToFollowKeyboard
#define RevertToFollowKeyboard 3
#endif
typedef unsigned long Leds;
typedef struct _OtherClients *OtherClientsPtr;
typedef struct _InputClients *InputClientsPtr;
typedef struct _DeviceIntRec *DeviceIntPtr;
typedef struct _ValuatorClassRec *ValuatorClassPtr;
typedef struct _ClassesRec *ClassesPtr;
typedef struct _SpriteRec *SpritePtr;
typedef struct _ValuatorMask ValuatorMask;
/* The DIX stores incoming input events in this list */
extern InternalEvent* InputEventList;
typedef int (*DeviceProc)(
DeviceIntPtr /*device*/,
int /*what*/);
typedef void (*ProcessInputProc)(
InternalEvent * /*event*/,
DeviceIntPtr /*device*/);
typedef Bool (*DeviceHandleProc)(
DeviceIntPtr /*device*/,
void* /*data*/
);
typedef void (*DeviceUnwrapProc)(
DeviceIntPtr /*device*/,
DeviceHandleProc /*proc*/,
void* /*data*/
);
/* pointer acceleration handling */
typedef void (*PointerAccelSchemeProc)(
DeviceIntPtr /*device*/,
ValuatorMask* /*valuators*/,
CARD32 /*evtime*/);
typedef void (*DeviceCallbackProc)(
DeviceIntPtr /*pDev*/);
struct _ValuatorAccelerationRec;
typedef Bool (*PointerAccelSchemeInitProc)(
DeviceIntPtr /*dev*/,
struct _ValuatorAccelerationRec* /*protoScheme*/);
typedef struct _DeviceRec {
typedef struct {
unsigned char autoRepeats[32];
unsigned char id;
} KeybdCtrl;
typedef struct {
int mapWidth;
} KeySymsRec, *KeySymsPtr;
typedef struct {
unsigned char id;
} PtrCtrl;
typedef struct {
int integer_displayed;
unsigned char id;
} IntegerCtrl;
typedef struct {
unsigned char id;
} StringCtrl;
typedef struct {
unsigned char id;
} BellCtrl;
typedef struct {
unsigned char id;
} LedCtrl;
typedef struct _InputOption {
char *key;
char *value;
struct _InputOption *next;
} InputOption;
typedef struct _InputAttributes {
char *product;
char *vendor;
char *device;
char *pnp_id;
char *usb_id;
char **tags; /* null-terminated */
#define ATTR_KEYBOARD (1<<0)
#define KEY_PROCESSED 1
#define BUTTON_PROCESSED 1
#define KEY_POSTED 2
#define BUTTON_POSTED 2
extern void InitCoreDevices(void);
extern void InitXTestDevices(void);
ClientPtr /*client*/,
DeviceProc /*deviceProc*/,
Bool /*autoStart*/);
DeviceIntPtr /*device*/,
BOOL /* sendevent */);
DeviceIntPtr /*device*/,
BOOL /* sendevent */);
DeviceIntPtr /*device*/,
BOOL /* sendevent */);
extern int InitAndStartDevices(void);
extern void CloseDownDevices(void);
extern void UndisplayDevices(void);
extern _X_EXPORT int RemoveDevice(
DeviceIntPtr /*dev*/,
BOOL /* sendevent */);
extern _X_EXPORT int NumMotionEvents(void);
extern _X_EXPORT int dixLookupDevice(
DeviceIntPtr * /* dev */,
int /* id */,
ClientPtr /* client */,
Mask /* access_mode */);
extern _X_EXPORT void QueryMinMaxKeyCodes(
KeyCode* /*minCode*/,
KeyCode* /*maxCode*/);
KeySymsPtr /*dst*/,
KeySymsPtr /*src*/);
DeviceIntPtr /*device*/,
int /*numButtons*/,
Atom* /* labels */,
CARD8* /*map*/);
int numAxes);
DeviceIntPtr /*device*/,
int /*numAxes*/,
Atom* /* labels */,
int /*numMotionEvents*/,
int /*mode*/);
DeviceIntPtr /*dev*/,
int /*scheme*/);
DeviceIntPtr /*device*/);
typedef void (*BellProcPtr)(
int /*percent*/,
DeviceIntPtr /*device*/,
pointer /*ctrl*/,
int);
typedef void (*KbdCtrlProcPtr)(
DeviceIntPtr /*device*/,
KeybdCtrl * /*ctrl*/);
typedef void (*PtrCtrlProcPtr)(
DeviceIntPtr /*device*/,
PtrCtrl * /*ctrl*/);
DeviceIntPtr /*device*/,
PtrCtrlProcPtr /*controlProc*/);
typedef void (*StringCtrlProcPtr)(
DeviceIntPtr /*device*/,
StringCtrl * /*ctrl*/);
DeviceIntPtr /*device*/,
StringCtrlProcPtr /*controlProc*/,
int /*max_symbols*/,
int /*num_symbols_supported*/,
KeySym* /*symbols*/);
typedef void (*BellCtrlProcPtr)(
DeviceIntPtr /*device*/,
BellCtrl * /*ctrl*/);
DeviceIntPtr /*device*/,
BellProcPtr /*bellProc*/,
BellCtrlProcPtr /*controlProc*/);
typedef void (*LedCtrlProcPtr)(
DeviceIntPtr /*device*/,
LedCtrl * /*ctrl*/);
DeviceIntPtr /*device*/,
LedCtrlProcPtr /*controlProc*/);
typedef void (*IntegerCtrlProcPtr)(
DeviceIntPtr /*device*/,
IntegerCtrl * /*ctrl*/);
DeviceIntPtr /*device*/,
IntegerCtrlProcPtr /*controlProc*/);
DevicePtr /*device*/,
CARD8* /*map*/,
int /*numButtons*/,
Atom* /* btn_labels */,
PtrCtrlProcPtr /*controlProc*/,
int /*numMotionEvents*/,
int /*numAxes*/,
Atom* /* axes_labels */);
DeviceIntPtr /*device*/,
XkbRMLVOSet * /*rmlvo*/,
BellProcPtr /*bellProc*/,
KbdCtrlProcPtr /*controlProc*/);
extern int ApplyPointerMapping(
DeviceIntPtr /* pDev */,
CARD8 * /* map */,
int /* len */,
ClientPtr /* client */);
extern Bool BadDeviceMap(
BYTE* /*buff*/,
int /*length*/,
unsigned /*low*/,
unsigned /*high*/,
XID* /*errval*/);
extern void NoteLedState(
DeviceIntPtr /*keybd*/,
int /*led*/,
Bool /*on*/);
extern void MaybeStopHint(
DeviceIntPtr /*device*/,
ClientPtr /*client*/);
extern void ProcessPointerEvent(
InternalEvent* /* ev */,
DeviceIntPtr /*mouse*/);
extern void ProcessKeyboardEvent(
InternalEvent* /*ev*/,
DeviceIntPtr /*keybd*/);
extern Bool LegalModifier(
unsigned int /*key*/,
DeviceIntPtr /*pDev*/);
extern _X_EXPORT void ProcessInputEvents(void);
int /*argc*/,
char ** /*argv*/);
extern _X_EXPORT void CloseInput(void);
extern _X_EXPORT int GetMaximumEventsNum(void);
int type);
extern InternalEvent * UpdateFromMaster(
int type,
int *num_events);
extern _X_EXPORT int GetPointerEvents(
int type,
int buttons,
int flags,
const ValuatorMask *mask);
extern _X_EXPORT void QueuePointerEvents(
int type,
int buttons,
int flags,
const ValuatorMask *mask);
extern _X_EXPORT int GetKeyboardEvents(
int type,
int key_code,
const ValuatorMask *mask);
extern _X_EXPORT void QueueKeyboardEvents(
int type,
int key_code,
const ValuatorMask *mask);
extern int GetProximityEvents(
int type,
const ValuatorMask *mask);
extern void QueueProximityEvents(
int type,
const ValuatorMask *mask);
extern void PostSyntheticMotion(
int x,
int y,
int screen,
unsigned long time);
extern _X_EXPORT int GetMotionHistorySize(
void);
extern _X_EXPORT void AllocateMotionHistory(
extern _X_EXPORT int GetMotionHistory(
xTimecoord **buff,
unsigned long start,
unsigned long stop,
char* name,
/* Helper functions. */
int max_keys_per_mod);
char* name,
/* misc event helpers */
/**
* Masks specifying the type of event to deliver for an InternalEvent; used
* by EventIsDeliverable.
* @defgroup EventIsDeliverable return flags
* @{
*/
/* @} */
/* Implemented by the DDX. */
extern _X_EXPORT int NewInputDeviceRequest(
DeviceIntPtr *dev);
extern _X_EXPORT void DeleteInputDeviceRequest(
extern _X_EXPORT void DDXRingBell(
int volume,
int pitch,
int duration);
#define VALUATOR_MODE_ALL_AXES -1
extern Bool EnableCursor;
int first_valuator, int num_valuators,
const int* valuators);
int valuator,
int data);
const ValuatorMask *src);
#endif /* INPUT_H */