toggleEffect() DBUS call

svn path=/branches/work/kwin_composite/; revision=655369
This commit is contained in:
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; 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 ) void EffectsHandlerImpl::loadEffect( const QString& name )
{ {
Workspace::self()->addRepaintFull();
assert( current_paint_screen == 0 ); assert( current_paint_screen == 0 );
assert( current_paint_window == 0 ); assert( current_paint_window == 0 );
assert( current_draw_window == 0 ); assert( current_draw_window == 0 );
@ -617,6 +637,7 @@ void EffectsHandlerImpl::loadEffect( const QString& name )
void EffectsHandlerImpl::unloadEffect( const QString& name ) void EffectsHandlerImpl::unloadEffect( const QString& name )
{ {
Workspace::self()->addRepaintFull();
assert( current_paint_screen == 0 ); assert( current_paint_screen == 0 );
assert( current_paint_window == 0 ); assert( current_paint_window == 0 );
assert( current_draw_window == 0 ); assert( current_draw_window == 0 );

View file

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

View file

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

View file

@ -700,6 +700,12 @@ void Workspace::loadEffect( const QString& name )
static_cast<EffectsHandlerImpl*>(effects)->loadEffect( 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 ) void Workspace::unloadEffect( const QString& name )
{ {
if( effects ) if( effects )

View file

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