[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdeui
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2003-04-03 18:40:32
[Download RAW message or body]

CVS commit by lunakl: 

Fix #32783.
Also, use the Withdrawn mapping state to simply detect if the main window
is shown or not. I hope now KSystemTray works for all.


  M +14 -8     ksystemtray.cpp   1.27


--- kdelibs/kdeui/ksystemtray.cpp  #1.26:1.27
@@ -59,4 +59,5 @@ public:
 
     KActionCollection* actionCollection;
+    bool on_all_desktops; // valid only when the parent widget was hidden
 };
 
@@ -86,8 +87,11 @@ KSystemTray::KSystemTray( QWidget* paren
                     this, SLOT( minimizeRestoreAction() ),
                     d->actionCollection, "minimizeRestore");
+        KWin::Info info = KWin::info( parentWidget()->winId());
+        d->on_all_desktops = info.onAllDesktops;
     }
     else
     {
         connect(quitAction, SIGNAL(activated()), qApp, SLOT(closeAllWindows()));
+        d->on_all_desktops = false;
     }
 }
@@ -201,16 +205,15 @@ void KSystemTray::activateOrHide()
 
     KWin::Info info = KWin::info( pw->winId() );
-    bool visible = (info.mappingState == NET::Visible);
-    // hack for KWin's non-compliant WM_STATE handling
-    visible = visible && ( info.desktop == KWin::currentDesktop());
+    // mapped = not hidden by calling hide()
+    bool mapped = (info.mappingState != NET::Withdrawn);
     // SELI using !pw->isActiveWindow() should be enough here,
     // but it doesn't work - e.g. with kscd, the "active" window
     // is the widget docked in Kicker
-    if ( visible && ( KWinModule().activeWindow() != pw->winId() )) // visible not active -> activate
+    if ( mapped && ( KWinModule().activeWindow() != pw->winId() )) // visible not active -> activate
     {
         KWin::setActiveWindow( pw->winId() );
         return;
     }
-    minimizeRestore( !visible );
+    minimizeRestore( !mapped );
 }
 
@@ -220,10 +223,12 @@ void KSystemTray::minimizeRestore( bool 
     if( !pw )
         return;
+    KWin::Info info = KWin::info( pw->winId() );
     if ( restore )
     {
 #ifndef Q_WS_QWS //FIXME
-        // TODO what to do with OnAllDesktops windows? (#32783)
+        if( d->on_all_desktops )
+            KWin::setOnAllDesktops( pw->winId(), true );
+        else
         KWin::setOnDesktop( pw->winId(), KWin::currentDesktop());
-        KWin::Info info = KWin::info( pw->winId() );
         pw->move( info.geometry.topLeft() ); // avoid placement policies
         pw->show();
@@ -231,4 +236,5 @@ void KSystemTray::minimizeRestore( bool 
 #endif
     } else {
+        d->on_all_desktops = info.onAllDesktops;
         pw->hide();
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic