office-gobmx/vcl/unx/gtk4/gtkaccessibleregistry.cxx
Michael Weghorn f557e22a67 gtk4 a11y: Fix build for Gtk < 4.9
The code in `vcl/unx/gtk4/a11y.cxx` is

    #if GTK_CHECK_VERSION(4, 9, 0)

, so should the code using that be.

Should fix this issue reported in [1]:

> Hi, building on Linux (Debian 12) breaks with the following error:
>
> [LNK] Library/libvclplug_gtk4lo.so
> ld.lld: error: undefined symbol: lo_accessible_new(_GdkDisplay*, _GtkAccessible*, com::sun::uno::Reference<com::sun::accessibility::XAccessible> const&)
> >>> referenced by gtkaccessibleregistry.cxx
> >>>               /home/etna/Tmpdir/libreoffice/build/workdir/CxxObject/vcl/unx/gtk4/gtkaccessibleregistry.o:(GtkAccessibleRegistry::getLOAccessible(com::sun::uno::Reference<com::sun::accessibility::XAccessible>, _GdkDisplay*, _GtkAccessible*))
> clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
> make[1]: *** [/home/etna/Tmpdir/libreoffice/vcl/Library_vclplug_gtk4.mk:20: /home/etna/Tmpdir/libreoffice/build/instdir/program/libvclplug_gtk4lo.so] Error 1
> make[1]: *** Waiting for unfinished jobs....
>
> I was able to get the build to succeed by rolling back commit 70ef230 ( 70ef230aae )

[1] https://lists.freedesktop.org/archives/libreoffice/2023-December/091330.html

Change-Id: Ifc359bd8b96af8eaa5427a7949259beb607e105d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161144
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-12-22 10:14:47 +01:00

45 lines
1.3 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/.
*/
#include "gtkaccessibleregistry.hxx"
#include "a11y.hxx"
#include <cassert>
#if GTK_CHECK_VERSION(4, 9, 0)
std::map<css::accessibility::XAccessible*, LoAccessible*> GtkAccessibleRegistry::m_aMapping = {};
LoAccessible*
GtkAccessibleRegistry::getLOAccessible(css::uno::Reference<css::accessibility::XAccessible> xAcc,
GdkDisplay* pDisplay, GtkAccessible* pParent)
{
if (!xAcc.is())
return nullptr;
// look for existing entry in the map
auto entry = m_aMapping.find(xAcc.get());
if (entry != m_aMapping.end())
return entry->second;
// create a new object and remember it in the map
LoAccessible* pLoAccessible = lo_accessible_new(pDisplay, pParent, xAcc);
m_aMapping.emplace(xAcc.get(), pLoAccessible);
return pLoAccessible;
}
void GtkAccessibleRegistry::remove(css::uno::Reference<css::accessibility::XAccessible> xAcc)
{
assert(xAcc.is());
m_aMapping.erase(xAcc.get());
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */