vcl/unx/gtk3/gtkinst.cxx |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 6f637690588c2a6704bdc0db296c29d34768cddd
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Jan 15 10:02:56 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu Jan 15 13:19:19 2026 +0100

    gtk4 a11y: Implement weld::Widget::get_accessible_id
    
    Make use of the new upstream GTK 4 logic/API introduced in
    GTK 4 commits [1]
    
        commit 088c5608adf90eece4dc316f014671b342f05ac9
        Author: Michael Weghorn <[email protected]>
        Date:   Tue Jan 13 14:32:27 2026 +0100
    
            a11y: Introduce accessible ID
    
    and [2]
    
        commit 2f208cc8b8c2052110772fb4edbc7220661386a7
        Author: Michael Weghorn <[email protected]>
        Date:   Tue Jan 13 14:47:46 2026 +0100
    
            a11y: Report buildable ID as GtkWidget's accessible ID
    
    to implement GtkInstanceWidget::get_accessible_id for
    the gtk4 VCL plugin.
    
    The GtkInstanceDrawingArea case doesn't need special
    handling for gtk4, so make it gtk3-only.
    
    [1] 
https://gitlab.gnome.org/GNOME/gtk/-/commit/088c5608adf90eece4dc316f014671b342f05ac9
    [2] 
https://gitlab.gnome.org/GNOME/gtk/-/commit/2f208cc8b8c2052110772fb4edbc7220661386a7
    
    Change-Id: Iea9bd6f1b69dde014cc3492aa0b71c188565c213
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197333
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index e664bd8eec03..ea044f8c2d38 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -3701,12 +3701,15 @@ public:
 
     virtual OUString get_accessible_id() const override
     {
-#if !GTK_CHECK_VERSION(4, 0, 0)
+#if GTK_CHECK_VERSION(4, 21, 5)
+        g_autofree char* pId = 
gtk_accessible_get_accessible_id(GTK_ACCESSIBLE(m_pWidget));
+        return OUString(pId, pId ? strlen(pId) : 0, RTL_TEXTENCODING_UTF8);
+#elif GTK_CHECK_VERSION(4, 0, 0)
+        return OUString();
+#else
         AtkObject* pAtkObject = gtk_widget_get_accessible(m_pWidget);
         const char* pStr = pAtkObject ? 
atk_object_get_accessible_id(pAtkObject) : nullptr;
         return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
-#else
-        return OUString();
 #endif
     }
 
@@ -18379,16 +18382,14 @@ public:
 #endif
     }
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
     virtual OUString get_accessible_id() const override
     {
-#if !GTK_CHECK_VERSION(4, 0, 0)
         AtkObject* pAtkObject = default_drawing_area_get_accessible(m_pWidget);
         const char* pStr = pAtkObject ? 
atk_object_get_accessible_id(pAtkObject) : nullptr;
         return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
-#else
-        return OUString();
-#endif
     }
+#endif
 
     virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& 
rHelper, sal_uInt8 eDNDConstants) override
     {

Reply via email to