From 3f4a2dfaedbd82cb69aada4853b0cc84aff60bb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Mon, 9 Jun 2008 16:09:56 +0000 Subject: [PATCH] Add functions for querying xinerama screens to effects API, from Lucas Murray . svn path=/trunk/KDE/kdebase/workspace/; revision=818782 --- client.cpp | 14 -------------- client.h | 3 --- effects.cpp | 10 ++++++++++ effects.h | 2 ++ lib/kwineffects.h | 4 +++- toplevel.cpp | 15 +++++++++++++++ toplevel.h | 2 ++ 7 files changed, 32 insertions(+), 18 deletions(-) diff --git a/client.cpp b/client.cpp index b84e2c24c1..599a3ad0f6 100644 --- a/client.cpp +++ b/client.cpp @@ -1253,20 +1253,6 @@ void Client::setOnAllDesktops( bool b ) setDesktop( 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 ) { diff --git a/client.h b/client.h index 2f595bfba5..346fcef015 100644 --- a/client.h +++ b/client.h @@ -129,9 +129,6 @@ class Client void setDesktop( int ); 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; bool isHiddenInternal() const; // for compositing diff --git a/effects.cpp b/effects.cpp index a16282ba28..761a25d496 100644 --- a/effects.cpp +++ b/effects.cpp @@ -547,6 +547,11 @@ int EffectsHandlerImpl::activeScreen() const return Workspace::self()->activeScreen(); } +int EffectsHandlerImpl::numScreens() const + { + return Workspace::self()->numScreens(); + } + QRect EffectsHandlerImpl::clientArea( clientAreaOption opt, int screen, int desktop ) const { return Workspace::self()->clientArea( opt, screen, desktop ); @@ -1057,6 +1062,11 @@ QRegion EffectWindowImpl::shape() const return sw ? sw->shape() : geometry(); } +int EffectWindowImpl::screen() const + { + return toplevel->screen(); + } + bool EffectWindowImpl::hasOwnShape() const { return toplevel->shape(); diff --git a/effects.h b/effects.h index 0efed8468a..f78e7ad315 100644 --- a/effects.h +++ b/effects.h @@ -87,6 +87,7 @@ class EffectsHandlerImpl : public EffectsHandler virtual void addRepaint( const QRect& r ); virtual void addRepaint( int x, int y, int w, int h ); virtual int activeScreen() const; + virtual int numScreens() const; virtual QRect clientArea( clientAreaOption, int screen, int desktop ) const; virtual QRect clientArea( clientAreaOption, const EffectWindow* c ) const; virtual QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const; @@ -191,6 +192,7 @@ class EffectWindowImpl : public EffectWindow virtual int height() const; virtual QRect geometry() const; virtual QRegion shape() const; + virtual int screen() const; virtual bool hasOwnShape() const; virtual QPoint pos() const; virtual QSize size() const; diff --git a/lib/kwineffects.h b/lib/kwineffects.h index b608a801ae..7dab8c75ca 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -162,7 +162,7 @@ X-KDE-Library=kwin4_effect_cooleffect #define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor )) #define KWIN_EFFECT_API_VERSION_MAJOR 0 -#define KWIN_EFFECT_API_VERSION_MINOR 20 +#define KWIN_EFFECT_API_VERSION_MINOR 21 #define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \ KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR ) @@ -476,6 +476,7 @@ class KWIN_EXPORT EffectsHandler virtual void setCurrentDesktop( int desktop ) = 0; virtual QString desktopName( int desktop ) const = 0; virtual int activeScreen() const = 0; // Xinerama + virtual int numScreens() const = 0; // Xinerama virtual QRect clientArea( clientAreaOption, int screen, int desktop ) const = 0; virtual QRect clientArea( clientAreaOption, const EffectWindow* c ) const = 0; virtual QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const = 0; @@ -619,6 +620,7 @@ class KWIN_EXPORT EffectWindow virtual int height() const = 0; virtual QRect geometry() const = 0; virtual QRegion shape() const = 0; + virtual int screen() const = 0; /** @internal Do not use */ virtual bool hasOwnShape() const = 0; // only for shadow effect, for now virtual QPoint pos() const = 0; diff --git a/toplevel.cpp b/toplevel.cpp index 591e9765b6..f6265f3c7d 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -334,6 +334,21 @@ void Toplevel::deleteEffectWindow() effect_window = NULL; } +int Toplevel::screen() const + { + if( !options->xineramaEnabled ) + return 0; + return workspace()->screenNumber( geometry().center()); + } + +bool Toplevel::isOnScreen( int screen ) const + { + if( !options->xineramaEnabled ) + return screen == 0; + return workspace()->screenGeometry( screen ).intersects( geometry()); + } + + } // namespace #include "toplevel.moc" diff --git a/toplevel.h b/toplevel.h index 7ece371200..d1676f18a5 100644 --- a/toplevel.h +++ b/toplevel.h @@ -60,6 +60,8 @@ class Toplevel int y() const; int width() const; int height() const; + bool isOnScreen( int screen ) const; // true if it's at least partially there + int screen() const; // the screen where the center is virtual QPoint clientPos() const = 0; // inside of geometry() virtual QSize clientSize() const = 0;