Bug#870631: (entry_text_shifted) wrong coordinates given to at-spi layer from GTK3 entries

Samuel Thibault sthibault at debian.org
Mon Apr 16 12:49:27 BST 2018


Samuel Thibault, le lun. 16 avril 2018 13:16:05 +0200, a ecrit:
> Samuel Thibault, le dim. 15 oct. 2017 22:14:38 +0200, a ecrit:
> > Just wondering: considering that it's just a few lines (as attached to
> > this mail) and the following usability impact:
> > 
> > Alex ARNAUD, on jeu. 03 août 2017 17:53:31 +0200, wrote:
> > > It is blocking for any a11y tool making these events accessible,
> > > like software magnifiers such as gnome3 zoom or compiz's ezoom with
> > > focus tracking. result is unreadable by visually impaired people.
> > 
> > how do [people] feel about including it stretch or even jessie?
> 
> because this is really a blocker for anybody who has to use a software
> screen magnifier.
> 
> I can manage the stretch-pu upload etc. I just need confirmation from
> gtk people.

(FTR, this is the upstream commit)
-------------- next part --------------
commit a2d78a2de72b84902a3ca21803ce334eb38743bd
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date:   Thu Oct 5 15:49:00 2017 +0000

    a11y/entry: Fix text coords not adjusted for alloc
    
    What is missing is the "allocation" part of x/y coordinates. Since
    gtk_entry_realize doesn't call gtk_widget_set_window(priv->text_area),
    the coordinates returned by gdk_window_get_origin don't include it.
    
    This patch fixes this.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784509

---
 gtk/a11y/gtkentryaccessible.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/gtk/a11y/gtkentryaccessible.c
+++ b/gtk/a11y/gtkentryaccessible.c
@@ -25,6 +25,7 @@
 #include "gtkentryprivate.h"
 #include "gtkcomboboxaccessible.h"
 #include "gtkstylecontextprivate.h"
+#include "gtkwidgetprivate.h"
 
 #define GTK_TYPE_ENTRY_ICON_ACCESSIBLE      (gtk_entry_icon_accessible_get_type ())
 #define GTK_ENTRY_ICON_ACCESSIBLE(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY_ICON_ACCESSIBLE, GtkEntryIconAccessible))
@@ -958,6 +959,7 @@ gtk_entry_accessible_get_character_exten
   gint index, x_layout, y_layout;
   GdkWindow *window;
   gint x_window, y_window;
+  GtkAllocation allocation;
 
   widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
@@ -973,11 +975,13 @@ gtk_entry_accessible_get_character_exten
   pango_layout_index_to_pos (gtk_entry_get_layout (entry), index, &char_rect);
   pango_extents_to_pixels (&char_rect, NULL);
 
+  _gtk_widget_get_allocation (widget, &allocation);
+
   window = gtk_widget_get_window (widget);
   gdk_window_get_origin (window, &x_window, &y_window);
 
-  *x = x_window + x_layout + char_rect.x;
-  *y = y_window + y_layout + char_rect.y;
+  *x = x_window + allocation.x + x_layout + char_rect.x;
+  *y = y_window + allocation.y + y_layout + char_rect.y;
   *width = char_rect.width;
   *height = char_rect.height;
 


More information about the pkg-gnome-maintainers mailing list