[orca] LibreOffice: Work around missing state-changed:focused event



commit f52f5e31666a435d0e728968a5dce58123ae1a0a
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Mar 22 12:05:42 2021 +0100

    LibreOffice: Work around missing state-changed:focused event
    
    After (at least) leaving the Save As dialog, paragraphs claim to be
    focusable but no longer claim to be focused. As a result, we ignore
    text-related events from those paragraphs having concluded the user
    is not interacting with them. Clearing the cache for these paragraphs
    seems to get them to report the focused state when they have it. So
    it seems LibreOffice is failing to emit the state-changed event needed
    to get AT-SPI2 to update its cache.

 src/orca/scripts/apps/soffice/script.py | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index a2e4c607c..8fc200326 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -797,6 +797,13 @@ class Script(default.Script):
         if event.detail1 == -1:
             return
 
+        if event.source.getRole() == pyatspi.ROLE_PARAGRAPH \
+           and not event.source.getState().contains(pyatspi.STATE_FOCUSED):
+            event.source.clearCache()
+            if event.source.getState().contains(pyatspi.STATE_FOCUSED):
+                msg = "SOFFICE: Clearing cache was needed due to missing state-changed event."
+                debug.println(debug.LEVEL_INFO, msg, True)
+
         if self.utilities._flowsFromOrToSelection(event.source):
            return
 


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