XTestFakeKeyEvent broken in Xvfb
Submitted by Clemens Eisserer
Assigned to Xorg Project Team
Description
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
Version: 6.8.2