From 40e1474d84c09d93197ac5db34a88e654386e68f Mon Sep 17 00:00:00 2001 From: Chris Salch Date: Mon, 4 Aug 2008 20:19:47 -0500 Subject: Adding a function to map button events to button numbers. Remove code duplication, let the mapping function hand us the actual button event to be passed up to the server. Signed-off-by: Peter Hutterer --- src/emuMB.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/emuMB.c') diff --git a/src/emuMB.c b/src/emuMB.c index 07d8989..1992654 100644 --- a/src/emuMB.c +++ b/src/emuMB.c @@ -212,14 +212,14 @@ EvdevMBEmuTimer(InputInfoPtr pInfo) /** * Emulate a middle button on button press. * - * @param code Evdev event code (BTN_LEFT or BTN_RIGHT) + * @param code button number (1 for left, 3 for right) * @param press TRUE if press, FALSE if release. * * @return TRUE if event was swallowed by middle mouse button emulation, FALSE * otherwise. */ BOOL -EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int code, BOOL press) +EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press) { EvdevPtr pEvdev = pInfo->private; int id; @@ -230,14 +230,14 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int code, BOOL press) return ret; /* don't care about other buttons */ - if (code != BTN_LEFT && code != BTN_RIGHT) + if (button != 1 && button != 3) return ret; btstate = &pEvdev->emulateMB.buttonstate; if (press) - *btstate |= (code == BTN_LEFT) ? 0x1 : 0x2; + *btstate |= (button == 1) ? 0x1 : 0x2; else - *btstate &= (code == BTN_LEFT) ? ~0x1 : ~0x2; + *btstate &= (button == 1) ? ~0x1 : ~0x2; if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0) { -- cgit v1.2.3