tdf#141197 expose gtk-widgets inside vcl-containers to atk hierarchy

f41
Caolán McNamara 4 years ago
parent 0391b06f3b
commit 783a050a00

@ -0,0 +1,43 @@
From 2beb3922391ae1a6f1d26128d82c0e34cb963af3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Tue, 23 Mar 2021 14:55:09 +0000
Subject: [PATCH] Related: tdf#141197 critical a11y warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
** (soffice:19098): CRITICAL **: 13:44:40.365:
AtkObject* atk_object_wrapper_ref(const com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible>&, bool):
assertion 'bool(rxAccessible)' failed
probably since...
commit cbc18cc904c652a936c4b68fba4d975bd89b5abd
Date: Mon Nov 23 21:03:28 2020 +0100
tdf#138425 vcl/gtk activate main menu in UpdateFull
Change-Id: Ieb181e02bb0d2a907aec8534349ec2a80fd9c7e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113000
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
---
vcl/source/window/menu.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 4fb964f2f008..233f531cfcaf 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1303,7 +1303,7 @@ css::uno::Reference<css::accessibility::XAccessible> Menu::GetAccessible()
// Since PopupMenu are sometimes shared by different instances of MenuBar, the mxAccessible member gets
// overwritten and may contain a disposed object when the initial menubar gets set again. So use the
// mxAccessible member only for sub menus.
- if ( pStartedFrom )
+ if (pStartedFrom && pStartedFrom != this)
{
for ( sal_uInt16 i = 0, nCount = pStartedFrom->GetItemCount(); i < nCount; ++i )
{
--
2.30.2

@ -0,0 +1,120 @@
From 26ff4db374438a230f1670ab12d88f7f54075127 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Wed, 24 Mar 2021 11:33:42 +0000
Subject: [PATCH] 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
---
vcl/Library_vclplug_gtk3.mk | 1 +
vcl/Library_vclplug_gtk3_kde5.mk | 1 +
vcl/unx/gtk3/a11y/atkwrapper.hxx | 1 +
vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx | 28 ++++++++++++++++++++++++++++
4 files changed, 31 insertions(+)
diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk
index 9e67d5efc265..317152b59fe9 100644
--- a/vcl/Library_vclplug_gtk3.mk
+++ b/vcl/Library_vclplug_gtk3.mk
@@ -36,6 +36,7 @@ $(eval $(call gb_Library_set_include,vclplug_gtk3,\
$(eval $(call gb_Library_add_defs,vclplug_gtk3,\
-DVCLPLUG_GTK_IMPLEMENTATION \
+ -DVCL_INTERNALS \
))
$(eval $(call gb_Library_use_custom_headers,vclplug_gtk3,\
diff --git a/vcl/Library_vclplug_gtk3_kde5.mk b/vcl/Library_vclplug_gtk3_kde5.mk
index 51dafda097be..602be3d13b45 100644
--- a/vcl/Library_vclplug_gtk3_kde5.mk
+++ b/vcl/Library_vclplug_gtk3_kde5.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_add_cxxflags,vclplug_gtk3_kde5,\
$(eval $(call gb_Library_add_defs,vclplug_gtk3_kde5,\
-DVCLPLUG_GTK_IMPLEMENTATION -DVCLPLUG_GTK3_KDE5_IMPLEMENTATION \
+ -DVCL_INTERNALS \
))
$(eval $(call gb_Library_use_custom_headers,vclplug_gtk3_kde5,\
diff --git a/vcl/unx/gtk3/a11y/atkwrapper.hxx b/vcl/unx/gtk3/a11y/atkwrapper.hxx
index d9c651a2eae8..0fcbce6369fd 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.hxx
@@ -46,6 +46,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 2442e6ab665d..56bc8717d0fb 100644
--- a/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx
+++ b/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx
@@ -40,9 +40,13 @@
#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 <vcl/syschild.hxx>
+#include <vcl/sysdata.hxx>
+#include <vcl/toolkit/unowrap.hxx>
#include "atkwrapper.hxx"
#include "atkregistry.hxx"
@@ -406,6 +410,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() )
@@ -428,6 +436,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
@@ -874,6 +889,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 &)
--
2.30.2

@ -50,7 +50,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.2
Release: 1%{?libo_prerelease}%{?dist}
Release: 2%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and MPLv2.0 and CC0
URL: http://www.libreoffice.org/
@ -248,6 +248,8 @@ Patch2: 0001-Resolves-rhbz-1432468-disable-opencl-by-default.patch
# backported
Patch3: 0001-fix-detecting-qrcodegen.patch
Patch4: 0001-rhbz-1918152-fix-FTBFS.patch
Patch5: 0001-Related-tdf-141197-critical-a11y-warning.patch
Patch6: 0001-tdf-141197-if-we-have-a-sysobj-child-then-include-th.patch
# not upstreamed
Patch500: 0001-disable-libe-book-support.patch
@ -2235,6 +2237,9 @@ gtk-update-icon-cache -q %{_datadir}/icons/hicolor &>/dev/null || :
%{_includedir}/LibreOfficeKit
%changelog
* Wed Mar 24 2021 Caolán McNamara <caolanm@redhat.com> - 1:7.1.1.2-2
- tdf#141197 expose gtk-widgets inside vcl-containers to atk hierarchy
* Thu Mar 04 2021 Caolán McNamara <caolanm@redhat.com> - 1:7.1.1.2-1
- latest version

Loading…
Cancel
Save