[Needs xkb protocol rework] keyboard layout switching shortcuts like Alt+Alt do not work anymore

Bug #251443 reported by Simos Xenitellis 
162
This bug affects 24 people
Affects Status Importance Assigned to Milestone
Ubuntu
Unknown
High
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Bryce Harrington
Declined for Karmic by Bryce Harrington
Declined for Lucid by Bryce Harrington
xorg-server (Ubuntu)
Invalid
Wishlist
Unassigned
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Bryce Harrington
Declined for Karmic by Bryce Harrington
Declined for Lucid by Bryce Harrington

Bug Description

Binary package hint: xorg

(Bug #196277 used to cover two separate but similar looking bugs. We split them now, and here we describe one of the two bugs. The other bug has to do with autologin, which when enabled, ignores any keyboard layout settings that have been configured in GNOME, the graphical interface).

In the keyboard layout preferences, you can set "Both alt keys together change layout", which worked in Gutsy for toggling between keyboard layouts.

Currently:
* "both alt keys..." does not toggle keyboard layouts
* "both ctrl keys..." does not toggle keyboard layouts
* "both shift keys..." works fine
* "Alt+shift" works fine

Steps to reproduce it are:
* Visit System->Preferences->Keyboard-Layouts
* Press Add and add a new layout.
* Close preferences.
* Open Text Editor or whatever you want and write something with Double-Alts it switch layout and writes with the other layout
OK till now.
* Reboot.
* Open a text editor and try to switch layout... Boom! It doesn't work!

Temporary Workaround. Open Layouts again and remove/add the second layout to start working again.

another workaround using a script: https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/196277/comments/60

The text in the applet will change, to make it appear to be setting the correct layout, but the changes do not take effect.
Actually shortcut doesn't work at all, I set to be alts toggle in keyboard preferences, and it doesn't work, another thing is that even with keyboard indicator applet you change language, it doesn't changes, name in the applet changes, but it doesn't work. I need to open keyboard preferences, layout options, remove the tick and then put it back on keyboard layout switching shortcut.. As I said, shortcut doesn't work after this, but applet starts to change the layout, not only letters on itself.

This issue has been sufficiently confirmed. Please do not comment on this bug unless you have some information that will help solve the bug.

[Background]
Both Canonical and upstream are aware of this issue and consider it of high importance. Unfortunately, the root cause is not something that can be easily fixed.

The issue is that to solve this problem, we need to have a way to save the ExplicitVModMapMask, which is tracked okay in memory but not when the configuration is passed via XKM binary files, because the XKM binary file format simply doesn't have a field for storing the VModMask flag data. The XKM file format allows only 8 flags to be set, and there are already 8 defined. See the upstream bug report for details: https://bugs.freedesktop.org/show_bug.cgi?id=4927

Upstream's proposed solution to the problem is to remove the xkbcomp design and the xkm file format entirely, and switch to new X input technologies. This will be a fairly sizeable re-architecting effort, and will take time to complete. If you would like to help contribute to this solution for this problem, please work with Sergey Udaltsov.

Revision history for this message
In , Daniel Stone (daniels) wrote :

xkm sucks

Revision history for this message
In , Sergey V. Udaltsov (svu) wrote :

let's drop this crap from xorg code:)

Revision history for this message
In , Daniel Stone (daniels) wrote :

Sorry about the phenomenal bug spam, guys. Adding xorg-team@ to the QA contact so bugs don't get lost in future.

Revision history for this message
In , Sergey V. Udaltsov (svu) wrote :

This problem is very visible now - the default GNOME switcher Alt-Alt is broken - because virtual modifiers RAlt/LAlt are not passed to X server. Any plans to fix it in the nearest future?

Revision history for this message
In , aldebx (aldebx) wrote :

This bug has also been reported on launchpad.net:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-keyboard/+bug/203991

Are there any chances to have this bug fixed before Ubuntu 8.04 LTS release?
Thanks

Revision history for this message
In , Sergey V. Udaltsov (svu) wrote :

8.04? I would humbly estimate it as very-very close to zero.

Revision history for this message
In , Daniel Stone (daniels) wrote :

flags is just a CARD8, so we can't fix this without breaking wire format, so this will only get solved when we dump xkbcomp, sadly.

Revision history for this message
In , Sergey V. Udaltsov (svu) wrote :

I am reopening the bug. It is actually LATER - once 15540 is fixed, this one is fixed automatically

Revision history for this message
In , Daniel Stone (daniels) wrote :

sorry, not happening for 7.4 due to dependency on #15540.

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

Sergey/Daniel, could you please provide pointers to a todo list or discussion/plan of what needs to be done to move this and/or #15540 forward, esp. things other folks could do to help contribute to a solution?

Also, are there any potential hacks/workarounds that we could investigate as temporary workarounds at the distro level? (E.g. such as appending another CARD32 flags variable at the end of the data file.)

Revision history for this message
In , Daniel Stone (daniels) wrote :

On Tue, Jun 17, 2008 at 02:15:18PM -0700, <email address hidden> wrote:
> --- Comment #10 from Bryce Harrington <email address hidden> 2008-06-17 14:15:17 PST ---
> Sergey/Daniel, could you please provide pointers to a todo list or
> discussion/plan of what needs to be done to move this and/or #15540 forward,
> esp. things other folks could do to help contribute to a solution?

The main thing to be done in rewriting xkbcomp is to rewrite xkbcomp.

> Also, are there any potential hacks/workarounds that we could investigate as
> temporary workarounds at the distro level? (E.g. such as appending another
> CARD32 flags variable at the end of the data file.)

At the expense of breaking every statically-linked application, everything
run from within a chroot, everything run remotely, and everything else
that just conforms to the spec, you could bump flags from CARD8 to
CARD16, yes.

Revision history for this message
In , Ansus (neptunia) wrote :

Hey guys why simply not to rollback to the previous versions of the software before the issue is resolved? My Fedora 9 worked well until it got updated. Why not simply prohibit updating of certain packages?

Also note that it can be made a post-install script/GUI tool to write the preferences directly to xorg.conf, which solution is proven to work.

Revision history for this message
In , Sergey V. Udaltsov (svu) wrote :

There is no "previous version" here. This problem was always there (somewhat hidden except for exotic configs). But it came to surface recently, when xkeyboard-config fixed another bug - and made this bug visible. Reverting xkeyboard-config code is not an option - it will return another bug. And since the current code over in xk-c is correct, I prefer to keep this bug visible (till it is fixed) rather than reverting to the broken code which, as a side affect, exposes another bug.

Revision history for this message
Simos Xenitellis  (simosx) wrote : keyboard layout switching shortcuts like Alt+Alt do not work anymore

Binary package hint: xorg

(Report https://bugs.edge.launchpad.net/ubuntu/+source/xorg/+bug/196277 used to cover two separate but similar looking bugs. We split them now, and here we describe one of the two bugs. The other bug has to do with autologin, which when enabled, ignores any keyboard layout settings that have been configured in GNOME, the graphical interface).

In the keyboard layout preferences, you can set "Both alt keys together change layout", which worked in Gutsy for toggling between keyboard layouts.

Currently:
* "both alt keys..." does not toggle keyboard layouts
* "both ctrl keys..." does not toggle keyboard layouts
* "both shift keys..." works fine
* "Alt+shift" works fine

Steps to reproduce it are:
* Visit System->Preferences->Keyboard-Layouts
* Press Add and add a new layout.
* Close preferences.
* Open Text Editor or whatever you want and write something with Double-Alts it switch layout and writes with the other layout
OK till now.
* Reboot.
* Open a text editor and try to switch layout... Boom! It doesn't work!

Temporary Workaround. Open Layouts again and remove/add the second layout to start working again.

another workaround using a script: https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/196277/comments/60

The text in the applet will change, to make it appear to be setting the correct layout, but the changes do not take effect.
Actually shortcut doesn't work at all, I set to be alts toggle in keyboard preferences, and it doesn't work, another thing is that even with keyboard indicator applet you change language, it doesn't changes, name in the applet changes, but it doesn't work. I need to open keyboard preferences, layout options, remove the tick and then put it back on keyboard layout switching shortcut.. As I said, shortcut doesn't work after this, but applet starts to change the layout, not only letters on itself.

This issue has been sufficiently confirmed. Please do not comment on this bug unless you have some information that will help solve the bug.

[Background]
Both Canonical and upstream are aware of this issue and consider it of high importance. Unfortunately, the root cause is not something that can be easily fixed.

The issue is that to solve this problem, we need to have a way to save the ExplicitVModMapMask, which is tracked okay in memory but not when the configuration is passed via XKM binary files, because the XKM binary file format simply doesn't have a field for storing the VModMask flag data. The XKM file format allows only 8 flags to be set, and there are already 8 defined. See the upstream bug report for details: https://bugs.freedesktop.org/show_bug.cgi?id=4927

Upstream's proposed solution to the problem is to remove the xkbcomp design and the xkm file format entirely, and switch to new X input technologies. This will be a fairly sizeable re-architecting effort, and will take time to complete. If you would like to help contribute to this solution for this problem, please work with Sergey Udaltsov.

Changed in xorg:
status: New → Confirmed
Changed in xorg-server:
status: Unknown → Confirmed
description: updated
Revision history for this message
In , Avg (avg) wrote :

Sergey, just out of curiosity, could you point to xkeyboard-config bug or change that provoked this bug? Anything will do - a bug, a commit, a description.
Thank you.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

On Fri, Aug 22, 2008 at 05:12:08AM -0700, <email address hidden> wrote:
> --- Comment #14 from Andriy Gapon <email address hidden> 2008-08-22 05:12:07 PST ---
> Sergey, just out of curiosity, could you point to xkeyboard-config bug or
> change that provoked this bug? Anything will do - a bug, a commit, a
> description.
> Thank you.

a8551efb70 in xkeyboard-config

Revision history for this message
Abra Kadabra (psihodelia) wrote : Re: keyboard layout switching shortcuts like Alt+Alt do not work anymore

I have the same problem after I have updated to:

1) new kernel 2.6.24-21-generic
2) new NVIDIA GLX drivers

So, I suppose that smth. is wrong with NVIDIA

Can you please solve this problem as soon as possible. It is absolutely impossible for us now to work properly. We are looking now for more stable Linux distribution, because Ubuntu with Gnome has a lot of surprises. For example, boot splash screen is no more in graphics mode - it goes in graphics, then in text (but there is no errors).

Revision history for this message
Abra Kadabra (psihodelia) wrote :

I have solved this problem by:

sudo aptitude purge preload

So, I think it was preload package that caused this issue with Gnome Keyboard Layout.

Revision history for this message
Michael Nagel (nailor) wrote :

cannot confirm the suggested fix with purging preload. i have never had preload installed (plus i purged it, to be sure). and the issue persists.

Revision history for this message
jowi (mail-jwidmer) wrote :

I'm facing the same problem. The suggested "preload" fix doesn't help. Plus I have an addition to make:

Generally, the layout can be switched either using the hot-keys or by clicking on the keyboard indicator.
As described, after reboot the hot-keys (like Alt+Alt) don't work any more. Then I switch the layout by clicking on the indicator, then the alternative layout ("Cze" for Czech Default in my case) is displayed correctly, but then the behaviour is completely odd: The keys behave as if I would permanently press the "Alt Gr" key, e.g. when pressing the E key, the Euro sign € appears etc.. When I switch back to German (my default layout) everything works fine again. This step is fully repeatable.

My workaround is similar to the one given in the bug description: The layout is correct as soon as I opened the keyboard preferences and modifid any option (seems that I just have to change anything, no matter what) and apply the changes. Afterwards the correct behaviour is restored until next reboot.

Btw: Restarting gnome (Ctrl+Alt+Backspace) doesn't reproduce the problem, the problem occurs only after a complete reboot of the system.

Hope my description helps tracking and solving the issue. Greetz.

Revision history for this message
nanotube (nanotube) wrote :

I can confirm this, but with the following additions:

1. the both-alts shortcut doesn't work ever since the first time i added a second layout. i didn't have to reboot for it to stop working.

2. changing anything in the keyboard layout preferences does /not/ restore the correct behavior.

both shifts work just fine to switch layout, however.

This on Hardy with latest updates (as of 2008-09-08).

Revision history for this message
Martin Olsson (mnemo) wrote :

I just updated to 8.10 alpha, for me not even normal ALT-TAB works. Seems like ALT is not acting like a proper modifier key for me, instead when I press TAB while holding ALT is just acts like I pressed TAB without holding ALT. This might not be related to this bug though. I use ATI with radeon driver btw.

Revision history for this message
Simos Xenitellis  (simosx) wrote :

Out of curiosity, could you please try the following,

1. Change the shortcut that lets you switch between keyboard layouts to LShift+RShift (that it, it does not involve the Alt key)
2. Try again Alt+Tab, etc and report if it now 'works'.

Again, this is an issue that is related to the inner workings of the X.org server.

Revision history for this message
Josh Faulkner (hunkadoodledoo) wrote :

I also can confirm the "Both Alt keys together" bug. With "Both Alt Keys together" selected, neither pressing the keys or clicking the Keyboard Indicator applet I added to the Panel change the layout. The "Both Shift keys together" seems to fix it with both pressing the keys and clicking the Keyboard Indicator on the Panel.

Revision history for this message
Josh Faulkner (hunkadoodledoo) wrote :

As others have mentioned, after rebooting, switching does not work anymore until I deselect "Both Shift keys together" and reselect it. Another side effect that might help to nail this bug down is right after reboot, when switching still doesn't work, if I right-click the Keyboard Indicator and choose Show Current Layout, the keyboard layout window that pops up is completely blank, except for the Print and Close buttons. Maybe that will help point out where the disconnect is. Good luck!

Revision history for this message
Simos Xenitellis  (simosx) wrote :

Josh:

The part where you reboot and the switching does not work is a known issue that has been resolved.
In Ubuntu 8.10 it is fixed. However, for Ubuntu 8.04, the packages have not been updated with this fix.
What happens is that with autologin (I assume you have this enabled), the keyboard layout settings are not set properly, so you need to invoke the Keyboard Indicator applet, and if you make any change (tick, untick), it applies the full settings to the system and now everything work. See the description at the top for more.

Regarding the Both Shifts option, this one works for me, and it appears to work for you as well.
It is another big issue in the X.Org X server that it has been identified and it is being worked on. Personally, I have switched to Both Shifts and I find this workaround quite convenient.

Revision history for this message
nanotube (nanotube) wrote :

just installed intrepid, and want to confirm that neither "both alts" nor "both ctrls" work to switch layouts. fiddling around with various configs suggested elsewhere (unchecking the "press right alt key to choose 3rd level" under 3rd level choosers, and checking "alt and meta are on the alt keys" under alt/win key behavior) does not fix them.

using "both shift keys" to switch layouts works just fine, however, so for now i am using that as a workaround.

Revision history for this message
Luca Dariz (luca-dariz) wrote :

Hello
i'm using Intrepid and the shortcut alt-alt doesn't work, I found alt-Maiusc working but it has a strange behavior: it changes the layout but to something that doesn't match with any of the layout I set to use (I use Italian and Spanish layouts). For example the 'p' key writes '-'.
By now, to properly change layout I have to open System->Preferences->Keyboard and manually drag and drop the right layout on the top of the list, as the radio box doesn't work (could this be related with the issue?).
I have the same behavior as alt-Maiusc with the gnome applet.
Hope it helps
Luca

Revision history for this message
nanotube (nanotube) wrote :

Luca, try using shift-shift to switch layouts, it works for me, and seems to work for others as well. that may be a happier solution for you than having to go through the menus.

(and by the way, i have no clue what "maiusc" is... :) )

Bryce Harrington (bryce)
Changed in xorg:
importance: Undecided → Low
status: Confirmed → Triaged
Revision history for this message
Simos Xenitellis  (simosx) wrote :

petrosyan: Changing the shortcut to something other than Alt+Alt is a “workaround”, not a fix.

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

[xorg component is unnecessary since there is already a task against xorg-server]

Changed in xorg:
status: New → Invalid
Revision history for this message
Luca Dariz (luca-dariz) wrote :

nanotube: sorry I wrote maiusc but I did mean shift

Revision history for this message
Lesmana Zimmer (lesmana) wrote :

there are many bugs about a not working right alt key. and there are many bugs about a not working shortcut to change keyboard layout (left alt + right alt). as far as i can tell fixing the right alt key would also fix the keyboard layout problem.

could someone with more knowledge than me in the topic please look at these bugs and generously mark as duplicate.

in no particular order:

bug #76901 (marked as fixed, but obviously there is a regression)
bug #363363
bug #251443
bug #462249
bug #96434
bug #226676
bug #382473
bug #438520

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

As per the background section of this bug report, the work needed to properly resolve this bug is quite involved, and thus well beyond the scope of what can be done as an SRU. As well, the issue crops up only within a specific configuration setup, and not in default installations, and it has a fairly straightforward workaround so the severity is probably not high enough to justify an SRU.

summary: - keyboard layout switching shortcuts like Alt+Alt do not work anymore
+ [Needs xkb protocol rework] keyboard layout switching shortcuts like
+ Alt+Alt do not work anymore
Changed in xorg-server (Ubuntu):
importance: Low → Wishlist
Revision history for this message
Simos Xenitellis  (simosx) wrote :

The upstream bug comment on this is at
http://bugs.freedesktop.org/show_bug.cgi?id=4927#c4

Changed in xorg-server:
importance: Unknown → High
Changed in xorg-server:
importance: High → Unknown
Changed in xorg-server:
importance: Unknown → High
Bryce Harrington (bryce)
Changed in xorg-server (Ubuntu):
assignee: nobody → Alberto Milone (albertomilone)
Revision history for this message
cl333r (cl333r) wrote :

I'd like remind the devs that before Ubuntu 8.04 there was no such bug.

I recall that Ubuntu 8.04 (Gnome version) shipped with an embarrassing bug which didn't allow the user to change the keyboard layout with a keyboard shortcut at all, the devs partially restored this functionality a few months later but functionality such like "both alt keys" hasn't been restored at all.

Before Ubuntu 8.04 everything was fine.

Revision history for this message
In , Jeremy Sequoia (jeremyhu) wrote :

What's the status of this? It seems like a high priority bug that hasn't been
touched in years...

Revision history for this message
In , Daniel Stone (daniels) wrote :

Unfortunately we can't fix this for anything that uses XKM, since it would be a format break to do so. What we _can_ do is to more aggressively deprecate the use of XKM, which means having the server use xkbcommon (which I'm working on, more or less) in particular.

Revision history for this message
In , Sergey V. Udaltsov (svu) wrote :

> use of XKM, which means having the server use xkbcommon (which I'm working on,
> more or less) in particular.
Any kind of ETA? Is there some open bug so that we could mark this one as dependent?

Revision history for this message
In , Sardemff7+freedesktop (sardemff7+freedesktop) wrote :

This bug is still annoying for at least i3lock users (see http://bugs.i3wm.org/report/ticket/953).

Is there any chance to get that fixed or should it be fixed at some other place instead?

Changed in xorg-server (Ubuntu):
assignee: Alberto Milone (albertomilone) → nobody
penalvch (penalvch)
no longer affects: xorg (Ubuntu)
Սահակ (petrosyan)
Changed in xorg-server (Ubuntu):
status: Triaged → Invalid
affects: xorg-server → ubuntu
Changed in ubuntu:
status: Confirmed → Invalid
Revision history for this message
In , Daniel Stone (daniels) wrote :

I assume it's relatively well known, but here's where I landed.

My plan to fix this, was to bypass XKM support completely, by integrating the parser into the server. Currently the server forks xkbcomp to build a particular keymap, xkbcomp produces (lossy) XKM files, and then the server consumes XKM. xkbcommon was supposed to fix this (hence the name), but the problem is that the server wants very different things from xkbcommon than everyone else. Specifically, it wants to be able to mutate arbitrary parts of the keymap after construction, which is very messy. Ultimately we just kept xkbcommon for everyone _but_ the X server, with a much smaller API.

The best thing to do for anyone who wants to pick this up is probably to look at importing xkbcommon circa https://github.com/xkbcommon/libxkbcommon/commit/ed18e65eacdabfeaeafee7c369891312af99c82d into the X server, in place of the xkbcomp entrypoint in xkb/ddxLoad.c. That particular commit is probably the most tractable balance between an actual functional xkbcommon without memory leaks, and one which hasn't changed the server-facing API and internals _too_ far away from what the server needs.

Changed in ubuntu:
status: Invalid → Confirmed
Revision history for this message
In , Gitlab-migration (gitlab-migration) wrote :

-- 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/297.

Changed in ubuntu:
status: Confirmed → Unknown
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.