diff --git a/client.cpp b/client.cpp index 01f9ba1247..0967c4710a 100644 --- a/client.cpp +++ b/client.cpp @@ -1065,6 +1065,8 @@ void Client::toggleOnAllDesktops() void Client::setDesktop( int desktop ) { + if( desktop != NET::OnAllDesktops ) // do range check + desktop = KMAX( 1, KMIN( workspace()->numberOfDesktops(), desktop )); if( desk == desktop ) return; int was_desk = desk; diff --git a/manage.cpp b/manage.cpp index a46da73b45..463c1c4194 100644 --- a/manage.cpp +++ b/manage.cpp @@ -18,6 +18,7 @@ License. See the file "COPYING" for the exact licensing terms. #include "client.h" #include +#include #include #include "notifications.h" @@ -181,6 +182,8 @@ bool Client::manage( Window w, bool isMapped ) } if ( desk == 0 ) // assume window wants to be visible on the current desktop desk = workspace()->currentDesktop(); + if( desk != NET::OnAllDesktops ) // do range check + desk = KMAX( 1, KMIN( workspace()->numberOfDesktops(), desk )); info->setDesktop( desk ); workspace()->updateOnAllDesktopsOfTransients( this ); // SELI // onAllDesktopsChange(); decoration doesn't exist here yet diff --git a/workspace.cpp b/workspace.cpp index f9087941af..034dba423c 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1166,6 +1166,7 @@ void Workspace::sendClientToDesktop( Client* c, int desk, bool dont_activate ) bool was_on_desktop = c->isOnDesktop( desk ) || c->isOnAllDesktops(); c->setDesktop( desk ); + desk = c->desktop(); // Client did range checking if ( c->isOnDesktop( currentDesktop() ) ) {