diff options
author | marha <marha@users.sourceforge.net> | 2010-07-07 09:37:20 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-07-07 09:37:20 +0000 |
commit | 3dd9390c49402534bc391f621a6b0f497a9407f7 (patch) | |
tree | bc5cd4665a525dbc9550292ad393fa0e5590c4a1 /xorg-server/dix/getevents.c | |
parent | a31abc5ff6da849ed1ac579a1c905d16ffaafcc7 (diff) | |
parent | 5da15e274b35656568f59602f2e3fd00d5718879 (diff) | |
download | vcxsrv-3dd9390c49402534bc391f621a6b0f497a9407f7.tar.gz vcxsrv-3dd9390c49402534bc391f621a6b0f497a9407f7.tar.bz2 vcxsrv-3dd9390c49402534bc391f621a6b0f497a9407f7.zip |
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/dix/getevents.c')
-rw-r--r-- | xorg-server/dix/getevents.c | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c index 37f05deef..1a0319908 100644 --- a/xorg-server/dix/getevents.c +++ b/xorg-server/dix/getevents.c @@ -106,21 +106,52 @@ GetMotionHistorySize(void) }
void
+set_button_down(DeviceIntPtr pDev, int button, int type)
+{
+ if (type == BUTTON_PROCESSED)
+ SetBit(pDev->button->down, button);
+ else
+ SetBit(pDev->button->postdown, button);
+}
+
+void
+set_button_up(DeviceIntPtr pDev, int button, int type)
+{
+ if (type == BUTTON_PROCESSED)
+ ClearBit(pDev->button->down, button);
+ else
+ ClearBit(pDev->button->postdown, button);
+}
+
+Bool
+button_is_down(DeviceIntPtr pDev, int button, int type)
+{
+ int ret = 0;
+
+ if (type & BUTTON_PROCESSED)
+ ret |= !!BitIsOn(pDev->button->down, button);
+ if (type & BUTTON_POSTED)
+ ret |= !!BitIsOn(pDev->button->postdown, button);
+
+ return ret;
+}
+
+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
@@ -129,9 +160,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)));
- else if (type & KEY_POSTED)
- ret |= !!(pDev->key->postdown[key_code >> 3] & (1 << (key_code & 7)));
+ ret |= !!BitIsOn(pDev->key->down, key_code);
+ if (type & KEY_POSTED)
+ ret |= !!BitIsOn(pDev->key->postdown, key_code);
return ret;
}
@@ -1138,11 +1169,11 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, else {
if (type == ButtonPress) {
event->type = ET_ButtonPress;
- pDev->button->postdown[buttons >> 3] |= (1 << (buttons & 7));
+ set_button_down(pDev, buttons, BUTTON_POSTED);
}
else if (type == ButtonRelease) {
event->type = ET_ButtonRelease;
- pDev->button->postdown[buttons >> 3] &= ~(1 << (buttons & 7));
+ set_button_up(pDev, buttons, BUTTON_POSTED);
}
event->detail.button = buttons;
}
|