ATSPI in gtk4-demo is reporting wrong coordinates (-1677635824, 22009) instead of expected (0, 0)
Steps to reproduce
I have made a reproducer for gtk4-demo. The demos position should be (0,0) just like the gtk3-demo returns. The gtk4-demo returns (-1677635824, 22009).
Current behavior
The gtk3-demo is giving me (0, 0) coordinates, while gtk4-demo gives me (-1677635824, 22009).
Expected outcome
The gtk4-demo should return (0, 0)
Version information
Fedora Rawhide Wayland gtk4-4.11.3-1.fc39.x86_64
Additional information
ATSPI reproducer:
#!/usr/bin/env python3
"""
Reproducer
"""
import warnings
import os
from subprocess import Popen
import gi
from time import sleep
gi.require_version("Atspi", "2.0")
from gi.repository import Atspi
from gi.repository import GLib
warnings.filterwarnings("ignore", "g_object_unref")
class Registry:
def __init__(self):
self.main_loop = GLib.MainLoop()
self._set_registry()
def __call__(self):
return self
def _set_registry(self):
self.event_listeners = dict()
def get_desktop(self, numbered_desktop):
return Atspi.get_desktop(numbered_desktop)
# Find a single satisfying descendant
# ----------------------------------------------------------------
def find_descendant(accesible_node, predicate):
return _find_descendant_depth_first(accesible_node, predicate)
def _find_descendant_depth_first(accesible_node, predicate):
try:
if predicate(accesible_node):
return accesible_node
except Exception:
pass
for accesible_child in accesible_node:
try:
success_match = _find_descendant_depth_first(accesible_child, predicate)
except Exception:
success_match = None
if success_match is not None:
return success_match
class Node:
def findChild(self, predicate):
result = None
for _ in range(20): # fixed cutoff in reproducer
result = find_descendant(self, predicate)
if result:
break
return result
class Root(Node):
def application(self, application_name):
return self.findChild(
lambda x: x.name == application_name and x.role_name == "application"
)
Atspi.Accessible.__bases__ = (
Root,
Node,
) + Atspi.Accessible.__bases__
registry = Registry()
root = registry.get_desktop(0)
app = "gtk4-demo"
Popen(f"killall {app}", shell=True)
sleep(1)
Popen(app, shell=True)
sleep(1)
accessibility_node = root.application(app).get_child_at_index(0)
atspi_point = accessibility_node.get_component_iface().get_position(0)
print(atspi_point.x, atspi_point.y)
When you change the app to gtk3-demo you can run the reproducer again to get the values I expected in gtk4-demo.
I filed it just to keep track of this I understand that this is nothing critical.
Edited by Michal Odehnal