vcl/unx/gtk3/a11y/atkwrapper.cxx | 9 ++++++++- vcl/unx/gtk3/a11y/atkwrapper.hxx | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-)
New commits: commit 14e6a810e14e28ab82fe65d66e604ce562016845 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Aug 15 13:14:08 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Nov 8 11:37:11 2022 +0100 fix "invalid class cast from 'OOoAtkObj' to 'GtkWidgetAccessible'" and similar Change-Id: I8a989465057a5b7810f6cedf370fc1cd77f5af0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138311 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit f3b0a95f9c2f85604808c21485e46e43aebbbfed) Resolves: tdf#150496 we want the AtkObject get_parent function GtkAccessible overrode it, but we expect the AtkObject implementation Change-Id: I5064bc619b11052bd22f9c75043b3e42697ebfc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138558 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit f0827c392641b45647241b3a22e24a95e2b595e3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142419 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx index d23f384e26fc..bc493561b1ce 100644 --- a/vcl/unx/gtk3/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx @@ -666,6 +666,13 @@ atk_object_wrapper_class_init (AtkObjectWrapperClass *klass) atk_class->get_index_in_parent = wrapper_get_index_in_parent; atk_class->ref_relation_set = wrapper_ref_relation_set; atk_class->ref_state_set = wrapper_ref_state_set; + + AtkObjectClass* orig_atk_klass = static_cast<AtkObjectClass*>(g_type_class_ref(ATK_TYPE_OBJECT)); + // tdf#150496 we want to inherit from GtkAccessible because gtk assumes it can cast to GtkAccessible + // but we want the original behaviour we got from atk_object_real_get_parent when we inherited + // from AtkObject + atk_class->get_parent = orig_atk_klass->get_parent; + g_type_class_unref(orig_atk_klass); } static void @@ -705,7 +712,7 @@ atk_object_wrapper_get_type() reinterpret_cast<GInstanceInitFunc>(atk_object_wrapper_init), nullptr } ; - type = g_type_register_static (ATK_TYPE_OBJECT, + type = g_type_register_static (GTK_TYPE_WIDGET_ACCESSIBLE, "OOoAtkObj", &typeInfo, GTypeFlags(0)) ; } diff --git a/vcl/unx/gtk3/a11y/atkwrapper.hxx b/vcl/unx/gtk3/a11y/atkwrapper.hxx index 0b5f64726bba..6f18bde614ee 100644 --- a/vcl/unx/gtk3/a11y/atkwrapper.hxx +++ b/vcl/unx/gtk3/a11y/atkwrapper.hxx @@ -47,7 +47,8 @@ namespace com::sun::star::accessibility { struct AtkObjectWrapper { - AtkObject aParent; + GtkWidgetAccessible aParent; + AtkObject* mpOrig; //if we're a GtkDrawingArea acting as a custom LibreOffice widget, this is the toolkit default impl AtkObject* mpSysObjChild; //if we're a container for a sysobj, then this is the sysobj native gtk AtkObject