toggleEffect() DBUS call

svn path=/branches/work/kwin_composite/; revision=655369
icc-effect-5.14.5
Luboš Luňák 2007-04-18 06:57:49 +00:00
parent cc8e2c73cb
commit 438b8ce045
5 changed files with 44 additions and 2 deletions

View File

@ -560,8 +560,28 @@ KLibrary* EffectsHandlerImpl::findEffectLibrary( const QString& effectname )
return library;
}
void EffectsHandlerImpl::toggleEffect( const QString& name )
{
assert( current_paint_screen == 0 );
assert( current_paint_window == 0 );
assert( current_draw_window == 0 );
assert( current_transform == 0 );
// Make sure a single effect won't be loaded multiple times
for(QVector< EffectPair >::const_iterator it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); it++)
{
if( (*it).first == name )
{
unloadEffect( name );
return;
}
}
loadEffect( name );
}
void EffectsHandlerImpl::loadEffect( const QString& name )
{
Workspace::self()->addRepaintFull();
assert( current_paint_screen == 0 );
assert( current_paint_window == 0 );
assert( current_draw_window == 0 );
@ -617,6 +637,7 @@ void EffectsHandlerImpl::loadEffect( const QString& name )
void EffectsHandlerImpl::unloadEffect( const QString& name )
{
Workspace::self()->addRepaintFull();
assert( current_paint_screen == 0 );
assert( current_paint_window == 0 );
assert( current_draw_window == 0 );

View File

@ -101,6 +101,7 @@ class EffectsHandlerImpl : public EffectsHandler
bool hasKeyboardGrab() const;
void loadEffect( const QString& name );
void toggleEffect( const QString& name );
void unloadEffect( const QString& name );
protected:

View File

@ -1,7 +1,7 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.KWin">
<interface name="org.kde.KWin">
<method name="cascadeDesktop">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
@ -23,6 +23,11 @@
<arg name="x" type="i" direction="in"/>
<arg name="y" type="i" direction="in"/>
</method>
<method name="setDesktopLayout">
<arg name="orientation" type="i" direction="in"/>
<arg name="x" type="i" direction="in"/>
<arg name="y" type="i" direction="in"/>
</method>
<method name="setCurrentDesktop">
<arg name="desktop" type="i" direction="in"/>
<arg type="b" direction="out"/>
@ -33,6 +38,14 @@
<method name="nextDesktop"/>
<method name="previousDesktop"/>
<method name="circulateDesktopApplications"/>
<signal name="reloadConfig"/>
<method name="loadEffect">
<arg name="name" type="s" direction="in"/>
</method>
<method name="unloadEffect">
<arg name="name" type="s" direction="in"/>
</method>
<method name="toggleEffect">
<arg name="name" type="s" direction="in"/>
</method>
</interface>
</node>

View File

@ -700,6 +700,12 @@ void Workspace::loadEffect( const QString& name )
static_cast<EffectsHandlerImpl*>(effects)->loadEffect( name );
}
void Workspace::toggleEffect( const QString& name )
{
if( effects )
static_cast<EffectsHandlerImpl*>(effects)->toggleEffect( name );
}
void Workspace::unloadEffect( const QString& name )
{
if( effects )

View File

@ -210,6 +210,7 @@ class Workspace : public QObject, public KDecorationDefines
void showWindowMenuAt( unsigned long id, int x, int y );
void loadEffect( const QString& name );
void toggleEffect( const QString& name );
void unloadEffect( const QString& name );