Add functions for querying xinerama screens to effects API,

from Lucas Murray <admin@undefinedfire.com>.


svn path=/trunk/KDE/kdebase/workspace/; revision=818782
This commit is contained in:
Luboš Luňák 2008-06-09 16:09:56 +00:00
parent 6e6afed817
commit 3f4a2dfaed
7 changed files with 32 additions and 18 deletions

View file

@ -1253,20 +1253,6 @@ void Client::setOnAllDesktops( bool b )
setDesktop( workspace()->currentDesktop()); 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 // performs activation and/or raising of the window
void Client::takeActivity( int flags, bool handled, allowed_t ) void Client::takeActivity( int flags, bool handled, allowed_t )
{ {

View file

@ -129,9 +129,6 @@ class Client
void setDesktop( int ); void setDesktop( int );
void setOnAllDesktops( bool set ); 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 // !isMinimized() && not hidden, i.e. normally visible on some virtual desktop
bool isShown( bool shaded_is_shown ) const; bool isShown( bool shaded_is_shown ) const;
bool isHiddenInternal() const; // for compositing bool isHiddenInternal() const; // for compositing

View file

@ -547,6 +547,11 @@ int EffectsHandlerImpl::activeScreen() const
return Workspace::self()->activeScreen(); return Workspace::self()->activeScreen();
} }
int EffectsHandlerImpl::numScreens() const
{
return Workspace::self()->numScreens();
}
QRect EffectsHandlerImpl::clientArea( clientAreaOption opt, int screen, int desktop ) const QRect EffectsHandlerImpl::clientArea( clientAreaOption opt, int screen, int desktop ) const
{ {
return Workspace::self()->clientArea( opt, screen, desktop ); return Workspace::self()->clientArea( opt, screen, desktop );
@ -1057,6 +1062,11 @@ QRegion EffectWindowImpl::shape() const
return sw ? sw->shape() : geometry(); return sw ? sw->shape() : geometry();
} }
int EffectWindowImpl::screen() const
{
return toplevel->screen();
}
bool EffectWindowImpl::hasOwnShape() const bool EffectWindowImpl::hasOwnShape() const
{ {
return toplevel->shape(); return toplevel->shape();

View file

@ -87,6 +87,7 @@ class EffectsHandlerImpl : public EffectsHandler
virtual void addRepaint( const QRect& r ); virtual void addRepaint( const QRect& r );
virtual void addRepaint( int x, int y, int w, int h ); virtual void addRepaint( int x, int y, int w, int h );
virtual int activeScreen() const; virtual int activeScreen() const;
virtual int numScreens() const;
virtual QRect clientArea( clientAreaOption, int screen, int desktop ) const; virtual QRect clientArea( clientAreaOption, int screen, int desktop ) const;
virtual QRect clientArea( clientAreaOption, const EffectWindow* c ) const; virtual QRect clientArea( clientAreaOption, const EffectWindow* c ) const;
virtual QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const; virtual QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const;
@ -191,6 +192,7 @@ class EffectWindowImpl : public EffectWindow
virtual int height() const; virtual int height() const;
virtual QRect geometry() const; virtual QRect geometry() const;
virtual QRegion shape() const; virtual QRegion shape() const;
virtual int screen() const;
virtual bool hasOwnShape() const; virtual bool hasOwnShape() const;
virtual QPoint pos() const; virtual QPoint pos() const;
virtual QSize size() const; virtual QSize size() const;

View file

@ -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_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor ))
#define KWIN_EFFECT_API_VERSION_MAJOR 0 #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( \ #define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR ) 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 void setCurrentDesktop( int desktop ) = 0;
virtual QString desktopName( int desktop ) const = 0; virtual QString desktopName( int desktop ) const = 0;
virtual int activeScreen() const = 0; // Xinerama 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, int screen, int desktop ) const = 0;
virtual QRect clientArea( clientAreaOption, const EffectWindow* c ) const = 0; virtual QRect clientArea( clientAreaOption, const EffectWindow* c ) const = 0;
virtual QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) 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 int height() const = 0;
virtual QRect geometry() const = 0; virtual QRect geometry() const = 0;
virtual QRegion shape() const = 0; virtual QRegion shape() const = 0;
virtual int screen() const = 0;
/** @internal Do not use */ /** @internal Do not use */
virtual bool hasOwnShape() const = 0; // only for shadow effect, for now virtual bool hasOwnShape() const = 0; // only for shadow effect, for now
virtual QPoint pos() const = 0; virtual QPoint pos() const = 0;

View file

@ -334,6 +334,21 @@ void Toplevel::deleteEffectWindow()
effect_window = NULL; 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 } // namespace
#include "toplevel.moc" #include "toplevel.moc"

View file

@ -60,6 +60,8 @@ class Toplevel
int y() const; int y() const;
int width() const; int width() const;
int height() 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 QPoint clientPos() const = 0; // inside of geometry()
virtual QSize clientSize() const = 0; virtual QSize clientSize() const = 0;