Summary: | Global menu items disappear when a pop-up window opens, but don't show up again after it closes | ||
---|---|---|---|
Product: | [Plasma] plasmashell | Reporter: | Kunshan Wang <wks1986> |
Component: | Global Menu widget | Assignee: | Plasma Bugs List <plasma-bugs-null> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | dashonwwIII, julien.dlq, kde, miranda, mvourlakos, nate, rabarbarugar+kdebug, sdar |
Priority: | NOR | Keywords: | qt6 |
Version First Reported In: | 6.0.1 | Flags: | miranda:
Wayland+
|
Target Milestone: | 1.0 | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Screen recording
Task Manager, Global Menu and pop-up window Preview window in Qt Designer |
Can confirm, in my case when using gimp and it opens any popup window I lost the global menu too. ie: open and image in gimp go to "File -> export as" the global menu is gone and it doesn't come back after closing the export window. If you alt tab out and back to gimp the global menu comes back. Created attachment 167011 [details]
Task Manager, Global Menu and pop-up window
I also noticed that when the global menu disappears, the current window is also not marked as active in the task manager.
I generated a new C++ KDE project with a main window, a toolbar and a main menu from a template in KDevelop, and added a few lines to the signal handler of a toolbar item to pop up a window.
```
QTimer::singleShot(200, this, [this]() {
KMessageBox::information(this, i18n("Congratulations, you have solved board"));
});
```
The pop-up window from `KMessageBox::information` does not appear on the task manager. When the window pops up, two things may non-deterministically happen to the task manager (See the screen recording in the attachment)
1. The task manager still highlights the main window as the active task. (This happens the first time I clicked the toolbar in the video)
2. The task manager does not highlight *any* window as active. (This happens the second time I clicked the toolbar in the video)
In the first case, the Global Menu applet still shows the menu of the main window; in the second case, the Global Menu applet disappears.
I think the connection between the Task Manager and the Global Menu applet is that the Global Menu applet uses the `TaskManager::TasksModel` (in libtaskmanager) to determine the active window. So if a glitch happens in the Task Manager, the Global Menu is affected, too.
I also suspect that if a window does not appear in the TaskManager but still has a MenuBar widget, the Global Menu widget will not work for that window even if the window has focus. I haven't confirmed it, yet.
Created attachment 167080 [details]
Preview window in Qt Designer
There is another way to reproduce it.
1. Open QtDesigner
2. Create a new form, using "Main window" as the template
3. Edit the "MainWindow - untitled" and add some menus in its menu bar (such as "foo" and "bar" as in the screenshot)
4. Preview (From the menu: "Form" -> "Preview...")
What actually happens is as shown in the screenshot. The global menu disappeared, and there is no active task highlighted in the task manager. There is an entry in the task manager for Qt Designer itself, but there is no entry for the preview window (the window with title "MainWindow - [preview] -- Qt Designer").
At this point, if we switch to another app (such as Konsole), and switch back to Qt Designer, then the preview window will be on top of Qt Designer. But Qt Designer will be high-lighted in the task manager, and the Global Menu applet will show the menu of Qt Designer. There is no way for Global Menu to show the menu for the preview window.
This confirms with my hypothesis that the Global Menu applet is showing the menu of the highlighted task in the task manager applet. If a window, for some reasons, does not have an entry in the task manager, its menu will not be shown even if it is the window with focus.
I think that's the root cause of the problem. The Global Menu applet should determine which window to show menu for by detecting the focused window rather than the active entry in the task manager.
Cool, great analysis! Would you like to work on a code change for that and submit it to KDE? (In reply to Nate Graham from comment #4) > Cool, great analysis! Would you like to work on a code change for that and > submit it to KDE? I have no prior experience in KDE development and very little in Qt programming, so I can't contribute code for now. Sorry about that. I can confirm this bug... it is pretty awful for productivity. I use Quartus Prime Lite and any time you open some kind of child window in the app, the global menu disappears and does not come back when the window closes. The only way to get it to come back is to switch focus away from the app and back again. A couple of important details about this bug: 1. This bug is WAYLAND ONLY. X11 still works correctly. But at this point we are kind of all being forced into Wayland so that's not very helpful anymore. 2. Focus follows mouse and its variations are not affected by the bug because the global menu is seemingly automatically restored by the mouse's focus. So people using FFM won't be noticing what a show stopper this bug is. 3. The global menu seems to be disappearing because it is somehow losing connection with the focused app. In the distribution Garuda KDE Dr460nized (which I am using) the global menu is set up to display the application name, and when nothing is focused (i.e. by clicking on the desktop) it just displays the name "Dr460niszed KDE". When the global menu disappears, it always says the focused app name is just "Dr460niszed KDE". 4. Related to #3: There is a less severe symptom of the bug which is probably going unnoticed by most. Some apps will restore the global menu after closing a child window, but Garuda Linux does not update the focused app name in the global menu. For example Gimp normally says "GNU Image Manipulation Program" in front of the menu options ("File Edit" etc..) but after the bug occurs it will still have it's menu options but will say "Dr460nized KDE" instead. Further clarification on #1: It looks llke the menu disappears maybe because child windows do not have global menu options directly associated with them. This is a Wayland-only behaviour. In X11 sessions, the global menu never changes when a child window with no global menu options appears, it consistently shows the main application global menu options. Hopefully these details help to get this bug fixed as quickly as possible. For testing I recommend installing Quartus Prime Lite, it's the most unusable thing I'm trying to use at the moment with this bug. Open the application then try to open a settings/options child window from the global menu (for example: Tools > Options...) (In reply to Miranda from comment #6) > 2. Focus follows mouse and its variations are not affected by the bug > because the global menu is seemingly automatically restored by the mouse's > focus. So people using FFM won't be noticing what a show stopper this bug > is. Sorry, I was wrong about this point. It's "Focus under mouse" and "Focus strictly under mouse" that are not affected. FFM doesn't reacquire the global menu focus, but the under mouse options seem to actually never lose focus in the first place, because the global menu does not disappear when you open child windows while in those modes. |
Created attachment 166845 [details] Screen recording SUMMARY The global menu disappears when I am playing Picmi and the high-score window pops up at the end of game, but not good enough to get a high score STEPS TO REPRODUCE 1. Ensure one panel contains the "Global Menu" widget. One way to do so is adding a "Global menu panel" 2. Open the Picmi game. 3. Play it enough times (any difficulty) to fill up the "highscores". Alternatively, modify `.config/picmirc` and add the following section to fill up the "Easy" difficulty: ========================CUT HERE========================= [KHighscore_Easy] 0_LastPlayer=test 1_Date=10 Mar 2024 13:40 1_Name=test 1_Score=98 1_Time=0:00:38 2_Date=10 Mar 2024 13:40 2_Name=test 2_Score=98 2_Time=0:00:38 3_Date=10 Mar 2024 13:40 3_Name=test 3_Score=98 3_Time=0:00:38 4_Date=10 Mar 2024 13:40 4_Name=test 4_Score=98 4_Time=0:00:38 5_Date=10 Mar 2024 13:40 5_Name=test 5_Score=98 5_Time=0:00:38 6_Date=10 Mar 2024 13:40 6_Name=test 6_Score=98 6_Time=0:00:38 7_Date=10 Mar 2024 13:40 7_Name=test 7_Score=98 7_Time=0:00:38 8_Date=10 Mar 2024 13:40 8_Name=test 8_Score=98 8_Time=0:00:38 9_Date=10 Mar 2024 13:40 9_Name=test 9_Score=98 9_Time=0:00:38 10_Date=10 Mar 2024 13:40 10_Name=test 10_Score=98 10_Time=0:00:38 ========================CUT HERE========================= 4. Play one more time at the same difficulty, win, but don't be too fast. Be slow enough not to enter the high scores. OBSERVED RESULT A dialog showing "Congratulations! You have solved the board!" appears, and the global menu disappears. After closing that dialog, the global menu still doesn't show up. But if I switch to another application (such as dolphin), the global menu appears. Then if I switch back to Picmi, the correct global menu for Picmi will show. EXPECTED RESULT After closing the "You have solved the board" dialog, the menu for Picmi should show immediately in the global menu widget. SOFTWARE/OS VERSIONS Linux/KDE Plasma: (available in About System) KDE Plasma Version: 6.0.1 KDE Frameworks Version: 6.0.0 Qt Version: 6.6.2 Kernel: 6.7.9-arch1-1 (64-bit) Graphics Platform: Wayland ADDITIONAL INFORMATION