Bug 209699

Summary: azerty+qwerty keyboard layout switch does not switch ctrl-z/ctrl-w ctrl-a/ctrl-q
Product: [Unmaintained] kdelibs Reporter: Erik Quaeghebeur <bugs.kde.org>
Component: klocaleAssignee: Chusslove Illich <caslav.ilic>
Status: RESOLVED FIXED    
Severity: normal CC: anakin.cs, kde, sanderd17, simonandric5, xionbox33418
Priority: NOR    
Version: 4.2.2   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Erik Quaeghebeur 2009-10-07 02:58:24 UTC
Version:            (using KDE 4.2.4)
OS:                Linux
Installed from:    Ubuntu Packages

I use a laptop with azerty-be layout together with a qwerty-us external keyboard. The azerty layout is used as the base one (command "setxkbmap -model pc104 -layout be,us -variant ,"), and I switch layouts (set to 'Global' in system settings) using the country flag icon in the tray. As far as I know, all keys are correctly switched, except for a number of editing-important ctrl-combinations: ctrl-z/ctrl-w and ctrl-a/ctrl-q to be precise (these pairs correspond to pairs of switched letters between azerty and qwerty).

Expected behavior: totally switch to qwerty, also when ctrl is pressed.
Comment 1 Erik Quaeghebeur 2009-10-07 03:00:03 UTC
Forgot to mention: this problem does not occur in Firefox or Konqueror, and was first noticed in Kile (uses katepart).
Comment 2 Milian Wolff 2009-10-07 14:09:14 UTC
I once had a similar problem with a German keyboard on a PC that was setup to use the English mapping. Ctrl + Z was actually on Ctrl + Y, very strange. They keys itself (i.e. while typing) where correct though.

I can't give more info though, as the problem has gone away...
Comment 3 Erik Quaeghebeur 2009-10-27 16:16:37 UTC
(In reply to comment #1)
> Forgot to mention: this problem does not occur in [Firefox or] Konqueror, [...]

Correction: it does occur in Konqueror as well, e.g., to close a tab, I have to press ctrl-z instead of ctrl-w, but it does not occur in the location and search input boxes.
Comment 4 Sander 2010-04-20 11:37:15 UTC
Here it's the same, and I've never had a qwerty keyboard before. 
Hope this bug will be solved because it's not so good that the program is closed (ctrl+w) instead of the action undone (ctrl+z).

I've reported this bug first in launchpad: https://bugs.launchpad.net/ubuntu/+source/kile/+bug/565262 but it's not a kile problem as mentionned.
Comment 5 Chusslove Illich 2010-04-20 12:27:15 UTC
The problem with discussions about keyboard layouts functioning is that they
are almost never clear to half the people involved :) So, first of all, take
a look at this random layout:

http://caslav.gmxhome.de/misc/layout-cyr-xkb_rs_latin.html

The important bit on this picture are the internal X key names written at
the bottom of each key, such as AD01, AB09, LSGT... Now:

1) Which layouts do you have in the rotation (i.e. switchable by a shortcut
or click on layout tray icon), and in which exact order (as listed in
keyboard layout settings)?

2) Which layout is currently active?

3) Which shortcut do you press, in terms of internal key names (e.g.
"LCTL+AD02")?

4) Which behaviour do you get, in terms of application (e.g. "the window
closes")?

5) Which behaviour did you expect, also in terms of application?
Comment 6 Sander 2010-04-20 12:42:56 UTC
1) I only use AZERTY (BE) and I have not used another since the installation of my OS.

2) AZERTY

3a) LCTL+AD02
4a) Kate asks to close the document (save the changes?) or close the document if all changes are saved.
5a) I wanted to undo an action

3b) LCTL+AD01
4b) Kate asks to close the editor (save the changes?) or close the editor if all changes are saved.
5b) I wanted to "select all"

3a) LCTL+AB01
4a) undo an action
5a) Normally I would expect kate to ask to close the document. but now I use this to undo an action.
Comment 7 Chusslove Illich 2010-04-20 13:13:33 UTC
That's nigh impossible if be is really the only layout. Could you paste here
the output from:

  $ setxkbmap -print
Comment 8 Sander 2010-04-20 13:23:51 UTC
[code]
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+ie+be:2+inet(evdev)+terminate(ctrl_alt_bksp)"	};
	xkb_geometry  { include "pc(pc105)"	};
};
[/code]
It says something about qwerty but I know I'm typing in azerty and all other apps (exept KDE) are listening to the correct hotkeys.
Comment 9 Chusslove Illich 2010-04-20 16:25:30 UTC
Ok, I've been testing a bit, and it seems KDE apps draw their Ctrl-shortcuts
_from the first layout in rotation. In your case, this line:

  xkb_symbols   { include "pc+ie+be:2+inet(evdev)+terminate(ctrl_alt_bksp)"

shows that the first layout is ie (Irish) and the second be, so Ctrl-
shortcuts are taken from ie (which is a QWERTY layout). You could therefore
"fix" your problem by setting be as the first or only layout.

Now, I don't know whether this first-layout behavior is intended or not
(feature or bug), so I'm adding to CC a person who might know. (Some people,
me included, would consider it exactly the right behavior: that Ctrl-
shortcuts should not change their physical positions on the keyboard as the
user switches layouts.)
Comment 10 Erik Quaeghebeur 2010-04-20 19:51:02 UTC
(In reply to comment #9)
> [...] it seems KDE apps draw their Ctrl-shortcuts
> from the first layout in rotation. [...]

Great. It seems you've made progress in identifying what is happening here.
My thanks for your effort.

> Now, I don't know whether this first-layout behavior is intended or not
> (feature or bug), [...] (Some people,me included, would consider it exactly
> the right behavior: that Ctrl-shortcuts should not change their physical
> positions on the keyboard as the user switches layouts.)

Well, I would say that this is a bug:
* other behavior in all(?) non-KDE programs
* other behavior in some parts of, e.g., Konqueror (address line, search box, text input fields)
* not taking into account that there are people that switch physical keyboards (like me--I have *both* layouts in my mind and in finger memory, believe me, this behavior can be maddening, most of all because wanting to undo an action can cause closing the text I'm editing without saving, as I encountered more than once in Kile)
* not even allowing the behavior that is standard for all(?) non-KDE programs

I think the solution should be to completely switch the layout as seems standard outside of KDE, but perhaps add an option that allows keeping the current behavior for those who want it.
Comment 11 Erik Quaeghebeur 2011-03-21 14:07:43 UTC
Still present in 4.5.5, so I guess the lack of further comments is indicative of the attention this bug has gotten since the previous comment. I would be very grateful if this bug got fixed (albeit with an advanced keyboard configuration option). I understand developers have limited time, so is there anything I can do to facilitate things (Info to be added to this report,...)?
Comment 12 xionbox 2014-03-05 23:11:06 UTC
*** Bug 316909 has been marked as a duplicate of this bug. ***
Comment 13 Justin Zobel 2022-10-17 00:41:13 UTC
Thank you for reporting this bug in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "CONFIRMED" when replying. Thank you!
Comment 14 Erik Quaeghebeur 2022-10-17 07:48:37 UTC
(In reply to Justin Zobel from comment #13)
> Thank you for reporting this bug in KDE software. As it has been a while
> since this issue was reported, can we please ask you to see if you can
> reproduce the issue with a recent software version?

It seems to have been fixed! (I had fully switched to QWERTY in the mean time, so didn't follow-up.)