diff options
author | marha <marha@users.sourceforge.net> | 2010-06-16 07:28:49 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-06-16 07:28:49 +0000 |
commit | 2a31e38d82566c4f93773ecf9c79f2cc9abef169 (patch) | |
tree | ab9cdebe56affbbad49351f5e8557058673efcc1 /xorg-server/hw/kdrive/ephyr | |
parent | 6753f87d9a6be8dcab916b479a0a122b1b375298 (diff) | |
download | vcxsrv-2a31e38d82566c4f93773ecf9c79f2cc9abef169.tar.gz vcxsrv-2a31e38d82566c4f93773ecf9c79f2cc9abef169.tar.bz2 vcxsrv-2a31e38d82566c4f93773ecf9c79f2cc9abef169.zip |
xserver and libxcb git update 11/6/2010
Diffstat (limited to 'xorg-server/hw/kdrive/ephyr')
-rw-r--r-- | xorg-server/hw/kdrive/ephyr/ephyr.c | 107 |
1 files changed, 45 insertions, 62 deletions
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c index 8ed97d614..315f68340 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyr.c +++ b/xorg-server/hw/kdrive/ephyr/ephyr.c @@ -38,6 +38,8 @@ #include "ephyrglxext.h"
#endif /* XF86DRI */
+#include "xkbsrv.h"
+
extern int KdTsPhyScreen;
#ifdef GLXEXT
extern Bool noGlxVisualInit;
@@ -748,75 +750,55 @@ ephyrScreenFini (KdScreenInfo *screen) void
ephyrUpdateModifierState(unsigned int state)
{
-#if 0
- DeviceIntPtr pkeydev;
- KeyClassPtr keyc;
- int i;
- CARD8 mask;
-
- pkeydev = inputInfo.keyboard;
- if (!pkeydev)
- return;
+ DeviceIntPtr pDev = inputInfo.keyboard;
+ KeyClassPtr keyc = pDev->key;
+ int i;
+ CARD8 mask;
+ int xkb_state;
-/* This is pretty broken.
- *
- * What should happen is that focus out should do as a VT switch does in
- * traditional servers: fake releases for all keys (and buttons too, come
- * to think of it) currently down. Then, on focus in, get the state from
- * the host, and fake keypresses for everything currently down.
- *
- * So I'm leaving this broken for a little while. Sorry, folks.
- *
- * -daniels
- */
+ if (!pDev)
+ return;
- keyc = pkeydev->key;
-
+ xkb_state = XkbStateFieldFromRec(&pDev->key->xkbInfo->state);
state = state & 0xff;
-
- if (keyc->state == state)
+
+ if (xkb_state == state)
return;
-
- for (i = 0, mask = 1; i < 8; i++, mask <<= 1)
- {
- int key;
- /* Modifier is down, but shouldn't be */
- if ((keyc->state & mask) && !(state & mask))
- {
- int count = keyc->modifierKeyCount[i];
-
- for (key = 0; key < MAP_LENGTH; key++)
- if (keyc->xkbInfo->desc->map->modmap[key] & mask)
- {
- int bit;
- BYTE *kptr;
-
- kptr = &keyc->down[key >> 3];
- bit = 1 << (key & 7);
-
- if (*kptr & bit && ephyrKbd &&
- ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
- KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE); /* release */
-
- if (--count == 0)
- break;
- }
- }
-
- /* Modifier shoud be down, but isn't */
- if (!(keyc->state & mask) && (state & mask))
- for (key = 0; key < MAP_LENGTH; key++)
- if (keyc->xkbInfo->desc->map->modmap[key] & mask)
- {
- if (keyc->xkbInfo->desc->map->modmap[key] & mask && ephyrKbd &&
- ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
- KdEnqueueKeyboardEvent(ephyrKbd, key, FALSE); /* press */
- break;
- }
+ for (i = 0, mask = 1; i < 8; i++, mask <<= 1) {
+ int key;
+
+ /* Modifier is down, but shouldn't be
+ */
+ if ((xkb_state & mask) && !(state & mask)) {
+ int count = keyc->modifierKeyCount[i];
+
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
+ int bit;
+ BYTE *kptr;
+
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+
+ if (*kptr & bit)
+ KdEnqueueKeyboardEvent (ephyrKbd, key, TRUE);
+
+ if (--count == 0)
+ break;
+ }
}
-#endif
+
+ /* Modifier shoud be down, but isn't
+ */
+ if (!(xkb_state & mask) && (state & mask))
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
+ KdEnqueueKeyboardEvent (ephyrKbd, key, FALSE);
+ break;
+ }
+ }
}
static void
@@ -998,6 +980,7 @@ ephyrPoll(void) if (!ephyrKbd ||
!((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
continue;
+ ephyrUpdateModifierState(ev.key_state);
KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE);
break;
|