[orca/gnome-3-34] Filter out bogus window focus claims from gnome-shell



commit 067c4cd55a3636142b694550733d49f340df7201
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Oct 4 15:07:27 2019 -0400

    Filter out bogus window focus claims from gnome-shell
    
    Alt+Tabbing into application windows is sometimes causing gnome-shell
    to emit object:state-changed:focused events for an accessible with
    the role of window. This is at least sometimes taking place after the
    application window gains focus. Since no gnome-shell window seems to
    be actually gaining focus, and since windows are expected to emit
    window:activate events, these events appear safe to ignore. In addition,
    failure to ignore them can cause Orca to load the gnome-shell script
    incorrectly.

 src/orca/scripts/apps/gnome-shell/script.py           |  6 ++++++
 src/orca/scripts/apps/gnome-shell/script_utilities.py | 10 ++++++++++
 2 files changed, 16 insertions(+)
---
diff --git a/src/orca/scripts/apps/gnome-shell/script.py b/src/orca/scripts/apps/gnome-shell/script.py
index 4dbaf3d85..697779612 100644
--- a/src/orca/scripts/apps/gnome-shell/script.py
+++ b/src/orca/scripts/apps/gnome-shell/script.py
@@ -62,6 +62,9 @@ class Script(clutter.Script):
             if role == pyatspi.ROLE_DIALOG:
                 return False
 
+            if role == pyatspi.ROLE_WINDOW:
+                return self.utilities.isBogusWindowFocusClaim(event)
+
         return clutter.Script.skipObjectEvent(self, event)
 
     def _presentDialogLabel(self, event):
@@ -227,4 +230,7 @@ class Script(clutter.Script):
         if event.type.startswith('object:state-changed:selected') and event.detail1:
             return True
 
+        if self.utilities.isBogusWindowFocusClaim(event):
+            return False
+
         return super().isActivatableEvent(event)
diff --git a/src/orca/scripts/apps/gnome-shell/script_utilities.py 
b/src/orca/scripts/apps/gnome-shell/script_utilities.py
index aa6336828..78836093b 100644
--- a/src/orca/scripts/apps/gnome-shell/script_utilities.py
+++ b/src/orca/scripts/apps/gnome-shell/script_utilities.py
@@ -117,3 +117,13 @@ class Utilities(script_utilities.Utilities):
                 return True
 
         return False
+
+    def isBogusWindowFocusClaim(self, event):
+        if event.type.startswith('object:state-changed:focused') and event.detail1 \
+           and event.source.getRole() == pyatspi.ROLE_WINDOW \
+           and not self.canBeActiveWindow(event.source):
+            msg = "GNOME SHELL: Event is believed to be bogus window focus claim"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
+
+        return False


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