Bug 373653

Summary: Konsole occasionally displays the wrong context menu on right click
Product: [Frameworks and Libraries] frameworks-kxmlgui Reporter: Michal Ziabkowski <mziab>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: ricardo, simonandric5, wbauer1
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Michal Ziabkowski 2016-12-14 18:28:24 UTC
When right-clicking, there is a 1-to-5 chance than Konsole will display a context menu with the "Configure shortcut..." and "Add to Toolbar" (inactive) options instead of the regular Konsole one. The likelihood of the wrong menu appearing increases when clicking in rapid succession.

Upon some quick investigation, this seems to be the menu from kxmlgui's KMenuMenuHandler, which is erroneously displayed for some reason.

The bug is similar to #351595. However, I've never had two menus displayed at the same time unlike the reporter of that bug, so I'm filing this as a separate issue.

I am quite certain it is not a mouse issue, since the problem only appeared when I switched from the old KDE4-based Konsole to the frameworks-based one.

The way to reproduce is really simple:
1) Start Konsole
2) Right-click a few times somewhere in the middle of the terminal

Here are some system specs:
Konsole 16.08.3
kde-frameworks 5.29.0
Qt 5.6.2
xcb platform
Comment 1 Ricardo J. Barberis 2017-02-10 03:37:18 UTC
Confirmed (Konsole 16.12.1) and easily reproducible:

1- Right-click on konsole -> normal popup is shown
2- Right-click on the popup -> Michal's popup is shown
Comment 2 Michal Ziabkowski 2017-02-10 09:27:06 UTC
Yes, that's a good observation. However, you don't even need to right-click the popup. It seems that as long as the normal popup is open, right-clicking anywhere inside the terminal will display the other "Configure shortcut" popup.

This is a regression in that right-clicking again used to close the current popup and redisplay it in the new location, and not display the other, completely different popup. The bug is still reproducible in Konsole 16.12.1 and Qt 5.7.1.
Comment 3 Kurt Hindenburg 2017-02-12 00:48:05 UTC
Yes, strange - I've never noticed this before
Comment 4 Kurt Hindenburg 2017-02-12 01:44:35 UTC
This is not just Konsole - it happens in Kate as well.
Comment 5 Kurt Hindenburg 2017-02-12 14:50:14 UTC
I don't think this is Konsole but the underlying kxmlgui
Comment 6 Wolfgang Bauer 2017-02-12 19:51:54 UTC
(In reply to Kurt Hindenburg from comment #5)
> I don't think this is Konsole but the underlying kxmlgui
I agree.

And I just noticed that it is also reproducible in Konsole/KDE4 and kmail/KDE4, so it seems to be a quite long-standing "issue" (or maybe a feature?) ;-)
Comment 7 Michal Ziabkowski 2017-09-09 10:20:09 UTC
I've actually found a better, sure-fire way to trigger the bug:

1) Right-click to display the normal popup
2) Right-click anywhere inside the application window

This also causes the "Configure shortcut" popup to be displayed.

From what I know, the popup in question should only display when right-clicking menu items, which lets you customize the hotkeys. It seems as though the wrong event is triggered somehow.

I can confirm the bug is not Konsole-exclusive. Just tried ark and got the same behavior.
Comment 8 Kai Uwe Broulik 2018-02-26 13:58:40 UTC
Git commit 5381b8b4b76cc1fced0c32aed22653e3a52ebc7a by Kai Uwe Broulik.
Committed on 26/02/2018 at 13:58.
Pushed by broulik into branch 'master'.

Don't show context menu menu if right-clicking outside

When right-clicking a KXMLGui menu bar entry you can configure it.
The menu would also show up if right clicked outside the menu which is pointless as none of the actions in the menu
would work as there's no action to configure to begin with.

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

M  +6    -1    src/kmenumenuhandler_p.cpp

https://commits.kde.org/kxmlgui/5381b8b4b76cc1fced0c32aed22653e3a52ebc7a