>From b53a2d1cafe6e5b6b0661b27f9c0fa6f28645047 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 3 Mar 2015 10:57:37 +0100 Subject: [PATCH 2/2] Pipe the mouse button emulation into the wheel emu The mouse emulation of middle mouse button is handed off to the wheel emulation module. This makes the wheel emulation usable on some pointing stick hardware with only two physical buttons, without breaking left/right mouse drag functionality and the middle button mouse emulation. --- src/emuMB.c | 6 ++++++ src/evdev.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/emuMB.c b/src/emuMB.c index b25eac8..7009206 100644 --- a/src/emuMB.c +++ b/src/emuMB.c @@ -191,6 +191,8 @@ EvdevMBEmuTimer(InputInfoPtr pInfo) pEvdev->emulateMB.pending = FALSE; if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) { + if (EvdevWheelEmuFilterButton(pInfo, abs(id), (id >= 0))) + {} else EvdevPostButtonEvent(pInfo, abs(id), (id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE); pEvdev->emulateMB.state = @@ -237,11 +239,15 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press) if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0) { + if (EvdevWheelEmuFilterButton(pInfo, abs(id), (id >= 0))) + {} else EvdevQueueButtonEvent(pInfo, abs(id), (id >= 0)); ret = TRUE; } if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0) { + if (EvdevWheelEmuFilterButton(pInfo, abs(id), (id >= 0))) + {} else EvdevQueueButtonEvent(pInfo, abs(id), (id >= 0)); ret = TRUE; } diff --git a/src/evdev.c b/src/evdev.c index 9c1a4d3..02963f3 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -585,10 +585,10 @@ EvdevProcessButtonEvent(InputInfoPtr pInfo, struct input_event *ev) if (EvdevDragLockFilterEvent(pInfo, button, value)) return; - if (EvdevWheelEmuFilterButton(pInfo, button, value)) + if (EvdevMBEmuFilterEvent(pInfo, button, value)) return; - if (EvdevMBEmuFilterEvent(pInfo, button, value)) + if (EvdevWheelEmuFilterButton(pInfo, button, value)) return; if (button) -- 2.1.4