aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-07-07 09:37:20 +0000
committermarha <marha@users.sourceforge.net>2010-07-07 09:37:20 +0000
commit3dd9390c49402534bc391f621a6b0f497a9407f7 (patch)
treebc5cd4665a525dbc9550292ad393fa0e5590c4a1 /xorg-server/dix
parenta31abc5ff6da849ed1ac579a1c905d16ffaafcc7 (diff)
parent5da15e274b35656568f59602f2e3fd00d5718879 (diff)
downloadvcxsrv-3dd9390c49402534bc391f621a6b0f497a9407f7.tar.gz
vcxsrv-3dd9390c49402534bc391f621a6b0f497a9407f7.tar.bz2
vcxsrv-3dd9390c49402534bc391f621a6b0f497a9407f7.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/events.c12
-rw-r--r--xorg-server/dix/getevents.c49
2 files changed, 43 insertions, 18 deletions
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index db5aab1a9..115bce82b 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -3943,13 +3943,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
void
FixKeyState (DeviceEvent *event, DeviceIntPtr keybd)
{
- int key, bit;
- BYTE *kptr;
- KeyClassPtr keyc = keybd->key;
-
- key = event->detail.key;
- kptr = &keyc->down[key >> 3];
- bit = 1 << (key & 7);
+ int key = event->detail.key;
if (event->type == ET_KeyPress) {
DebugF("FixKeyState: Key %d %s\n",key,
@@ -3957,9 +3951,9 @@ FixKeyState (DeviceEvent *event, DeviceIntPtr keybd)
}
if (event->type == ET_KeyPress)
- *kptr |= bit;
+ set_key_down(keybd, key, KEY_PROCESSED);
else if (event->type == ET_KeyRelease)
- *kptr &= ~bit;
+ set_key_up(keybd, key, KEY_PROCESSED);
else
FatalError("Impossible keyboard event");
}
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;
}