diff options
author | Matthieu Herrb <matthieu@openbsd.org> | 2009-11-26 16:45:02 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@openbsd.org> | 2009-11-26 16:45:02 +0000 |
commit | c74386f23185dc6f890f0e4f3fe2ace3431d24bc (patch) | |
tree | 86adac32ff394db5810a0a595f0671620aaa020f /src/ws.h | |
parent | f41fbb1a7c6c5e9e3ac4def1d5fda4214857624f (diff) |
Missed this file when adding middle button emulation.
Diffstat (limited to 'src/ws.h')
-rw-r--r-- | src/ws.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/ws.h b/src/ws.h new file mode 100644 index 0000000..597d208 --- /dev/null +++ b/src/ws.h @@ -0,0 +1,73 @@ +/* + * Copyright © 2009 Matthieu Herrb <matthieu@herrb.eu> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, 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. + */ + +#include <dev/wscons/wsconsio.h> + +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3 +#define HAVE_PROPERTIES 1 +#endif + +/* #undef DEBUG */ +#define DEBUG +#undef DBG +extern int ws_debug_level; +#ifdef DEBUG +# define DBG(lvl, f) { if ((lvl) <= ws_debug_level) f;} +#else +# define DBG(lvl, f) +#endif + +#define NAXES 2 /* X and Y axes only */ +#define NBUTTONS 32 /* max theoretical buttons */ +#define DFLTBUTTONS 3 /* default number of buttons */ +#define NUMEVENTS 16 /* max # of ws events to read at once */ + +typedef struct WSDevice { + char *devName; /* device name */ + int type; /* ws device type */ + unsigned int buttons; /* # of buttons */ + unsigned int lastButtons; /* last state of buttons */ + int min_x, max_x, min_y, max_y; /* coord space */ + int swap_axes; + int raw; + int inv_x, inv_y; + int screen_width, screen_height; + int screen_no; + int num, den, threshold; /* relative accel params */ + pointer buffer; + int negativeZ, positiveZ; /* mappings for Z axis */ + int negativeW, positiveW; /* mappings for W axis */ + struct wsmouse_calibcoords coords; /* mirror of the kernel values */ + /* Middle mouse button emulation */ + struct { + BOOL enabled; + BOOL pending; /* timer waiting? */ + int buttonstate; /* phys. button state */ + int state; /* state machine (see emumb.c) */ + Time expires; /* time of expiry */ + Time timeout; + } emulateMB; +} WSDeviceRec, *WSDevicePtr; + +extern int wsmbEmuTimer(InputInfoPtr); +extern BOOL wsmbEmuFilterEvent(InputInfoPtr, int, BOOL); +extern void wsmbEmuWakeupHandler(pointer, int, pointer); +extern void wsmbEmuBlockHandler(pointer, struct timeval **, pointer); +extern void wsmbEmuPreInit(InputInfoPtr); +extern void wsmbEmuOn(InputInfoPtr); +extern void wsmbEmuFinalize(InputInfoPtr); +extern void wsmbEmuEnable(InputInfoPtr, BOOL); +extern void wsmbEmuInitProperty(DeviceIntPtr); |