diff --git a/activation.cpp b/activation.cpp index c3d8447a76..378bca460c 100644 --- a/activation.cpp +++ b/activation.cpp @@ -222,8 +222,8 @@ void Workspace::setActiveClient( Client* c, allowed_t ) ++set_active_client_recursion; if( active_client != NULL ) { // note that this may call setActiveClient( NULL ), therefore the recursion counter - active_client->setActive( false ); - } + active_client->setActive( false ); + } active_client = c; Q_ASSERT( c == NULL || c->isActive()); if( active_client != NULL ) @@ -266,6 +266,7 @@ void Workspace::activateClient( Client* c, bool force ) { if( c == NULL ) { + focusToNull(); setActiveClient( NULL, Allowed ); return; } diff --git a/workspace.cpp b/workspace.cpp index b4951ceb52..03dc3f584e 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1324,7 +1324,10 @@ bool Workspace::setCurrentDesktop( int new_desktop ) // and active_client is on_all_desktops and under mouse (hence == old_active_client), // conserve focus (thanks to Volker Schatz ) else if( active_client && active_client->isShown( true ) && active_client->isOnCurrentDesktop()) - c= active_client; + c = active_client; + + if( c == NULL && !desktops.isEmpty()) + c = findDesktop( true, currentDesktop()); if( c != active_client ) setActiveClient( NULL, Allowed );