[orca] gnome-shell: don't announce nameless window if we have pending focus event



commit 0d73d1c9ee890cc188d69a66940590aaaff5c922
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Apr 20 18:03:24 2022 +0200

    gnome-shell: don't announce nameless window if we have pending focus event
    
    Some users have complained that saying "window" is not especially
    helpful when entering the gnome-shell switcher and other views.
    We can now peak and queued events, so if the newly-activated gnome-shell
    window lacks a name and we have a pending focus event, don't say "window".
    
    See issue #226.

 src/orca/scripts/apps/gnome-shell/script.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/orca/scripts/apps/gnome-shell/script.py b/src/orca/scripts/apps/gnome-shell/script.py
index 694dcbaa4..f7922dfde 100644
--- a/src/orca/scripts/apps/gnome-shell/script.py
+++ b/src/orca/scripts/apps/gnome-shell/script.py
@@ -29,6 +29,7 @@ __license__   = "LGPL"
 import pyatspi
 import time
 
+import orca.debug as debug
 import orca.orca as orca
 import orca.scripts.toolkits.clutter as clutter
 
@@ -73,6 +74,15 @@ class Script(clutter.Script):
 
         return clutter.Script.skipObjectEvent(self, event)
 
+    def locusOfFocusChanged(self, event, oldFocus, newFocus):
+        if (event.type == "window:activate" and newFocus and not newFocus.name):
+            if self._getQueuedEvent("object:state-changed:focused", True):
+                msg = "GNOME SHELL: Have matching focused event. Not announcing nameless window."
+                debug.println(debug.LEVEL_INFO, msg, True)
+                return
+
+        super().locusOfFocusChanged(event, oldFocus, newFocus)
+
     def _presentDialogLabel(self, event):
         try:
             role = event.source.getRole()


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