[PATCH 3/3] dix: purge leftover manual key down bit setting.

Peter Hutterer peter.hutterer at who-t.net
Mon Jul 5 16:32:05 PDT 2010


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/events.c                   |   12 +++---------
 hw/dmx/input/atKeynames.h      |    2 --
 hw/kdrive/ephyr/ephyr.c        |    8 +-------
 hw/xfree86/common/xf86Events.c |    4 +---
 hw/xnest/Keyboard.c            |    8 +-------
 hw/xwin/winkeynames.h          |    1 -
 6 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index e1c3d0a..07f7b1f 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3937,13 +3937,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,
@@ -3951,9 +3945,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/hw/dmx/input/atKeynames.h b/hw/dmx/input/atKeynames.h
index e632ca2..6aea1ed 100644
--- a/hw/dmx/input/atKeynames.h
+++ b/hw/dmx/input/atKeynames.h
@@ -66,8 +66,6 @@
 #define KanaMask	Mod4Mask
 #define ScrollLockMask	Mod5Mask
 
-#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
-
 /*
  * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
  *       sets of scancodes. Set3 can only be generated by a MF keyboard.
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index bd7deed..8096a24 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -776,13 +776,7 @@ ephyrUpdateModifierState(unsigned int state)
 
       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)
+          if (key_is_down(pDev, key, KEY_PROCESSED))
 	        KdEnqueueKeyboardEvent (ephyrKbd, key, TRUE);
 
           if (--count == 0)
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 2ff77c6..2e82848 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -372,8 +372,6 @@ xf86PrintBacktrace(void)
     xorg_backtrace();
 }
 
-#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
-
 static void
 xf86ReleaseKeys(DeviceIntPtr pDev)
 {
@@ -399,7 +397,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
     for (i = keyc->xkbInfo->desc->min_key_code;
          i < keyc->xkbInfo->desc->max_key_code;
          i++) {
-        if (KeyPressed(i)) {
+        if (key_is_down(pDev, i, KEY_POSTED)) {
             sigstate = xf86BlockSIGIO ();
             nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
             for (j = 0; j < nevents; j++)
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index 570866b..ec629dc 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -231,13 +231,7 @@ xnestUpdateModifierState(unsigned int state)
 
       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)
+	  if (key_is_down(pDev, key, KEY_PROCESSED))
 	    xnestQueueKeyEvent(KeyRelease, key);
 
 	  if (--count == 0)
diff --git a/hw/xwin/winkeynames.h b/hw/xwin/winkeynames.h
index 7c16337..3d59383 100644
--- a/hw/xwin/winkeynames.h
+++ b/hw/xwin/winkeynames.h
@@ -38,7 +38,6 @@
 #define KanaMask	Mod4Mask
 #define ScrollLockMask	Mod5Mask
 
-#define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7)))
 #define ModifierDown(k) ((keyc->state & (k)) == (k))
 
 /*
-- 
1.7.1



More information about the xorg-devel mailing list