diff --git a/client.cpp b/client.cpp index b21dbbf8c2..8e436c90ad 100644 --- a/client.cpp +++ b/client.cpp @@ -49,7 +49,10 @@ public: } virtual void changeDesktop(Q_UINT32 desktop) { - m_client->setDesktop( desktop ); + if ( desktop == NETWinInfo::OnAllDesktops ) + m_client->setSticky( TRUE ); + else + m_client->workspace()->sendClientToDesktop( m_client, desktop ); } virtual void changeState(Q_UINT32 state, Q_UINT32 mask ) { // state : kwin.h says: possible values are or'ed combinations of NET::Modal, diff --git a/workspace.cpp b/workspace.cpp index 99a3919a23..ec25402dbe 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -2014,7 +2014,32 @@ void Workspace::clientPopupAboutToShow() /*! - Sends the activeClient() to desktop \a desk + Sends client \a c to desktop \a desk. + + Takes care of transients as well. + */ +void Workspace::sendClientToDesktop( Client* c, int desk ) +{ + if ( c->isSticky() ) + c->setSticky( FALSE ); + + if ( c->isOnDesktop( desk ) ) + return; + + c->setDesktop( desk ); + c->hide(); + + for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) { + if ( (*it)->transientFor() == c->window() ) { + sendClientToDesktop( *it, desk ); + } + } +} + +/*! + Sends the popup client to desktop \a desk + + Internal slot for the window operation menu */ void Workspace::sendToDesktop( int desk ) { @@ -2024,24 +2049,9 @@ void Workspace::sendToDesktop( int desk ) popup_client->setSticky( !popup_client->isSticky() ); return; } + + sendClientToDesktop( popup_client, desk ); - if ( popup_client->isSticky() ) - popup_client->setSticky( FALSE ); - - if ( popup_client->isOnDesktop( desk ) ) - return; - - popup_client->setDesktop( desk ); - popup_client->hide(); - - Client* old = popup_client; - for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) { - if ( (*it)->transientFor() == popup_client->window() ) { - popup_client = *it; - sendToDesktop( desk ); - popup_client = old; - } - } } diff --git a/workspace.h b/workspace.h index 344219d16f..51c1cac643 100644 --- a/workspace.h +++ b/workspace.h @@ -147,6 +147,8 @@ public: const ClientList& stackingOrder() const; Client* topClientOnDesktop() const; + void sendClientToDesktop( Client* c, int desktop ); + QPopupMenu* clientPopup( Client* ); @@ -172,7 +174,7 @@ public: void cascadeDesktop(); void unclutterDesktop(); void reconfigure(); - + public slots: void setCurrentDesktop( int new_desktop ); @@ -223,7 +225,7 @@ private: void freeKeyboard(bool pass); Client* clientFactory(WId w); - + void raiseTransientsOf( ClientList& safeset, Client* c ); void lowerTransientsOf( ClientList& safeset, Client* c ); void randomPlacement(Client* c);