diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-06-10 15:55:40 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-06-10 22:46:20 +0930 |
commit | e8887435ac065ec3071b2d8bf0895e8cb196ec3d (patch) | |
tree | 22fea9071a9c4ca8e6c61e6bffbe463508365899 /src/evdev.c | |
parent | Plug a memory leak, we allocated pEvdev twice, dropping the first memory area. (diff) | |
download | xf86-input-evdev-e8887435ac065ec3071b2d8bf0895e8cb196ec3d.tar.gz xf86-input-evdev-e8887435ac065ec3071b2d8bf0895e8cb196ec3d.tar.bz2 xf86-input-evdev-e8887435ac065ec3071b2d8bf0895e8cb196ec3d.zip |
Enable middle-mouse button emulation.
Ported from xf86-input-mouse, with a few cleanups.
Diffstat (limited to 'src/evdev.c')
-rw-r--r-- | src/evdev.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/src/evdev.c b/src/evdev.c index 2f093c4..27d75dc 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -33,7 +33,6 @@ #include <X11/XF86keysym.h> #include <X11/extensions/XIproto.h> -#include <linux/input.h> #include <unistd.h> #include <misc.h> @@ -44,10 +43,7 @@ #include <exevents.h> #include <mipointer.h> -#if defined(XKB) -/* XXX VERY WRONG. this is a client side header. */ -#include <X11/extensions/XKBstr.h> -#endif +#include "evdev.h" #include <xf86Module.h> @@ -91,25 +87,6 @@ #define MODEFLAG 8 #define COMPOSEFLAG 16 -typedef struct { - int kernel24; - int screen; - int min_x, min_y, max_x, max_y; - int abs_x, abs_y, old_x, old_y; - int flags; - int tool; - - /* XKB stuff has to be per-device rather than per-driver */ - int noXkb; -#ifdef XKB - char *xkb_rules; - char *xkb_model; - char *xkb_layout; - char *xkb_variant; - char *xkb_options; - XkbComponentNamesRec xkbnames; -#endif -} EvdevRec, *EvdevPtr; static const char *evdevDefaults[] = { "XkbRules", "base", @@ -241,10 +218,12 @@ EvdevReadInput(InputInfoPtr pInfo) switch (ev.code) { /* swap here, pretend we're an X-conformant device. */ case BTN_LEFT: - xf86PostButtonEvent(pInfo->dev, 0, 1, value, 0, 0); + if (!EvdevMBEmuFilterEvent(pInfo, ev.code, value)) + xf86PostButtonEvent(pInfo->dev, 0, 1, value, 0, 0); break; case BTN_RIGHT: - xf86PostButtonEvent(pInfo->dev, 0, 3, value, 0, 0); + if (!EvdevMBEmuFilterEvent(pInfo, ev.code, value)) + xf86PostButtonEvent(pInfo->dev, 0, 3, value, 0, 0); break; case BTN_MIDDLE: xf86PostButtonEvent(pInfo->dev, 0, 2, value, 0, 0); @@ -964,6 +943,12 @@ EvdevProbe(InputInfoPtr pInfo) has_buttons = TRUE; } + if (TestBit(BTN_MIDDLE, key_bitmask)) { + xf86Msg(X_INFO, "%s: Found middle button. Disabling emulation.\n", + pInfo->name); + EvdevMBEmuEnable(pInfo, FALSE); + } + for (i = 0; i < BTN_MISC; i++) if (TestBit(i, key_bitmask)) break; @@ -1044,6 +1029,8 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags) */ pEvdev->tool = 1; + EvdevMBEmuPreInit(pInfo); + device = xf86CheckStrOption(dev->commonOptions, "Path", NULL); if (!device) device = xf86CheckStrOption(dev->commonOptions, "Device", NULL); @@ -1052,7 +1039,7 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86DeleteInput(pInfo, 0); return NULL; } - + xf86Msg(deviceFrom, "%s: Device: \"%s\"\n", pInfo->name, device); do { pInfo->fd = open(device, O_RDWR, 0); |