45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission to use, copy, modify, distribute, and sell this software and its
45e9809aff7304721fddb95654901b32195c9c7avboxsync * documentation for any purpose is hereby granted without fee, provided that
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the above copyright notice appear in all copies and that both that
45e9809aff7304721fddb95654901b32195c9c7avboxsync * copyright notice and this permission notice appear in supporting
45e9809aff7304721fddb95654901b32195c9c7avboxsync * documentation, and that the name of Frederic Lepied not be used in
45e9809aff7304721fddb95654901b32195c9c7avboxsync * advertising or publicity pertaining to distribution of the software without
45e9809aff7304721fddb95654901b32195c9c7avboxsync * specific, written prior permission. Frederic Lepied makes no
45e9809aff7304721fddb95654901b32195c9c7avboxsync * representations about the suitability of this software for any purpose. It
45e9809aff7304721fddb95654901b32195c9c7avboxsync * is provided "as is" without express or implied warranty.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
45e9809aff7304721fddb95654901b32195c9c7avboxsync * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
45e9809aff7304721fddb95654901b32195c9c7avboxsync * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * PERFORMANCE OF THIS SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright (c) 2000-2002 by The XFree86 Project, Inc.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission is hereby granted, free of charge, to any person obtaining a
45e9809aff7304721fddb95654901b32195c9c7avboxsync * copy of this software and associated documentation files (the "Software"),
45e9809aff7304721fddb95654901b32195c9c7avboxsync * to deal in the Software without restriction, including without limitation
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * and/or sell copies of the Software, and to permit persons to whom the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Software is furnished to do so, subject to the following conditions:
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * The above copyright notice and this permission notice shall be included in
45e9809aff7304721fddb95654901b32195c9c7avboxsync * all copies or substantial portions of the Software.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
45e9809aff7304721fddb95654901b32195c9c7avboxsync * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OTHER DEALINGS IN THE SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Except as contained in this notice, the name of the copyright holder(s)
45e9809aff7304721fddb95654901b32195c9c7avboxsync * and author(s) shall not be used in advertising or otherwise to promote
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the sale, use or other dealings in this Software without prior written
45e9809aff7304721fddb95654901b32195c9c7avboxsync * authorization from the copyright holder(s) and author(s).
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef _xf86Xinput_h
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define _xf86Xinput_h
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef NEED_EVENTS
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define NEED_EVENTS
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "xf86str.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "inputstr.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef XINPUT
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <X11/extensions/XI.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <X11/extensions/XIproto.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "XIstubs.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Input device flags */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define XI86_CONFIGURED 0x02 /* the device has been configured */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* the device sends Xinput and core pointer events */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* if the device is the core pointer or is sending core events, and
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events
45e9809aff7304721fddb95654901b32195c9c7avboxsync * (mouse drag action) are sent. This is mainly to allow a touch screen to be
45e9809aff7304721fddb95654901b32195c9c7avboxsync * used with netscape and other browsers which do strange things if the mouse
45e9809aff7304721fddb95654901b32195c9c7avboxsync * moves between button down and button up. With a touch screen, this motion
45e9809aff7304721fddb95654901b32195c9c7avboxsync * is common due to the user's finger moving slightly.
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define XI86_SEND_DRAG_EVENTS 0x08
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define XI86_CORE_POINTER 0x10 /* device is the core pointer */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define XI_PRIVATE(dev) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync (((LocalDevicePtr)((dev)->public.devicePrivate))->private)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Stupid API backwards-compatibility. */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TS_Raw 60
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define TS_Scaled 61
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef XINPUT
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* This holds the input driver entry and module information. */
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct _InputDriverRec {
45e9809aff7304721fddb95654901b32195c9c7avboxsync int driverVersion;
45e9809aff7304721fddb95654901b32195c9c7avboxsync char * driverName;
45e9809aff7304721fddb95654901b32195c9c7avboxsync void (*Identify)(int flags);
45e9809aff7304721fddb95654901b32195c9c7avboxsync struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
45e9809aff7304721fddb95654901b32195c9c7avboxsync IDevPtr dev, int flags);
45e9809aff7304721fddb95654901b32195c9c7avboxsync void (*UnInit)(struct _InputDriverRec *drv,
45e9809aff7304721fddb95654901b32195c9c7avboxsync struct _LocalDeviceRec *pInfo,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int flags);
45e9809aff7304721fddb95654901b32195c9c7avboxsync pointer module;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int refCount;
45e9809aff7304721fddb95654901b32195c9c7avboxsync} InputDriverRec, *InputDriverPtr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* This is to input devices what the ScrnInfoRec is to screens. */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct _LocalDeviceRec {
45e9809aff7304721fddb95654901b32195c9c7avboxsync struct _LocalDeviceRec *next;
45e9809aff7304721fddb95654901b32195c9c7avboxsync char * name;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int flags;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool (*device_control)(DeviceIntPtr device, int what);
45e9809aff7304721fddb95654901b32195c9c7avboxsync void (*read_input)(struct _LocalDeviceRec *local);
45e9809aff7304721fddb95654901b32195c9c7avboxsync int (*control_proc)(struct _LocalDeviceRec *local,
45e9809aff7304721fddb95654901b32195c9c7avboxsync xDeviceCtl *control);
45e9809aff7304721fddb95654901b32195c9c7avboxsync void (*close_proc)(struct _LocalDeviceRec *local);
45e9809aff7304721fddb95654901b32195c9c7avboxsync int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int mode);
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool (*conversion_proc)(struct _LocalDeviceRec *local,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int first, int num, int v0,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int v1, int v2, int v3, int v4,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int v5, int *x, int *y);
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool (*reverse_conversion_proc)(
45e9809aff7304721fddb95654901b32195c9c7avboxsync struct _LocalDeviceRec *local,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int x, int y, int *valuators);
45e9809aff7304721fddb95654901b32195c9c7avboxsync int (*set_device_valuators)
45e9809aff7304721fddb95654901b32195c9c7avboxsync (struct _LocalDeviceRec *local,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int *valuators, int first_valuator,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int num_valuators);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync int fd;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Atom atom;
45e9809aff7304721fddb95654901b32195c9c7avboxsync DeviceIntPtr dev;
45e9809aff7304721fddb95654901b32195c9c7avboxsync pointer private;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int private_flags;
45e9809aff7304721fddb95654901b32195c9c7avboxsync unsigned int first;
45e9809aff7304721fddb95654901b32195c9c7avboxsync unsigned int last;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int old_x;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int old_y;
45e9809aff7304721fddb95654901b32195c9c7avboxsync char * type_name;
45e9809aff7304721fddb95654901b32195c9c7avboxsync IntegerFeedbackPtr always_core_feedback;
45e9809aff7304721fddb95654901b32195c9c7avboxsync IDevPtr conf_idev;
45e9809aff7304721fddb95654901b32195c9c7avboxsync InputDriverPtr drv;
45e9809aff7304721fddb95654901b32195c9c7avboxsync pointer module;
45e9809aff7304721fddb95654901b32195c9c7avboxsync pointer options;
45e9809aff7304721fddb95654901b32195c9c7avboxsync unsigned int history_size;
45e9809aff7304721fddb95654901b32195c9c7avboxsync} LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct _DeviceAssocRec
45e9809aff7304721fddb95654901b32195c9c7avboxsync{
45e9809aff7304721fddb95654901b32195c9c7avboxsync char * config_section_name;
45e9809aff7304721fddb95654901b32195c9c7avboxsync LocalDevicePtr (*device_allocate)(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsync} DeviceAssocRec, *DeviceAssocPtr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* xf86Globals.c */
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern InputInfoPtr xf86InputDevs;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* xf86Xinput.c */
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid InitExtInput(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int first_valuator, int num_valuators, ...);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int first_valuator, int num_valuators, int *valuators);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86PostProximityEvent(DeviceIntPtr device, int is_in,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int first_valuator, int num_valuators, ...);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int is_down, int first_valuator, int num_valuators,
45e9809aff7304721fddb95654901b32195c9c7avboxsync ...);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int is_absolute, int first_valuator, int num_valuators,
45e9809aff7304721fddb95654901b32195c9c7avboxsync ...);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int is_down);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86XinputFinalizeInit(DeviceIntPtr dev);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86ActivateDevice(LocalDevicePtr local);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncBool xf86CheckButton(int button, int down);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86SwitchCoreDevice(LocalDevicePtr device, DeviceIntPtr core);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncLocalDevicePtr xf86FirstLocalDevice(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncint xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int maxval, int resolution, int min_res,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int max_res);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86AddEnabledDevice(InputInfoPtr pInfo);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86RemoveEnabledDevice(InputInfoPtr pInfo);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86DisableDevice(DeviceIntPtr dev, Bool panic);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86EnableDevice(DeviceIntPtr dev);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* xf86Helper.c */
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86DeleteInputDriver(int drvIndex);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncInputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncInputDriverPtr xf86LookupInputDriver(const char *name);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncInputInfoPtr xf86LookupInput(const char *name);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86DeleteInput(InputInfoPtr pInp, int flags);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86MotionHistoryAllocate(LocalDevicePtr local);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncint xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
45e9809aff7304721fddb95654901b32195c9c7avboxsync unsigned long start, unsigned long stop,
45e9809aff7304721fddb95654901b32195c9c7avboxsync ScreenPtr pScreen);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* xf86Option.c */
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
45e9809aff7304721fddb95654901b32195c9c7avboxsync pointer extraOpts);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Legacy hatred */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SendCoreEvents 59
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DontSendCoreEvents 60
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* _xf86Xinput_h */