[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/kwin_composite
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2007-04-18 6:57:50
Message-ID: 1176879470.003193.29478.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 655369 by lunakl:

toggleEffect() DBUS call



 M  +21 -0     effects.cpp  
 M  +1 -0      effects.h  
 M  +3 -0      org.kde.KWin.xml  
 M  +6 -0      useractions.cpp  
 M  +1 -0      workspace.h  


--- branches/work/kwin_composite/effects.cpp #655368:655369
@@ -560,8 +560,28 @@
     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::unloadEffect( const QString& name )
     {
+    Workspace::self()->addRepaintFull();
     assert( current_paint_screen == 0 );
     assert( current_paint_window == 0 );
     assert( current_draw_window == 0 );
--- branches/work/kwin_composite/effects.h #655368:655369
@@ -101,6 +101,7 @@
         bool hasKeyboardGrab() const;
 
         void loadEffect( const QString& name );
+        void toggleEffect( const QString& name );
         void unloadEffect( const QString& name );
 
     protected:
--- branches/work/kwin_composite/org.kde.KWin.xml #655368:655369
@@ -44,5 +44,8 @@
     <method name="unloadEffect">
     <arg name="name" type="s" direction="in"/>
     </method>
+    <method name="toggleEffect">
+    <arg name="name" type="s" direction="in"/>
+    </method>
   </interface>
 </node>
--- branches/work/kwin_composite/useractions.cpp #655368:655369
@@ -700,6 +700,12 @@
         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 )
--- branches/work/kwin_composite/workspace.h #655368:655369
@@ -210,6 +210,7 @@
         void showWindowMenuAt( unsigned long id, int x, int y );
 
         void loadEffect( const QString& name );
+        void toggleEffect( const QString& name );
 
         void unloadEffect( const QString& name );
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic