mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
6 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04003a98a9 | ||
|
|
0443fb430f | ||
|
|
998f52010f | ||
|
|
de07c04f5c | ||
|
|
01355b9d4b | ||
|
|
9591dc1f6c |
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
AC_PREREQ(2.57)
|
AC_PREREQ(2.57)
|
||||||
AC_INIT([xf86-input-evdev],
|
AC_INIT([xf86-input-evdev],
|
||||||
1.99.3,
|
2.0.0,
|
||||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||||
xf86-input-evdev)
|
xf86-input-evdev)
|
||||||
|
|
||||||
|
|||||||
32
src/emuMB.c
32
src/emuMB.c
@@ -34,8 +34,16 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <xf86.h>
|
||||||
|
|
||||||
#include "evdev.h"
|
#include "evdev.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MBEMU_DISABLED = 0,
|
||||||
|
MBEMU_ENABLED,
|
||||||
|
MBEMU_AUTO
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lets create a simple finite-state machine for 3 button emulation:
|
* Lets create a simple finite-state machine for 3 button emulation:
|
||||||
*
|
*
|
||||||
@@ -288,9 +296,17 @@ void
|
|||||||
EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
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,
|
pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
|
||||||
"Emulate3Timeout", 50);
|
"Emulate3Timeout", 50);
|
||||||
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
||||||
@@ -299,10 +315,20 @@ EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EvdevMBEmuFinalize(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
RemoveBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
||||||
|
EvdevMBEmuWakeupHandler,
|
||||||
|
(pointer)pInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable/disable middle mouse button emulation. */
|
/* Enable/disable middle mouse button emulation. */
|
||||||
void
|
void
|
||||||
EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable)
|
EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable)
|
||||||
{
|
{
|
||||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
pEvdev->emulateMB.enabled = enable;
|
if (pEvdev->emulateMB.enabled == MBEMU_AUTO)
|
||||||
|
pEvdev->emulateMB.enabled = enable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -843,6 +843,7 @@ EvdevProc(DeviceIntPtr device, int what)
|
|||||||
xf86Msg(X_WARNING, "%s: Release failed (%s)\n", pInfo->name,
|
xf86Msg(X_WARNING, "%s: Release failed (%s)\n", pInfo->name,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
xf86RemoveEnabledDevice(pInfo);
|
xf86RemoveEnabledDevice(pInfo);
|
||||||
|
EvdevMBEmuFinalize(pInfo);
|
||||||
device->public.on = FALSE;
|
device->public.on = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -940,6 +941,7 @@ EvdevProbe(InputInfoPtr pInfo)
|
|||||||
|
|
||||||
if (TestBit(BTN_LEFT, key_bitmask)) {
|
if (TestBit(BTN_LEFT, key_bitmask)) {
|
||||||
xf86Msg(X_INFO, "%s: Found mouse buttons\n", pInfo->name);
|
xf86Msg(X_INFO, "%s: Found mouse buttons\n", pInfo->name);
|
||||||
|
EvdevMBEmuPreInit(pInfo);
|
||||||
pEvdev->flags |= EVDEV_BUTTON_EVENTS;
|
pEvdev->flags |= EVDEV_BUTTON_EVENTS;
|
||||||
has_buttons = TRUE;
|
has_buttons = TRUE;
|
||||||
}
|
}
|
||||||
@@ -1024,8 +1026,6 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
|||||||
*/
|
*/
|
||||||
pEvdev->tool = 1;
|
pEvdev->tool = 1;
|
||||||
|
|
||||||
EvdevMBEmuPreInit(pInfo);
|
|
||||||
|
|
||||||
device = xf86CheckStrOption(dev->commonOptions, "Path", NULL);
|
device = xf86CheckStrOption(dev->commonOptions, "Path", NULL);
|
||||||
if (!device)
|
if (!device)
|
||||||
device = xf86CheckStrOption(dev->commonOptions, "Device", NULL);
|
device = xf86CheckStrOption(dev->commonOptions, "Device", NULL);
|
||||||
@@ -1051,6 +1051,7 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
|||||||
/* parse the XKB options during kbd setup */
|
/* parse the XKB options during kbd setup */
|
||||||
|
|
||||||
if (EvdevProbe(pInfo)) {
|
if (EvdevProbe(pInfo)) {
|
||||||
|
EvdevMBEmuFinalize(pInfo);
|
||||||
xf86DeleteInput(pInfo, 0);
|
xf86DeleteInput(pInfo, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL);
|
|||||||
void EvdevMBEmuWakeupHandler(pointer, int, pointer);
|
void EvdevMBEmuWakeupHandler(pointer, int, pointer);
|
||||||
void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer);
|
void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer);
|
||||||
void EvdevMBEmuPreInit(InputInfoPtr);
|
void EvdevMBEmuPreInit(InputInfoPtr);
|
||||||
|
void EvdevMBEmuFinalize(InputInfoPtr);
|
||||||
void EvdevMBEmuEnable(InputInfoPtr, BOOL);
|
void EvdevMBEmuEnable(InputInfoPtr, BOOL);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user