XTestFakeKeyEvent changes keyboard mapping to 'us'

Bug #837456 reported by marmuta
This bug affects 17 people
Affects Status Importance Assigned to Milestone
xorg-server (Ubuntu)

Bug Description

Typing with the onscreen keyboard Onboard on a system with German default layout immediately switches the keyboard layout to 'English (US)'. Touching any key on a physical keyboard switches back to the German default. This can be repeated indefinitely.

Onboard uses XTestFakeKeyEvent to send key events. When switching from a physical keyboard to Onboard, the first call to this function leads to an unwanted MappingNotify event and the keyboard map changes from 'pc+de+inet(evdev)', 'German' to 'pc+us+inet(evdev)', 'English (US)'. Pressing any key on an attached USB keyboard switches back to 'pc+de+inet(evdev)', 'German'.

Running any of the following temporarily fixes the problem for the current session:
$ setxkbmap de
$ sudo dpkg-reconfigure keyboard-configuration

Restarting X brings back the unwanted layout switches.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: xorg 1:7.6+7ubuntu6
ProcVersionSignature: Ubuntu 3.0.0-9.14-generic 3.0.3
Uname: Linux 3.0.0-9-generic x86_64
Architecture: amd64
CompizPlugins: [core,bailer,detection,composite,opengl,decor,mousepoll,vpswitch,regex,animation,snap,expo,move,compiztoolbox,place,grid,imgpng,gnomecompat,wall,ezoom,workarounds,resize,fade,unitymtgrabhandles,scale,session,unityshell]
CompositorRunning: compiz
Date: Tue Aug 30 16:21:46 2011
DistUpgraded: Fresh install
DistroCodename: oneiric
DistroVariant: ubuntu
ExtraDebuggingInterest: Yes, whatever it takes to get this fixed in Ubuntu
 Intel Corporation 82G33/G31 Express Integrated Graphics Controller [8086:29c2] (rev 10) (prog-if 00 [VGA controller])
   Subsystem: Foxconn International, Inc. Device [105b:0df0]
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Alpha amd64 (20110826)
MachineType: OEM OEM
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.0.0-9-generic root=UUID=3bee4cb7-392a-4347-a496-f32c7141e658 ro quiet splash vt.handoff=7
SourcePackage: xorg
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 09/04/2008
dmi.bios.vendor: Phoenix Technologies, LTD
dmi.bios.version: 6.00 PG
dmi.board.name: G31MG-S
dmi.board.vendor: Foxconn
dmi.board.version: FAB:1.0
dmi.chassis.type: 3
dmi.chassis.vendor: OEM
dmi.chassis.version: OEM
dmi.modalias: dmi:bvnPhoenixTechnologies,LTD:bvr6.00PG:bd09/04/2008:svnOEM:pnOEM:pvrOEM:rvnFoxconn:rnG31MG-S:rvrFAB1.0:cvnOEM:ct3:cvrOEM:
dmi.product.name: OEM
dmi.product.version: OEM
dmi.sys.vendor: OEM
version.compiz: compiz 1:
version.ia32-libs: ia32-libs N/A
version.libdrm2: libdrm2 2.4.26-1ubuntu1
version.libgl1-mesa-dri: libgl1-mesa-dri 7.11-0ubuntu3
version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
version.libgl1-mesa-glx: libgl1-mesa-glx 7.11-0ubuntu3
version.xserver-xorg: xserver-xorg 1:7.6+7ubuntu6
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev 1:2.6.0-1ubuntu13
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:6.14.99~git20110811.g93fc084-0ubuntu1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.15.901-1ubuntu2
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:0.0.16+git20110411+8378443-1

Revision history for this message
marmuta (marmuta) wrote :
Revision history for this message
marmuta (marmuta) wrote :

xev log of pressing the space bar once in Onboard and another time on an USB keyboard. Note unexpected MappingNotify events before the two KeyPress events.

Revision history for this message
marmuta (marmuta) wrote :

FWIW, here is a gdb backtrace with a break point set on XkbSendLegacyMapNotify, probably the source of the MappingNotify event. Apparently the keyboard device changes from physical to on-screen keyboard and the two devices don't share the same keyboard map (?).

summary: - [Oneiric] XTestFakeKeyEvent changes kayboard mapping to 'us'
+ [Oneiric] XTestFakeKeyEvent changes keyboard mapping to 'us'
Changed in xorg (Ubuntu):
status: New → Confirmed
bugbot (bugbot)
affects: xorg (Ubuntu) → xserver-xorg-input-evdev (Ubuntu)
Timo Aaltonen (tjaalton)
affects: xserver-xorg-input-evdev (Ubuntu) → xorg-server (Ubuntu)
Revision history for this message
Dave Jones (waveform) wrote : Re: [Oneiric] XTestFakeKeyEvent changes keyboard mapping to 'us'

This appears to affect anything which uses XTestFakeKeyEvent. For example, I use KeePassX, a password database with auto-type functionality (apparently implemented with XTestFakeKeyEvent). My keyboard is set to United Kingdom, yet when I use auto-type with (for example) a username including an ampersand (<email address hidden>) the ampersand becomes a double-quote (i.e. it enters someone"somewhere.org instead - the double-quote on a US keyboard is where the ampersand is on a UK keyboard). From reading a couple of forum posts it would appear Synergy (a cross-platform keyboard/mouse sharing application) is affected as well.

The "setxkbmap" workaround mentioned in the report fixes the issue temporarily for KeePassX (and apparently Synergy), but it would be nice to have something more permanent. I first noticed this with Oneiric (auto-type worked fine under Lucid, Maverick and Natty).

Revision history for this message
Christoph Korn (c-korn) wrote :

I have exactly the same problem with KeePassX in oneiric. The setxkbmap workaround works. But how can this command been run automatically?

Revision history for this message
JB5 (sir-bunt) wrote :

KeepassX exhibits the same behaviour for me in 11.10 (64 bit) (English UK - keyboard layout).
Specifically the @ and " symbols are transposed when using KepassX's Auto-type function.

Another workaround is to add a second keyboard layout to the keyboard preferences, (any layout will do); Auto-type then works as expected. (At least it does for me!)

To add a second keyboard layout :-→

System Settings - Keyboard layout - Hit the " + " button (bottom left of window pane) - select another keyboard layout.

[May have to log out/in again this to work.]

Revision history for this message
Bryce Harrington (bryce) wrote :

Hey marmuta,

Hi, thanks for reporting this issue during the development period of

I notice there's not been further comments to the bug report since the
release came out, would you mind updating us on the status of it in the

Are you still able to reproduce the issue? If not, do you think the bug
report can be closed, or do you think we should continue tracking it?

Changed in xorg-server (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Frederik Elwert (frederik-elwert) wrote :

I can confirm that this is still an issue with the current release of Ubuntu and onboard. I am using a German keyboard layout, and onboard still switches to a default layout when typing any key. The "setxkbmap" workaround does indeed work for the current session.

Changed in xorg-server (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
marmuta (marmuta) wrote :

Confirming too. I've tested my freshly updated Oneiric installs and the layout switches are still occurring for Onboard and kvkbd.
Other distributions appear to be affected too, I've seen this happening with Onboard on Mandriva 2011 (under KDE) recently.

Revision history for this message
burli (mb-embedit) wrote :

It does not happen if you just add a second keyboard layout. My default layout is de and I just add en to the system settings. Now Onboard always uses the German layout.

Revision history for this message
Frederik Elwert (frederik-elwert) wrote :

I can confirm both this bug and burli’s workaround with current Precise.

Revision history for this message
Francesco Fumanti (frafu) wrote :

Could you please tell us whether you still get the correct layout with your work around after restarting the computer without doing any new manipulation in the keyboard settings?

I have three layouts defined without the US layout; when I change something in the keyboard settings, I get the correct layout; however, after restarting the computer, Onboard displays the US layout.

Revision history for this message
Francesco Fumanti (frafu) wrote :

I added the US layout to my three layouts and Onboard showed the correct layout, even after restarting the computer.

Then I removed the US layout from my layouts lists in the keyboard settings pane of the System Settings and Onboard continued to show the correct layout.

Afterwards I clicked on the "Restore to Defaults" button, and restarted the computer. Onboard showed again the US layout, even if it was not in the list with my layouts.

Revision history for this message
JB5 (sir-bunt) wrote :

Auto-type replacing @ with " for UK keyboard seems to be fixed in PP-12.04 Beta 1.

Linux ERIC 3.2.0-19-generic #30-Ubuntu SMP Fri Mar 16 16:27:15 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
KeePassX 0.4.3

No need for second keyboard workaround anymore.

Revision history for this message
mrDoctorWho (mrdoctorwho) wrote :

Also exists in Precise and Quantal

Revision history for this message
mrDoctorWho (mrdoctorwho) wrote :

I'm sorry for asking, but bug reported one year ago. Why its not fixed? I think that it's high importance bug, because while it not fixed many people can't use onscreen keyboard like Onboard or Florence.

tags: added: i386 raring
tags: added: xfce xfwm4
Revision history for this message
Krzisch (krzisch-claude-t) wrote :

The same one exists in Trusty Tahr ... Some two years ago

Changed in xorg-server (Ubuntu):
importance: Undecided → High
summary: - [Oneiric] XTestFakeKeyEvent changes keyboard mapping to 'us'
+ XTestFakeKeyEvent changes keyboard mapping to 'us'
Mathew Hodson (mhodson)
tags: removed: i386 raring ubuntu xfce xfwm4
Revision history for this message
Arturo Espinosa (arturoea-u) wrote :

Hi. I can confirm this situation on Lubuntu 17.10 with onboard-1.4.1-2ubuntu1 installed and Spanish keyboard configured (localectl set-keymap es). No need for clients generating synthetic keyboard events: just using onboard, any key, will switch it back to 'us' layout. Same: any physical keyboard usage will switch the system back to the correct layout.

This is a quite barebones installation for a kiosk; I'm not using fcitx nor any other fancy IM subsystem. Before removing fcitx, I didn't notice this bug. It seems like fcitx kept onboard at bay.

Issuing setxkbmap es at the start of the session (in my case in ~/.config/lxsession/Lubuntu/autostart) fixed the problem AFAICT.

Otherwise, I'm VERY happy with onboard and its flexibility. So far I have been able to overcome all of its quirks and take advantage of its power, without any need to patch the code. We have custom layout, theme and colors. Again, very happy with it.

Revision history for this message
Thomas Raffler (thomas-rafflers) wrote :

I can confirm this bug with Manjaro (xorg-server 1.20.3-1, KDE 5.14.5) and onboard-1.4.1-4. The Workaround 'setxkbmap de' is ok for my needs, but I'd rather help to fix the bug...

Revision history for this message
Tobias Schlemmer (keinstein-junior) wrote :

I found this issue in the X.org bug tracker:


I think further discussion should go on, there.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.