When a user clicks on a window, set active Xinerama screen to be the screen

where the click occured.


svn path=/trunk/KDE/kdebase/workspace/; revision=662864
This commit is contained in:
Luboš Luňák 2007-05-09 12:30:29 +00:00
parent 02405eccd7
commit 57b7967d66
3 changed files with 16 additions and 0 deletions

View file

@ -565,27 +565,33 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
case Options::MouseActivateAndRaise:
replay = isActive(); // for clickraise mode
workspace()->takeActivity( this, ActivityFocus | ActivityRaise, handled && replay );
workspace()->setActiveScreenMouse( globalPos );
break;
case Options::MouseActivateAndLower:
workspace()->requestFocus( this );
workspace()->lowerClient( this );
workspace()->setActiveScreenMouse( globalPos );
break;
case Options::MouseActivate:
replay = isActive(); // for clickraise mode
workspace()->takeActivity( this, ActivityFocus, handled && replay );
workspace()->setActiveScreenMouse( globalPos );
break;
case Options::MouseActivateRaiseAndPassClick:
workspace()->takeActivity( this, ActivityFocus | ActivityRaise, handled );
workspace()->setActiveScreenMouse( globalPos );
replay = true;
break;
case Options::MouseActivateAndPassClick:
workspace()->takeActivity( this, ActivityFocus, handled );
workspace()->setActiveScreenMouse( globalPos );
replay = true;
break;
case Options::MouseActivateRaiseAndMove:
case Options::MouseActivateRaiseAndUnrestrictedMove:
workspace()->raiseClient( this );
workspace()->requestFocus( this );
workspace()->setActiveScreenMouse( globalPos );
if( options->moveMode == Options::Transparent && isMovable())
move_faked_activity = workspace()->fakeRequestedActivity( this );
// fallthrough

View file

@ -1634,6 +1634,15 @@ void Workspace::checkActiveScreen( const Client* c )
active_screen = c->screen();
}
// called e.g. when a user clicks on a window, set active screen to be the screen
// where the click occured
void Workspace::setActiveScreenMouse( QPoint mousepos )
{
if( !options->xineramaEnabled )
return;
active_screen = qApp->desktop()->screenNumber( mousepos );
}
QRect Workspace::screenGeometry( int screen ) const
{
if( !options->xineramaEnabled )

View file

@ -175,6 +175,7 @@ class Workspace : public QObject, public KDecorationDefines
int activeScreen() const;
int numScreens() const;
void checkActiveScreen( const Client* c );
void setActiveScreenMouse( QPoint mousepos );
QRect screenGeometry( int screen ) const;
int screenNumber( QPoint pos ) const;
QWidget* desktopWidget();