highly improved style switching
svn path=/trunk/kdebase/kwin/; revision=56978
This commit is contained in:
parent
e316ecc005
commit
bda93628e4
3 changed files with 56 additions and 24 deletions
28
client.cpp
28
client.cpp
|
@ -480,7 +480,7 @@ Client::~Client()
|
|||
Manages the clients. This means handling the very first maprequest:
|
||||
reparenting, initial geometry, initial state, placement, etc.
|
||||
*/
|
||||
void Client::manage( bool isMapped )
|
||||
bool Client::manage( bool isMapped, bool isReset )
|
||||
{
|
||||
|
||||
if (layout())
|
||||
|
@ -564,15 +564,22 @@ void Client::manage( bool isMapped )
|
|||
}
|
||||
|
||||
info->setDesktop( desk );
|
||||
|
||||
|
||||
|
||||
setMappingState( state );
|
||||
if ( state == NormalState && isOnDesktop( workspace()->currentDesktop() ) ) {
|
||||
|
||||
bool showMe = state == NormalState && isOnDesktop( workspace()->currentDesktop() );
|
||||
|
||||
if ( showMe && !isReset ) {
|
||||
Events::raise( isTransient() ? Events::TransNew : Events::New );
|
||||
workspace()->raiseClient( this ); // ensure constrains
|
||||
show();
|
||||
if ( options->focusPolicyIsReasonable() && wantsTabFocus() )
|
||||
workspace()->requestFocus( this );
|
||||
if ( isMapped ) {
|
||||
show();
|
||||
} else {
|
||||
workspace()->raiseClient( this ); // ensure constrains
|
||||
show();
|
||||
if ( options->focusPolicyIsReasonable() && wantsTabFocus() )
|
||||
workspace()->requestFocus( this );
|
||||
}
|
||||
}
|
||||
|
||||
// other settings from the previous session
|
||||
|
@ -581,8 +588,11 @@ void Client::manage( bool isMapped )
|
|||
}
|
||||
|
||||
delete session;
|
||||
|
||||
workspace()->updateClientArea();
|
||||
|
||||
if ( !isReset )
|
||||
workspace()->updateClientArea();
|
||||
|
||||
return showMe;
|
||||
}
|
||||
|
||||
|
||||
|
|
2
client.h
2
client.h
|
@ -74,7 +74,7 @@ public:
|
|||
|
||||
virtual bool windowEvent( XEvent * );
|
||||
|
||||
void manage( bool isMapped = FALSE );
|
||||
bool manage( bool isMapped = FALSE, bool isReset = FALSE );
|
||||
|
||||
void setMappingState( int s );
|
||||
int mappingState() const;
|
||||
|
|
|
@ -1559,6 +1559,7 @@ void Workspace::raiseClient( Client* c )
|
|||
if ( !c )
|
||||
return;
|
||||
|
||||
qDebug("raise client %s", c->caption().latin1() );
|
||||
if ( tab_box->isVisible() )
|
||||
return;
|
||||
|
||||
|
@ -2499,21 +2500,42 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent key )
|
|||
*/
|
||||
void Workspace::slotResetAllClients()
|
||||
{
|
||||
for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) {
|
||||
Client *oldClient = (*it);
|
||||
WId w = oldClient->window();
|
||||
oldClient->hide();
|
||||
oldClient->releaseWindow();
|
||||
// Replace oldClient with newClient in all lists
|
||||
Client *newClient = clientFactory (w);
|
||||
(*it) = newClient;
|
||||
ClientList::Iterator jt = stacking_order.find (oldClient);
|
||||
(*jt) = newClient;
|
||||
jt = focus_chain.find (oldClient);
|
||||
(*jt) = newClient;
|
||||
delete oldClient;
|
||||
newClient->manage( TRUE );
|
||||
|
||||
ClientList stack = stacking_order;
|
||||
Client* active = activeClient();
|
||||
block_focus = TRUE;
|
||||
Client* prev = 0;
|
||||
for (ClientList::Iterator it = stack.fromLast(); it != stack.end(); --it) {
|
||||
Client *oldClient = (*it);
|
||||
oldClient->hide();
|
||||
WId w = oldClient->window();
|
||||
XUnmapWindow( qt_xdisplay(), w );
|
||||
oldClient->releaseWindow();
|
||||
// Replace oldClient with newClient in all lists
|
||||
Client *newClient = clientFactory (w);
|
||||
if ( oldClient == active )
|
||||
active = newClient;
|
||||
ClientList::Iterator jt = clients.find (oldClient);
|
||||
(*jt) = newClient;
|
||||
jt = stacking_order.find (oldClient);
|
||||
(*jt) = newClient;
|
||||
jt = focus_chain.find (oldClient);
|
||||
(*jt) = newClient;
|
||||
delete oldClient;
|
||||
bool showIt = newClient->manage( TRUE, TRUE );
|
||||
if ( prev ) {
|
||||
Window stack[2];
|
||||
stack[0] = prev->winId();;
|
||||
stack[1] = newClient->winId();
|
||||
XRestackWindows( qt_xdisplay(), stack, 2 );
|
||||
}
|
||||
if ( showIt )
|
||||
newClient->show();
|
||||
prev = newClient;
|
||||
}
|
||||
block_focus = FALSE;
|
||||
if ( active )
|
||||
requestFocus( active );
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Reference in a new issue