vcl/unx/gtk3/a11y/atkutil.cxx |   92 ------------------------------------------
 1 file changed, 92 deletions(-)

New commits:
commit fedd4886b0b63ea3254ea4ce4b7f9b5b73af95f0
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue May 7 08:19:35 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue May 7 16:16:41 2024 +0200

    gtk3 a11y: Drop VclEventId::MenuHighlight processing
    
    Drop the manual processing of `VclEventId::MenuHighlight`
    in the gtk3 a11y bridge.
    
    As mentioned in
    
        commit c45c64aeb57dce91965d7be54601128946455c90
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Mon May 6 14:44:36 2024 +0200
    
            tdf#160806 tdf#160837 gtk3 a11y: Drop handling of some VclEventIds
    
    , the a11y bridge should not have to handle VCL events itself,
    but all relevant events should be forwarded to the a11y
    event listener as appropriate `AccessibleEventObject` and be handled
    by the a11y event listener instead, see `AtkListener::notifyEvent`
    for the gtk3 implementation.
    
    In a quick test, menu items were still announced
    just fine by the Orca screen reader when using the
    gtk3 VCL plugin with this commit in place.
    
    By now, most menus should be native GTK widgets anyway.
    For non-native menus,
    `OAccessibleMenuBaseComponent::ProcessMenuEvent` contains
    handling for the `VclEventId::MenuHighlight` event that
    should be taking care of forwarding that as the corresponding
    a11y event to the a11y bridges. If anything is missing after
    this commit, that's probably a good starting point for further
    analysis.
    
    Change-Id: Ia8686101dc559ed98b48285eac15c35fc10818af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167254
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/unx/gtk3/a11y/atkutil.cxx b/vcl/unx/gtk3/a11y/atkutil.cxx
index 6cc52a56ba6c..d10bc3b27967 100644
--- a/vcl/unx/gtk3/a11y/atkutil.cxx
+++ b/vcl/unx/gtk3/a11y/atkutil.cxx
@@ -306,47 +306,12 @@ rtl::Reference<DocumentFocusListener> 
GtkSalData::GetDocumentFocusListener()
     return xDFL;
 }
 
-static void handle_menu_highlighted(::VclMenuEvent const * pEvent)
-{
-    try
-    {
-        Menu* pMenu = pEvent->GetMenu();
-        sal_uInt16 nPos = pEvent->GetItemPos();
-
-        if( pMenu &&  nPos != 0xFFFF)
-        {
-            uno::Reference< accessibility::XAccessible > xAccessible ( 
pMenu->GetAccessible() );
-
-            if( xAccessible.is() )
-            {
-                uno::Reference< accessibility::XAccessibleContext > xContext ( 
xAccessible->getAccessibleContext() );
-
-                if( xContext.is() )
-                    
atk_wrapper_notify_focus_change(xContext->getAccessibleChild(nPos));
-            }
-        }
-    }
-    catch (const uno::Exception&)
-    {
-        g_warning( "Exception caught processing menu highlight events" );
-    }
-}
-
-/*****************************************************************************/
-
 static void WindowEventHandler(void *, VclSimpleEvent& rEvent)
 {
     try
     {
         switch (rEvent.GetId())
         {
-        case VclEventId::MenuHighlight:
-            if (const VclMenuEvent* pMenuEvent = dynamic_cast<const 
VclMenuEvent*>(&rEvent))
-            {
-                handle_menu_highlighted(pMenuEvent);
-            }
-            break;
-
         case VclEventId::TabpageActivate:
             handle_tabpage_activated(static_cast< ::VclWindowEvent const * 
>(&rEvent)->GetWindow());
             break;
commit f44b1cf1fc2925d54512f1f04361ac2c2fc7d276
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue May 7 08:08:49 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue May 7 16:16:33 2024 +0200

    gtk3 a11y: Drop VclEventId::ToolboxHighlight{,Off} processing
    
    Drop the manual processing of `VclEventId::ToolboxHighlight`
    in the gtk3 a11y bridge.
    
    As mentioned in
    
        commit c45c64aeb57dce91965d7be54601128946455c90
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Mon May 6 14:44:36 2024 +0200
    
            tdf#160806 tdf#160837 gtk3 a11y: Drop handling of some VclEventIds
    
    , the a11y bridge should not have to handle VCL events itself,
    but all relevant events should be forwarded to the a11y
    event listener as appropriate `AccessibleEventObject` and be handled
    by the a11y event listener instead, see `AtkListener::notifyEvent`
    for the gtk3 implementation.
    
    In a quick test, toolbar items were still announced
    just fine by the Orca screen reader when using the
    gtk3 VCL plugin with this commit in place.
    
    `VCLXAccessibleToolBox::ProcessWindowEvent` handles
    `VclEventId::ToolboxHighlight` and
    `VclEventId::ToolboxHighlightOff` whose manual processing
    is now dropped from gtk3, so the former might be a good place
    to further look into if anything is still missing after
    this commit.
    
    The now dropped handling was originally added in
    
        commit e9816343cd71dfe556e6ace12d67c642a8dde635
        Author: Jens-Heiner Rechtien <h...@openoffice.org>
        Date:   Thu May 11 12:32:22 2006 +0000
    
            INTEGRATION: CWS atkbridge2 (1.2.4); FILE MERGED
            2006/05/08 13:45:15 obr 1.2.4.1: #135353# fixed crashes when 
closing sub-toolbars and application exit
    
        Change-Id: Ib6cfafbc3711fce6a48120439654dc6e6c15971a
    
    Change-Id: I87061fdc595a0a29c2a3dce88ab13c9d7d7ba1b0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167253
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/unx/gtk3/a11y/atkutil.cxx b/vcl/unx/gtk3/a11y/atkutil.cxx
index 6d550341b669..6cc52a56ba6c 100644
--- a/vcl/unx/gtk3/a11y/atkutil.cxx
+++ b/vcl/unx/gtk3/a11y/atkutil.cxx
@@ -295,55 +295,6 @@ static void handle_tabpage_activated(vcl::Window *pWindow)
         
atk_wrapper_notify_focus_change(xSelection->getSelectedAccessibleChild(0));
 }
 
-/*****************************************************************************/
-
-/*
- * toolbar items in gtk are widgets, so we need to simulate focus events for 
those
- */
-
-static void notify_toolbox_item_focus(ToolBox *pToolBox)
-{
-    uno::Reference< accessibility::XAccessible > xAccessible =
-        pToolBox->GetAccessible();
-
-    if( ! xAccessible.is() )
-        return;
-
-    uno::Reference< accessibility::XAccessibleContext > xContext =
-        xAccessible->getAccessibleContext();
-
-    if( ! xContext.is() )
-        return;
-
-    ToolBox::ImplToolItems::size_type nPos = pToolBox->GetItemPos( 
pToolBox->GetHighlightItemId() );
-    if( nPos != ToolBox::ITEM_NOTFOUND )
-        atk_wrapper_notify_focus_change(xContext->getAccessibleChild(nPos));
-}
-
-static void handle_toolbox_highlight(vcl::Window *pWindow)
-{
-    ToolBox *pToolBox = static_cast <ToolBox *> (pWindow);
-
-    // Make sure either the toolbox or its parent toolbox has the focus
-    if ( ! pToolBox->HasFocus() )
-    {
-        ToolBox* pToolBoxParent = dynamic_cast< ToolBox* >( 
pToolBox->GetParent() );
-        if ( ! pToolBoxParent || ! pToolBoxParent->HasFocus() )
-            return;
-    }
-
-    notify_toolbox_item_focus(pToolBox);
-}
-
-static void handle_toolbox_highlightoff(vcl::Window const *pWindow)
-{
-    ToolBox* pToolBoxParent = dynamic_cast< ToolBox* >( pWindow->GetParent() );
-
-    // Notify when leaving sub toolboxes
-    if( pToolBoxParent && pToolBoxParent->HasFocus() )
-        notify_toolbox_item_focus( pToolBoxParent );
-}
-
 rtl::Reference<DocumentFocusListener> GtkSalData::GetDocumentFocusListener()
 {
     rtl::Reference<DocumentFocusListener> xDFL = 
m_xDocumentFocusListener.get();
@@ -396,14 +347,6 @@ static void WindowEventHandler(void *, VclSimpleEvent& 
rEvent)
             }
             break;
 
-        case VclEventId::ToolboxHighlight:
-            handle_toolbox_highlight(static_cast< ::VclWindowEvent const * 
>(&rEvent)->GetWindow());
-            break;
-
-        case VclEventId::ToolboxHighlightOff:
-            handle_toolbox_highlightoff(static_cast< ::VclWindowEvent const * 
>(&rEvent)->GetWindow());
-            break;
-
         case VclEventId::TabpageActivate:
             handle_tabpage_activated(static_cast< ::VclWindowEvent const * 
>(&rEvent)->GetWindow());
             break;

Reply via email to