--- kwin/geometry.cpp.sav 2006-08-18 15:33:22.000000000 +0200 +++ kwin/geometry.cpp 2006-08-30 19:08:27.000000000 +0200 @@ -1722,6 +1722,7 @@ void Client::setGeometry( int x, int y, sendSyntheticConfigureNotify(); updateWindowRules(); checkMaximizeGeometry(); + workspace()->checkActiveScreen( this ); } void Client::plainResize( int w, int h, ForceGeometry_t force ) @@ -1775,6 +1776,7 @@ void Client::plainResize( int w, int h, sendSyntheticConfigureNotify(); updateWindowRules(); checkMaximizeGeometry(); + workspace()->checkActiveScreen( this ); } /*! @@ -1795,6 +1797,7 @@ void Client::move( int x, int y, ForceGe sendSyntheticConfigureNotify(); updateWindowRules(); checkMaximizeGeometry(); + workspace()->checkActiveScreen( this ); } --- kwin/workspace.cpp.sav 2006-06-23 14:35:28.000000000 +0200 +++ kwin/workspace.cpp 2006-08-30 19:46:15.000000000 +0200 @@ -1526,6 +1526,18 @@ int Workspace::activeScreen() const return qApp->desktop()->screenNumber( QCursor::pos()); } +// check whether a client moved completely out of what's considered the active screen, +// if yes, set a new active screen +void Workspace::checkActiveScreen( const Client* c ) + { + if( !options->xineramaEnabled ) + return; + if( !c->isActive()) + return; + if( !c->isOnScreen( active_screen )) + active_screen = c->screen(); + } + QRect Workspace::screenGeometry( int screen ) const { if( !options->xineramaEnabled ) @@ -1555,6 +1567,8 @@ void Workspace::sendClientToScreen( Clie it != transients_stacking_order.end(); ++it ) sendClientToScreen( *it, screen ); + if( c->isActive()) + active_screen = screen; } void Workspace::setDesktopLayout(int o, int x, int y) --- kwin/workspace.h.sav 2006-06-23 14:35:28.000000000 +0200 +++ kwin/workspace.h 2006-08-30 19:08:43.000000000 +0200 @@ -166,6 +166,7 @@ class Workspace : public QObject, public int activeScreen() const; int numScreens() const; + void checkActiveScreen( const Client* c ); QRect screenGeometry( int screen ) const; int screenNumber( QPoint pos ) const;