Version: 1.90 (using KDE 3.1.0) Compiler: gcc version 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk) OS: Linux (i686) release 2.4.21-0.13mdk 1. Start kmix. Make sure that the kmix icon appears in system tray. 2. Do not quit kmix but simply close the kmix window. Confirm that the system tray still has kmix icon. 3. Right click on kmix icon on system tray. Select "Show mixer window". Kmix window reappears. 4. Right click on kmix icon on system tray. Select "Hide mixer window". The kmix window definitely does not minimize/vanish. Worse, if it was in the background, it comes to the foreground.
Confirm on HEAD 20030312 If the mixer window has focus, selecting Hide Mixer Window hides it. If not, it gets raised and focused, as the reporter says.
Subject: kdelibs/kdeui CVS commit by lunakl: Fix #56641. CCMAIL: 56641-done@bugs.kde.org M +26 -6 ksystemtray.cpp 1.26 M +3 -1 ksystemtray.h 1.10 --- kdelibs/kdeui/ksystemtray.cpp #1.25:1.26 @@ -84,5 +84,5 @@ KSystemTray::KSystemTray( QWidget* paren connect(quitAction, SIGNAL(activated()), parentWidget(), SLOT(close())); new KAction(i18n("Minimize"), KShortcut(), - this, SLOT( toggleMinimizeRestore() ), + this, SLOT( minimizeRestoreAction() ), d->actionCollection, "minimizeRestore"); } @@ -149,5 +149,5 @@ void KSystemTray::mousePressEvent( QMous switch ( e->button() ) { case LeftButton: - toggleMinimizeRestore(); + activateOrHide(); break; case MidButton: @@ -181,5 +179,19 @@ void KSystemTray::contextMenuAboutToShow } -void KSystemTray::toggleMinimizeRestore() +// called from the popup menu - always do what the menu entry says, +// i.e. if the window is shown, no matter if active or not, the menu +// entry is "minimize", otherwise it's "restore" +void KSystemTray::minimizeRestoreAction() +{ + if ( parentWidget() ) { + bool restore = !( parentWidget()->isVisible() ); + minimizeRestore( restore ); + } +} + +// called when left-clicking the tray icon +// if the window is not the active one, show it if needed, and activate it +// (just like taskbar); otherwise hide it +void KSystemTray::activateOrHide() { QWidget *pw = parentWidget(); @@ -200,10 +212,18 @@ void KSystemTray::toggleMinimizeRestore( return; } + minimizeRestore( !visible ); +} - if ( !visible ) +void KSystemTray::minimizeRestore( bool restore ) +{ + QWidget* pw = parentWidget(); + if( !pw ) + return; + if ( restore ) { #ifndef Q_WS_QWS //FIXME // TODO what to do with OnAllDesktops windows? (#32783) KWin::setOnDesktop( pw->winId(), KWin::currentDesktop()); + KWin::Info info = KWin::info( pw->winId() ); pw->move( info.geometry.topLeft() ); // avoid placement policies pw->show(); --- kdelibs/kdeui/ksystemtray.h #1.9:1.10 @@ -144,6 +144,8 @@ signals: private slots: - void toggleMinimizeRestore(); + void minimizeRestoreAction(); private: + void activateOrHide(); + void minimizeRestore( bool restore ); KPopupMenu* menu; // minimizeRestoreId is no longer needed. remove in KDE 4.0