summaryrefslogtreecommitdiff
path: root/src/eventcomm.c
diff options
context:
space:
mode:
authorCyril Brulebois <kibi@debian.org>2011-12-12 01:35:27 +0100
committerPeter Hutterer <peter.hutterer@who-t.net>2011-12-12 11:16:14 +1000
commitb7e65f04f5f0c17ac8a26393134cc7e8418ccdec (patch)
treebea93568e73ebdab3a16d203c2f0f4328e126a63 /src/eventcomm.c
parent0cd5a77c3a455e942929eb4d5412fa51630ed13f (diff)
Revert: "eventcomm: replace synaptics-custom TEST_BIT with server's BitIsOn."
This commit reverts 13543b156d78bc4d01a19844a5ee8f283269621b As seen in Debian's #648488, this switch causes a regression on PowerPC, especially seen on iBook G4 with appletouch. Take a defensive stance and revert back to a working state until things have been figured out and fixed properly. Since things have evolved and since that revert triggers a lot of conflicts, the following method was applied: - manual reintroduction of the 3 removed macros: OFF, LONG, TEST_BIT - coccinelle semantic patch to revert from BitIsOn to TEST_BIT Coccinelle semantic patch: @@ expression a,b; @@ -BitIsOn(a,b) +TEST_BIT(b,a) Bugzilla: http://bugs.debian.org/648488 Signed-off-by: Cyril Brulebois <kibi@debian.org>
Diffstat (limited to 'src/eventcomm.c')
-rw-r--r--src/eventcomm.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c
index cd08f13..40e9bdf 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -47,6 +47,9 @@
#define LONG_BITS (sizeof(long) * 8)
#define NBITS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
+#define OFF(x) ((x) % LONG_BITS)
+#define LONG(x) ((x) / LONG_BITS)
+#define TEST_BIT(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
/**
* Protocol-specific data.
@@ -122,16 +125,16 @@ event_query_is_touchpad(int fd, BOOL test_grab)
SYSCALL(rc = ioctl(fd, EVIOCGBIT(0, sizeof(evbits)), evbits));
if (rc < 0)
goto unwind;
- if (!BitIsOn(evbits, EV_SYN) ||
- !BitIsOn(evbits, EV_ABS) ||
- !BitIsOn(evbits, EV_KEY))
+ if (!TEST_BIT(EV_SYN, evbits) ||
+ !TEST_BIT(EV_ABS, evbits) ||
+ !TEST_BIT(EV_KEY, evbits))
goto unwind;
SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits));
if (rc < 0)
goto unwind;
- if (!BitIsOn(absbits, ABS_X) ||
- !BitIsOn(absbits, ABS_Y))
+ if (!TEST_BIT(ABS_X, absbits) ||
+ !TEST_BIT(ABS_Y, absbits))
goto unwind;
SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits));
@@ -139,12 +142,12 @@ event_query_is_touchpad(int fd, BOOL test_grab)
goto unwind;
/* we expect touchpad either report raw pressure or touches */
- if (!BitIsOn(absbits, ABS_PRESSURE) && !BitIsOn(keybits, BTN_TOUCH))
+ if (!TEST_BIT(ABS_PRESSURE, absbits) && !TEST_BIT(BTN_TOUCH, keybits))
goto unwind;
/* all Synaptics-like touchpad report BTN_TOOL_FINGER */
- if (!BitIsOn(keybits, BTN_TOOL_FINGER))
+ if (!TEST_BIT(BTN_TOOL_FINGER, keybits))
goto unwind;
- if (BitIsOn(keybits, BTN_TOOL_PEN))
+ if (TEST_BIT(BTN_TOOL_PEN, keybits))
goto unwind; /* Don't match wacom tablets */
ret = TRUE;
@@ -269,8 +272,8 @@ event_query_axis_ranges(InputInfoPtr pInfo)
SYSCALL(rc = ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits));
if (rc >= 0)
{
- priv->has_pressure = (BitIsOn(absbits, ABS_PRESSURE) != 0);
- priv->has_width = (BitIsOn(absbits, ABS_TOOL_WIDTH) != 0);
+ priv->has_pressure = (TEST_BIT(ABS_PRESSURE, absbits) != 0);
+ priv->has_width = (TEST_BIT(ABS_TOOL_WIDTH, absbits) != 0);
}
else
xf86IDrvMsg(pInfo, X_ERROR, "failed to query ABS bits (%s)\n", strerror(errno));
@@ -287,16 +290,16 @@ event_query_axis_ranges(InputInfoPtr pInfo)
SYSCALL(rc = ioctl(pInfo->fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits));
if (rc >= 0)
{
- priv->has_left = (BitIsOn(keybits, BTN_LEFT) != 0);
- priv->has_right = (BitIsOn(keybits, BTN_RIGHT) != 0);
- priv->has_middle = (BitIsOn(keybits, BTN_MIDDLE) != 0);
- priv->has_double = (BitIsOn(keybits, BTN_TOOL_DOUBLETAP) != 0);
- priv->has_triple = (BitIsOn(keybits, BTN_TOOL_TRIPLETAP) != 0);
-
- if ((BitIsOn(keybits, BTN_0) != 0) ||
- (BitIsOn(keybits, BTN_1) != 0) ||
- (BitIsOn(keybits, BTN_2) != 0) ||
- (BitIsOn(keybits, BTN_3) != 0))
+ priv->has_left = (TEST_BIT(BTN_LEFT, keybits) != 0);
+ priv->has_right = (TEST_BIT(BTN_RIGHT, keybits) != 0);
+ priv->has_middle = (TEST_BIT(BTN_MIDDLE, keybits) != 0);
+ priv->has_double = (TEST_BIT(BTN_TOOL_DOUBLETAP, keybits) != 0);
+ priv->has_triple = (TEST_BIT(BTN_TOOL_TRIPLETAP, keybits) != 0);
+
+ if ((TEST_BIT(BTN_0, keybits) != 0) ||
+ (TEST_BIT(BTN_1, keybits) != 0) ||
+ (TEST_BIT(BTN_2, keybits) != 0) ||
+ (TEST_BIT(BTN_3, keybits) != 0))
priv->has_scrollbuttons = 1;
}