vcl/unx/gtk4/gtkaccessibleeventlistener.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit b4059c4b9ae2230d9c6d722d457dca2216ddd581
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Feb 14 20:20:40 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Feb 14 23:03:08 2025 +0100

    gtk4 a11y: Report update to focused state
    
    Recent GTK 4 upstream commits [1] [2]
    
        commit 224e587cd30b9452eb19d3ec06f9f49ccd3c7cd0
        Author: Emmanuele Bassi <eba...@gnome.org>
        Date:   Thu Feb 13 12:15:50 2025 +0000
    
            a11y: Emit platform state changes on non widgets
    
            GtkAccessible implementations are not necessarily widgets, so handle
            platform states just like we do for any other state attribute.
    
            Fixes: #6272
    
        commit e7dfe11e6aa3513a661bfbe5028ad0d792a3fc9e
        Author: Emmanuele Bassi <eba...@gnome.org>
        Date:   Thu Feb 13 12:09:18 2025 +0000
    
            a11y: Add platform change notification method
    
            Some GtkAccessible implementations have a concept of "platform 
state": a
            state inherent to the toolkit, and not under user control. We 
already
            allow accessible objects to provide that state when implementing the
            GtkAccessible interface, but we have no way of communicating 
changes in
            the platform state to assistive technologies.
    
            See: #6272
    
    introduced API that allows notifying of changes to
    "platform states" for non-GtkWidget GtkAccessible implementations
    This includes changes to the focused state.
    
    Use that API to notify about changes to the FOCUSED
    state.
    
    This is essential for assistive technology like the
    Orca screen reader, which announces the newly focused
    object based on the corresponding object:state-changed:focused
    AT-SPI event that gets emitted.
    
    With this in place, Orca now e.g. announces the currently
    focused toolbar button in Writer's toolbars when moving
    focus between the items using the Tab key.
    
    Focus changes between paragraphs in Writer are currently
    still not announced reliably with the gtk4 VCL plugin,
    which is probably due to another issue.
    
    Orca now querying information for newly focused objects
    was seen to (sometimes) trigger crashes when a Writer
    paragraph gets focus. This turned out to be related to
    the logic for text attribute runs.
    GTK MR with a suggested fix: [3]
    
    [1] 
https://gitlab.gnome.org/GNOME/gtk/-/commit/224e587cd30b9452eb19d3ec06f9f49ccd3c7cd0
    [2] 
https://gitlab.gnome.org/GNOME/gtk/-/commit/e7dfe11e6aa3513a661bfbe5028ad0d792a3fc9e
    [3] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/8208
    
    Change-Id: Icab099eee6d895fe4373ef6356793ca0789e8b72
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161062
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/unx/gtk4/gtkaccessibleeventlistener.cxx 
b/vcl/unx/gtk4/gtkaccessibleeventlistener.cxx
index 6d395413b417..b094058d8c4e 100644
--- a/vcl/unx/gtk4/gtkaccessibleeventlistener.cxx
+++ b/vcl/unx/gtk4/gtkaccessibleeventlistener.cxx
@@ -67,6 +67,13 @@ void GtkAccessibleEventListener::notifyEvent(
                 gtk_accessible_update_state(GTK_ACCESSIBLE(m_pLoAccessible),
                                             GTK_ACCESSIBLE_STATE_CHECKED, 
eState, -1);
             }
+#if GTK_CHECK_VERSION(4, 17, 5)
+            else if (nState == 
css::accessibility::AccessibleStateType::FOCUSED)
+            {
+                
gtk_accessible_update_platform_state(GTK_ACCESSIBLE(m_pLoAccessible),
+                                                     
GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED);
+            }
+#endif
             break;
         }
 #if GTK_CHECK_VERSION(4, 13, 8)

Reply via email to