diff --git a/activation.cpp b/activation.cpp index b0c7a8d034..ce68a9d431 100644 --- a/activation.cpp +++ b/activation.cpp @@ -343,6 +343,7 @@ extern bool block_focus; // SELI void Workspace::clientHidden( Client* c ) { + assert( !c->isShown( true ) || !c->isOnCurrentDesktop()); if( !( c == active_client || ( should_get_focus.count() > 0 && c == should_get_focus.last()))) return; @@ -378,13 +379,10 @@ void Workspace::clientHidden( Client* c ) if( get_focus == NULL ) get_focus = *it; } + if( get_focus == NULL ) + get_focus = findDesktop( true, currentDesktop()); if( get_focus != NULL ) - { requestFocus( get_focus ); - return; - } - if ( !desktops.isEmpty() ) - requestFocus( findDesktop( true, currentDesktop())); else focusToNull(); } diff --git a/client.cpp b/client.cpp index f6431d2618..00cddc50b9 100644 --- a/client.cpp +++ b/client.cpp @@ -172,6 +172,7 @@ void Client::releaseWindow( bool on_shutdown ) if (moveResizeMode) leaveMoveResize(); setModal( false ); // otherwise its mainwindow wouldn't get focus + hidden = true; // so that it's not considered visible anymore if( !on_shutdown ) workspace()->clientHidden( this ); destroyDecoration(); @@ -212,6 +213,7 @@ void Client::destroyClient() leaveMoveResize(); ++block_geometry; setModal( false ); + hidden = true; // so that it's not considered visible anymore workspace()->clientHidden( this ); destroyDecoration(); cleanGrouping();