Bug 350816

Summary: kglobalaccel5 load the wrong keyboard mapping/layout
Product: [Frameworks and Libraries] frameworks-kglobalaccel Reporter: Carl-Erwin Griffith <carl.erwin>
Component: generalAssignee: Martin Flöser <mgraesslin>
Status: RESOLVED FIXED    
Severity: normal CC: cousinmarc, dev, drew.m.fisher, emilsedgh, gdamjan, jany.belluz, kde, kdelibs-bugs, kdenis, koerber.matthias, ludwig.schubert, mail, nate, raphael.kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
URL: https://bugreports.qt.io/browse/QTBUG-30911
See Also: https://bugs.kde.org/show_bug.cgi?id=318904
https://bugs.kde.org/show_bug.cgi?id=159288
https://bugreports.qt.io/browse/QTBUG-30911
https://bugs.kde.org/show_bug.cgi?id=307390
https://bugs.kde.org/show_bug.cgi?id=353926
https://bugs.kde.org/show_bug.cgi?id=375518
Latest Commit: Version Fixed In: 5.52
Sentry Crash Report:

Description Carl-Erwin Griffith 2015-07-31 08:51:01 UTC
I'm using a french keyboard layout but at startup kglobalaccel5 loads the "us" one.
examples:
   Z <-> W  are inverted
   M <-> ,   are inverted 

When the previous instance is killed and reloaded from a terminal ($ /usr/bin/kglobalaccel5) ,
the correct layout is loaded.

Reproducible: Always

Steps to Reproduce:
1.setup french keyboard layout
2.define some shortcuts  (ex: WinKey+w -> web browser)
3.restart the session
4.WinKey+z works instead of WinKey+w

Actual Results:  
WinKey+z works instead of WinKey+w

Expected Results:  
WinKey+w to launch the browser (chromium in my case)
Comment 1 Thomas Lübking 2015-08-20 08:20:11 UTC
*** Bug 351198 has been marked as a duplicate of this bug. ***
Comment 2 Denis Kurz 2015-08-21 16:36:58 UTC
I can confirm this for the neo2 layout. I configured Meta+E for KDevelop and Meta+F for Firefox, but when I press Meta+E, Firefox is launched. Note that neo2(E) = qwerty(F).

The proposed workaround works, too, which I am very grateful for :-)
Comment 3 Thomas Lübking 2015-10-18 12:30:38 UTC
kglobalaccel has (maybe broken, see bug #269403) code to update on keyboard map changes, but doesn't get the event because of https://bugreports.qt.io/browse/QTBUG-30911)
Comment 4 Thomas Lübking 2015-10-25 11:20:56 UTC
experimental workaround, feel free to try https://git.reviewboard.kde.org/r/125786/
Comment 5 Holger 2018-10-02 09:22:29 UTC
*** Bug 365812 has been marked as a duplicate of this bug. ***
Comment 6 Holger 2018-10-02 12:36:47 UTC
*** Bug 154212 has been marked as a duplicate of this bug. ***
Comment 7 Holger 2018-10-02 12:37:38 UTC
*** Bug 307390 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2018-11-02 13:51:59 UTC
Re-opening since apparently there's something we can do about this. There's a patch: https://phabricator.kde.org/D16434
Comment 9 Nate Graham 2018-11-02 13:52:15 UTC
*** Bug 362775 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2018-11-02 13:52:30 UTC
*** Bug 397984 has been marked as a duplicate of this bug. ***
Comment 11 Nate Graham 2018-11-02 13:52:51 UTC
*** Bug 353926 has been marked as a duplicate of this bug. ***
Comment 12 Fabian Vogt 2018-11-03 12:14:47 UTC
Git commit 4d28bd4183d20a9bff4f50e88cbb47ffef0ede43 by Fabian Vogt.
Committed on 03/11/2018 at 12:14.
Pushed by fvogt into branch 'master'.

Fix keyboard layout change notifications

Summary:
This rework fixes several issues:
- Qt wasn't informed about XCB_MAPPING_NOTIFY anymore
- With XKB enabled in Qt, X won't send XCB_MAPPING_NOTIFY anymore.
  So listen for XKB events as well.
- Install the event filter before fetching the keysym mapping to
  close a race window
- Use the old mapping for ungrabbing
Related: bug 269403

Test Plan:
Ctrl-Alt-Y global shortcut works even when doing
"setxkbmap us; kglobalaccel5 & sleep 1; setxkbmap de;" while it did not
before. On some systems, this race happened on every login, now it works
reliably.

Reviewers: #frameworks, #plasma, romangg

Reviewed By: #plasma, romangg

Subscribers: romangg, ngraham, anthonyfieroni, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16434

M  +1    -1    CMakeLists.txt
M  +1    -1    src/runtime/plugins/CMakeLists.txt
M  +1    -0    src/runtime/plugins/xcb/CMakeLists.txt
M  +55   -21   src/runtime/plugins/xcb/kglobalaccel_x11.cpp
M  +1    -0    src/runtime/plugins/xcb/kglobalaccel_x11.h

https://commits.kde.org/kglobalaccel/4d28bd4183d20a9bff4f50e88cbb47ffef0ede43
Comment 13 Damjan Georgievski 2018-11-04 13:37:46 UTC
does this fix
https://bugs.kde.org/show_bug.cgi?id=320612 too
Comment 14 Nate Graham 2018-11-04 13:57:41 UTC
*** Bug 320612 has been marked as a duplicate of this bug. ***
Comment 15 Holger 2019-03-05 22:01:37 UTC
*** Bug 394684 has been marked as a duplicate of this bug. ***
Comment 16 Nate Graham 2021-03-26 16:12:51 UTC
*** Bug 422329 has been marked as a duplicate of this bug. ***