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

Bug#875629: accerciser: can't access object content and highlight without compositor



Package: accerciser
Version: 3.22.0-2
Severity: important
Tags: a11y patch upstream
Owner: bugs@hypra.fr
User: bugs@hypra.fr
Usertags: hypra
Forwarded: https://bugzilla.gnome.org/show_bug.cgi?id=787592

Hello,

My desktop doesn't include a compositor.  When I click on an object in
the at-spi tree, I get this in the accerciser output:

Traceback (most recent call last):

+ Trace 237951

  • File "/usr/lib/python3/dist-packages/accerciser/accessible_treeview.py", line 839 in _onSelectionChanged
    self.node.update(new_acc)

  • File "/usr/lib/python3/dist-packages/accerciser/node.py", line 100 in update
    self.highlight()
  • File "/usr/lib/python3/dist-packages/accerciser/node.py", line 134 in highlight 2.0, 0)
  • File "/usr/lib/python3/dist-packages/accerciser/node.py", line 222 in __init__
    self.root = gdk.get_default_root_window().get_image(

AttributeError: 'X11Window' object has no attribute 'get_image'

and I don't get attributes, content, etc. of the object.

Indeed, get_image is something that got removed between gtk+2.0 and
gtk+3.0, it seems the migration in accerciser didn't fix that part,
probably because the maintainer does use a compositor.

This is a problem because it makes accerciser basically unusable when
not running a compositor. The attached patch fixes it by replacing
the gtk+2.0 implementation (which can't work anyway) with an X11
implementation (gtk+3.0 does not provide the features needed here).

I'll commit the patch to the repository, this is more for documenting
the issue, for reference to potentially backport the fix to Stretch.

Samuel

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'stable-debug'), (500, 'oldoldstable'), (500, 'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.13.0 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages accerciser depends on:
ii  dconf-gsettings-backend [gsettings-backend]  0.26.0-2+b1
ii  gir1.2-atk-1.0                               2.24.0-1
ii  gir1.2-gdkpixbuf-2.0                         2.36.5-2
ii  gir1.2-glib-2.0                              1.53.2-4
ii  gir1.2-gtk-3.0                               3.22.19-1
ii  gir1.2-pango-1.0                             1.40.11-1
ii  gir1.2-rsvg-2.0                              2.40.18-1
ii  gir1.2-wnck-3.0                              3.24.1-1
ii  ipython3                                     5.1.0-3
ii  python3                                      3.5.3-3
ii  python3-cairo                                1.10.0+dfsg-5+b3
ii  python3-pyatspi                              2.24.0+dfsg-1

accerciser recommends no packages.

accerciser suggests no packages.

-- no debconf information

-- 
Samuel
/*
 * [...] Note that 120 sec is defined in the protocol as the maximum
 * possible RTT.  I guess we'll have to use something other than TCP
 * to talk to the University of Mars.
 * PAWS allows us longer timeouts and large windows, so once implemented
 * ftp to mars will work nicely.
 */
(from /usr/src/linux/net/inet/tcp.c, concerning RTT [retransmission timeout])
---
 src/lib/accerciser/node.py |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

--- a/src/lib/accerciser/node.py
+++ b/src/lib/accerciser/node.py
@@ -24,6 +24,8 @@ import pyatspi
 import string
 from .tools import ToolsAccessor, parseColorString
 
+import Xlib, Xlib.display
+
 MAX_BLINKS = 6
 
 gsettings = GSettings.new('org.a11y.Accerciser')
@@ -147,14 +149,11 @@ class Node(GObject.GObject, ToolsAccesso
     self.max_blinks = times
     self.blinks = 0
     # get info for drawing higlight rectangles
-    display = gdk.Display.get_default()
-    screen = display.get_default_screen()
-    self.root = screen.get_root_window()
-    self.gc = self.root.new_gc()
-    self.gc.set_subwindow(gdk.SubwindowMode.INCLUDE_INFERIORS)
-    self.gc.set_function(gdk.Function.INVERT)
-    self.gc.set_line_attributes(3, gdk.LineStyle.ON_OFF_DASH, \
-                                gdk.CapStyle.BUTT, gdk.JoinStyle.MITER)
+    display = Xlib.display.Display()
+    screen = display.screen()
+    self.root = screen.root
+    self.gc = w.create_gc(subwindow_mode = Xlib.X.IncludeInferiors, function = Xlib.X.GXinvert)
+
     self.inv = gtk.Invisible()
     self.inv.set_screen(screen)
     GLib.timeout_add(30, self._drawRectangle)
@@ -167,7 +166,7 @@ class Node(GObject.GObject, ToolsAccesso
     if self.blinks == 0:
       self.inv.show()
       self.inv.grab_add()
-    self.root.draw_rectangle(self.gc, False, 
+    self.root.fill_rectangle(self.gc,
                              self.extents.x,
                              self.extents.y,
                              self.extents.width,
@@ -219,8 +218,8 @@ class _HighLight(gtk.Window):
       self.set_visual(visual)
     else:
       # Take a screenshot for compositing on the client side.
-      self.root = gdk.get_default_root_window().get_image(
-        self.x, self.y, self.w, self.h)
+      #self.root = gdk.get_default_root_window().get_image(
+      #  self.x, self.y, self.w, self.h)
 
     # Place window, and resize it, and set proper properties.
     self.set_app_paintable(True)
@@ -265,10 +264,10 @@ class _HighLight(gtk.Window):
     if not self._composited:
       # Draw the screengrab of the underlaying window, and set the drawing
       # operator to OVER.
-      self.window.draw_image(self.style.black_gc, self.root,
-                             event.area.x,event.area.y,
-                             event.area.x, event.area.y,
-                             event.area.width, event.area.height)
+      #self.window.draw_image(self.style.black_gc, self.root,
+      #                       event.area.x,event.area.y,
+      #                       event.area.x, event.area.y,
+      #                       event.area.width, event.area.height)
       cairo_operator = cairo.OPERATOR_OVER
     else:
       cairo_operator = cairo.OPERATOR_SOURCE

Reply to: