Bug 416911 - Titlebar or global menu disappear, if a second QMenuBar is added (even if invisible)
Summary: Titlebar or global menu disappear, if a second QMenuBar is added (even if inv...
Status: RESOLVED FIXED
Alias: None
Product: kded-appmenu
Classification: Plasma
Component: export (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-29 14:58 UTC by flyos
Modified: 2022-10-17 07:26 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description flyos 2020-01-29 14:58:24 UTC
VERSION 0.7.1

SUMMARY
When a R script is opened in RKWard and Kwin is configured for placing the menus in the titlebar (or a globalmenu bar), the menu of RKWard becomes inaccessible. It is invisible in-app (as it should), but also not placed in a titlebar button (while it should) and not accessible through other means such as Plasma-HUD.

STEPS TO REPRODUCE
1. When the menu bar is set to be exported in the title bar (adding the "App Menu" button to the buttons of the title bar is enough nowadays).
2. Open RKWard directly, the app menu button is shown, and the menu is accessible.
3. Now open a script within RKWard, the app menu button disappears and the menu is not accessible anymore. Closing the script leave the app menu inaccessible, it doesn't come back.

Of course, it doesn't happen when the appmenu is shown, as it is by default.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20200125
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.66.0
Qt Version: 5.14.0
Kernel Version: 5.4.13-1-default
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-3770 CPU @ 3.40GHz
Memory: 15,6 Gio

ADDITIONAL INFORMATION
Comment 1 Thomas Friedrichsmeier 2020-01-29 19:06:45 UTC
Apologies if this re-assignment is not the correct place for this issue, but I think it is at least closer to where it will need to be fixed.

Some words of context: When opening a script file in RKWard, the menus get changed (KXMLGUI / KParts based). I guess this plays a role, here.

Pierre: How about when you open other kinds of windows in RKWard (HTML, data, the R console)? Does the menu work correctly when switching between those?
Comment 2 flyos 2020-01-29 19:41:07 UTC
Only happens when opening a script panel. Opening the R console, a HTML panel (tested a man page), an "object" panel (for looking into a data.frame) and a plot. All have no problem with displaying the titlebar menu button. As I said, when a script is opening and the button disapears, it is not reversible, and it doesn't come back when opening the panels mentioned above.

Is this clear enough?
Comment 3 Cezar Tigaret 2020-02-05 23:16:08 UTC
SUMMARY:
rkward loses the global application menu after regaining focus.

I use the Window AppMenu widget (instead of global AppMenu) and an Application Menu button on the window manager title bar. The Applications Menu Daemon is running.

When rkwad is first launched, both the AppMenu widget (on the panel) and the Application Menu button are present. 

They persist as long as rkward's main window does not lose focus (i.e., even after rkward loads the workspace and opens the viewer windows as per the last session,  and during switching between viewers attached to the main window using the tabs at the top).

Both the global app menu for rkward and the app menu button in rkward window title disappear when rkward loses focus (either by detaching one of its viewer windows, or after focusing on another application window)


STEPS TO REPRODUCE:
1. start rkward, open an existing RData file
2. rkward loads rdata and windows layout, opens object viewers attached to main window
3. rkward main window loses both the appmenu and the app menu button after either :
3.a) switching to another application window then back to rkward
3.b) detaching a window (e.g. script, or output, or html help, or data.frame window)
     NOTE: if the detached window is one of the following, it DOES retain both its own appmenu and the app menu button on its own window title:
          object viewer window, data.frame window, html window (either a help window or the output window)

     NOTE: if the detached window is a script editor, it loses both the appmenu and its application menu button from its own window title

Unfortunately, neither of the detached windows offer any way to get to the plot, analysis, distribution and other plugin menus , nor to the settings menu for rkward (so no packages can be loaded/installed/updated via the gui)


I use rkward version 0.7.1
KDE Plasma version 5.17.90
KDE Frameworks version 5.66.0
Qt 5.14.1 
OS: openSUSE Leap 15.1, kernel 4.12.14-lp151.28.36-default
Comment 4 flyos 2020-02-06 08:19:37 UTC
Interesting, I can't confirm this exact behaviour, it only does this when I open a script on my computer... Could this be related to the fact that I use the menu within the title bar? Are you using the "MacOS-style" global menu with the Plasma widget?

Or the fact that you're using the Plasma 5.18 beta?
Comment 5 zagead 2020-03-20 19:55:44 UTC
I can confirm the issue is still present using Rkward v.0.7.1 and Plasma 5.18.3.

I.e. if one has the global menu widget enabled and opens an Rscript in Rkward, 
the appmenu disappears and becomes inaccessible. Restarting the application, of course, alleviates said bug.

This same bug is also reproduced when opening an Rscript from dolphin. 
The bug is NOT reproduced when opening an rscript from the command line.
E.g.
$ rkward somescript.r

Will open the rscript and the appmenu will show like usual. However, if you open another Rscript in 
rkward (i.e. using the file-dialogue), the appmenu will dissapear.
Comment 6 zagead 2020-03-20 19:59:18 UTC
Forgot to add:
Rkward: v0.7.1
Plasma: v5.18.3
KDE-frameworks: v5.68.0
Qt: 5.14.1
Kernel Version: 5.5.10-arch-1-1
OS: Archlinux
Comment 7 Matthias 2020-10-20 08:43:57 UTC
I have the same problem with RKWard 0.7.2 and Plasma version 5.18.5.
Comment 8 flyos 2022-04-27 06:21:34 UTC
The bug is still alive in Rkward 0.7.3, Plasma 5.24.4 and Frameworks 5.93.0.
Comment 9 Thomas Friedrichsmeier 2022-04-27 19:55:49 UTC
I still have no decent idea on how to attack this problem. It would be much appreciated, if somebody more familiar with the appmenu stuff could help out, at least with some ideas on where to start debugging.

Some notes to myself:
- RKCommandEditorWindow::fixupPartGUI() is not related, disabling it does not change anything. Many other experiments show no effect, short of disabling part->insertChildClient(m_view) in rkcommandeditorwindow.cpp (which is no acceptable solution).
- All mechanics at work seem to live in https://invent.kde.org/plasma/plasma-workspace/:
  - https://invent.kde.org/plasma/plasma-workspace/-/tree/master/appmenu is a qt theme plugin that sends the menus over dbus
  - https://invent.kde.org/plasma/plasma-workspace/-/tree/master/libdbusmenuqt implements the protocol
  - https://invent.kde.org/plasma/plasma-workspace/-/tree/master/applets/appmenu imports and shows the menu
- Easiest way to reproduce: 1. Start RKWard 2. Create->Script file 3. Create->Script file, again.
Comment 10 Thomas Friedrichsmeier 2022-07-01 22:37:23 UTC
Git commit 75d2ff4f468f6807669237cfe344fa8dbd469b9a by Thomas Friedrichsmeier.
Committed on 01/07/2022 at 22:35.
Pushed by tfry into branch 'master'.

Fix menu quirks due to use of a fully blown KXMLGUIWindow as preview area.
Related: bug 429900

M  +39   -21   rkward/misc/rkxmlguipreviewarea.cpp
M  +8    -2    rkward/misc/rkxmlguipreviewarea.h

https://invent.kde.org/education/rkward/commit/75d2ff4f468f6807669237cfe344fa8dbd469b9a
Comment 11 Thomas Friedrichsmeier 2022-07-23 10:56:53 UTC
Finally some progress:
The bug arises, if a second QMenuBar is added to a window. This may not exactly be a standard use-case, but is not entirely outlandish in the context of providing previews. Importantly, note that the bug still occurs, if the second QMenuBar never becomes visible at all. It's enough for it to become a child of the window.

With that knowledge, the issue is now fixed (in the sense of no longer triggered) in the development version of RKWard. See #429900 . It is still present in appmenu in the form described in the above paragraph.
Comment 12 flyos 2022-08-17 09:05:36 UTC
I can only use the AppImage to test for the fix, but based on my testing using this, the bug is indeed fixed with the new version of RKWard. I'll keep you posted if the bug isn't fixed when 0.7.5 is released.
Comment 13 flyos 2022-10-17 07:26:26 UTC
Bug confirmed fixed in RKWard 0.7.5.