Add functions for querying xinerama screens to effects API,

from Lucas Murray <admin@undefinedfire.com>.


svn path=/trunk/KDE/kdebase/workspace/; revision=818782
icc-effect-5.14.5
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());
}
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 )
{

View File

@ -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

View File

@ -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();

View File

@ -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;

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_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;

View File

@ -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"

View File

@ -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;