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.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
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.
Rebased after #14123 merging. @promag @jonasschnelli Would you mind reviewing this PR?
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)) {
Does calling 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?
utACK 40d3f19d20040ff1e0b2754fd083d0bb269c2fb5
utACK 40d3f19
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) {
We might want to use a 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.
thank you, utACK a88640e123ca0c00d81719f9a009699c26e85b90