[PATCH] Xi: use set_key_up/down instead of manual bit handling.

Peter Hutterer peter.hutterer at who-t.net
Mon Jul 5 00:10:44 PDT 2010


We have the wrappers, use them.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/exevents.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index de24b4c..df13190 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -814,23 +814,22 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
         if (!k)
             return DONT_PROCESS;
 
-	kptr = &k->down[key >> 3];
-        /* don't allow ddx to generate multiple downs, but repeats are okay */
-	if ((*kptr & bit) && !event->key_repeat)
+	/* don't allow ddx to generate multiple downs, but repeats are okay */
+	if (key_is_down(device, key, KEY_PROCESSED) && !event->key_repeat)
 	    return DONT_PROCESS;
+
 	if (device->valuator)
 	    device->valuator->motionHintWindow = NullWindow;
-	*kptr |= bit;
+	set_key_down(device, key, KEY_PROCESSED);
     } else if (event->type == ET_KeyRelease) {
         if (!k)
             return DONT_PROCESS;
 
-	kptr = &k->down[key >> 3];
-	if (!(*kptr & bit))	/* guard against duplicates */
+	if (!key_is_down(device, key, KEY_PROCESSED))	/* guard against duplicates */
 	    return DONT_PROCESS;
 	if (device->valuator)
 	    device->valuator->motionHintWindow = NullWindow;
-	*kptr &= ~bit;
+	set_key_up(device, key, KEY_PROCESSED);
     } else if (event->type == ET_ButtonPress) {
         Mask mask;
         if (!b)
-- 
1.7.1


More information about the xorg-devel mailing list