70ef230aae
Don't create a new `LoAccessible` for an `XAccessible`
each time, but add a `GtkAccessibleRegistry` class that
remembers the corresponding `LoAccessible` for
an `XAccessible` in a map.
Remove the entry from the map again in
`GtkAccessibleEventListener::disposing`.
This prevents Libreoffice from becoming unresponsive
in local WIP branches of both, gtk and LO that add
handling for changes to the focused state, when used
with the Orca screen reader.
This commit is very similar to what was added for the Qt-based
VCL plugins in
commit 812fe185fb
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Wed Aug 24 11:42:04 2022 +0200
qt a11y: Remember and reuse existing QObject for XAccessible
Change-Id: Ib217b477bf15abf255fcf254bf607ab8fc11a040
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161061
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <map>
|
|
#include <gtk/gtk.h>
|
|
#include <com/sun/star/accessibility/XAccessible.hpp>
|
|
|
|
struct LoAccessible;
|
|
|
|
class GtkAccessibleRegistry
|
|
{
|
|
private:
|
|
static std::map<css::accessibility::XAccessible*, LoAccessible*> m_aMapping;
|
|
GtkAccessibleRegistry() = delete;
|
|
|
|
public:
|
|
/** Returns the related LoAccessible* for the XAccessible. Creates a new one if none exists yet. */
|
|
static LoAccessible* getLOAccessible(css::uno::Reference<css::accessibility::XAccessible> xAcc,
|
|
GdkDisplay* pDisplay, GtkAccessible* pParent);
|
|
/** Removes the entry for the given XAccessible. */
|
|
static void remove(css::uno::Reference<css::accessibility::XAccessible> xAcc);
|
|
};
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|