Fix #14591
On some Linux systems the minimized to the taskbar (iconified) main window cannot be restored properly using actions from the systray icon menu when QSystemTrayIcon::contextMenu()
is a child of the main window.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
373@@ -374,6 +374,12 @@ void bringToFront(QWidget* w)
374 // activateWindow() (sometimes) helps with keyboard focus on Windows
375 if (w->isMinimized()) {
376 w->showNormal();
377+ // This is a workaround when the main window still minimized to the taskbar (iconified)
378+ // due to a (possible) Qt bug or a weird window manager behaviour.
379+ if (isObscured(w)) {
isObscured()
directly after showNormal()
make sense or should it hit back the the runloop first?
@jonasschnelli
Thank you for your review and your hint making me investigate the problem more deeper.
The root of problem has been detected: X11 and/or the window manager fail to handle the main window properly when QSystemTrayIcon::contextMenu()
is a child of the main window.
There is no more ugly workarounds.
Would you mind re-reviewing?
223@@ -224,6 +224,10 @@ BitcoinGUI::~BitcoinGUI()
224 settings.setValue("MainWindowGeometry", saveGeometry());
225 if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
226 trayIcon->hide();
227+ if (trayIconMenu) {
unique_ptr
and RAII here?
On some Linux systems the minimized to the taskbar (iconified) main
window cannot be restored properly using actions from the systray icon
menu when QSystemTrayIcon::contextMenu() is a child of the main window.