tdf#160806 tdf#160837 gtk3 a11y: Drop VclEventId::ToolboxButtonStateChanged

Similar to how the previous

    Change-Id: I00e62016ced2fbb8796960671f5e58a3ceac4b29
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Mon May 6 14:44:36 2024 +0200

        tdf#160806 tdf#160837 gtk3 a11y: Drop handling of some VclEventIds

dropped handling for `VclEventId::WindowGetFocus`
and `VclEventId::ObjectDying` in the gtk3 a11y bridge,
do the same for `VclEventId::ToolboxButtonStateChanged`.

And drop `VclEventId::ObjectDying` completely, as the
gtk3 a11y bridge was the only place processing it.

That event and the handling had been introduced in

    commit 3b40f50234
    Author: Ivo Hinkelmann <ihi@openoffice.org>
    Date:   Tue Feb 5 11:30:51 2008 +0000

        INTEGRATION: CWS fwk83_SRC680 (1.7.186); FILE MERGED
        2008/01/30 12:40:39 obr 1.7.186.2: fix for fedora tinderbox (64bit)
        2008/01/15 23:49:28 obr 1.7.186.1: #i70872# create wrapper for toolbox items that change state

    commit a1cbbd113d
    Author: Ivo Hinkelmann <ihi@openoffice.org>
    Date:   Tue Feb 5 11:30:25 2008 +0000

        INTEGRATION: CWS fwk83_SRC680 (1.51.160); FILE MERGED
        2008/01/14 14:35:26 cd 1.51.160.1: #i70872# Added VCLEVENT_TOOLBOX_BUTTONCHANGED to notify accessibility implementation that an action happens to a toolbox button

    commit 3f1afd1788
    Author: Ivo Hinkelmann <ihi@openoffice.org>
    Date:   Tue Feb 5 11:29:57 2008 +0000

        INTEGRATION: CWS fwk83_SRC680 (1.2.262); FILE MERGED
        2008/01/14 14:35:26 cd 1.2.262.1: #i70872# Added VCLEVENT_TOOLBOX_BUTTONCHANGED to notify accessibility implementation that an action happens to a toolbox button

to ensure that an a11y object is created for toolbar
buttons whose state changes, so that the corresponding
a11y events are forwarded to the platform layer, see
the referenced OOo bug #i70872# [1] for more details.

This seems to be no longer necessary.
By now, at least the scenario of toggling the
bold/italics/underline status of text is
announced just fine by Orca 46.1-1 on Debian
testing with this change in place.

(FWIW, tdf#123864 and the corresponding commits are more
recent tickets/commits related to the topic.)

Like for the above-mentioned change,
dropping that handling addresses another case where the
work window/root pane's a11y object when walking up
the a11y hierarchy would be problematic, as it doesn't
take into account the GtkWidget hierarchy.

Sample backtrace of how the "problematic" a11y object
was created (frame 1 below is the one where the a11y object
with role root pane is created.)

    1  atk_object_wrapper_new                                              atkwrapper.cxx             983  0x7f620365672b
    2  atk_object_wrapper_ref                                              atkwrapper.cxx             948  0x7f62036560a0
    3  atk_object_wrapper_new                                              atkwrapper.cxx             1000 0x7f6203656952
    4  atk_object_wrapper_ref                                              atkwrapper.cxx             948  0x7f62036560a0
    5  atk_object_wrapper_new                                              atkwrapper.cxx             1000 0x7f6203656952
    6  atk_object_wrapper_ref                                              atkwrapper.cxx             948  0x7f62036560a0
    7  atk_object_wrapper_new                                              atkwrapper.cxx             1000 0x7f6203656952
    8  atk_object_wrapper_ref                                              atkwrapper.cxx             948  0x7f62036560a0
    9  create_wrapper_for_child                                            atkutil.cxx                359  0x7f620364c740
    10 handle_toolbox_buttonchange                                         atkutil.cxx                376  0x7f620364c1ef
    11 WindowEventHandler                                                  atkutil.cxx                438  0x7f620364bd7f
    12 Link<VclSimpleEvent&, void>::Call                                   link.hxx                   111  0x7f620dfd4ef8
    13 VclEventListeners::Call                                             vclevent.cxx               46   0x7f620dfd3f1a
    14 Application::ImplCallEventListeners                                 svapp.cxx                  725  0x7f620df96b0d
    15 vcl::Window::CallEventListeners                                     event.cxx                  225  0x7f620d59f6ee
    16 ToolBox::SetItemState                                               toolbox2.cxx               1197 0x7f620d6afd81
    17 ToolBox::CheckItem                                                  toolbox.hxx                515  0x7f6214502c53
    18 (anonymous namespace)::PopupMenuToolbarController::statusChanged    popuptoolbarcontroller.cxx 180  0x7f621454205d
    19 (anonymous namespace)::GenericPopupToolbarController::statusChanged popuptoolbarcontroller.cxx 373  0x7f6214540855
    20 SfxDispatchController_Impl::addStatusListener                       unoctitm.cxx               797  0x7f6213090e95
    21 SfxOfficeDispatch::addStatusListener                                unoctitm.cxx               279  0x7f6213090ade
    22 svt::ToolboxController::bindListener                                toolboxcontroller.cxx      558  0x7f620fe9fbce
    23 svt::ToolboxController::update                                      toolboxcontroller.cxx      235  0x7f620fe9f207
    24 framework::ToolBarManager::UpdateControllers                        toolbarmanager.cxx         726  0x7f62145b0f25
    25 framework::ToolBarManager::AsyncUpdateControllersHdl                toolbarmanager.cxx         2291 0x7f62145bdbfc
    26 framework::ToolBarManager::LinkStubAsyncUpdateControllersHdl        toolbarmanager.cxx         2278 0x7f62145aff9d
    27 Link<Timer *, void>::Call                                           link.hxx                   111  0x7f620dfbc618
    28 Timer::Invoke                                                       timer.cxx                  75   0x7f620dfbc46c
    29 Scheduler::CallbackTaskScheduling                                   scheduler.cxx              509  0x7f620df5fa08
    30 SalTimer::CallCallback                                              saltimer.hxx               54   0x7f620368b566
    31 sal_gtk_timeout_dispatch                                            gtkdata.cxx                733  0x7f620368a573
    32 ??                                                                                                  0x7f62097110d9
    33 ??                                                                                                  0x7f6209714317
    34 g_main_context_iteration                                                                            0x7f6209714930
    35 GtkSalData::Yield                                                   gtkdata.cxx                405  0x7f62036888ef
    36 GtkInstance::DoYield                                                gtkinst.cxx                435  0x7f620368dd73
    37 ImplYield                                                           svapp.cxx                  378  0x7f620df94dfc
    38 Application::Yield                                                  svapp.cxx                  466  0x7f620df9470b
    39 Application::Execute                                                svapp.cxx                  353  0x7f620df944a2
    40 desktop::Desktop::Main                                              app.cxx                    1615 0x7f62171254fc
    41 ImplSVMain                                                          svmain.cxx                 229  0x7f620dfb760e
    42 SVMain                                                              svmain.cxx                 261  0x7f620dfb9659
    43 soffice_main                                                        sofficemain.cxx            93   0x7f62171a7eb3
    44 sal_main                                                            main.c                     51   0x56162eceea5d
    45 main                                                                main.c                     49   0x56162eceea37

[1] https://bz.apache.org/ooo/show_bug.cgi?id=70872

Change-Id: I7409806071a00f32b201b08a831dc6941f072047
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167209
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn 2024-05-06 15:45:39 +02:00
parent c45c64aeb5
commit 593923ee10
3 changed files with 0 additions and 48 deletions

View file

@ -121,7 +121,6 @@ enum class VclEventId
TabpageRemovedAll,
ToolboxActivate,
ToolboxAllItemsChanged,
ToolboxButtonStateChanged, // pData = itempos
ToolboxClick,
ToolboxDeactivate,
ToolboxDoubleClick,

View file

@ -1038,9 +1038,6 @@ void ToolBox::SetItemText( ToolBoxItemId nItemId, const OUString& rText )
else
pItem->maText = MnemonicGenerator::EraseAllMnemonicChars(rText);
// Notify button changed event to prepare accessibility bridge
CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
// Notify
CallEventListeners( VclEventId::ToolboxItemTextChanged, reinterpret_cast< void* >( nPos ) );
}
@ -1193,9 +1190,6 @@ void ToolBox::SetItemState( ToolBoxItemId nItemId, TriState eState )
pItem->meState = eState;
ImplUpdateItem( nPos );
// Notify button changed event to prepare accessibility bridge
CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
// Call accessible listener to notify state_changed event
CallEventListeners( VclEventId::ToolboxItemUpdated, reinterpret_cast< void* >(nPos) );
}
@ -1232,9 +1226,6 @@ void ToolBox::EnableItem( ToolBoxItemId nItemId, bool bEnable )
ImplUpdateInputEnable();
// Notify button changed event to prepare accessibility bridge
CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
CallEventListeners( bEnable ? VclEventId::ToolboxItemEnabled : VclEventId::ToolboxItemDisabled, reinterpret_cast< void* >( nPos ) );
}

View file

@ -344,40 +344,6 @@ static void handle_toolbox_highlightoff(vcl::Window const *pWindow)
notify_toolbox_item_focus( pToolBoxParent );
}
/*****************************************************************************/
static void create_wrapper_for_child(
const uno::Reference< accessibility::XAccessibleContext >& xContext,
sal_Int32 index)
{
if( xContext.is() )
{
uno::Reference< accessibility::XAccessible > xChild(xContext->getAccessibleChild(index));
if( xChild.is() )
{
// create the wrapper object - it will survive the unref unless it is a transient object
g_object_unref( atk_object_wrapper_ref( xChild ) );
}
}
}
/*****************************************************************************/
static void handle_toolbox_buttonchange(VclWindowEvent const *pEvent)
{
vcl::Window* pWindow = pEvent->GetWindow();
sal_Int32 index = static_cast<sal_Int32>(reinterpret_cast<sal_IntPtr>(pEvent->GetData()));
if( pWindow && pWindow->IsReallyVisible() )
{
uno::Reference< accessibility::XAccessible > xAccessible(pWindow->GetAccessible());
if( xAccessible.is() )
{
create_wrapper_for_child(xAccessible->getAccessibleContext(), index);
}
}
}
rtl::Reference<DocumentFocusListener> GtkSalData::GetDocumentFocusListener()
{
rtl::Reference<DocumentFocusListener> xDFL = m_xDocumentFocusListener.get();
@ -434,10 +400,6 @@ static void WindowEventHandler(void *, VclSimpleEvent& rEvent)
handle_toolbox_highlight(static_cast< ::VclWindowEvent const * >(&rEvent)->GetWindow());
break;
case VclEventId::ToolboxButtonStateChanged:
handle_toolbox_buttonchange(static_cast< ::VclWindowEvent const * >(&rEvent));
break;
case VclEventId::ToolboxHighlightOff:
handle_toolbox_highlightoff(static_cast< ::VclWindowEvent const * >(&rEvent)->GetWindow());
break;