diff --git a/geometry.cpp b/geometry.cpp index e2e42de0c8..c5204708d2 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1707,6 +1707,7 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force ) sendSyntheticConfigureNotify(); updateWindowRules(); checkMaximizeGeometry(); + workspace()->checkActiveScreen( this ); if( geom_before_block.size() != geom.size()) { discardWindowPixmap(); @@ -1770,6 +1771,7 @@ void Client::plainResize( int w, int h, ForceGeometry_t force ) sendSyntheticConfigureNotify(); updateWindowRules(); checkMaximizeGeometry(); + workspace()->checkActiveScreen( this ); discardWindowPixmap(); if( scene != NULL ) scene->windowGeometryShapeChanged( this ); @@ -1797,6 +1799,7 @@ void Client::move( int x, int y, ForceGeometry_t force ) sendSyntheticConfigureNotify(); updateWindowRules(); checkMaximizeGeometry(); + workspace()->checkActiveScreen( this ); // client itself is not damaged addWorkspaceRepaint( geom_before_block ); addWorkspaceRepaint( geom ); // trigger repaint of window's new location diff --git a/workspace.cpp b/workspace.cpp index 51cfcd9bc3..fedc39c9f2 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1622,6 +1622,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 ) @@ -1651,6 +1663,8 @@ void Workspace::sendClientToScreen( Client* c, int screen ) it != transients_stacking_order.end(); ++it ) sendClientToScreen( *it, screen ); + if( c->isActive()) + active_screen = screen; } void Workspace::setDesktopLayout(NET::Orientation o, int x, int y,NET::DesktopLayoutCorner c) diff --git a/workspace.h b/workspace.h index 9abc226519..fb19649a09 100644 --- a/workspace.h +++ b/workspace.h @@ -174,6 +174,7 @@ class Workspace : public QObject, public KDecorationDefines int activeScreen() const; int numScreens() const; + void checkActiveScreen( const Client* c ); QRect screenGeometry( int screen ) const; int screenNumber( QPoint pos ) const; QWidget* desktopWidget();