[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 29 21:23:25 UTC 2019


 vcl/unx/gtk3/gtk3gtkinst.cxx |   29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

New commits:
commit b70053ba681a9b62afd6fa700ad94256d98d8dc7
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 29 15:23:28 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 29 22:22:57 2019 +0100

    prefer help strings to a11y strings when available
    
    Change-Id: I50b36f697b8dd9ff8108392d48a7050702edbfbe
    Reviewed-on: https://gerrit.libreoffice.org/69934
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 3b740f7a8985..1a1713568e9b 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7651,6 +7651,13 @@ public:
         return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
     }
 
+    virtual OUString get_accessible_description() const override
+    {
+        AtkObject* pAtkObject = default_drawing_area_get_accessible(m_pWidget);
+        const char* pStr = pAtkObject ? atk_object_get_description(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");
@@ -8776,16 +8783,7 @@ namespace
         const ImplSVData* pSVData = ImplGetSVData();
         if (pSVData->maHelpData.mbBalloonHelp)
         {
-            /*This is how I would prefer things to be, only a few like this though*/
-            AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
-            const char* pDesc = pAtkObject ? atk_object_get_description(pAtkObject) : nullptr;
-            if (pDesc)
-            {
-                gtk_tooltip_set_text(tooltip, pDesc);
-                return true;
-            }
-
-            /*So fallback to existing mechanism which needs help installed*/
+            /*Current mechanism which needs help installed*/
             OString sHelpId = ::get_help_id(pWidget);
             Help* pHelp = !sHelpId.isEmpty() ? Application::GetHelp() : nullptr;
             if (pHelp)
@@ -8797,10 +8795,19 @@ namespace
                     return true;
                 }
             }
+
+            /*This is how I would prefer things to be, only a few like this though*/
+            AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
+            const char* pDesc = pAtkObject ? atk_object_get_description(pAtkObject) : nullptr;
+            if (pDesc && pDesc[0])
+            {
+                gtk_tooltip_set_text(tooltip, pDesc);
+                return true;
+            }
         }
 
         const char* pDesc = gtk_widget_get_tooltip_text(pWidget);
-        if (pDesc)
+        if (pDesc && pDesc[0])
         {
             gtk_tooltip_set_text(tooltip, pDesc);
             return true;


More information about the Libreoffice-commits mailing list