mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
10 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b125b834f4 | ||
|
|
05b20db8db | ||
|
|
43768d59da | ||
|
|
9c524f6963 | ||
|
|
04003a98a9 | ||
|
|
0443fb430f | ||
|
|
998f52010f | ||
|
|
de07c04f5c | ||
|
|
01355b9d4b | ||
|
|
9591dc1f6c |
@@ -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)
|
||||
|
||||
|
||||
32
src/emuMB.c
32
src/emuMB.c
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user