[orca] Fix for bgo bug #466841.



commit 65b4e9fb8ff0a6244795a244d482878220f1d626
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sat May 16 21:52:55 2009 -0400

    Fix for bgo bug #466841.
    
    This fix is designed to improve Orca's access to the basic window switcher
    in Compiz. There are still bugs in Compiz which make providing compelling
    access difficult, but this should at least make switching windows accessible.
---
 ChangeLog                                     |   10 ++
 src/orca/scripts/apps/Makefile.am             |    1 +
 src/orca/scripts/apps/gtk-window-decorator.py |  134 +++++++++++++++++++++++++
 3 files changed, 145 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a9161ef..6a43d9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-05-17  Joanmarie Diggs <joanmarie diggs gmail com>
+
+        * src/orca/scripts/apps/Makefile.am:
+          src/orca/scripts/apps/gtk-window-decorator.py: (new)
+          Fix for bug #466841 - Orca doesn't announce items when Alt+Tabbing
+          if Compiz is enabled. This fix is designed to improve Orca's
+          access to the basic window switcher in Compiz. There are still
+          bugs in Compiz which make providing compelling access difficult,
+          but this should at least make switching windows accessible.
+
 2009-05-02  Willie Walker <william walker sun com>
 
         * src/orca/orca_console_prefs.py:
diff --git a/src/orca/scripts/apps/Makefile.am b/src/orca/scripts/apps/Makefile.am
index bf2fa5a..37bb417 100644
--- a/src/orca/scripts/apps/Makefile.am
+++ b/src/orca/scripts/apps/Makefile.am
@@ -23,6 +23,7 @@ orca_python_PYTHON = \
 	gnome_segv2.py \
 	gnome-system-monitor.py \
 	gnome-terminal.py \
+	gtk-window-decorator.py \
 	liferea.py \
 	metacity.py \
 	Mozilla.py \
diff --git a/src/orca/scripts/apps/gtk-window-decorator.py b/src/orca/scripts/apps/gtk-window-decorator.py
new file mode 100644
index 0000000..3814452
--- /dev/null
+++ b/src/orca/scripts/apps/gtk-window-decorator.py
@@ -0,0 +1,134 @@
+# Orca
+#
+# Copyright 2005-2008 Sun Microsystems Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
+# Boston MA  02110-1301 USA.
+
+"""Custom script for metacity."""
+
+__id__        = "$Id$"
+__version__   = "$Revision$"
+__date__      = "$Date$"
+__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
+__license__   = "LGPL"
+
+import orca.braille as braille
+import orca.default as default
+import orca.speech as speech
+import pyatspi
+
+from orca.orca_i18n import _
+
+########################################################################
+#                                                                      #
+# The gtk-window-decorator script class.                               #
+#                                                                      #
+########################################################################
+
+class Script(default.Script):
+
+    def __init__(self, app):
+        """Creates a new script for the given application.
+
+        Arguments:
+        - app: the application to create a script for.
+        """
+
+        default.Script.__init__(self, app)
+
+    def presentStatusBar(self, obj):
+        """Presents information about the gtk-window-decorator status
+        bar.
+
+        Arguments:
+        - obj: the accessible status bar.
+        """
+
+        objName = obj.name
+        if not (objName and len(objName)):
+            return
+
+        # gtk-window-decorator sometimes abbreviates the names, placing
+        # '...' at the end.  Strip the ending off so that we can compare
+        # the beginning of the window names with the objName.
+        #
+        index = objName.rfind('...')
+        if index >= 0:
+            objName = objName[0:index]
+
+        # Do we know about this window?  Traverse through our list of apps
+        # and go through the toplevel windows in each to see if we know
+        # about this one.  If we do, it's accessible.  If we don't, it is
+        # not.
+        #
+        found = False
+        for app in self.getKnownApplications():
+            for child in app:
+                if child.name.startswith(objName):
+                    found = True
+                    break
+
+        text = obj.name
+        if not found:
+            # Translators: inaccessible means that the application cannot
+            # be read by Orca.  This usually means the application is not
+            # friendly to the assistive technology infrastructure.
+            #
+            text += ". " + _("inaccessible")
+
+        braille.displayMessage(text)
+        speech.stop()
+        speech.speak(text)
+
+    def onNameChanged(self, event):
+        """The status bar in gtk-window-decorator tells us what toplevel
+        window will be activated when Alt is released.  We will key off
+        the text inserted event to determine when to say something, as it
+        seems to be the more reliable event.
+
+        Arguments:
+        - event: the name changed Event
+        """
+
+        # Ignore changes on the status bar.  We handle them in onTextInserted.
+        #
+        if event.source.getRole() != pyatspi.ROLE_STATUS_BAR:
+            default.Script.onNameChanged(self, event)
+
+    def onTextInserted(self, event):
+        """Called whenever text is inserted into an object.  This seems to
+        be the most reliable event to let us know something is changing.
+
+        Arguments:
+        - event: the Event
+        """
+
+        if event.source.getRole() != pyatspi.ROLE_STATUS_BAR:
+            default.Script.onTextInserted(self, event)
+
+        self.presentStatusBar(event.source)
+
+    def onTextDeleted(self, event):
+        """Called whenever text is deleted from an object.
+
+        Arguments:
+        - event: the Event
+        """
+
+        # Ignore changes on the status bar.  We handle them in onTextInserted.
+        #
+        if event.source.getRole() != pyatspi.ROLE_STATUS_BAR:
+            default.Script.onTextDeleted(self, event)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]