aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xi/exevents.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/Xi/exevents.c')
-rw-r--r--xorg-server/Xi/exevents.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c
index d1d87a639..0bc2ecc81 100644
--- a/xorg-server/Xi/exevents.c
+++ b/xorg-server/Xi/exevents.c
@@ -747,7 +747,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
KeyClassPtr k = NULL;
ButtonClassPtr b = NULL;
ValuatorClassPtr v = NULL;
- BYTE *kptr = NULL;
/* This event is always the first we get, before the actual events with
* the data. However, the way how the DDX is set up, "device" will
@@ -814,32 +813,31 @@ 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)
return DONT_PROCESS;
- kptr = &b->down[key >> 3];
- if ((*kptr & bit) != 0)
+ if (button_is_down(device, key, BUTTON_PROCESSED))
return DONT_PROCESS;
- *kptr |= bit;
+
+ set_button_down(device, key, BUTTON_PROCESSED);
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
if (!b->map[key])
@@ -859,8 +857,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
if (!b)
return DONT_PROCESS;
- kptr = &b->down[key>>3];
- if (!(*kptr & bit))
+ if (!button_is_down(device, key, BUTTON_PROCESSED))
return DONT_PROCESS;
if (IsMaster(device)) {
DeviceIntPtr sd;
@@ -875,11 +872,11 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
continue;
if (!sd->button)
continue;
- if ((sd->button->down[key>>3] & bit) != 0)
+ if (button_is_down(sd, key, BUTTON_PROCESSED))
return DONT_PROCESS;
}
}
- *kptr &= ~bit;
+ set_button_up(device, key, BUTTON_PROCESSED);
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
if (!b->map[key])