Bug 286302 - Strange behaviour of Keyboard Layout Switcher
Summary: Strange behaviour of Keyboard Layout Switcher
Status: RESOLVED FIXED
Alias: None
Product: kxkb
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Andriy Rysin
URL:
Keywords:
: 286472 286527 287074 287614 288484 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-11-10 21:55 UTC by Valdas
Modified: 2012-07-19 22:45 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.7.4


Attachments
Normal list of layouts (4.20 KB, image/png)
2011-11-10 21:55 UTC, Valdas
Details
List of layouts with strange entry (4.44 KB, image/png)
2011-11-10 21:56 UTC, Valdas
Details
kxkbrx file from my system (208 bytes, text/plain)
2011-11-11 12:10 UTC, Valdas
Details
My kxkbrc: us,ru layouts (239 bytes, text/plain)
2011-11-12 22:18 UTC, John Zaitseff
Details
kded crash backtrace (5.95 KB, text/plain)
2011-11-12 22:18 UTC, John Zaitseff
Details
Output from "setxkbmap -print" before Ctrl+Alt+K is pressed (295 bytes, text/plain)
2011-11-15 03:18 UTC, John Zaitseff
Details
Output from "setxkbmap -print" after Ctrl+Alt+K is pressed (290 bytes, text/plain)
2011-11-15 03:18 UTC, John Zaitseff
Details
/usr/share/kde-settings/kde-profile/default/share/config/kglobalshortcutsrc (13.60 KB, application/octet-stream)
2011-11-15 12:59 UTC, Fikret Skrgic
Details
/home/fskrgic/.kde/share/config/kglobalshortcutsrc (13.60 KB, application/octet-stream)
2011-11-15 13:00 UTC, Fikret Skrgic
Details
/usr/share/kde-settings/kde-profile/default/share/config/kglobalshortcutsrc (550 bytes, application/octet-stream)
2011-11-15 19:44 UTC, Fikret Skrgic
Details
/home/fikret/.kde/share/config/kglobalshortcutsrc (13.45 KB, application/octet-stream)
2011-11-15 19:46 UTC, Fikret Skrgic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Valdas 2011-11-10 21:55:11 UTC
Created attachment 65499 [details]
Normal list of layouts

Version:           unspecified (using KDE 4.7.3) 
OS:                Linux

 If I switch keyboard layout by shortcut the switcher enters in strange state:
 - layout from any layout is always switched to first layout from layout list;
 - after releasing shortcut, "NumLock" indicator turns off;
 - switch by shortcut stops working;
 - switch by left mouse click on layout indicator stops working;
 - switch is only possible by context menu of layout indicator;
 - in list of layouts (attached picture "sw_normal.png") is added strange entry "-- -" (attached pic "sw_strange.png");

 It happens only if layout is switched by "Alternative shortcut" (in Keyboard - System Settings" -> "Layouts" -> "Shortcuts for Switching Layouts"). If it is switched by "Main shortcuts" then I do not encounter that strange switcher state.

Reproducible: Always

Steps to Reproduce:
 Switch with "Alternative chortcut"

Actual Results:  
 Switch keyboard layout is possible only in context menu of layout indicator.

Expected Results:  
 Switch should be possible with all configured shortcuts.

 In versions earlier than 4.7.3 I not had such strange problem.
Comment 1 Valdas 2011-11-10 21:56:14 UTC
Created attachment 65500 [details]
List of layouts with strange entry
Comment 2 Valdas 2011-11-10 21:59:55 UTC
Forgot mention that if I select other layout from context menu of indicator of layout then switcher is restored to normal (till next "Alternative shortcut" press).
Comment 3 Andriy Rysin 2011-11-11 00:21:16 UTC
Could you please attach your kxkbrc file?
Comment 4 Valdas 2011-11-11 12:10:00 UTC
Created attachment 65521 [details]
kxkbrx file from my system
Comment 5 John Zaitseff 2011-11-12 22:16:17 UTC
I can confirm that this same strange buggy behaviour occurs for me, with all of the symptoms mentioned by Valdas.

I tried to debug this problem by removing all keyboard layouts, logging out, then (once logged in again) reselecting all needed layouts using System Settings.  This did NOT solve the problem: the same buggy behaviour was present.

As an aside, another bug surfaced: pressing the Alternative shortcut (in my case Ctrl+Alt+K) with NO keyboard layouts defined causes the KDE Daemon (kded) to crash.  I will attach the backtrace, although I'm not sure how useful it will be.
Comment 6 John Zaitseff 2011-11-12 22:18:08 UTC
Created attachment 65574 [details]
My kxkbrc: us,ru layouts
Comment 7 John Zaitseff 2011-11-12 22:18:59 UTC
Created attachment 65575 [details]
kded crash backtrace
Comment 8 Andriy Rysin 2011-11-13 01:37:37 UTC
the crash is fixed in 286150
Comment 9 Christoph Feck 2011-11-14 02:38:08 UTC
*** Bug 286527 has been marked as a duplicate of this bug. ***
Comment 10 Jürgen Richtsfeld 2011-11-14 10:33:24 UTC
I also experience this problem.
Comment 11 Andriy Rysin 2011-11-15 03:00:06 UTC
I could not reproduce it quickly, could you please provide the output of "setxkbmap -print" before and after the problem appears?
Comment 12 John Zaitseff 2011-11-15 03:18:09 UTC
Created attachment 65685 [details]
Output from "setxkbmap -print" before Ctrl+Alt+K is pressed
Comment 13 John Zaitseff 2011-11-15 03:18:46 UTC
Created attachment 65686 [details]
Output from "setxkbmap -print" after Ctrl+Alt+K is pressed
Comment 14 John Zaitseff 2011-11-15 03:24:02 UTC
This particular bug seems to be easy to reproduce:

1. Run Kubuntu 11.10 with KDE 4.7.3 (using the Kubuntu PPA).
2. Create a new test user (or an existing user with a clean home directory and no dot-files such as ".kde" or ".config").
3. Log in to KDE.
4. In System Settings, select Input Devices >> Keyboard >> Layouts.
5. Add any layout, such as Russian.  Make sure the Alternative shortcut is Ctrl+Alt+K (it is, by default).
6. After closing System Settings, try pressing Ctrl+Alt+K.
7. Viola! the bug is triggered.
Comment 15 Fikret Skrgic 2011-11-15 11:29:49 UTC
I am also experiencing strange behaviour. However, symptoms are different. They also differ between two different computers I use daily. I use Fedora 16 on both with the latest KDE 4.7.3 available in the Fedora repositories.

On my work computer, a standard desktop, with a standard US keyboard and keyboard model set to "Generic 101-key PC", the keyboard layout appears when KDE starts, I can use Ctrl+Alt+K to switch to the default layout, but not to anything else. I use three layouts us,ba, and de. Hitting Ctrl+Alt+K causes the context menu to be divided by a line into us+ba and de. If I then select de from the context menu, then hit Ctrl+Alt+K, besides switching to us, it also turns off NumLock. NumLock turning off doesn't happen when ba is selected (above the line in context menu).

I think the intention with this divider line was to separate the layouts one uses frequently, which would be cycled through by Ctrl+Alt+K or clicking on the icon, from the layouts one wants to have available, but does not use frequently, which would be available from the context menu only. Not necessarily a bad idea, but it doesn't work. Ctrl+Alt+K only switches to the top layout. One cannot turn off this dividing. It comes back every time Ctrl+Alt+K is hit. Once a layout below the line is selected, clicking on the icon does cycle through all the layouts.

I think the algorithm for the aforementioned intended behaviour is quite simple and it should be as follows:

1. Either icon is left-clicked or Ctrl+Alt+K is hit.
2. If dividing is turned off or the current layout is in the main list, do 3.
3. Switch to the next item in the main list of layouts, which is circular.
4. Done.
5. Switch to default layout.
6. Done.

Context menu should allow switching to any layout. Needless to say, if dividing is turned off, all configured layouts should be in the main list.

This would fix the problem I have on this machine. On my own computer, a Macbook Air, I experience different symptoms. First of all, the keyboard layout icon does not appear when KDE starts. If I go into Settings and turn layouts off, apply, then turned them back on, and again apply, it appears. I also appears, if I add the Plasma layout widget to the task bar. Then I have two, the standard layout icon and the very ugly looking Plasma widget, which I would consider using if it looked the same as the standard icon. I then remove the Plasma one and the standard one stays. The keyboard is set to Macbook Pro (Air and Pro have the same keyboard layout). I tried switching to Generic keyboard, which works exactly the same way anyway, but that didn't make a difference. The other difference is that on Macbook Air, the Ctrl+Alt+K combination doesn't do anything at all.

The "Spare layouts" option is unchecked in Settings on both computers and I have the same three layouts on both.
Comment 16 Andriy Rysin 2011-11-15 12:49:07 UTC
Could you please also attach your kglobalshortcutsrc ?
Comment 17 Fikret Skrgic 2011-11-15 12:59:20 UTC
Created attachment 65710 [details]
/usr/share/kde-settings/kde-profile/default/share/config/kglobalshortcutsrc

Work computer from comments, default, not edited.
Comment 18 Fikret Skrgic 2011-11-15 13:00:34 UTC
Created attachment 65711 [details]
/home/fskrgic/.kde/share/config/kglobalshortcutsrc

Work computer from comments, default, not edited.
Comment 19 Fikret Skrgic 2011-11-15 13:08:45 UTC
I will get you the same from Macbook Air as soon as I get home. Thanks for your efforts. However, it should all be the same. I have not edited any shortcuts. I always just use default settings. Maybe worth mentioning. I upgraded from Fedora 15, which was the original installation on both machines, and hence from whatever KDE version they came with, as the versions were updated in the repository.All this worked perfectly fine in Fedora 15, KDE 4.6.5. Version 4.7.3 just hit the repos a couple of days ago. Fedora 16 came with 4.7.2 I think, certainly 4.7.x. I am not sure whether the problems with switching started with 4.7.3 any more or with Fedora 16 upgrade, but I do remember that the problem with the missing icon started right after the upgrade.
Comment 20 Fikret Skrgic 2011-11-15 19:44:19 UTC
Created attachment 65724 [details]
/usr/share/kde-settings/kde-profile/default/share/config/kglobalshortcutsrc

From Macbook Air.
Comment 21 Fikret Skrgic 2011-11-15 19:46:09 UTC
Created attachment 65725 [details]
/home/fikret/.kde/share/config/kglobalshortcutsrc

From Macbook Air.
Comment 22 Fikret Skrgic 2011-11-16 10:49:17 UTC
Actually, I was wrong. On Macbook Air it behaves the same way as on the other machine apart from the fact that the icon does not show up on startup. However, the missing icon problem might be caused by something else. Namely, another icon stopped appearing on startup, the bluetooth icon, which also was working fine before.It can be activated by the same method, i.e. disable KDE bluetooth integration and reenable it. Then it shows up. The Apper icon also misbehaves. When it's done updating it becomes invisible, but the space in the systray stays reserved for it (empty space, nothing visible) and one can click on it and then it says "Apper" in a little pop-up widget, but it doesn't offer any actions (nothing to click on). So, there might be something wrong with how systray works in general.
Comment 23 Andriy Rysin 2011-11-19 04:17:15 UTC
Git commit 285318084a6b4a767b0ed19034375a69a752c2c2 by Andriy Rysin.
Committed on 19/11/2011 at 05:12.
Pushed by rysin into branch 'KDE/4.7'.

Fix keyboard layout global shortcuts
BUG: 286302
FIXED-IN: 4.7.4
(cherry picked from commit 2d56e4d5ac6b1b73cfe8797c9b3f5670a53a11c9)

M  +21   -10   kcontrol/keyboard/bindings.cpp
M  +1    -1    kcontrol/keyboard/bindings.h
M  +5    -1    kcontrol/keyboard/keyboard_daemon.cpp
M  +3    -4    kcontrol/keyboard/layouts_menu.cpp

http://commits.kde.org/kde-workspace/285318084a6b4a767b0ed19034375a69a752c2c2
Comment 24 Andriy Rysin 2011-11-19 04:17:16 UTC
Git commit 1ac5ebe482f633295fb4a79eb1c5236561e9ca70 by Andriy Rysin.
Committed on 19/11/2011 at 05:12.
Pushed by rysin into branch 'master'.

Fix keyboard layout global shortcuts
BUG: 286302

M  +21   -10   kcontrol/keyboard/bindings.cpp
M  +1    -1    kcontrol/keyboard/bindings.h
M  +5    -1    kcontrol/keyboard/keyboard_daemon.cpp
M  +3    -4    kcontrol/keyboard/layouts_menu.cpp

http://commits.kde.org/kde-workspace/1ac5ebe482f633295fb4a79eb1c5236561e9ca70
Comment 25 Andriy Rysin 2011-11-19 04:19:51 UTC
*** Bug 286958 has been marked as a duplicate of this bug. ***
Comment 26 Andriy Rysin 2011-11-19 04:21:24 UTC
There was some fun dealing with global shortcuts, hopefully should be fixed
now. I also added better debug logging so in case we see more problems like
this it would be easier to trace them down.

Please try and let me know if this fix helped.
Comment 27 Andriy Rysin 2011-11-19 04:30:33 UTC
*** Bug 286472 has been marked as a duplicate of this bug. ***
Comment 28 Andriy Rysin 2011-11-20 14:33:18 UTC
*** Bug 287074 has been marked as a duplicate of this bug. ***
Comment 29 Andriy Rysin 2011-11-28 16:21:21 UTC
*** Bug 287614 has been marked as a duplicate of this bug. ***
Comment 30 Andriy Rysin 2011-12-03 23:43:19 UTC
KDE 4.7.4 is out, you may wanna bug your distro maker to update the packages. Please let me know if you still see the problems.
Comment 31 Andriy Rysin 2011-12-08 17:05:13 UTC
*** Bug 288484 has been marked as a duplicate of this bug. ***
Comment 32 Valdas 2011-12-15 23:35:06 UTC
Updated to 4.7.4: works OK. Thanks.
Comment 33 Joachim Schiele 2011-12-16 00:06:41 UTC
Works great! Thanks a lot!
----- Original message -----
> https://bugs.kde.org/show_bug.cgi?id=286302
> 
> 
> 
> 
> 
> --- Comment #32 from Valdas <zmogas hotmail com>   2011-12-15 23:35:06 ---
> Updated to 4.7.4: works OK. Thanks.
> 
> -- 
> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.
>
Comment 34 Ruslan Blurred 2011-12-16 05:34:39 UTC
Thank you!!! It has become convenient)