Bug 410641 - Disabling "Enable menu accelerators" makes Konsole ignore keys
Summary: Disabling "Enable menu accelerators" makes Konsole ignore keys
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: keyboard (show other bugs)
Version: 19.04.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-06 08:43 UTC by Konstantin Kharlamov
Modified: 2019-08-07 14:31 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 19.08


Attachments
Fix for menu accelerators (2.05 KB, text/plain)
2019-08-06 23:53 UTC, Konstantin Kharlamov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kharlamov 2019-08-06 08:43:17 UTC
SUMMARY

Basically, after pressing Alt and releasing it Konsole starts ignoring all keys. The reliable way to reproduce that is setting XDG_CURRENT_DESKTOP=gnome. So far there was a workaround to set XDG_CURRENT_DESKTOP=kde, however as part of trying to work around issue #410639 this stopped working for me. Since the problem always existed, I decided to report it.

STEPS TO REPRODUCE
1. Open "Settings → Configure Konsole…", tab "General", and disable checkbox "Enable Menu accelerators.
2. Run konsole as `XDG_CURRENT_DESKTOP=gnome konsole`
3. Press Alt, and release it
4. Type "hello world"

OBSERVED RESULT
Nothing happens

EXPECTED RESULT
Text "hello world" should've appeared in the shell.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Archlinux, repro both in Plasma 5.16 and pure i3wm
KDE Plasma Version: 5.16
KDE Frameworks Version: 5.60.0
Qt Version: 5.13.0
Comment 1 Konstantin Kharlamov 2019-08-06 09:33:01 UTC
I figured it should be an easy fix, so I downloaded the code, and tried searching it. And… search for `AllowMenuAccelerators` shows that all that konsole does is creates the checkbox and a configuration setting. This is odd, it does not use the setting anywhere.

Setting the checkbox shouldn't do anything, the checkbox is unused, I'm clueless why it even works.
Comment 2 Konstantin Kharlamov 2019-08-06 09:38:04 UTC
(In reply to Konstantin Kharlamov from comment #1)
> I figured it should be an easy fix, so I downloaded the code, and tried
> searching it. And… search for `AllowMenuAccelerators` shows that all that
> konsole does is creates the checkbox and a configuration setting. This is
> odd, it does not use the setting anywhere.
> 
> Setting the checkbox shouldn't do anything, the checkbox is unused, I'm
> clueless why it even works.

Aha, nvm, I missed the usage in header file, where it declared a getter starting with low-case "a", "allowMenuAccelerators". I found the code to remove them is at MainWindow.cpp:177
Comment 3 Konstantin Kharlamov 2019-08-06 10:00:33 UTC
So, it seems the code removes accelerators correctly, but the problem is that after all menu items got unbound, Alt still is. I don't know what to do with it. I asked on #Qt irc, hopefully someone knows.
Comment 4 Konstantin Kharlamov 2019-08-06 23:46:29 UTC
Good news, I wrote a code, and managed to make it work. Now, where should I send the patch? I found a mailing list, but it has no patches, so probably not there. I also heard, KDE was migrating to gitlab…?
Comment 5 Konstantin Kharlamov 2019-08-06 23:53:36 UTC
Created attachment 121987 [details]
Fix for menu accelerators

Okay, for now I'll attach the patch here.
Comment 6 Konstantin Kharlamov 2019-08-07 00:05:19 UTC
Okay, I occasionally found¹: I have to move over to phabricator, attach the patch there, and choose the project I'm attaching it for. Done!²

1: https://community.kde.org/Infrastructure/Github_Mirror
2: https://phabricator.kde.org/D22980
Comment 7 Kurt Hindenburg 2019-08-07 14:26:29 UTC
Git commit 0107e68e22d3b70bb7bd7002e38d94f6e6e961ce by Kurt Hindenburg, on behalf of Konstantin Kharlamov.
Committed on 07/08/2019 at 14:22.
Pushed by hindenburg into branch 'master'.

Fix focus getting stuck in menu when XDG_CURRENT_DESKTOP ≠ kde

When XDG_CURRENT_DESKTOP ≠ kde, perssing and immediately releasing Alt
key makes focus get stuck in menu. Fix this by overriding QProxyStyle.

This does not influence menu accelerators (e.g. Alt+f to access "File" in
menu), which continue working according to user settings.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
FIXED-IN: 19.08
Differential Revision: https://phabricator.kde.org/D22980

M  +17   -0    src/main.cpp

https://invent.kde.org/kde/konsole/commit/0107e68e22d3b70bb7bd7002e38d94f6e6e961ce
Comment 8 Kurt Hindenburg 2019-08-07 14:26:33 UTC
Git commit 0107e68e22d3b70bb7bd7002e38d94f6e6e961ce by Kurt Hindenburg, on behalf of Konstantin Kharlamov.
Committed on 07/08/2019 at 14:22.
Pushed by scmsync into branch 'master'.

Fix focus getting stuck in menu when XDG_CURRENT_DESKTOP ≠ kde

When XDG_CURRENT_DESKTOP ≠ kde, perssing and immediately releasing Alt
key makes focus get stuck in menu. Fix this by overriding QProxyStyle.

This does not influence menu accelerators (e.g. Alt+f to access "File" in
menu), which continue working according to user settings.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
FIXED-IN: 19.08
Differential Revision: https://phabricator.kde.org/D22980

M  +17   -0    src/main.cpp

https://commits.kde.org/konsole/0107e68e22d3b70bb7bd7002e38d94f6e6e961ce
Comment 9 Kurt Hindenburg 2019-08-07 14:31:07 UTC
Git commit f8f7b43936b7b3718383d3a3ca67a387e28a3089 by Kurt Hindenburg, on behalf of Konstantin Kharlamov.
Committed on 07/08/2019 at 14:30.
Pushed by hindenburg into branch 'Applications/19.08'.

Fix focus getting stuck in menu when XDG_CURRENT_DESKTOP ≠ kde

When XDG_CURRENT_DESKTOP ≠ kde, perssing and immediately releasing Alt
key makes focus get stuck in menu. Fix this by overriding QProxyStyle.

This does not influence menu accelerators (e.g. Alt+f to access "File" in
menu), which continue working according to user settings.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
FIXED-IN: 19.08
Differential Revision: https://phabricator.kde.org/D22980

(cherry picked from commit 0107e68e22d3b70bb7bd7002e38d94f6e6e961ce)

M  +17   -0    src/main.cpp

https://invent.kde.org/kde/konsole/commit/f8f7b43936b7b3718383d3a3ca67a387e28a3089
Comment 10 Kurt Hindenburg 2019-08-07 14:31:10 UTC
Git commit f8f7b43936b7b3718383d3a3ca67a387e28a3089 by Kurt Hindenburg, on behalf of Konstantin Kharlamov.
Committed on 07/08/2019 at 14:30.
Pushed by scmsync into branch 'Applications/19.08'.

Fix focus getting stuck in menu when XDG_CURRENT_DESKTOP ≠ kde

When XDG_CURRENT_DESKTOP ≠ kde, perssing and immediately releasing Alt
key makes focus get stuck in menu. Fix this by overriding QProxyStyle.

This does not influence menu accelerators (e.g. Alt+f to access "File" in
menu), which continue working according to user settings.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
FIXED-IN: 19.08
Differential Revision: https://phabricator.kde.org/D22980

(cherry picked from commit 0107e68e22d3b70bb7bd7002e38d94f6e6e961ce)

M  +17   -0    src/main.cpp

https://commits.kde.org/konsole/f8f7b43936b7b3718383d3a3ca67a387e28a3089