Move minimized windows to the right place in focus chain.

(#124807)


svn path=/trunk/KDE/kdebase/workspace/; revision=528632
icc-effect-5.14.5
Luboš Luňák 2006-04-11 14:52:27 +00:00
parent e906595aaf
commit 4d8462f579
5 changed files with 29 additions and 13 deletions

View File

@ -229,7 +229,7 @@ void Workspace::setActiveClient( Client* c, allowed_t )
last_active_client = active_client;
if ( active_client )
{
updateFocusChains( active_client, true ); // make it first in focus chain
updateFocusChains( active_client, FocusChainMakeFirst );
active_client->demandAttention( false );
}
pending_take_activity = NULL;

View File

@ -574,7 +574,7 @@ void Client::minimize( bool avoid_animation )
updateAllowedActions();
workspace()->updateMinimizedOfTransients( this );
updateWindowRules();
workspace()->updateFocusChains( this, false ); // make it last in the focus chain
workspace()->updateFocusChains( this, Workspace::FocusChainMakeLast );
}
void Client::unminimize( bool avoid_animation )
@ -1154,7 +1154,8 @@ void Client::setSkipTaskbar( bool b, bool from_outside )
info->setState( b?NET::SkipTaskbar:0, NET::SkipTaskbar );
updateWindowRules();
if( was_wants_tab_focus != wantsTabFocus())
workspace()->updateFocusChains( this, isActive());
workspace()->updateFocusChains( this,
isActive() ? Workspace::FocusChainMakeFirst : Workspace::FocusChainUpdate );
}
void Client::setSkipPager( bool b )
@ -1196,7 +1197,7 @@ void Client::setDesktop( int desktop )
}
if( decoration != NULL )
decoration->desktopChange();
workspace()->updateFocusChains( this, true );
workspace()->updateFocusChains( this, Workspace::FocusChainMakeFirst );
updateVisibility();
updateWindowRules();
}

View File

@ -370,7 +370,7 @@ bool Workspace::workspaceEvent( XEvent * e )
if( c )
{
c->windowEvent( e );
updateFocusChains( c, true );
updateFocusChains( c, FocusChainUpdate );
return true;
}
break;

View File

@ -516,7 +516,7 @@ void Workspace::addClient( Client* c, allowed_t )
}
else
{
updateFocusChains( c, false ); // add to focus chain if not already there
updateFocusChains( c, FocusChainUpdate ); // add to focus chain if not already there
clients.append( c );
}
if( !unconstrained_stacking_order.contains( c ))
@ -595,7 +595,7 @@ void Workspace::removeClient( Client* c, allowed_t )
updateClientArea();
}
void Workspace::updateFocusChains( Client* c, bool make_first )
void Workspace::updateFocusChains( Client* c, FocusChainChange change )
{
if( !c->wantsTabFocus()) // doesn't want tab focus, remove
{
@ -609,11 +609,15 @@ void Workspace::updateFocusChains( Client* c, bool make_first )
if(c->desktop() == NET::OnAllDesktops)
{ //now on all desktops, add it to focus_chains it is not already in
for( int i=1; i<= numberOfDesktops(); i++)
{ // make_first works only on current desktop, don't affect all desktops
if( make_first && i == currentDesktop())
{ // making first/last works only on current desktop, don't affect all desktops
if( i == currentDesktop()
&& ( change == FocusChainMakeFirst || change == FocusChainMakeLast ))
{
focus_chain[ i ].remove( c );
focus_chain[ i ].append( c );
if( change == FocusChainMakeFirst )
focus_chain[ i ].append( c );
else
focus_chain[ i ].prepend( c );
}
else if( !focus_chain[ i ].contains( c ))
focus_chain[ i ].prepend( c ); // otherwise add as the last one
@ -625,11 +629,16 @@ void Workspace::updateFocusChains( Client* c, bool make_first )
{
if( i == c->desktop())
{
if( make_first )
if( change == FocusChainMakeFirst )
{
focus_chain[ i ].remove( c );
focus_chain[ i ].append( c );
}
else if( change == FocusChainMakeLast )
{
focus_chain[ i ].remove( c );
focus_chain[ i ].prepend( c );
}
else if( !focus_chain[ i ].contains( c ))
focus_chain[ i ].prepend( c );
}
@ -637,11 +646,16 @@ void Workspace::updateFocusChains( Client* c, bool make_first )
focus_chain[ i ].remove( c );
}
}
if( make_first )
if( change == FocusChainMakeFirst )
{
global_focus_chain.remove( c );
global_focus_chain.append( c );
}
else if( change == FocusChainMakeLast )
{
global_focus_chain.remove( c );
global_focus_chain.prepend( c );
}
else if( !global_focus_chain.contains( c ))
global_focus_chain.prepend( c );
}

View File

@ -251,7 +251,8 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data );
void focusToNull(); // SELI public?
void updateFocusChains( Client* c, bool make_first );
enum FocusChainChange { FocusChainMakeFirst, FocusChainMakeLast, FocusChainUpdate };
void updateFocusChains( Client* c, FocusChainChange change );
bool forcedGlobalMouseGrab() const;
void clientShortcutUpdated( Client* c );