Commit a2d0f2e6 authored by Joanmarie Diggs's avatar Joanmarie Diggs

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.
parent feb44b4b
......@@ -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)
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment