summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-07-06 08:56:12 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-07-07 13:29:45 +1000
commit32473d6bf38c95b2d6d5ddbf583a1e801c6605e4 (patch)
treea4db411cd62e55f1165890ee6c215bd310ff500a
parentc18442908080c9833dfd6bb2ff367945d1892421 (diff)
dix: use BitIsOn/SetBit/ClearBit macros for set_key_down helpers.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r--dix/getevents.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 2eacdfed4..1d505e536 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -94,18 +94,18 @@ void
set_key_down(DeviceIntPtr pDev, int key_code, int type)
{
if (type == KEY_PROCESSED)
- pDev->key->down[key_code >> 3] |= (1 << (key_code & 7));
+ SetBit(pDev->key->down, key_code);
else
- pDev->key->postdown[key_code >> 3] |= (1 << (key_code & 7));
+ SetBit(pDev->key->postdown, key_code);
}
void
set_key_up(DeviceIntPtr pDev, int key_code, int type)
{
if (type == KEY_PROCESSED)
- pDev->key->down[key_code >> 3] &= ~(1 << (key_code & 7));
+ ClearBit(pDev->key->down, key_code);
else
- pDev->key->postdown[key_code >> 3] &= ~(1 << (key_code & 7));
+ ClearBit(pDev->key->postdown, key_code);
}
Bool
@@ -114,9 +114,9 @@ key_is_down(DeviceIntPtr pDev, int key_code, int type)
int ret = 0;
if (type & KEY_PROCESSED)
- ret |= !!(pDev->key->down[key_code >> 3] & (1 << (key_code & 7)));
+ ret |= !!BitIsOn(pDev->key->down, key_code);
if (type & KEY_POSTED)
- ret |= !!(pDev->key->postdown[key_code >> 3] & (1 << (key_code & 7)));
+ ret |= !!BitIsOn(pDev->key->postdown, key_code);
return ret;
}