diff options
author | Eric Williams | 2019-02-13 19:26:11 +0000 |
---|---|---|
committer | Eric Williams | 2019-02-13 21:28:02 +0000 |
commit | f2a41f7a4410a657943ce506c40fe9a7b2be8503 (patch) | |
tree | 51072d728564a1160b8a2764d07b703cc0dbdf04 /bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library | |
parent | 73a25fb3b2f4e5472d1226f1b58edd392b2b5e6f (diff) | |
download | eclipse.platform.swt-f2a41f7a4410a657943ce506c40fe9a7b2be8503.tar.gz eclipse.platform.swt-f2a41f7a4410a657943ce506c40fe9a7b2be8503.tar.xz eclipse.platform.swt-f2a41f7a4410a657943ce506c40fe9a7b2be8503.zip |
Bug 543949: Orca's flat review mode can not be used
Not all SwtFixedAccessible instances have corresponding
AccessibleObjects, meaning the implementation of ATK API is
SwtFixedAccessible's responsibility to handle natively.
Most ATK API like AtkEditableText or AtkAction doesn't need to worry
about this since those API's are specialized for certain functions.
However AtkComponent covers geometry which is pretty important
information for a container accessibility implementation.
The fix: if no AccessibleObject exists, calculate the
extents/size/position manually. We can do this even with scaling by
using JNI to call Java level methods like toDisplay.
Change-Id: Ib54821fc006eedc039dc9dc4b3dc83ddc5cc58ab
Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c index e942805f66..dbc7dffb45 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c @@ -1482,29 +1482,30 @@ static void swt_fixed_accessible_component_get_extents (AtkComponent *component, if (private->has_accessible) { call_accessible_object_function("atkComponent_get_extents", "(JJJJJJ)J", component, x, y, width, height, coord_type); - } - return; -} - -static void swt_fixed_accessible_component_get_position (AtkComponent *component, gint *x, gint *y, - AtkCoordType coord_type) { - SwtFixedAccessible *fixed = SWT_FIXED_ACCESSIBLE (component); - SwtFixedAccessiblePrivate *private = fixed->priv; - - if (private->has_accessible) { - call_accessible_object_function("atkComponent_get_position", "(JJJJ)J", component, x, y, coord_type); - } - return; -} - -static void swt_fixed_accessible_component_get_size (AtkComponent *component, gint *width, gint *height) { - SwtFixedAccessible *fixed = SWT_FIXED_ACCESSIBLE (component); - SwtFixedAccessiblePrivate *private = fixed->priv; - - if (private->has_accessible) { - // Note we are calling the Java method with 4 arguments: on GTK2 atk_component_get_size - // accepts 4 parameters, on GTK3 it only accepts 3. - call_accessible_object_function("atkComponent_get_size", "(JJJJ)J", component, width, height, 0); + } else { + // Only GTK3 has accessibility support at the moment. + #if !defined(GTK4) + GtkWidget *widget = gtk_accessible_get_widget(GTK_ACCESSIBLE(fixed)); + GdkWindow *window = gtk_widget_get_window(widget); + gint fixed_x, fixed_y; + call_accessible_object_function("toDisplay", "(JJJ)J", window, &fixed_x, &fixed_y); + GtkAllocation allocation; + gtk_widget_get_allocation(widget, &allocation); + if (coord_type == ATK_XY_SCREEN) { + *x = fixed_x; + *y = fixed_y; + } + if (coord_type == ATK_XY_WINDOW) { + GtkWidget *top = gtk_widget_get_toplevel(widget); + GdkWindow *top_window = gtk_widget_get_window(top); + gint top_x, top_y; + call_accessible_object_function("toDisplay", "(JJJ)J", top_window, &top_x, &top_y); + *x = fixed_x - top_x; + *y = fixed_y - top_y; + } + *width = allocation.width; + *height = allocation.height; + #endif } return; } @@ -2176,8 +2177,6 @@ static void swt_fixed_accessible_action_iface_init (AtkActionIface *iface) { static void swt_fixed_accessible_component_iface_init (AtkComponentIface *iface) { iface->get_extents = swt_fixed_accessible_component_get_extents; - iface->get_position = swt_fixed_accessible_component_get_position; - iface->get_size = swt_fixed_accessible_component_get_size; iface->ref_accessible_at_point = swt_fixed_accessible_component_ref_accessible_at_point; } |