Bug 4761 - XTestFakeKeyEvent broken in Xvfb
Summary: XTestFakeKeyEvent broken in Xvfb
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/DDX/Xvfb (show other bugs)
Version: 6.8.2
Hardware: x86 (IA32) Linux (All)
: high major
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
Whiteboard: 2011BRB_Reviewed
Depends on:
Reported: 2005-10-13 00:52 UTC by Clemens Eisserer
Modified: 2018-12-13 18:31 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:

Test-case (60.88 KB, application/x-tar)
2005-10-13 00:56 UTC, Clemens Eisserer
no flags Details

Description Clemens Eisserer 2005-10-13 00:52:49 UTC
It is not possible to reliable simulate key-events when running in Xvfb, whereas
a "native" X-Server does not cause any problems.
Some key-events are received by the client-application twice, others
get completly lost.

I first thought this is a specific problem of the library I used for
this task (java.awt.Robot class in java) and wrote my own library in
plain C using XTest which is heavily based on the code of Xvkbd-2.7 and
it shows exactly the same sympthoms. If I insert a wait of 200ms after
each key everything works like expected with both libraries (100ms do
not work).

For my testing I used Xvfb delivered with Xorg-6.8.2, running with the
following flags:
Xvfb :1 -screen :1 500x1000x24 -fbdir /tmp/

I attached a a test-case which is derivated from xkdbd-2.7 which shows the
problem (have a look at main() of CRobot.c) and a simple bash-script to compile
the test-case.
Note: Although the Xtest-code is really ugly hacked withought any deep knowledge
whats going on behind the scenes (thats why I unmap Xkdbd's main-window
immediatly after creating it instead of not mapping it at all) I think its a bug
in Xvfb since I had absolutly the same problems when using java.awt.Robot from
Java which does only provide low-level keyPressed/keyReleased methods.
Note that this problem sometimes shows up and sometimes not.

I already tried to find it myself, however I think I lack too much x knowledge :-(

Good luck with fixing it, lg Clemens
Comment 1 Clemens Eisserer 2005-10-13 00:56:11 UTC
Created attachment 3552 [details]

modified xvfkbd-source, see main() in CRobot.c
Comment 2 Clemens Eisserer 2005-10-13 00:57:02 UTC
btw. if needed I could also create a testcase written in java using the
java.awt.Robot class which shows the same problem independent of the ugly hacked
code testcase I've submitted. 
Comment 3 Daniel Stone 2007-02-27 01:28:27 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 4 Clemens Eisserer 2009-03-17 12:26:17 UTC
wow, this was 3,5y ago :-/
Comment 5 Clemens Eisserer 2011-10-31 02:01:09 UTC
can't believe it - I filed this bug 6 years ago ;)
Comment 6 Jeremy Huddleston Sequoia 2011-10-31 16:42:21 UTC
This is not a bug with the keyboard driver.  Xvfb doesn't even use the keyboard 

Do you have the problem when using teh Xorg DDX with the xf86-video-nested 
Comment 7 GitLab Migration User 2018-12-13 18:31:08 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/191.

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.