Bug 75302

Summary: very minor: Reactivate previous window on auto-unshade
Product: [Plasma] kwin Reporter: Martin Pärtel <martin.partel>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Martin Pärtel 2004-02-15 20:10:45 UTC
Version:            (using KDE KDE 3.2.0)
Installed from:    Gentoo Packages
OS:          Linux

A minor suggestion for the useful feature of automatically unshading a shaded window when the mouse hovers over it and then shading it again when the mouse leaves:
The previously active window could become active again after auto-unshading another window.
Comment 1 Lubos Lunak 2004-02-16 16:19:52 UTC
CVS commit by lunakl: 

On auto unshading, don't keep focus on the unshaded window, revert
focus to the previously active window.
CCMAIL: 75302-done@bugs.kde.org


  M +7 -1      activation.cpp   2.19
  M +7 -1      client.cpp   1.409
  M +1 -0      workspace.h   1.164


--- kdebase/kwin/activation.cpp  #2.18:2.19
@@ -340,4 +340,11 @@ void Workspace::clientHidden( Client* c 
     {
     assert( !c->isShown( true ) || !c->isOnCurrentDesktop());
+    activateNextClient( c );
+    }
+
+// deactivates 'c' and activates next client    
+void Workspace::activateNextClient( Client* c )
+    {
+    // if 'c' is not the active or the to-become active one, do nothing
     if( !( c == active_client
             || ( should_get_focus.count() > 0 && c == should_get_focus.last())))

--- kdebase/kwin/client.cpp  #1.408:1.409
@@ -673,4 +673,5 @@ void Client::setShade( ShadeMode mode )
         return;
     bool was_shade = isShade();
+    ShadeMode was_shade_mode = shade_mode;
     shade_mode = mode;
     if( was_shade == isShade())
@@ -720,6 +721,11 @@ void Client::setShade( ShadeMode mode )
         plainResize( s );
         if( isActive())
+            {
+            if( was_shade_mode == ShadeHover )
+                workspace()->activateNextClient( this );
+            else
             workspace()->focusToNull();
         }
+        }
     else 
         {

--- kdebase/kwin/workspace.h  #1.163:1.164
@@ -119,4 +119,5 @@ class Workspace : public QObject, public
         bool fakeRequestedActivity( Client* c );
         void unfakeActivity( Client* c );
+        void activateNextClient( Client* c );
         bool focusChangeEnabled() { return block_focus == 0; }