summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-30 16:26:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-30 22:29:32 +0200
commitfd52a23e4428bd9447643fd9c9c58905a4e7250b (patch)
treee0b82f11cc8c60c550c7724fa4e14a6fb9a5debf
parent0258bcdedd710d78de99c9cefc9d8c3e2ca85fdf (diff)
tdf#117859 crash in Tab Color a11y
Change-Id: I935f0b1a28b483fad70caf7af96742dee74916ad Reviewed-on: https://gerrit.libreoffice.org/55087 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.hxx8
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx25
2 files changed, 31 insertions, 2 deletions
diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx
index c45f0f9c839b..381f3c074fdf 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.hxx
@@ -21,6 +21,10 @@
#define INCLUDED_VCL_UNX_GTK_A11Y_ATKWRAPPER_HXX
#include <atk/atk.h>
+#include <gtk/gtk.h>
+#if GTK_CHECK_VERSION(3,0,0)
+#include <gtk/gtk-a11y.h>
+#endif
#include <com/sun/star/accessibility/XAccessible.hpp>
extern "C" {
@@ -70,7 +74,11 @@ struct AtkObjectWrapper
struct AtkObjectWrapperClass
{
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkWidgetAccessibleClass aParentClass;
+#else
AtkObjectClass aParentClass;
+#endif
};
GType atk_object_wrapper_get_type() G_GNUC_CONST;
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 577d5e1d2744..54444d801c5c 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3653,6 +3653,14 @@ static MouseEventModifiers ImplGetMouseMoveMode(sal_uInt16 nCode)
return nMode;
}
+namespace
+{
+
+AtkObject* (*default_drawing_area_get_accessible)(GtkWidget *widget);
+
+}
+
+
class GtkInstanceDrawingArea : public GtkInstanceWidget, public virtual weld::DrawingArea
{
private:
@@ -3928,6 +3936,21 @@ public:
return uno::Reference<css::accessibility::XAccessibleRelationSet>();
}
+ virtual void set_accessible_name(const OUString& rName) override
+ {
+ AtkObject* pAtkObject = default_drawing_area_get_accessible(m_pWidget);
+ if (!pAtkObject)
+ return;
+ atk_object_set_name(pAtkObject, OUStringToOString(rName, RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+ virtual OUString get_accessible_name() const override
+ {
+ AtkObject* pAtkObject = default_drawing_area_get_accessible(m_pWidget);
+ const char* pStr = pAtkObject ? atk_object_get_name(pAtkObject) : nullptr;
+ return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
+ }
+
virtual ~GtkInstanceDrawingArea() override
{
g_object_steal_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea");
@@ -4411,8 +4434,6 @@ namespace
namespace
{
-AtkObject* (*default_drawing_area_get_accessible)(GtkWidget *widget);
-
AtkObject* drawing_area_get_accessibity(GtkWidget *pWidget)
{
AtkObject* pDefaultAccessible = default_drawing_area_get_accessible(pWidget);