Bug 46226

Summary: Accessibility suggestion for vision impaired
Product: [Plasma] kwin Reporter: jheard
Component: compositingAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Mandrake RPMs   
OS: Linux   
Latest Commit: Version Fixed In:

Description jheard 2002-08-07 17:35:22 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kwin
Version:           KDE 3.0.1 
Severity:          wishlist
Installed from:    Mandrake RPMs
Compiler:          gcc-2.9x
OS:                Linux
OS/Compiler notes: Not Specified

I and one of my coworkers have severely limited vision but contrast helps.  A thought had occurred to me that the workspace in non-active windows could be dimmed so that the active window stands out.  This would help nullify some of the "busyness" on the desktop.

(Submitted via bugs.kde.org)
Comment 1 Lubos Lunak 2003-04-24 10:59:24 UTC
Dimming non-active windows would be quite expensive, as that requires transparency. Would it 
be sufficient if the window contents became e.g. completely black? 
 
Comment 2 Luciano Montanaro 2003-04-27 19:10:18 UTC
Umh, perhaps using a pattern, like the effect done when closing the X session would be 
sufficient? 
Or maybe simply changing color scheme for background applications. But this will not dim 
graphical applications, of course. 
Comment 3 Lubos Lunak 2007-04-10 16:49:02 UTC
SVN commit 652255 by lunakl:

Add support for dimming of inactive windows (accessibility).
FEATURE: 46226



 M  +4 -0      COMPOSITE_TODO  
 M  +35 -0     effects.cpp  
 M  +20 -0     effects.h  
 M  +2 -2      effects/CMakeLists.txt  
 A             effects/diminactive.cpp   [License: UNKNOWN]
 A             effects/diminactive.desktop  
 A             effects/diminactive.h   [License: UNKNOWN]
 M  +3 -0      group.cpp  
 M  +9 -0      group.h  
 M  +9 -0      lib/kwineffects.cpp  
 M  +11 -0     lib/kwineffects.h  


--- branches/work/kwin_composite/COMPOSITE_TODO #652254:652255
@@ -71,7 +71,9 @@
 
 * cursorPos() does not work reliably now (not from e.g. timers, it needs events), so it's disabled
 
+* window grouping is not implemented for unmanaged windows (used e.g. by DimInactive)
 
+
 OpenGL TODO
 =================================
 
@@ -237,3 +239,5 @@
 +   - something that presents all virtual desktops as being in grid (as in pager)
         and zooms out of the old one and into the new one
     - or whatever
+
+* DimInactive flickers when switching between windows (temporarily no window becomes active)
--- branches/work/kwin_composite/effects.cpp #652254:652255
@@ -12,6 +12,7 @@
 
 #include "deleted.h"
 #include "client.h"
+#include "group.h"
 #include "workspace.h"
 
 #include "kdebug.h"
@@ -286,6 +287,21 @@
     sceneWindow()->disablePainting( reason );
     }
 
+void EffectWindowImpl::addRepaint( const QRect& r )
+    {
+    toplevel->addRepaint( r );
+    }
+
+void EffectWindowImpl::addRepaint( int x, int y, int w, int h )
+    {
+    toplevel->addRepaint( x, y, w, h );
+    }
+
+void EffectWindowImpl::addRepaintFull()
+    {
+    toplevel->addRepaintFull();
+    }
+
 int EffectWindowImpl::desktop() const
     {
     return toplevel->desktop();
@@ -304,6 +320,13 @@
         return "";
     }
 
+const EffectWindowGroup* EffectWindowImpl::group() const
+    {
+    if( Client* c = dynamic_cast< Client* >( toplevel ))
+        return c->group()->effectGroup();
+    return NULL; // TODO
+    }
+
 bool EffectWindowImpl::isMinimized() const
     {
     if( Client* c = dynamic_cast<Client*>( toplevel ))
@@ -479,5 +502,17 @@
     return ret;
     }
 
+//****************************************
+// EffectWindowGroupImpl
+//****************************************
 
+ 
+EffectWindowList EffectWindowGroupImpl::members() const
+    {
+    EffectWindowList ret;
+    foreach( Toplevel* c, group->members())
+        ret.append( c->effectWindow());
+    return ret;
+    }
+
 } // namespace
--- branches/work/kwin_composite/effects.h #652254:652255
@@ -64,6 +64,9 @@
 
         virtual void enablePainting( int reason );
         virtual void disablePainting( int reason );
+        virtual void addRepaint( const QRect& r );
+        virtual void addRepaint( int x, int y, int w, int h );
+        virtual void addRepaintFull();
 
         virtual bool isDeleted() const;
 
@@ -71,6 +74,7 @@
         virtual int desktop() const; // prefer isOnXXX()
         virtual bool isMinimized() const;
         virtual QString caption() const;
+        virtual const EffectWindowGroup* group() const;
 
         virtual int x() const;
         virtual int y() const;
@@ -109,6 +113,22 @@
         Scene::Window* sw; // This one is used only during paint pass.
 };
 
+class EffectWindowGroupImpl
+    : public EffectWindowGroup
+    {
+    public:
+        EffectWindowGroupImpl( Group* g );
+        virtual EffectWindowList members() const;
+    private:
+        Group* group;
+    };
+
+inline
+EffectWindowGroupImpl::EffectWindowGroupImpl( Group* g )
+    : group( g )
+    {
+    }
+
 EffectWindow* effectWindow( Toplevel* w );
 EffectWindow* effectWindow( Scene::Window* w );
 
--- branches/work/kwin_composite/effects/CMakeLists.txt #652254:652255
@@ -11,7 +11,7 @@
     ${CMAKE_SOURCE_DIR}/workspace/kwin/lib
     )
 
-KWIN4_ADD_EFFECT(builtins presentwindows.cpp shadow.cpp)
+KWIN4_ADD_EFFECT(builtins presentwindows.cpp shadow.cpp diminactive.cpp)
 
-install( FILES presentwindows.desktop shadow.desktop
+install( FILES presentwindows.desktop shadow.desktop diminactive.desktop
         DESTINATION ${DATA_INSTALL_DIR}/kwin/effects )
--- branches/work/kwin_composite/group.cpp #652254:652255
@@ -21,6 +21,7 @@
 
 #include "workspace.h"
 #include "client.h"
+#include "effects.h"
 
 #include <assert.h>
 #include <kstartupinfo.h>
@@ -54,12 +55,14 @@
         leader_info = new NETWinInfo( display(), leader_P, workspace()->rootWin(),
             properties, 2 );
         }
+    effect_group = new EffectWindowGroupImpl( this );
     workspace()->addGroup( this, Allowed );
     }
 
 Group::~Group()
     {
     delete leader_info;
+    delete effect_group;
     }
 
 QPixmap Group::icon() const
--- branches/work/kwin_composite/group.h #652254:652255
@@ -21,6 +21,7 @@
 
 class Client;
 class Workspace;
+class EffectWindowGroupImpl;
 
 class Group
     {
@@ -41,6 +42,7 @@
         bool groupEvent( XEvent* e );
         void updateUserTime( Time time = CurrentTime );
         Time userTime() const;
+        EffectWindowGroupImpl* effectGroup();
     private:
         void getIcons();
         void startupIdChanged();
@@ -50,6 +52,7 @@
         Workspace* _workspace;
         NETWinInfo* leader_info;
         Time user_time;
+        EffectWindowGroupImpl* effect_group;
     };
 
 inline Window Group::leader() const
@@ -82,6 +85,12 @@
     return user_time;
     }
 
+inline
+EffectWindowGroupImpl* Group::effectGroup()
+    {
+    return effect_group;
+    }
+
 } // namespace
 
 #endif
--- branches/work/kwin_composite/lib/kwineffects.cpp #652254:652255
@@ -469,4 +469,13 @@
     }
 
 
+//****************************************
+// EffectWindowGroup
+//****************************************
+
+EffectWindowGroup::~EffectWindowGroup()
+    {
+    }
+
+
 } // namespace
--- branches/work/kwin_composite/lib/kwineffects.h #652254:652255
@@ -32,6 +32,7 @@
 
 
 class EffectWindow;
+class EffectWindowGroup;
 class Effect;
 
 typedef QPair< QString, Effect* > EffectPair;
@@ -251,6 +252,9 @@
 
         virtual void enablePainting( int reason ) = 0;
         virtual void disablePainting( int reason ) = 0;
+        virtual void addRepaint( const QRect& r ) = 0;
+        virtual void addRepaint( int x, int y, int w, int h ) = 0;
+        virtual void addRepaintFull() = 0;
 
         virtual bool isDeleted() const = 0;
         virtual bool isMinimized() const = 0;
@@ -270,6 +274,7 @@
         virtual QRect rect() const = 0;
 
         virtual QString caption() const = 0;
+        virtual const EffectWindowGroup* group() const = 0;
 
         virtual bool isDesktop() const = 0;
         virtual bool isDock() const = 0;
@@ -290,6 +295,12 @@
 
     };
 
+class KWIN_EXPORT EffectWindowGroup
+    {
+    public:
+        virtual ~EffectWindowGroup();
+        virtual EffectWindowList members() const = 0;
+    };
 
 extern KWIN_EXPORT EffectsHandler* effects;