[orca/gnome-3-22] Disable a sad hack we were using for Pidgin



commit c4a1c7a5664df015f4374b639658296bddf4f97b
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Sep 6 18:38:00 2016 -0400

    Disable a sad hack we were using for Pidgin
    
    Pidgin used to fail to give us the accessibility events we need to
    present incoming messages. We could hack around this by doing a
    tree dive to force creation of accessibles which were not yet exposed.
    The side effect of this, however, was that in channels with a huge user
    list, thousands of new accessible objects were being created. Hopefully
    we don't need this hack any longer. It is still in place, just in case,
    but disabled by default. Users who find Orca no longer presents incoming
    messages in Pidgin should re-enable the hack by adding the following lines
    to their orca_customizations.py:
    
    import orca.settings
    orca.settings.enableSadPidginHack = True

 src/orca/scripts/apps/pidgin/script.py |   13 +++++++++++++
 src/orca/settings.py                   |    3 +++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/apps/pidgin/script.py b/src/orca/scripts/apps/pidgin/script.py
index e89901d..7a56a23 100644
--- a/src/orca/scripts/apps/pidgin/script.py
+++ b/src/orca/scripts/apps/pidgin/script.py
@@ -28,8 +28,10 @@ __license__   = "LGPL"
 
 import pyatspi
 
+import orca.debug as debug
 import orca.messages as messages
 import orca.scripts.toolkits.GAIL as GAIL
+import orca.settings as settings
 import orca.speech as speech
 
 from .chat import Chat
@@ -185,11 +187,22 @@ class Script(GAIL.Script):
     def onWindowActivated(self, event):
         """Called whenever a toplevel window is activated."""
 
+        if not settings.enableSadPidginHack:
+            msg = "PIDGIN: Hack for missing events disabled"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            GAIL.Script.onWindowActivated(self, event)
+            return
+
+        msg = "PIDGIN: Starting hack for missing events"
+        debug.println(debug.LEVEL_INFO, msg, True)
+
         # Hack to "tickle" the accessible hierarchy. Otherwise, the
         # events we need to present text added to the chatroom are
         # missing.
         hasRole = lambda x: x and x.getRole() == pyatspi.ROLE_PAGE_TAB
         allPageTabs = pyatspi.findAllDescendants(event.source, hasRole)
+        msg = "PIDGIN: Hack to work around missing events complete"
+        debug.println(debug.LEVEL_INFO, msg, True)
         GAIL.Script.onWindowActivated(self, event)
 
     def onExpandedChanged(self, event):
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 38b3ac0..de17858 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -377,3 +377,6 @@ layoutMode = True
 
 rewindAndFastForwardInSayAll = False
 structNavInSayAll = False
+
+# N.B. The following are experimental and may change or go away at any time.
+enableSadPidginHack = False


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