Blame 0001-Resolves-rhbz-1712823-prefer-help-strings-to-a11y-st.patch

e9abb43
From 623ad17227406b30e53436046831c43f160a6486 Mon Sep 17 00:00:00 2001
e9abb43
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
e9abb43
Date: Fri, 29 Mar 2019 15:23:28 +0000
e9abb43
Subject: [PATCH] Resolves: rhbz#1712823 prefer help strings to a11y strings
e9abb43
 when available
e9abb43
MIME-Version: 1.0
e9abb43
Content-Type: text/plain; charset=UTF-8
e9abb43
Content-Transfer-Encoding: 8bit
e9abb43
e9abb43
Reviewed-on: https://gerrit.libreoffice.org/69934
e9abb43
Tested-by: Jenkins
e9abb43
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
e9abb43
Tested-by: Caolán McNamara <caolanm@redhat.com>
e9abb43
(cherry picked from commit b70053ba681a9b62afd6fa700ad94256d98d8dc7)
e9abb43
e9abb43
Change-Id: I50b36f697b8dd9ff8108392d48a7050702edbfbe
e9abb43
---
e9abb43
 vcl/unx/gtk3/gtk3gtkinst.cxx | 29 ++++++++++++++++++-----------
e9abb43
 1 file changed, 18 insertions(+), 11 deletions(-)
e9abb43
e9abb43
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
e9abb43
index a69e4df05806..5123db7c9f2e 100644
e9abb43
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
e9abb43
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
e9abb43
@@ -6514,6 +6514,13 @@ public:
e9abb43
         return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
e9abb43
     }
e9abb43
 
e9abb43
+    virtual OUString get_accessible_description() const override
e9abb43
+    {
e9abb43
+        AtkObject* pAtkObject = default_drawing_area_get_accessible(m_pWidget);
e9abb43
+        const char* pStr = pAtkObject ? atk_object_get_description(pAtkObject) : nullptr;
e9abb43
+        return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
e9abb43
+    }
e9abb43
+
e9abb43
     virtual ~GtkInstanceDrawingArea() override
e9abb43
     {
e9abb43
         g_object_steal_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea");
e9abb43
@@ -7579,16 +7586,7 @@ namespace
e9abb43
         const ImplSVData* pSVData = ImplGetSVData();
e9abb43
         if (pSVData->maHelpData.mbBalloonHelp)
e9abb43
         {
e9abb43
-            /*This is how I would prefer things to be, only a few like this though*/
e9abb43
-            AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
e9abb43
-            const char* pDesc = pAtkObject ? atk_object_get_description(pAtkObject) : nullptr;
e9abb43
-            if (pDesc)
e9abb43
-            {
e9abb43
-                gtk_tooltip_set_text(tooltip, pDesc);
e9abb43
-                return true;
e9abb43
-            }
e9abb43
-
e9abb43
-            /*So fallback to existing mechanism which needs help installed*/
e9abb43
+            /*Current mechanism which needs help installed*/
e9abb43
             OString sHelpId = ::get_help_id(pWidget);
e9abb43
             Help* pHelp = !sHelpId.isEmpty() ? Application::GetHelp() : nullptr;
e9abb43
             if (pHelp)
e9abb43
@@ -7600,10 +7598,19 @@ namespace
e9abb43
                     return true;
e9abb43
                 }
e9abb43
             }
e9abb43
+
e9abb43
+            /*This is how I would prefer things to be, only a few like this though*/
e9abb43
+            AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
e9abb43
+            const char* pDesc = pAtkObject ? atk_object_get_description(pAtkObject) : nullptr;
e9abb43
+            if (pDesc && pDesc[0])
e9abb43
+            {
e9abb43
+                gtk_tooltip_set_text(tooltip, pDesc);
e9abb43
+                return true;
e9abb43
+            }
e9abb43
         }
e9abb43
 
e9abb43
         const char* pDesc = gtk_widget_get_tooltip_text(pWidget);
e9abb43
-        if (pDesc)
e9abb43
+        if (pDesc && pDesc[0])
e9abb43
         {
e9abb43
             gtk_tooltip_set_text(tooltip, pDesc);
e9abb43
             return true;
e9abb43
-- 
e9abb43
2.21.0
e9abb43