I've found the solution to a long-standing problem, which for example
afflicted users of Sawfish WM. Under certain conditions (in fact during a long
enough sync key/board grab), some keys were repeated:


Explanation:
============

1/ XKB-enabled Xfree86 implements key-repeating in software (w/ timers). When a
hardware Key Release arrives, the software timer is canceled.


2/ 
Xfree86 implements key(board) grabs in GrabModeSync by switching a pointer

dev->public.processInputProc

to either
   dev->public.enqueueInputProc  ... events are put in a queue for later processing
or                     
   dev->public.realInputProc



The problem is, that the public.enqueueInputProc (which is EnqueueEvent() in
xc/programs/Xserver/dix/events.c) does not invoke function
AccessXCancelRepeatKey(), which cancels the timer. 


So, if during Sync grab, key Release is signalled/read from kernel(hardware), the
timer is not cancelled. Therefore it is run (later), and generates a pair of
Release/Press events, and reschedules itself (so it can result in many incorrect key
events).


Fix:
====

I've made a _quick_ fix, basically adding into the EnqueueEvent():

    if (xE->u.u.type==KeyRelease)
       AccessXCancelRepeatKey(xkbi,key);


I will continue reviewing the related code, but i'm very new to xfree86 sources,
so others' opinion would help.


Michal Maruska

-- 

http://maruska.dyndns.org
http://maruska.dyndns.org/comp/
_______________________________________________
XFree86 mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xfree86

Reply via email to