xserver-multidpi/xkb
Peter Hutterer 651c36e95e xkb: post-fix PointerKeys button events with a DeviceChangedEvent.
commit 1432785839
    xkb: release XTEST pointer buttons on physical releases. (#28808)
revealed a bug with the XTEST/PointerKeys interaction.

Events resulting from PointerKeys are injected into the event processing
stream, not appended to the event queue. The events generated for the fake
button press include a DeviceChangedEvent (DCE), a raw button event and the
button event itself. The DCE causes the master to switch classes to the
attached XTEST pointer device.

Once the fake button is processed, normal event processing continues with
events in the EQ. The master still contains the XTEST classes, causing some
events to be dropped if e.g. the number of valuators of the event in the
queue exceeds the XTEST device's number of valuators.

Example: the EQ contains the following events, processed one-by-one, left to
right.

[DCE (dev)][Btn down][Btn up][Motion][Motion][...]
                  ^ XkbFakeDeviceButton injects [DCE (XTEST)][Btn up]

Thus the event sequence processed looks like this:

[DCE (dev)][Btn down][Btn up][DCE (XTEST)][Btn up][Motion][Motion][...]

The first DCE causes the master to switch to the device. The button up event
injects a DCE to the XTEST device, causing the following Motion events to be
processed with the master still being on XTEST classes.

This patch post-fixes the injected event sequence with a DCE to restore the
classes of the original slave device, resulting in an event sequence like
this:
[DCE (dev)][Btn down][Btn up][DCE (XTEST)][Btn up][DCE (dev)][Motion][Motion]

Note that this is a simplified description. The event sequence injected by
the PointerKeys code is injected for the master device only and the matching
slave device that caused the injection has already finished processing on
the slave. Furthermore, the injection happens as part of the the XKB layer,
before the unwrapping of the processInputProc takes us into the DIX where
the DCE is actually handled.

Bug reproducible with a device that reports more than 2 valuators. Simply
cause button releases on the device and wait for a "too many valuators"
warning message.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-08-13 11:07:13 +10:00
..
ddxBeep.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
ddxCtrls.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
ddxKillSrv.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
ddxLEDs.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
ddxList.c Remove more superfluous if(p) checks around free(p) 2010-06-11 19:05:46 +07:00
ddxLoad.c xkb: replace xstrdup with strdup in Win32System 2010-06-11 19:05:46 +07:00
ddxPrivate.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
ddxVT.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
Makefile.am xkb: rename XkbFakeDeviceButton and XkbFakeDeviceMotion, move into xkbActions.c 2010-04-19 09:23:20 +10:00
maprules.c Remove more superfluous if(p) checks around free(p) 2010-06-06 20:27:18 +07:00
README.compiled R6.6 is the Xorg base-line 2003-11-14 15:54:54 +00:00
xkb.c xkb: use GetMaster instead of dev->u.master. 2010-07-21 08:12:03 +10:00
xkb.h xkb: move XkbFilterEvents to xkbsrv.h 2009-07-30 08:43:14 +10:00
xkbAccessX.c xkb: release XTEST pointer buttons on physical releases. (#28808) 2010-07-02 08:51:30 +10:00
xkbActions.c xkb: post-fix PointerKeys button events with a DeviceChangedEvent. 2010-08-13 11:07:13 +10:00
XKBAlloc.c Replace deprecated bzero with memset 2010-06-06 15:07:27 +07:00
xkbDflts.h Static markup and dead code cull over xkb/. 2007-03-20 18:37:02 -04:00
xkbEvents.c Set event sequence number in WriteEventsToClient instead of at callers. 2010-05-19 12:32:34 -07:00
xkbfmisc.c Remove unnecessary parentheses around return values in functions 2010-06-10 06:42:42 -07:00
XKBGAlloc.c Remove more superfluous if(p) checks around free(p) 2010-06-11 19:05:46 +07:00
xkbgeom.h xkb: remove some now-useless XFUNCPROTOBEGIN 2009-05-08 14:28:44 +10:00
xkbInit.c Remove more superfluous if(p) checks around free(p) 2010-06-11 19:05:46 +07:00
xkbLEDs.c Remove unnecessary parentheses around return values in functions 2010-06-10 06:42:42 -07:00
XKBMAlloc.c Remove more superfluous if(p) checks around free(p) 2010-06-11 19:05:46 +07:00
XKBMisc.c Replace deprecated bzero with memset 2010-06-06 15:07:27 +07:00
xkbout.c xkb: check for NULL pointer before dereferences it in XkbWriteXKBSymbols 2010-04-21 18:07:25 +03:00
xkbPrKeyEv.c input: don't use typecasts to access members of InternalEvent. 2009-09-22 11:15:32 +10:00
xkbSwap.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
xkbtext.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
xkbUtils.c xkb: merge lockedPtrButtons state from all attached SDs. 2010-07-01 14:05:39 +10:00
XKM_file_format.txt xkb: Add XKM file format description. 2010-02-02 10:03:21 +10:00
xkmread.c Replace deprecated bzero with memset 2010-06-06 15:07:27 +07:00

The X server uses this directory to store the compiled version of the
current keymap and/or any scratch keymaps used by clients.  The X server
or some other tool might destroy or replace the files in this directory,
so it is not a safe place to store compiled keymaps for long periods of
time.  The default keymap for any server is usually stored in:
     X<num>-default.xkm
where <num> is the display number of the server in question, which makes
it possible for several servers *on the same host* to share the same 
directory.

Unless the X server is modified, sharing this directory between servers on
different hosts could cause problems.