Bug 12858

Summary: Keyboard events tend to escape.
Product: xorg Reporter: Naoki Hamada <nao>
Component: * OtherAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: high CC: brice.goglin, sndirsch, wouter-freedesktop
Version: 7.3 (2007.09)Keywords: patch
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 12560    

Description Naoki Hamada 2007-10-19 04:07:02 UTC
Letters and modifiers are often lost, particularly if you type fast.
The following patch remedies the symptom.

diff -ur xorg-server-1.4.orig/dix/getevents.c xorg-server-1.4/dix/getevents.c
--- xorg-server-1.4.orig/dix/getevents.c        Thu Sep  6 09:47:48 2007
+++ xorg-server-1.4/dix/getevents.c     Fri Oct 19 16:56:09 2007
@@ -95,7 +95,7 @@
 static Bool
 key_is_down(DeviceIntPtr pDev, int key_code)
 {
-    return pDev->key->postdown[key_code >> 3] >> (key_code & 7);
+    return pDev->key->postdown[key_code >> 3] & (1 << (key_code & 7));
 }

 /**
Comment 1 Jürg Billeter 2007-10-19 05:36:15 UTC
Thanks for the patch. This is possibly a duplicate of bug 12509.
Comment 2 Samuel Tardieu 2007-10-20 03:48:54 UTC
*** Bug 12509 has been marked as a duplicate of this bug. ***
Comment 3 Samuel Tardieu 2007-10-20 03:50:17 UTC
Relation of duplication changed, because this one has a working fix (tested and confirmed on my machines).
Comment 4 Daniel Stone 2007-10-25 08:46:41 UTC
pushed to master and input-fixes-for-1.4.1, thanks.
Comment 5 Stefan Dirsch 2007-11-12 09:48:22 UTC
*** Bug 13198 has been marked as a duplicate of this bug. ***
Comment 6 Stefan Dirsch 2007-11-13 00:57:03 UTC
Additional comment by an affected ALSA developer (Takashi Iwai <tiwai@suse.de>):

"Thanks. I think

    return (pDev->key->postdown[key_code >> 3] >> (key_code & 7)) & 1;

would be a better fix.  Then the value is either 0 or 1.  The current
code returns zero or non-zero."
Comment 7 Daniel Stone 2007-11-13 03:50:26 UTC
I already did that when I committed:
+    return !!(pDev->key->postdown[key_code >> 3] & (1 << (key_code & 7)));
Comment 8 Daniel Stone 2007-11-17 13:44:36 UTC
(already fixed in master, now cherry-picked to 1.4 branch.)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.