diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-24 11:33:42 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-03-24 20:36:52 +0100 |
commit | 305c6fee0be4db38023d9ca5f7915e443e0bc1fc (patch) | |
tree | 11cf8eb513e7ed1e51e5aa336fdb865e540474ff | |
parent | 6c13e5a92ed4b6a10458cd5d5741ddb3d816df4e (diff) |
tdf#141197 if we have a sysobj child then include that in the atk hierarchy
this also should make the case of an embedded video visible in the atk
hierarchy as well as the target of the native gtk widgets in a vcl
window container in the startcenter
Change-Id: Ia91439cbccbffbb0badbfb466f7ab6d1ccbfe3ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113033
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/unx/gtk3/a11y/atkwrapper.hxx | 1 | ||||
-rw-r--r-- | vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/a11y/atkwrapper.hxx b/vcl/unx/gtk3/a11y/atkwrapper.hxx index 3b9e5bd03c1b..b892b8979d8e 100644 --- a/vcl/unx/gtk3/a11y/atkwrapper.hxx +++ b/vcl/unx/gtk3/a11y/atkwrapper.hxx @@ -50,6 +50,7 @@ struct AtkObjectWrapper { AtkObject 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 css::uno::Reference<css::accessibility::XAccessible> mpAccessible; css::uno::Reference<css::accessibility::XAccessibleContext> mpContext; diff --git a/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx b/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx index cbce84b09fd1..1d53043f3d2b 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx @@ -40,10 +40,14 @@ #include <com/sun/star/accessibility/XAccessibleImage.hpp> #include <com/sun/star/accessibility/XAccessibleHypertext.hpp> #include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/awt/XWindow.hpp> #include <rtl/strbuf.hxx> #include <osl/diagnose.h> #include <tools/diagnose_ex.h> +#include <vcl/syschild.hxx> +#include <vcl/sysdata.hxx> +#include <vcl/toolkit/unowrap.hxx> #include "atkwrapper.hxx" #include "atkregistry.hxx" @@ -407,6 +411,10 @@ static gint wrapper_get_n_children( AtkObject *atk_obj ) { AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj); + + if (obj->mpSysObjChild) + return 1; + gint n = 0; if( obj->mpContext.is() ) @@ -429,6 +437,13 @@ wrapper_ref_child( AtkObject *atk_obj, gint i ) { AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj); + + if (obj->mpSysObjChild) + { + g_object_ref(obj->mpSysObjChild); + return obj->mpSysObjChild; + } + AtkObject* child = nullptr; // see comments above atk_object_wrapper_remove_child @@ -875,6 +890,19 @@ atk_object_wrapper_new( const css::uno::Reference< css::accessibility::XAccessib } } + // tdf#141197 if we have a sysobj child then include that in the hierarchy + if (UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper()) + { + css::uno::Reference<css::awt::XWindow> xAWTWindow(rxAccessible, css::uno::UNO_QUERY); + VclPtr<vcl::Window> xWindow = pWrapper->GetWindow(xAWTWindow); + if (xWindow && xWindow->GetType() == WindowType::SYSTEMCHILDWINDOW) + { + const SystemEnvData* pEnvData = static_cast<SystemChildWindow*>(xWindow.get())->GetSystemData(); + if (GtkWidget *pSysObj = pEnvData ? static_cast<GtkWidget*>(pEnvData->pWidget) : nullptr) + pWrap->mpSysObjChild = gtk_widget_get_accessible(pSysObj); + } + } + return ATK_OBJECT( pWrap ); } catch (const uno::Exception &) |