Compare commits

..

10 Commits

Author SHA1 Message Date
Peter Hutterer
b125b834f4 evdev 2.0.1 2008-06-22 17:52:58 +09:30
Peter Hutterer
05b20db8db No need to finalize MB emulation after EvdevProbe anymore.
Follow-up to 76800bfa75.
(cherry picked from commit 5a0ea39b79)
2008-06-22 16:26:10 +09:30
Simon Munton
43768d59da Close file descriptor if EvdevProbe fails.
Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
(cherry picked from commit 373e13ae35)
2008-06-22 16:25:48 +09:30
Keith Packard
9c524f6963 Enable middle button emulation at DEVICE_ON instead of DEVICE_INIT.
This ensures that the middle button emulation is re-enabled after VT switch,
otherwise the block handler that deals with the timeouts would not get
re-registered.

Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 76800bfa75)
2008-06-22 16:24:57 +09:30
Peter Hutterer
04003a98a9 evdev 2.0.0 2008-06-17 14:01:49 +09:30
Peter Hutterer
0443fb430f Shut up compiler warning "implicit declaration of function 'xf86Msg'" 2008-06-17 13:59:15 +09:30
Peter Hutterer
998f52010f Finalize MB emulation if EvdevProbe fails.
This avoids segfaults when HAL is restarted behind our backs. Also, only init
MB emulation when the device actually has a button.
2008-06-12 11:24:04 +09:30
Peter Hutterer
de07c04f5c evdev 1.99.4
1.99.3 had a nasty bug, so here's a quick update.
2008-06-11 11:55:12 +09:30
Peter Hutterer
01355b9d4b If Emulate3Buttons is specified in the config, don't auto-deactivate it.
Default setting is still "on" until middle button is pressed.  If the options
is however explicitly stated in the config file, it takes the value from the
config file, no matter if a middle button is present.
2008-06-11 11:23:53 +09:30
Peter Hutterer
9591dc1f6c Remove wakeup handlers when device is closed.
Less SIGABRTs are less exciting, but sometimes boredom is what we want.
2008-06-11 11:23:38 +09:30
4 changed files with 35 additions and 6 deletions

View File

@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-input-evdev],
1.99.3,
2.0.1,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-input-evdev)

View File

@@ -34,8 +34,16 @@
#include "config.h"
#endif
#include <xf86.h>
#include "evdev.h"
enum {
MBEMU_DISABLED = 0,
MBEMU_ENABLED,
MBEMU_AUTO
};
/*
* Lets create a simple finite-state machine for 3 button emulation:
*
@@ -288,9 +296,17 @@ void
EvdevMBEmuPreInit(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
pEvdev->emulateMB.enabled = MBEMU_AUTO;
if (xf86FindOption(pInfo->options, "Emulate3Buttons"))
{
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
"Emulate3Buttons",
MBEMU_ENABLED);
xf86Msg(X_INFO, "%s: Forcing middle mouse button emulation.\n",
pInfo->name);
}
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
"Emulate3Buttons", TRUE);
pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
"Emulate3Timeout", 50);
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
@@ -299,10 +315,20 @@ EvdevMBEmuPreInit(InputInfoPtr pInfo)
}
void
EvdevMBEmuFinalize(InputInfoPtr pInfo)
{
RemoveBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
EvdevMBEmuWakeupHandler,
(pointer)pInfo);
}
/* Enable/disable middle mouse button emulation. */
void
EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
pEvdev->emulateMB.enabled = enable;
if (pEvdev->emulateMB.enabled == MBEMU_AUTO)
pEvdev->emulateMB.enabled = enable;
}

View File

@@ -835,6 +835,8 @@ EvdevProc(DeviceIntPtr device, int what)
xf86Msg(X_WARNING, "%s: Grab failed (%s)\n", pInfo->name,
strerror(errno));
xf86AddEnabledDevice(pInfo);
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
EvdevMBEmuPreInit(pInfo);
device->public.on = TRUE;
break;
@@ -843,6 +845,7 @@ EvdevProc(DeviceIntPtr device, int what)
xf86Msg(X_WARNING, "%s: Release failed (%s)\n", pInfo->name,
strerror(errno));
xf86RemoveEnabledDevice(pInfo);
EvdevMBEmuFinalize(pInfo);
device->public.on = FALSE;
break;
@@ -1024,8 +1027,6 @@ 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);
@@ -1051,6 +1052,7 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
/* parse the XKB options during kbd setup */
if (EvdevProbe(pInfo)) {
close(pInfo->fd);
xf86DeleteInput(pInfo, 0);
return NULL;
}

View File

@@ -75,6 +75,7 @@ BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL);
void EvdevMBEmuWakeupHandler(pointer, int, pointer);
void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer);
void EvdevMBEmuPreInit(InputInfoPtr);
void EvdevMBEmuFinalize(InputInfoPtr);
void EvdevMBEmuEnable(InputInfoPtr, BOOL);
#endif