Fix #76408 - do range checking on _NET_WM_DESKTOP values.

CCMAIL: 76408-done@bugs.kde.org

svn path=/trunk/kdebase/kwin/; revision=292889
This commit is contained in:
Luboš Luňák 2004-03-01 17:20:19 +00:00
parent 6e819697ad
commit aee628e008
3 changed files with 6 additions and 0 deletions

View file

@ -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;

View file

@ -18,6 +18,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "client.h"
#include <kstartupinfo.h>
#include <kglobal.h>
#include <X11/extensions/shape.h>
#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

View file

@ -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() ) )
{