--- kwin/activation.cpp.sav 2006-06-09 17:55:54.000000000 +0200 +++ kwin/activation.cpp 2006-06-09 17:56:25.000000000 +0200 @@ -411,6 +411,8 @@ bool Workspace::activateNextClient( Clie { if( !(*it)->isShown( false ) || !(*it)->isOnCurrentDesktop()) continue; + if( options->separateScreenFocus && !(*it)->isOnScreen( c->screen())) + continue; if( mainwindows.contains( *it )) { get_focus = *it; --- kwin/kwin.kcfg.sav 2006-06-09 17:55:54.000000000 +0200 +++ kwin/kwin.kcfg 2006-06-09 17:56:25.000000000 +0200 @@ -60,6 +60,8 @@ + + --- kwin/client.h.sav 2006-06-09 17:55:54.000000000 +0200 +++ kwin/client.h 2006-06-09 18:00:31.000000000 +0200 @@ -116,6 +116,9 @@ class Client : public QObject, public KD bool isOnCurrentDesktop() const; bool isOnAllDesktops() const; void setOnAllDesktops( bool set ); + + bool isOnScreen( int screen ) const; // true if it's at least partially there + int screen() const; // the screen where the center is // !isMinimized() && not hidden, i.e. normally visible on some virtual desktop bool isShown( bool shaded_is_shown ) const; --- kwin/options.cpp.sav 2006-06-09 17:55:54.000000000 +0200 +++ kwin/options.cpp 2006-06-09 17:58:18.000000000 +0200 @@ -70,6 +70,9 @@ unsigned long Options::updateSettings() altTabStyle = KDE; // what a default :-) if ( val == "CDE" ) altTabStyle = CDE; + + separateScreenFocus = config->readBoolEntry( "SeparateScreenFocus", false ); + activeMouseScreen = config->readBoolEntry( "ActiveMouseScreen", focusPolicy != ClickToFocus ); rollOverDesktops = config->readBoolEntry("RollOverDesktops", TRUE); --- kwin/options.h.sav 2006-06-09 17:55:54.000000000 +0200 +++ kwin/options.h 2006-06-09 17:57:26.000000000 +0200 @@ -124,6 +124,11 @@ class Options : public KDecorationOption */ enum AltTabStyle { KDE, CDE }; AltTabStyle altTabStyle; + + // whether to see Xinerama screens separately for focus (in Alt+Tab, when activating next client) + bool separateScreenFocus; + // whether active Xinerama screen is the one with mouse (or with the active window) + bool activeMouseScreen; /** * Xinerama options --- kwin/tabbox.cpp.sav 2006-06-09 17:55:54.000000000 +0200 +++ kwin/tabbox.cpp 2006-06-09 17:56:25.000000000 +0200 @@ -23,7 +23,6 @@ License. See the file "COPYING" for the #include #include #include -#include #include #include #include @@ -96,26 +95,36 @@ void TabBox::createClientList(ClientList while ( c ) { + Client* add = NULL; if ( ((desktop == -1) || c->isOnDesktop(desktop)) && c->wantsTabFocus() ) + { // don't add windows that have modal dialogs + Client* modal = c->findModal(); + if( modal == NULL || modal == c ) + add = c; + else if( !list.contains( modal )) + add = modal; + else + { + // nothing + } + } + + if( options->separateScreenFocus && options->xineramaEnabled ) { - if ( start == c ) + if( c->screen() != workspace()->activeScreen()) + add = NULL; + } + + if( add != NULL ) + { + if ( start == add ) { - list.remove( c ); - list.prepend( c ); + list.remove( add ); + list.prepend( add ); } else - { // don't add windows that have modal dialogs - Client* modal = c->findModal(); - if( modal == NULL || modal == c ) - list += c; - else if( !list.contains( modal )) - list += modal; - else - { - // nothing - } - } + list += add; } if ( chain ) @@ -142,7 +151,7 @@ void TabBox::reset() { int w, h, cw = 0, wmax = 0; - QRect r = KGlobalSettings::desktopGeometry(QCursor::pos()); + QRect r = workspace()->screenGeometry( workspace()->activeScreen()); // calculate height of 1 line // fontheight + 1 pixel above + 1 pixel below, or 32x32 icon + 2 pixel above + below --- kwin/client.cpp.sav 2006-06-09 17:55:54.000000000 +0200 +++ kwin/client.cpp 2006-06-09 18:00:31.000000000 +0200 @@ -1222,6 +1222,20 @@ bool Client::isOnCurrentDesktop() const return isOnDesktop( workspace()->currentDesktop()); } +int Client::screen() const + { + if( !options->xineramaEnabled ) + return 0; + return workspace()->screenNumber( geometry().center()); + } + +bool Client::isOnScreen( int screen ) const + { + if( !options->xineramaEnabled ) + return screen == 0; + return workspace()->screenGeometry( screen ).intersects( geometry()); + } + // performs activation and/or raising of the window void Client::takeActivity( int flags, bool handled, allowed_t ) { --- kwin/workspace.h.sav 2006-06-09 17:55:54.000000000 +0200 +++ kwin/workspace.h 2006-06-09 18:00:31.000000000 +0200 @@ -91,6 +91,7 @@ class Workspace : public QObject, public QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const; QRect clientArea( clientAreaOption, const Client* c ) const; + QRect clientArea( clientAreaOption, int screen, int desktop ) const; /** * @internal @@ -161,6 +162,11 @@ class Workspace : public QObject, public */ int numberOfDesktops() const; void setNumberOfDesktops( int n ); + + int activeScreen() const; + int numScreens() const; + QRect screenGeometry( int screen ) const; + int screenNumber( QPoint pos ) const; QWidget* desktopWidget(); --- kwin/workspace.cpp.sav 2006-06-09 17:55:54.000000000 +0200 +++ kwin/workspace.cpp 2006-06-09 18:00:31.000000000 +0200 @@ -189,7 +189,7 @@ Workspace::Workspace( bool restore ) client_keys = new KGlobalAccel( this ); initShortcuts(); tab_box = new TabBox( this ); - popupinfo = new PopupInfo( ); + popupinfo = new PopupInfo( this ); init(); @@ -1502,6 +1502,40 @@ void Workspace::sendClientToDesktop( Cli updateClientArea(); } +int Workspace::numScreens() const + { + if( !options->xineramaEnabled ) + return 1; + return qApp->desktop()->numScreens(); + } + +int Workspace::activeScreen() const + { + if( !options->xineramaEnabled ) + return 0; + if( !options->activeMouseScreen ) + { + if( activeClient() != NULL ) + return qApp->desktop()->screenNumber( activeClient()->geometry().center()); + return qApp->desktop()->primaryScreen(); + } + return qApp->desktop()->screenNumber( QCursor::pos()); + } + +QRect Workspace::screenGeometry( int screen ) const + { + if( !options->xineramaEnabled ) + return qApp->desktop()->geometry(); + return qApp->desktop()->screenGeometry( screen ); + } + +int Workspace::screenNumber( QPoint pos ) const + { + if( !options->xineramaEnabled ) + return 0; + return qApp->desktop()->screenNumber( pos ); + } + void Workspace::setDesktopLayout(int o, int x, int y) { layoutOrientation = (Qt::Orientation) o; --- kwin/popupinfo.cpp.sav 2006-06-09 17:55:54.000000000 +0200 +++ kwin/popupinfo.cpp 2006-06-09 17:56:25.000000000 +0200 @@ -25,7 +25,6 @@ License. See the file "COPYING" for the #include #include #include -#include #include #include @@ -34,8 +33,8 @@ License. See the file "COPYING" for the namespace KWinInternal { -PopupInfo::PopupInfo( const char *name ) - : QWidget( 0, name ) +PopupInfo::PopupInfo( Workspace* ws, const char *name ) + : QWidget( 0, name ), workspace( ws ) { m_infoString = ""; m_shown = false; @@ -60,7 +59,7 @@ PopupInfo::~PopupInfo() */ void PopupInfo::reset() { - QRect r = KGlobalSettings::desktopGeometry(QCursor::pos()); + QRect r = workspace->screenGeometry( workspace->activeScreen()); int w = fontMetrics().width( m_infoString ) + 30; --- kwin/popupinfo.h.sav 2006-06-09 17:55:54.000000000 +0200 +++ kwin/popupinfo.h 2006-06-09 17:56:25.000000000 +0200 @@ -24,7 +24,7 @@ class PopupInfo : public QWidget { Q_OBJECT public: - PopupInfo( const char *name=0 ); + PopupInfo( Workspace* ws, const char *name=0 ); ~PopupInfo(); void reset(); @@ -43,6 +43,7 @@ class PopupInfo : public QWidget bool m_show; bool m_shown; QString m_infoString; + Workspace* workspace; }; } // namespace --- kwin/geometry.cpp.sav 2006-06-09 17:55:42.000000000 +0200 +++ kwin/geometry.cpp 2006-06-09 18:00:31.000000000 +0200 @@ -205,14 +205,11 @@ void Workspace::updateClientArea() \sa geometry() */ -QRect Workspace::clientArea( clientAreaOption opt, const QPoint& p, int desktop ) const +QRect Workspace::clientArea( clientAreaOption opt, int screen, int desktop ) const { if( desktop == NETWinInfo::OnAllDesktops || desktop == 0 ) desktop = currentDesktop(); QDesktopWidget *desktopwidget = KApplication::desktop(); - int screen = desktopwidget->screenNumber( p ); - if( screen < 0 ) - screen = desktopwidget->primaryScreen(); QRect sarea = screenarea // may be NULL during KWin initialization ? screenarea[ desktop ][ screen ] : desktopwidget->screenGeometry( screen ); @@ -257,11 +254,21 @@ QRect Workspace::clientArea( clientAreaO return QRect(); } +QRect Workspace::clientArea( clientAreaOption opt, const QPoint& p, int desktop ) const + { + QDesktopWidget *desktopwidget = KApplication::desktop(); + int screen = desktopwidget->screenNumber( p ); + if( screen < 0 ) + screen = desktopwidget->primaryScreen(); + return clientArea( opt, screen, desktop ); + } + QRect Workspace::clientArea( clientAreaOption opt, const Client* c ) const { return clientArea( opt, c->geometry().center(), c->desktop()); } + /*! Client \a c is moved around to position \a pos. This gives the workspace the opportunity to interveniate and to implement