From b55115a8be1068899825c39e80873013dd691a43 Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Fri, 13 Feb 2009 06:59:34 +0000 Subject: [PATCH] Prevent recursion loop in Toplevel::screen() and Workspace::activeScreen() when the center of the active client is offscreen and was not previously on the active screen. svn path=/trunk/KDE/kdebase/workspace/; revision=925362 --- toplevel.cpp | 2 +- workspace.cpp | 4 ++-- workspace.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/toplevel.cpp b/toplevel.cpp index fbe756b82f..9068835bbc 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -346,7 +346,7 @@ int Toplevel::screen() const if( s < 0 ) // Center of the window is offscreen, just use the active one as if this window is the // one with input focus then activeScreen() will return the screen it used to be on. - return workspace()->activeScreen(); + return workspace()->activeScreen( false ); return s; } diff --git a/workspace.cpp b/workspace.cpp index fe07dfbd7a..ec3066a43a 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1661,7 +1661,7 @@ int Workspace::numScreens() const return Kephal::ScreenUtils::numScreens(); } -int Workspace::activeScreen() const +int Workspace::activeScreen( bool checkClient ) const { if( !options->xineramaEnabled ) return 0; @@ -1670,7 +1670,7 @@ int Workspace::activeScreen() const screen = Kephal::ScreenUtils::screenId( cursorPos()); if( screen != -1 ) return screen; - if( activeClient() != NULL && !activeClient()->isOnScreen( active_screen )) + if( activeClient() != NULL && !activeClient()->isOnScreen( active_screen ) && checkClient ) return activeClient()->screen(); return active_screen; } diff --git a/workspace.h b/workspace.h index c77610cb3d..4125100df3 100644 --- a/workspace.h +++ b/workspace.h @@ -172,7 +172,7 @@ class Workspace : public QObject, public KDecorationDefines int desktopUp( int desktop, bool wrap ) const; int desktopDown( int desktop, bool wrap ) const; - int activeScreen() const; + int activeScreen( bool checkClient = true ) const; int numScreens() const; void checkActiveScreen( const Client* c ); void setActiveScreenMouse( const QPoint& mousepos );