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

List:       kde-core-devel
Subject:    Re: System tray problems in HEAD
From:       Lubos Lunak <l.lunak () suse ! cz>
Date:       2003-02-24 12:03:04
[Download RAW message or body]

On Monday 24 of February 2003 02:20, Aaron J. Seigo wrote:
> On Sunday 23 February 2003 12:27, George Staikos wrote:
> > in HEAD, opening apps from the system tray works fine (for instance
> > clicking on the kscd or kmix tray icon opens the window).  However,
> > closing the window via the system tray icon doesn't work.  It works fine
> > in 3.1-branch.  Did anyone change something that could affect this
> > recently? One thing I did not ice is that if I click really quickly
> > approximately 6 times it often closes the app, though not always.

 KGet works fine here.

>
> ok, did a bit of poking about in the sources and the problem is this:
>
> if the window is visible (e.g. not hid()den) then checks to see if it is
> the active window. if it not the active window, then it tries to see if the
> window is simply obscured by another window in the way. it seems to try to
> assess this with the following code:
>
>         KWinModule mod;
>         if ( mod.stackingOrder().last() != pw->winId() )
>
> problem is that  mod.stackingOrder().last() NEVER equals pw->winId... i'm

 Obviously ... the topmost window in the stacking order is usually Kicker.

> not familiar with the KWin stacking code, so i don't know exactly what this
> is really supposed to do, but i assume it's trying to see if it is the
> top-most windw on the desktop. no matter what, though, it always evaluates
> to true and the window is ALWAYS raised. even if it is plainly visible;
> even if the window in question has keyboard focus!

 And why exactly is this problem? Raising a window that cannot be raised more 
should be a no-op. The code in KSystemTray::toggleMinimizeRestore() looks 
strange to me anyway (for example the hide()+show() combo). Does it work 
better with the attached patch? That's how I think it should be done 
correctly.

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/

["ksystemtray.cpp.patch" (text/x-diff)]

--- ksystemtray.cpp.sav	2003-01-02 13:00:58.000000000 +0100
+++ ksystemtray.cpp	2003-02-24 13:00:12.000000000 +0100
@@ -187,33 +187,19 @@ void KSystemTray::toggleMinimizeRestore(
 
     KWin::Info info = KWin::info( pw->winId() );
     bool visible = (info.mappingState == NET::Visible);
-    if ( visible && !pw->isActiveWindow() ) // may be obscured -> raise it
+    // hack for KWin's non-compliant WM_STATE handling
+    visible = visible && ( info.desktop == KWin::currentDesktop());
+    if ( visible && !pw->isActiveWindow() ) // visible not active -> activate
     {
-        KWinModule mod;
-        if ( mod.stackingOrder().last() != pw->winId() )
-        {
-            if ( info.desktop == KWin::currentDesktop() )
-            {
-                KWin::setActiveWindow( pw->winId() );
-                return;
-            }
-            else
-                visible = false;
-        }
+        KWin::setActiveWindow( pw->winId() );
+        return;
     }
 
     if ( !visible )
     {
-        if ( info.mappingState != NET::Iconic )
-        {
-            pw->hide(); // KWin::setOnDesktop( parentWidget()->winId(), KWin::currentDesktop() );
-#ifndef Q_WS_QWS //FIXME
-            pw->move( info.geometry.topLeft() );
-#endif
-            pw->show();
 #ifndef Q_WS_QWS //FIXME
-        }
-        KWin::deIconifyWindow( pw->winId() );
+	KWin::setOnDesktop( pw->winId(), KWin::currentDesktop());
+        pw->show();
 	KWin::setActiveWindow( pw->winId() );
 #endif
     } else {


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

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