Make unrelated atspi events filtering better.
This commit is contained in:
1 parent
41283a5d8d
commit
ce5f196956
25 files changed
+654
-41
No files matched your search
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2026 Storm Dragon
|
||||
# Authors: Storm Dragon, Angus Kola
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Controlled selection flood and same-process sibling window fixture."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
gi.require_version("Atk", "1.0")
|
||||
gi.require_version("GdkX11", "3.0")
|
||||
from gi.repository import Atk, GdkX11, GLib, Gtk
|
||||
|
||||
|
||||
fixtureName = sys.argv[1]
|
||||
windows = []
|
||||
pendingInput = ""
|
||||
|
||||
|
||||
def make_window(title):
|
||||
window = Gtk.Window(title=title)
|
||||
window.set_default_size(350, 260)
|
||||
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
window.add(box)
|
||||
entry = Gtk.Entry()
|
||||
entry.get_accessible().set_name(title + " entry")
|
||||
box.add(entry)
|
||||
store = Gtk.ListStore(str)
|
||||
for index in range(40):
|
||||
store.append(["Result " + str(index)])
|
||||
table = Gtk.TreeView(model=store)
|
||||
table.get_accessible().set_name(title + " results")
|
||||
table.append_column(Gtk.TreeViewColumn("Result", Gtk.CellRendererText(), text=0))
|
||||
box.add(table)
|
||||
marker = Gtk.Label(label="Marker")
|
||||
marker.get_accessible().set_role(Atk.Role.ALERT)
|
||||
box.add(marker)
|
||||
window.show_all()
|
||||
entry.grab_focus()
|
||||
windows.append(window)
|
||||
return window, entry, table, marker
|
||||
|
||||
|
||||
window, entry, table, marker = make_window(fixtureName)
|
||||
sibling = None
|
||||
|
||||
|
||||
def receive_command(_source, _condition):
|
||||
global pendingInput, sibling
|
||||
content = os.read(sys.stdin.fileno(), 4096)
|
||||
if not content:
|
||||
Gtk.main_quit()
|
||||
return False
|
||||
pendingInput += content.decode()
|
||||
while "\n" in pendingInput:
|
||||
command, pendingInput = pendingInput.split("\n", 1)
|
||||
if command.startswith("flood "):
|
||||
generation = command.split()[1]
|
||||
selection = table.get_selection()
|
||||
for index in range(300):
|
||||
selection.select_path(Gtk.TreePath.new_from_indices([index % 40]))
|
||||
marker.set_text("Flood complete " + generation)
|
||||
elif command == "sibling":
|
||||
sibling, _, _, _ = make_window(fixtureName + " sibling")
|
||||
print("sibling", GdkX11.X11Window.get_xid(sibling.get_window()), flush=True)
|
||||
elif command == "edit":
|
||||
entry.set_text("Updated text")
|
||||
entry.set_position(-1)
|
||||
elif command == "focus-table":
|
||||
table.grab_focus()
|
||||
table.set_cursor(Gtk.TreePath.new_from_indices([1]))
|
||||
elif command == "quit":
|
||||
Gtk.main_quit()
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
GLib.io_add_watch(sys.stdin, GLib.IO_IN | GLib.IO_HUP, receive_command)
|
||||
GLib.idle_add(lambda: print("ready", GdkX11.X11Window.get_xid(window.get_window()), flush=True) or False)
|
||||
Gtk.main()
|
||||
@@ -26,6 +26,9 @@ body = Gtk.Label(label="Playing: Example Game")
|
||||
toast.add(username)
|
||||
toast.add(body)
|
||||
box.add(toast)
|
||||
barrier = Gtk.Label(label="Marker")
|
||||
barrier.get_accessible().set_role(Atk.Role.ALERT)
|
||||
box.add(barrier)
|
||||
window.connect("destroy", Gtk.main_quit)
|
||||
window.show_all()
|
||||
foreground = Gtk.Window(title="Foreground fixture")
|
||||
@@ -52,6 +55,8 @@ def receive_command(source: object, condition: object) -> bool:
|
||||
toast.show_all()
|
||||
elif command == "update":
|
||||
body.set_text("Username is now online")
|
||||
elif command == "barrier":
|
||||
barrier.set_text("Notification barrier")
|
||||
elif command == "destroy":
|
||||
toast.destroy()
|
||||
elif command == "add":
|
||||
|
||||
Reference in new issue
Block a user