summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk4
AgeCommit message (Collapse)Author
2024-09-12tdf#161256 gtk4 a11y: Don't crash on missing context or invalid child indexMichael Weghorn
If an `XAccessible` doesn't have a context or `XAccessibleContext::getAccessibleIndexInParent()` returns an invalid index of -1, don't crash/assert, but let `lo_accessible_get_next_accessible_sibling` return `nullptr`. This works around potential bugs in underlying `XAccessible`/`XAccessibleContext` implementations for now. This is meant to fix the assert/crash seen in the backtraces attachment 196363 and attachment 196383 from tdf#161256 which I cannot reproduce locally on Debian testing. Change-Id: Ic1779d875161469bf296c558039e19f1d426a259 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173216 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-12gtk4 a11y: Avoid explicit std::max template specializationMichael Weghorn
Thanks to Mike Kaganski for pointing out this is the better way to do it in [1]: > In these cases, it's best to avoid the explicit template specialization, > but instead, do something like > > std::max(sal_Int32(0), xText->getCaretPosition()) > > because this latter form makes sure that it will not create problems > later at some unknown point in time, when we decide to change the > type of the returned value of the function. When that happens, your > form would silently continue to cast both its parameters to > sal_Int32, maybe overflowing. In the proposed form, this max would > break again, because the sal_Int32(0) would now not match the type > of getCaretPosition, and require us to revisit this code, and make > correct changes. > > It is indeed ~impossible in the specific case of the UNO API method; > but the best practice is that, and having inconsistency in the > codebase is sub-optimal ;-) [1] https://gerrit.libreoffice.org/c/core/+/171687/comment/35580611_5d9dfe85/ Change-Id: I489bf4fe5ca12833bc17849434822b984a8586a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171744 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-08-10gtk4 a11y: Fix 32-bit buildMichael Weghorn
Take over the fix that Ubuntu has as a patch in its LibreOffice package. Thanks to Rene Engelhard for pointing it out on IRC: [10:43] <_rene_> michaelweghorn: see armhf and i386 at https://buildd.debian.org/status/package.php?p=libreoffice&suite=experimental. gtk4 and 32bit [10:44] <_rene_> michaelweghorn: i saw https://git.launchpad.net/~libreoffice/ubuntu/+source/libreoffice/commit/?h=wip/oracular-24.8 in ubuntu for that somrhow only mentioning armhf Change-Id: I7666fb56f5e36195d5b320689bed6cfda2140e38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171687 Reviewed-by: René Engelhard <rene@debian.org> Tested-by: Jenkins Tested-by: René Engelhard <rene@debian.org>
2024-07-25gtk4: fix -Wmaybe-uninitializedĐoàn Trần Công Danh
Despite that we bailed out when both old and new value set, gcc-13 cannot see that. Change-Id: Ie727a14bb29a4b1cc304d2ce077c62f72cece19f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170973 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-06-30gtk4: Require GTK >= 4.10Michael Weghorn
For the gtk4 VCL plugin, require GTK version >= 4.10 and drop code for older versions. This simplifies maintenance, in particular since requiring 4.10 ensures that the basic GtkAccessible API is available. GTK 4.10 was released on 2023-03-04 [1], so it will be almost 2 years by the time that LO 25.2 will be released. Given that the gtk4 VCL plugin is still experimental, providing support for older GTK 4 releases shouldn't have to be a concern. [1] https://gitlab.gnome.org/GNOME/gtk/-/blob/4.10.0/NEWS?ref_type=tags Change-Id: I6f361b533391225d0e74c174e0479b767b9d827a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169324 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
2024-06-26gtk4 a11y: Handle when there's no a11y contextMichael Weghorn
Handle the case where `XAccessible::getAccessibleContext` returns an empty reference, as e.g. `VCLXWindow::getAccessibleContext` does when already disposed. Fixes an assert/crash seen with the gtk4 VCL plugin when experimenting with missing menu item handling in Writer's "Tools" -> "Bibliography Database", expanding the search filter menu, then closing the dialog and LO altogether. Backtrace: Thread 1 received signal SIGABRT, Aborted. __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44 44 ./nptl/pthread_kill.c: No such file or directory. (rr) bt #0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44 #1 0x00007fe8f96a6b6f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78 #2 0x00007fe8f96584e2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #3 0x00007fe8f96414ed in __GI_abort () at ./stdlib/abort.c:79 #4 0x00007fe8f9641415 in __assert_fail_base (fmt=0x7fe8f97b7ba8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7fe8e5f1ba3a "_pInterface != NULL", file=file@entry=0x7fe8e5f46536 ".../libreoffice/include/com/sun/star/uno/Reference.h", line=line@entry=387, function=function@entry=0x7fe8e5f41e71 "interface_type *com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::operator->() const [interface_type = com::sun::star::accessibility::XAccessibleContext]") at ./assert/assert.c:92 #5 0x00007fe8f9651002 in __assert_fail (assertion=0x7fe8e5f1ba3a "_pInterface != NULL", file=0x7fe8e5f46536 ".../libreoffice/include/com/sun/star/uno/Reference.h", line=387, function=0x7fe8e5f41e71 "interface_type *com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::operator->() const [interface_type = com::sun::star::accessibility::XAccessibleContext]") at ./assert/assert.c:101 #6 0x00007fe8e6034e42 in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::operator->() const (this=0x7ffe3fddc640) at include/com/sun/star/uno/Reference.h:387 #7 0x00007fe8e6038c14 in map_accessible_role(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> const&) (rAccessible=uno::Reference to (VCLXWindow *) 0x5603d155bba8) at .../libreoffice/vcl/unx/gtk4/a11y.cxx:56 #8 0x00007fe8e6038a16 in lo_accessible_get_property(_GObject*, unsigned int, _GValue*, _GParamSpec*) (object=0x5603e5e9fde0, property_id=2, value=0x7ffe3fddca00, pspec=0x5603bfdc1820) at .../libreoffice/vcl/unx/gtk4/a11y.cxx:559 #9 0x00007fe8f47be345 in g_object_get_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0 #10 0x00007fe8f47be8b7 in g_object_get () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0 #11 0x00007fe8e54d81f8 in gtk_accessible_get_accessible_role (self=self@entry=0x5603e5e9fde0) at ../gtk/gtkaccessible.c:296 #12 0x00007fe8e54d9447 in gtk_accessible_should_present (self=self@entry=0x5603e5e9fde0) at ../gtk/gtkaccessible.c:1304 #13 0x00007fe8e575dab8 in get_index_in (parent=parent@entry=0x5603e4203030, child=child@entry=0x5603e5ea13a0) at ../gtk/a11y/gtkatspicontext.c:398 #14 0x00007fe8e5760213 in gtk_at_spi_context_child_change (ctx=0x5603e41f8670, change=GTK_ACCESSIBLE_CHILD_CHANGE_REMOVED, child=0x5603e5ea13a0) at ../gtk/a11y/gtkatspicontext.c:1260 #15 0x00007fe8e575ed8f in gtk_at_spi_context_state_change (ctx=0x5603e5ea15a0, changed_states=GTK_ACCESSIBLE_STATE_CHANGE_HIDDEN, changed_properties=0, changed_relations=<optimized out>, states=0x5603e5ea1770, properties=0x5603e5ea16b0, relations=0x5603e5ea1710) at ../gtk/a11y/gtkatspicontext.c:979 #16 0x00007fe8e54e2bdf in gtk_at_context_update (self=0x5603e5ea15a0) at ../gtk/gtkatcontext.c:831 #17 0x00007fe8e54d839a in gtk_accessible_update_state (self=self@entry=0x5603e5ea13a0, first_state=first_state@entry=GTK_ACCESSIBLE_STATE_HIDDEN) at ../gtk/gtkaccessible.c:364 #18 0x00007fe8e5684d4b in gtk_widget_unmap (widget=0x5603e5ea13a0) at ../gtk/gtkwidget.c:2895 #19 gtk_widget_unmap (widget=0x5603e5ea13a0) at ../gtk/gtkwidget.c:2879 #20 0x00007fe8e5684e25 in gtk_widget_real_hide (widget=0x5603e5ea13a0) at ../gtk/gtkwidget.c:2811 #21 0x00007fe8f47b4939 in () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0 #22 0x00007fe8f47ca33f in () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0 #23 0x00007fe8f47cff06 in g_signal_emit_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0 #24 0x00007fe8f47cffc3 in g_signal_emit () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0 #25 0x00007fe8e56872cd in gtk_widget_hide (widget=0x5603e5ea13a0) at ../gtk/gtkwidget.c:2787 #26 0x00007fe8e61de10e in GtkSalObjectWidgetClip::Show(bool) (this=0x5603dafec8f0, bVisible=false) at vcl/unx/gtk4/../gtk3/gtkobject.cxx:534 #27 0x00007fe8efc96b3d in vcl::Window::ImplSysObjClip(vcl::Region const*) (this=0x5603e5ebb940, pOldRegion=0x0) at .../libreoffice/vcl/source/window/clipping.cxx:352 #28 0x00007fe8efc96fa0 in vcl::Window::ImplSetClipFlagChildren(bool) (this=0x5603e5ebb940, bSysObjOnlySmaller=false) at .../libreoffice/vcl/source/window/clipping.cxx:424 #29 0x00007fe8efc97227 in vcl::Window::ImplSetClipFlag(bool) (this=0x5603e5ebb940, bSysObjOnlySmaller=false) at .../libreoffice/vcl/source/window/clipping.cxx:466 #30 0x00007fe8eff2307b in vcl::Window::Show(bool, ShowFlags) (this=0x5603e5ebb940, bVisible=false, nFlags=ShowFlags::NONE) at .../libreoffice/vcl/source/window/window.cxx:2238 #31 0x00007fe8efc6a189 in vcl::Window::Hide() (this=0x5603e5ebb940) at include/vcl/window.hxx:881 #32 0x00007fe8efeac189 in SystemChildWindow::dispose() (this=0x5603e5ebb940) at .../libreoffice/vcl/source/window/syschild.cxx:121 #33 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603e5ebb950) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38 #34 0x00007fe8e61ad349 in VclPtr<SystemChildWindow>::disposeAndClear() (this=0x5603e5ea49f0) at include/vcl/vclptr.hxx:207 #35 0x00007fe8e60a30ca in (anonymous namespace)::GtkInstanceBuilder::~GtkInstanceBuilder() (this=0x5603e5ea4900) at vcl/unx/gtk4/../gtk3/gtkinst.cxx:24349 #36 0x00007fe8e60a3169 in (anonymous namespace)::GtkInstanceBuilder::~GtkInstanceBuilder() (this=0x5603e5ea4900) at vcl/unx/gtk4/../gtk3/gtkinst.cxx:24342 #37 0x00007fe8efe748cf in std::default_delete<weld::Builder>::operator()(weld::Builder*) const (this=0x5603e41d6730, __ptr=0x5603e5ea4900) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:99 #38 0x00007fe8efe747fc in std::__uniq_ptr_impl<weld::Builder, std::default_delete<weld::Builder> >::reset(weld::Builder*) (this=0x5603e41d6730, __p=0x0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:211 #39 0x00007fe8efff1ffd in std::unique_ptr<weld::Builder, std::default_delete<weld::Builder> >::reset(weld::Builder*) (this=0x5603e41d6730, __p=0x0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:509 #40 0x00007fe8efff16b3 in InterimItemWindow::dispose() (this=0x5603e41d6660) at .../libreoffice/vcl/source/control/InterimItemWindow.cxx:49 #41 0x00007fe8a6f57e51 in EditControl::dispose() (this=0x5603e41d6660) at .../libreoffice/extensions/source/bibliography/toolbar.cxx:209 #42 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603e41d67b8) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38 #43 0x00007fe8a6f5d5f6 in VclPtr<EditControl>::disposeAndClear() (this=0x5603e5e8e9f0) at include/vcl/vclptr.hxx:207 #44 0x00007fe8a6f5a13c in BibToolBar::dispose() (this=0x5603e5e8e580) at .../libreoffice/extensions/source/bibliography/toolbar.cxx:272 #45 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603e5e8ea68) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38 #46 0x00007fe8a6edbf09 in VclPtr<BibToolBar>::disposeAndClear() (this=0x5603e06c1578) at include/vcl/vclptr.hxx:207 #47 0x00007fe8a6edab2e in bib::BibBeamer::dispose() (this=0x5603e06c1340) at .../libreoffice/extensions/source/bibliography/bibbeam.cxx:205 #48 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603e06c1588) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38 #49 0x00007fe8a6ef2b49 in VclPtr<vcl::Window>::disposeAndClear() (this=0x7ffe3fdddcb0) at include/vcl/vclptr.hxx:207 #50 0x00007fe8a6ef173a in BibWindowContainer::dispose() (this=0x5603e70e5ed0) at .../libreoffice/extensions/source/bibliography/bibcont.cxx:81 #51 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603e70e5ef8) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38 #52 0x00007fe8a6ef2b49 in VclPtr<vcl::Window>::disposeAndClear() (this=0x7ffe3fdddd90) at include/vcl/vclptr.hxx:207 #53 0x00007fe8a6ef2043 in BibBookContainer::dispose() (this=0x5603de460610) at .../libreoffice/extensions/source/bibliography/bibcont.cxx:126 #54 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603de460878) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38 #55 0x00007fe8f1d624a9 in VclPtr<vcl::Window>::disposeAndClear() (this=0x7ffe3fddded8) at include/vcl/vclptr.hxx:207 #56 0x00007fe8f1d52fe4 in VCLXWindow::dispose() (this=0x5603d155bb40) at .../libreoffice/toolkit/source/awt/vclxwindow.cxx:926 #57 0x00007fe8f6c28644 in (anonymous namespace)::XFrameImpl::setComponent(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, com::sun::star::uno::Reference<com::sun::star::frame::XController> const&) (this=0x5603e4174370, xComponentWindow=empty uno::Reference, xController=empty uno::Reference) at .../libreoffice/framework/source/services/frame.cxx:1525 #58 0x00007fe8f6c2abc8 in (anonymous namespace)::XFrameImpl::close(unsigned char) (this=0x5603e4174370, bDeliverOwnership=0 '\000') at .../libreoffice/framework/source/services/frame.cxx:1707 #59 0x00007fe8f6a3a23a in framework::pattern::frame::closeIt(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&) (xResource=uno::Reference to ((anonymous namespace)::XFrameImpl *) 0x5603e41743e0) at framework/source/inc/pattern/frame.hxx:57 #60 0x00007fe8f6a38445 in framework::CloseDispatcher::implts_closeFrame() (this=0x5603e93410a0) at .../libreoffice/framework/source/dispatch/closedispatcher.cxx:500 #61 0x00007fe8f6a37ab1 in framework::CloseDispatcher::impl_asyncCallback(LinkParamNone*) (this=0x5603e93410a0) at .../libreoffice/framework/source/dispatch/closedispatcher.cxx:379 #62 0x00007fe8f6a35fed in framework::CloseDispatcher::LinkStubimpl_asyncCallback(void*, LinkParamNone*) (instance=0x5603e93410a0, data=0x0) at .../libreoffice/framework/source/dispatch/closedispatcher.cxx:246 #63 0x00007fe8efc40828 in Link<LinkParamNone*, void>::Call(LinkParamNone*) const (this=0x5603eb162878, data=0x0) at include/tools/link.hxx:111 #64 0x00007fe8f06cff25 in vcl::EventPoster::DoEvent_Impl(void*) (this=0x5603eb162870) at .../libreoffice/vcl/source/helper/evntpost.cxx:52 #65 0x00007fe8f06cfedd in vcl::EventPoster::LinkStubDoEvent_Impl(void*, void*) (instance=0x5603eb162870, data=0x0) at .../libreoffice/vcl/source/helper/evntpost.cxx:48 #66 0x00007fe8eff4ca78 in Link<void*, void>::Call(void*) const (this=0x5603dfaf31a8, data=0x0) at include/tools/link.hxx:111 #67 0x00007fe8eff48759 in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x5603dfaf31a0) at .../libreoffice/vcl/source/window/winproc.cxx:2287 #68 0x00007fe8eff45110 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x5603c9d5cf10, nEvent=SalEvent::UserEvent, pEvent=0x5603dfaf31a0) at .../libreoffice/vcl/source/window/winproc.cxx:2851 #69 0x00007fe8f0bd5ba0 in SalFrame::CallCallback(SalEvent, void const*) const (this=0x5603cb949f00, nEvent=SalEvent::UserEvent, pEvent=0x5603dfaf31a0) at vcl/inc/salframe.hxx:312 #70 0x00007fe8f0c0072f in SalGenericDisplay::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x5603bec36aa0, aEvent=...) at .../libreoffice/vcl/unx/generic/app/gendisp.cxx:66 #71 0x00007fe8f06e433d in SalUserEventList::DispatchUserEvents(bool)::$_0::operator()() const (this=0x7ffe3fddefd0) at .../libreoffice/vcl/source/app/salusereventlist.cxx:119 #72 0x00007fe8f06e41e4 in SalUserEventList::DispatchUserEvents(bool) (this=0x5603bec36aa0, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/source/app/salusereventlist.cxx:120 #73 0x00007fe8f0c00685 in SalGenericDisplay::DispatchInternalEvent(bool) (this=0x5603bec36aa0, bHandleAllCurrentEvent=false) at .../libreoffice/vcl/unx/generic/app/gendisp.cxx:51 #74 0x00007fe8e607b706 in call_userEventFn(void*) (data=0x5603beaa55d0) at vcl/unx/gtk4/../gtk3/gtkdata.cxx:824 #75 0x00007fe8ead1ce3f in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #76 0x00007fe8ead1eec7 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #77 0x00007fe8ead1f4e0 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #78 0x00007fe8e607a2bf in GtkSalData::Yield(bool, bool) (this=0x5603beaa55d0, bWait=true, bHandleAllCurrentEvents=false) at vcl/unx/gtk4/../gtk3/gtkdata.cxx:405 #79 0x00007fe8e6080123 in GtkInstance::DoYield(bool, bool) (this=0x5603beaa5480, bWait=true, bHandleAllCurrentEvents=false) at vcl/unx/gtk4/../gtk3/gtkinst.cxx:429 #80 0x00007fe8f07c4d5c in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:384 #81 0x00007fe8f07c466b in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:472 #82 0x00007fe8f07c4402 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:359 #83 0x00007fe8f9926be0 in desktop::Desktop::Main() (this=0x7ffe3fde1018) at .../libreoffice/desktop/source/app/app.cxx:1652 #84 0x00007fe8f07e796e in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229 #85 0x00007fe8f07e9999 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261 #86 0x00007fe8f99a9b2c in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:99 #87 0x00005603bca36a5d in sal_main () at .../libreoffice/desktop/source/app/main.c:51 #88 0x00005603bca36a37 in main (argc=2, argv=0x7ffe3fde1228) at .../libreoffice/desktop/source/app/main.c:49 Change-Id: Ia3f19d700de66c72f2896595a0e387bd3c42d7ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169451 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-05-03gtk4 a11y: Align role mapping with upstream GTKMichael Weghorn
Align the gtk4 a11y role mapping with what upstream GTK 4 does with current git main (as of commit 0064500146fc080dae1ef2b30bebf7bb8b35a52f), see this upstream GTK commit [0] and the one it refers to for more details: commit ad8613876c753cea8695dc8b03dcd37eb8e723a5 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Apr 30 14:44:11 2024 +0200 a11y atspi: Improve mapping for container roles GTK_ACCESSIBLE_ROLE_GENERIC is for "a nameless container that has no semantic meaning of its own", for which AT-SPI role ATSPI_ROLE_PANEL [1] ("A generic container that is often used to group objects.") fits better than ATSPI_ROLE_FILLER ("A object that fills up space in a user interface."), so map to this one. With this in place, widgets like GtkBox are again reported with the panel role on AT-SPI level after commit a86923de943b6a42ba431be2a336972dca9c587d ("a11y: Change the role for many containers"), whose commit message suggests that the change on the AT-SPI level was unintended. For GTK_ACCESSIBLE_ROLE_GROUP, use the corresponding ATSPI_ROLE_GROUPING ("A group of related widgets. This group typically has a label."). [1] https://docs.gtk.org/atspi2/enum.Role.html This causes the LO a11y roles `PANEL`, `SPLIT_PANE` and `ROOT_PANE` to be mapped to the AT-SPI panel role again. With the above-mentioned GTK upstream change, the native GTK widgets now also use the panel role without having to explicitly set anything on LO side rather than being fillers, which removes the need to set them explicitly, see the full commit message of commit f6ca163d3f6383d3a48dbdacc5410e630d678ea1 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Apr 26 12:43:24 2024 +0200 gtk4 a11y: Don't create second AT context for OOoFixed for more details. Also, map the LO `FILLER` role to `GTK_ACCESSIBLE_ROLE_WIDGET` which GTK maps to the AT-SPI filler role. (The previously used `GTK_ACCESSIBLE_ROLE_GENERIC` is now mapped to the AT-SPI panel role, which is for widget containers rather than fillers.) [0] https://gitlab.gnome.org/GNOME/gtk/-/commit/ad8613876c753cea8695dc8b03dcd37eb8e723a5 Change-Id: I1d1a8f626911455481d2d722790e8915daa921c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166995 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-04-30gtk4 a11y: Handle accessible relationsMichael Weghorn
When creating a new LoAccessible, also consider accessible relations. These can be retrieved via the XAccessibleRelationSet UNO interface. Bridge those that have an equivalent in the GTK 4 a11y API. As the parent GtkAccessible of a target XAccessible is not known, extend `GtkAccessibleRegistry::getLOAccessible` with the functionality to find a parent via the XAccessible hierarchy (i.e. by walking up the XAccessible hierarchy until a parent is reached that has an entry in registry already). This could potentially be problematic as an a11y hierarchy solely based on the XAccessible hierarchy doesn't necessarily match the one with the GtkAccessibles from the native GtkWidget hierarchy. In my current understanding, this should presumably be OK as long as that mechanism finds one existing entry before getting to the root, so assert that this is the case. With this in place, having a Writer doc with multiple paragraphs, there is a flows_to relation shown for the first paragraph to the second in Accerciser, etc., and jumping to the target selects the next paragraph as expected. Change-Id: I2ec1fe8c48dd4250d407ae4fb3c8d9c0f6671646 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166926 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-04-26gtk4 a11y: Don't create second AT context for OOoFixedMichael Weghorn
Similar to how the previous Change-Id: I35196ca686e9d56f97bbf884da8b6492358e41fc Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Apr 26 09:45:39 2024 +0200 gtk4 a11y: Don't create multiple AT contexts for same accessible avoids creating multiple AT contexts for the same accessible when the role changes, this commit addresses another case in which 2 GtkATContexts could be created for the OOoFixed which could result in segfault crashes: The OOoFixed is a GtkWidget, and GTK's `gtk_widget_init` already creates an AT context for widgets. Then, a second AT context would be created because `ooo_fixed_accessible_init` set an own implementation for GtkAccessibleInterface::get_at_context that would create a second AT context when it got called, resulting in breaking the apparent assumption that there's a 1:1 mapping between GtkAccessible and GtkATConetxt. No longer override `GtkAccessibleInterface::get_at_context` but live with the GtkATContext created for the GtkWidget, even if that means an a11y role cannot explicitly be set for these for now. From a first quick look at the tree in Accerciser, I only see one item changed its a11y role from panel to filler. The main class used. e.g. for the document content is LOAccessible, not OOoFixed, and setting the proper role for instances of that class is unaffected, see `lo_accessible_get_at_context`. If setting the a11y role is relevant, this could be done when initializing the OOoFixed instead by setting the "accessible-role" property [1], tested with this demo local change to set a dummy table-cell a11y role and verifying in Accerciser that it was actually set: --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -993,7 +993,10 @@ void GtkSalFrame::InitCommon() #else m_pOverlay = GTK_OVERLAY(gtk_overlay_new()); #if GTK_CHECK_VERSION(4,9,0) - m_pFixedContainer = GTK_FIXED(g_object_new( ooo_fixed_get_type(), nullptr )); + GValue aValue = G_VALUE_INIT; + g_value_init (&aValue, GTK_TYPE_ACCESSIBLE_ROLE); + g_value_set_enum(&aValue, GTK_ACCESSIBLE_ROLE_CELL); + m_pFixedContainer = GTK_FIXED(g_object_new( ooo_fixed_get_type(), "accessible-role", aValue, nullptr )); #else m_pFixedContainer = GTK_FIXED(gtk_fixed_new()); #endif Similar to how the dropped code did, this could use the a11y role from the corresponding `vcl::Window`, which is currently not passed, but that could be adjusted, e.g. by either passing the window or its accessible info to `SalInstance::CreateFrame`/`SalInstance::CreateChildFrame`. See `Window::ImplInit`, where the `vcl::Window` is currently only set via `SalFrame::SetCallback` after the call to `SalInstance::CreateFrame`/`SalInstance::CreateChildFrame`. Without this commit, for me, this crash happened about 10-30 % of the time when starting LO Writer with the gtk4 VCL plugin in rr, when Accerciser was running already. Backtrace for first AT context creation (from `gtk_widget_init`): 1 gtk_at_context_create gtkatcontext.c 671 0x7f677daf129e 2 create_at_context gtkwidget.c 8574 0x7f677dd6bcd9 3 gtk_widget_init gtkwidget.c 2392 0x7f677dd5edbc 4 g_type_create_instance 0x7f678ed8f2a3 5 ?? 0x7f678ed72500 6 g_object_new_with_properties 0x7f678ed73b96 7 g_object_new 0x7f678ed74a41 8 GtkSalFrame::InitCommon gtkframe.cxx 996 0x7f677edb9243 9 GtkSalFrame::Init gtkframe.cxx 1785 0x7f677edb7bca 10 GtkSalFrame::GtkSalFrame gtkframe.cxx 510 0x7f677edb726d 11 GtkInstance::CreateFrame gtkinst.cxx 273 0x7f677ec7cebc 12 vcl::Window::ImplInit window.cxx 1057 0x7f6788cf7f49 13 ImplBorderWindow::ImplInit brdwin.cxx 1555 0x7f6788a6d45b 14 ImplBorderWindow::ImplBorderWindow brdwin.cxx 1584 0x7f6788a6da21 15 VclPtrInstance<ImplBorderWindow>::VclPtrInstance<vcl::Window *&, SystemParentData *&, long&, BorderWindowStyle&> vclptr.hxx 280 0x7f6788d31049 16 WorkWindow::ImplInit wrkwin.cxx 51 0x7f6788d2f809 17 IntroWindow::IntroWindow introwin.cxx 35 0x7f6788bb7ee0 18 (anonymous namespace)::SplashScreenWindow::SplashScreenWindow splash.cxx 122 0x7f677c1cee61 19 VclPtr<(anonymous namespace)::SplashScreenWindow>::Create<(anonymous namespace)::SplashScreen *> vclptr.hxx 129 0x7f677c1cc86b 20 (anonymous namespace)::SplashScreen::SplashScreen splash.cxx 145 0x7f677c1cc5f8 21 desktop_SplashScreen_get_implementation splash.cxx 616 0x7f677c1cc4f9 22 std::__invoke_impl<com::sun::star::uno::XInterface *, com::sun::star::uno::XInterface * ( *&)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&> invoke.h 61 0x7f67907ef7a8 23 std::__invoke_r<com::sun::star::uno::XInterface *, com::sun::star::uno::XInterface * ( *&)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&> invoke.h 114 0x7f67907ef745 24 std::_Function_handler<com::sun::star::uno::XInterface * (com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XInterface * ( *)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::_M_invoke(std::_Any_data const&, com::sun::star::uno::XComponentContext *&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) std_function.h 290 0x7f67907ef63d 25 std::function<com::sun::star::uno::XInterface * (com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::operator()(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) const std_function.h 591 0x7f67907b6848 26 cppuhelper::ServiceManager::Data::Implementation::doCreateInstanceWithArguments servicemanager.cxx 725 0x7f679079f26f 27 cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments servicemanager.cxx 696 0x7f679079f143 28 cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext servicemanager.cxx 1021 0x7f67907a56c5 29 non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) servicemanager.cxx 1022 0x7f67907a577c 30 desktop::Desktop::OpenSplashScreen app.cxx 2449 0x7f6792723b2c 31 desktop::Desktop::Main app.cxx 1299 0x7f6792721362 32 ImplSVMain svmain.cxx 229 0x7f67895bcfbe 33 SVMain svmain.cxx 261 0x7f67895bf009 34 soffice_main sofficemain.cxx 93 0x7f67927a5a73 35 sal_main main.c 51 0x55fa1fbf7a5d 36 main main.c 49 0x55fa1fbf7a37 Backtrace for second AT context creation: 1 gtk_at_context_create gtkatcontext.c 671 0x7f677daf129e 2 get_at_context a11y.cxx 806 0x7f677ec389b6 3 gtk_accessible_get_at_context gtkaccessible.c 105 0x7f677dae2d4b 4 gtk_accessible_platform_changed gtkaccessible.c 1081 0x7f677dae427d 5 gtk_widget_set_focusable gtkwidget.c 5255 0x7f677dd65086 6 GtkSalFrame::InitCommon gtkframe.cxx 1157 0x7f677edb9d15 7 GtkSalFrame::Init gtkframe.cxx 1785 0x7f677edb7bca 8 GtkSalFrame::GtkSalFrame gtkframe.cxx 510 0x7f677edb726d 9 GtkInstance::CreateFrame gtkinst.cxx 273 0x7f677ec7cebc 10 vcl::Window::ImplInit window.cxx 1057 0x7f6788cf7f49 11 ImplBorderWindow::ImplInit brdwin.cxx 1555 0x7f6788a6d45b 12 ImplBorderWindow::ImplBorderWindow brdwin.cxx 1584 0x7f6788a6da21 13 VclPtrInstance<ImplBorderWindow>::VclPtrInstance<vcl::Window *&, SystemParentData *&, long&, BorderWindowStyle&> vclptr.hxx 280 0x7f6788d31049 14 WorkWindow::ImplInit wrkwin.cxx 51 0x7f6788d2f809 15 IntroWindow::IntroWindow introwin.cxx 35 0x7f6788bb7ee0 16 (anonymous namespace)::SplashScreenWindow::SplashScreenWindow splash.cxx 122 0x7f677c1cee61 17 VclPtr<(anonymous namespace)::SplashScreenWindow>::Create<(anonymous namespace)::SplashScreen *> vclptr.hxx 129 0x7f677c1cc86b 18 (anonymous namespace)::SplashScreen::SplashScreen splash.cxx 145 0x7f677c1cc5f8 19 desktop_SplashScreen_get_implementation splash.cxx 616 0x7f677c1cc4f9 20 std::__invoke_impl<com::sun::star::uno::XInterface *, com::sun::star::uno::XInterface * ( *&)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&> invoke.h 61 0x7f67907ef7a8 21 std::__invoke_r<com::sun::star::uno::XInterface *, com::sun::star::uno::XInterface * ( *&)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&> invoke.h 114 0x7f67907ef745 22 std::_Function_handler<com::sun::star::uno::XInterface * (com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XInterface * ( *)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::_M_invoke(std::_Any_data const&, com::sun::star::uno::XComponentContext *&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) std_function.h 290 0x7f67907ef63d 23 std::function<com::sun::star::uno::XInterface * (com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::operator()(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) const std_function.h 591 0x7f67907b6848 24 cppuhelper::ServiceManager::Data::Implementation::doCreateInstanceWithArguments servicemanager.cxx 725 0x7f679079f26f 25 cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments servicemanager.cxx 696 0x7f679079f143 26 cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext servicemanager.cxx 1021 0x7f67907a56c5 27 non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) servicemanager.cxx 1022 0x7f67907a577c 28 desktop::Desktop::OpenSplashScreen app.cxx 2449 0x7f6792723b2c 29 desktop::Desktop::Main app.cxx 1299 0x7f6792721362 30 ImplSVMain svmain.cxx 229 0x7f67895bcfbe 31 SVMain svmain.cxx 261 0x7f67895bf009 32 soffice_main sofficemain.cxx 93 0x7f67927a5a73 33 sal_main main.c 51 0x55fa1fbf7a5d 34 main main.c 49 0x55fa1fbf7a37 Backtrace of the segfault: Thread 1 received signal SIGSEGV, Segmentation fault. 0x00007f677deaec8e in GTK_IS_ACCESSIBLE_TEXT (ptr=0x55fa21196bb0) at ../gtk/gtkaccessibletext.h:35 35 G_DECLARE_INTERFACE (GtkAccessibleText, gtk_accessible_text, GTK, ACCESSIBLE_TEXT, GtkAccessible) (rr) bt #0 0x00007f677deaec8e in GTK_IS_ACCESSIBLE_TEXT (ptr=0x55fa21196bb0) at ../gtk/gtkaccessibletext.h:35 #1 0x00007f677deb1d88 in gtk_atspi_connect_text_signals (accessible=0x55fa21196bb0, text_changed=0x7f677dea1365 <emit_text_changed>, selection_changed=0x7f677dea140b <emit_text_selection_changed>, data=0x55fa2119d860) at ../gtk/a11y/gtkatspitext.c:1037 #2 0x00007f677dea2fea in register_object (root=0x55fa2119e210, context=0x55fa2119d860) at ../gtk/a11y/gtkatspicontext.c:1442 #3 0x00007f677dea8138 in on_registration_reply (gobject=0x55fa21179030, result=0x55fa39240d80, user_data=0x55fa2117a4a0) at ../gtk/a11y/gtkatspiroot.c:531 #4 0x00007f6783cc8ee3 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0 #5 0x00007f6783cc9b83 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0 #6 0x00007f6783d269da in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0 #7 0x00007f6783cc8ee3 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0 #8 0x00007f6783cc8f1d in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0 #9 0x00007f6785b110d9 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #10 0x00007f6785b14317 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #11 0x00007f6785b14930 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #12 0x00007f677ec77d0f in GtkSalData::Yield(bool, bool) (this=0x55fa1fe8e000, bWait=true, bHandleAllCurrentEvents=false) at vcl/unx/gtk4/../gtk3/gtkdata.cxx:405 #13 0x00007f677ec7dbd3 in GtkInstance::DoYield(bool, bool) (this=0x55fa1fe8deb0, bWait=true, bHandleAllCurrentEvents=false) at vcl/unx/gtk4/../gtk3/gtkinst.cxx:435 #14 0x00007f678959a64c in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:394 #15 0x00007f6789599f5b in Application::Yield() () at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:482 #16 0x00007f6789599cf2 in Application::Execute() () at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:369 #17 0x00007f679272304c in desktop::Desktop::Main() (this=0x7ffdf3dcc768) at /home/michi/development/git/libreoffice/desktop/source/app/app.cxx:1615 #18 0x00007f67895bcfbe in ImplSVMain() () at /home/michi/development/git/libreoffice/vcl/source/app/svmain.cxx:229 #19 0x00007f67895bf009 in SVMain() () at /home/michi/development/git/libreoffice/vcl/source/app/svmain.cxx:261 #20 0x00007f67927a5a73 in soffice_main() () at /home/michi/development/git/libreoffice/desktop/source/app/sofficemain.cxx:93 #21 0x000055fa1fbf7a5d in sal_main () at /home/michi/development/git/libreoffice/desktop/source/app/main.c:51 #22 0x000055fa1fbf7a37 in main (argc=2, argv=0x7ffdf3dcc978) at /home/michi/development/git/libreoffice/desktop/source/app/main.c:49 [1] https://docs.gtk.org/gtk4/property.Accessible.accessible-role.html Change-Id: If4fdcd249aaada846934c3e967d654e3266ad73d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166709 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-04-26gtk4 a11y: Don't create multiple AT contexts for same accessibleMichael Weghorn
In the `GtkAccessibleInterface::get_at_context` implementations, do not create a new `GtkATContext` if the accessible role has changed. This broke the apparent assumption that there's a 1:1 mapping between `GtkAccessible` and `GtkATContext` and resulted in segfaults seen quite often when starting LO Writer with the gtk4 VCL plugin while Accerciser was also running. For me, this was even more reproducible when running in rr (crashed reliably on start). LO has the `AccessibleEventId::ROLE_CHANGED` event type to indicate role changes, but GTK 4 doesn't support changing the initial role any more. Quoting the GtkAccessible doc [1]: > The role cannot be changed after instantiating a > GtkAccessible implementation. And the accessibility section in the GTK 4 doc [2] says: > Each role is part of the widget’s instance, and cannot be changed over > time or as the result of a user action. Roles allows assistive > technology applications to identify a UI control and decide how to > present it to a user; if a part of the application’s UI changes role, > the control needs to be removed and replaced with another one > with the appropriate role. Sample backtrace: Thread 1 received signal SIGSEGV, Segmentation fault. 0x00007f0399aa0636 in get_parent_context_ref (accessible=0x55a141b5a9b0) at ../gtk/a11y/gtkatspicontext.c:462 462 res = gtk_at_spi_root_to_ref (self->root); (rr) bt #0 0x00007f0399aa0636 in get_parent_context_ref (accessible=0x55a141b5a9b0) at ../gtk/a11y/gtkatspicontext.c:462 #1 0x00007f0399aa43ba in gtk_at_spi_context_get_parent_ref (self=0x55a141b615c0) at ../gtk/a11y/gtkatspicontext.c:1956 #2 0x00007f0399a9dc75 in collect_object (self=0x55a1469113a0, builder=0x7fff90e1a220, context=0x55a141b615c0) at ../gtk/a11y/gtkatspicache.c:131 #3 0x00007f0399a9e2f2 in emit_add_accessible (self=0x55a1469113a0, context=0x55a141b615c0) at ../gtk/a11y/gtkatspicache.c:235 #4 0x00007f0399a9eac1 in gtk_at_spi_cache_add_context (self=0x55a1469113a0, context=0x55a141b615c0) at ../gtk/a11y/gtkatspicache.c:436 #5 0x00007f0399aa8152 in on_registration_reply (gobject=0x55a141b62060, result=0x55a14e28a890, user_data=0x55a141b64770) at ../gtk/a11y/gtkatspiroot.c:533 #6 0x00007f039fac8ee3 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0 #7 0x00007f039fac9b83 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0 #8 0x00007f039fb269da in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0 #9 0x00007f039fac8ee3 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0 #10 0x00007f039fac8f1d in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0 #11 0x00007f03a0b110d9 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #12 0x00007f03a0b14317 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #13 0x00007f03a0b14930 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #14 0x00007f039a877d9f in GtkSalData::Yield(bool, bool) (this=0x55a140869000, bWait=true, bHandleAllCurrentEvents=false) at vcl/unx/gtk4/../gtk3/gtkdata.cxx:405 #15 0x00007f039a87dc63 in GtkInstance::DoYield(bool, bool) (this=0x55a140868eb0, bWait=true, bHandleAllCurrentEvents=false) at vcl/unx/gtk4/../gtk3/gtkinst.cxx:435 #16 0x00007f03a539a64c in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:394 #17 0x00007f03a5399f5b in Application::Yield() () at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:482 #18 0x00007f03a5399cf2 in Application::Execute() () at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:369 #19 0x00007f03ae52304c in desktop::Desktop::Main() (this=0x7fff90e1c288) at /home/michi/development/git/libreoffice/desktop/source/app/app.cxx:1615 #20 0x00007f03a53bcfbe in ImplSVMain() () at /home/michi/development/git/libreoffice/vcl/source/app/svmain.cxx:229 #21 0x00007f03a53bf009 in SVMain() () at /home/michi/development/git/libreoffice/vcl/source/app/svmain.cxx:261 #22 0x00007f03ae5a5a73 in soffice_main() () at /home/michi/development/git/libreoffice/desktop/source/app/sofficemain.cxx:93 #23 0x000055a13fefca5d in sal_main () at /home/michi/development/git/libreoffice/desktop/source/app/main.c:51 #24 0x000055a13fefca37 in main (argc=2, argv=0x7fff90e1c498) at /home/michi/development/git/libreoffice/desktop/source/app/main.c:49 From valgrind output: (soffice:972353): Gtk-CRITICAL **: 09:28:48.066: gtk_accessible_get_accessible_parent: assertion 'GTK_IS_ACCESSIBLE (self)' failed (soffice:972353): Gtk-CRITICAL **: 09:28:48.067: gtk_accessible_get_at_context: assertion 'GTK_IS_ACCESSIBLE (self)' failed ==972353== Thread 1: ==972353== Invalid read of size 8 ==972353== at 0x19077636: get_parent_context_ref (gtkatspicontext.c:462) ==972353== by 0x1907B3B9: gtk_at_spi_context_get_parent_ref (gtkatspicontext.c:1956) ==972353== by 0x19074C74: collect_object (gtkatspicache.c:131) ==972353== by 0x190752F1: emit_add_accessible (gtkatspicache.c:235) ==972353== by 0x19075AC0: gtk_at_spi_cache_add_context (gtkatspicache.c:436) ==972353== by 0x1907F151: on_registration_reply (gtkatspiroot.c:533) ==972353== by 0x12E72EE2: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7800.4) ==972353== by 0x12E73B82: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7800.4) ==972353== by 0x12ED09D9: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7800.4) ==972353== by 0x12E72EE2: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7800.4) ==972353== by 0x12E72F1C: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7800.4) ==972353== by 0x130620D8: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7800.4) ==972353== Address 0x70 is not stack'd, malloc'd or (recently) free'd ==972353== [1] https://docs.gtk.org/gtk4/iface.Accessible.html [2] https://docs.gtk.org/gtk4/section-accessibility.html Change-Id: I35196ca686e9d56f97bbf884da8b6492358e41fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166708 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-04-25gtk4: Ignore "input-purpose" for GtkSpinButtonMichael Weghorn
"input-purpose" is a property of GtkEntry, for both, GTK 3 [1] and GTK 4 [2]. However, while the GTK 3 GtkSpinButton derives from GtkEntry [3], the GTK 4 one doesn't any more but it derives directly from GtkWidget [4]. Therefore, after commit 139199ee9c09d25624191132adbe4fd29365eb7a Date: Thu Feb 22 00:03:01 2024 -0900 tdf#141728 Revamp sw navigator go to page spin control , opening the navigator by pressing F5 in Writer when using the gtk4 VCL plugin triggered the following assert: warn:vcl.gtk:233860:233860:vcl/unx/gtk4/convert3to4.cxx:1595: GtkInstanceBuilder: error when calling gtk_builder_add_from_string: .:197:65 Invalid property: GtkSpinButton.input-purpose soffice.bin: /home/michi/development/git/libreoffice/vcl/unx/gtk4/convert3to4.cxx:1598: void builder_add_from_gtk3_file(GtkBuilder *, const OUString &): Assertion `rc && "could not load UI file"' failed. Just ignore that property for gtk4. [1] https://docs.gtk.org/gtk3/property.Entry.input-purpose.html [2] https://docs.gtk.org/gtk4/property.Entry.input-purpose.html [3] https://docs.gtk.org/gtk3/class.SpinButton.html [4] https://docs.gtk.org/gtk4/class.SpinButton.html Change-Id: Ia3ece9fdf0269dc5178786fc64644ab3f0433871 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166618 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-04-04gtk4 a11y: Implement new GtkAccessibleTextInterface::get_offsetMichael Weghorn
Implement the new `get_offset` method for `GtkAccessibleTextInterface` newly introduced in GTK 4 in GTK commits commit f802be88e98f817c3d6fa048bf79d82de60173d3 Author: Matthias Clasen <mclasen@redhat.com> Date: Sun Mar 10 10:27:56 2024 -0400 a11y: Use gtk_accessible_text_get_offset Implement GetOffsetAtPoint using gtk_accessible_text_get_offset. commit b9d2049991427e8dee443e9f3b683e52c96d6b83 Author: Matthias Clasen <mclasen@redhat.com> Date: Sun Mar 10 10:27:32 2024 -0400 a11y: Add gtk_accessible_text_get_offset This is not implemented yet. commit cfe35586107d7c42eb3af7aa38ee23df22f718d0 Author: Matthias Clasen <mclasen@redhat.com> Date: Sun Mar 10 10:02:24 2024 -0400 a11y: Add GetOffsetAtPoint We don't handle it yet. In order for this to actually work on the AT-SPI level, this also needs fixes on the GTK side. Pending MR: [1] With this, the previous Change-Id: I7d171b6696037a696f0d767d3134c7a7184f93a3 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Thu Apr 4 11:08:10 2024 +0200 gtk4 a11y: Implement new GtkAccessibleTextInterface::get_extents and the mentioned GTK MR in place, a quick test with a Writer paragraph using Accerciser's IPython console now looks OK: In [1]: acc.queryText().getCharacterExtents(5, pyatspi.XY_WINDOW) Out[1]: (483, 219, 4, 18) In [2]: acc.queryText().getOffsetAtPoint(484, 220, pyatspi.XY_WINDOW) Out[2]: 5 [1] https://docs.gtk.org/atk/vfunc.Text.get_range_extents.html Change-Id: Ieb45e3d0d6f37350898ffee081491bf94b6dbea0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165794 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-04-04gtk4 a11y: Implement new GtkAccessibleTextInterface::get_extentsMichael Weghorn
Implement the new `get_extents` method for `GtkAccessibleTextInterface` newly introduced in GTK 4 in GTK commits commit 7955efef6c31d23c8553dc3464e72273886a4417 Author: Matthias Clasen <mclasen@redhat.com> Date: Sun Mar 10 14:28:07 2024 -0400 atspi: Use gtk_accessible_text_get_extents Implement the GetCharacterExtents and GetRangeExtents methods of the atspi Text interface using the new GtkAccessibleText api. commit 3134003376fc37c6d5e7e6eb7c6f36307039a92c Author: Matthias Clasen <mclasen@redhat.com> Date: Sun Mar 10 14:27:42 2024 -0400 a11y: Add gtk_accessible_text_get_extents This will be used to implement GetRangeExtents in atspi. The `XAccessibleText` UNO interface currently only has a way to retrieve the extents of a single character, so just return `false` if the extents for a larger text range is requested. (LO's gtk3/ATK implemenation currently also doesn't implement AtkText.get_range_extents` [1]) To actually work, this also needs changes on GTK side to support non-GtkWidget GtkAccessible implementations. Pending MR: [2] [1] https://docs.gtk.org/atk/vfunc.Text.get_range_extents.html [2] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7104 Change-Id: I7d171b6696037a696f0d767d3134c7a7184f93a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165793 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-03-24Avoid -Werror,-Wcast-function-type-mismatchStephan Bergmann
Change-Id: I12014c46bf4a22232c8739166effc42756e97dce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165252 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-15gtk4 a11y: Report default text attributesMichael Weghorn
Implement handling of default text attributes by implementing the GtkAccessibleTextInterface method `get_default_attributes` recently added to the GTK 4 API in GTK commit [1] commit fe64c998f82c218e46211984485a7a824a781426 Author: Emmanuele Bassi <ebassi@gnome.org> Date: Sun Mar 3 14:23:37 2024 +0000 a11y: Add GtkAccessibleText.get_default_attributes With this in place, the default font family for a Writer paragraph is now reported as expected. With the paragraph selected in Accerciser's treeview of the LO a11y hierarchy, this can be seen as follows using Accerciser's IPython console: In [4]: acc.queryText().getDefaultAttributes() Out[4]: 'family-name:Liberation Serif' This API is available from GTK 4.14.0 on, so bump the version check for the GtkAccessibleText implementation to that minimum version. [1] https://gitlab.gnome.org/GNOME/gtk/-/commit/fe64c998f82c218e46211984485a7a824a781426 Change-Id: Id22bee4b7db542ddde241a4d94a7eb916090ba92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164860 Tested-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-03-15gtk4 a11y: Extract helper function for text attr conversionMichael Weghorn
Extract conversion of LO's text attr representation to the one that the GTK implementation in `lo_accessible_text_get_attributes` needs to return to a new helper function `convertUnoTextAttributesToGtk` that will be reused in an upcoming commit to implement handling of default text attributes for which API has recently been added to GTK. Change-Id: I01a703012c668149a29c3ce759437a1b716988dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164859 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-03-15gtk4 a11y: Add initial text attribute handlingMichael Weghorn
Implement initial handling for reporting text attributes in `lo_accessible_text_get_attributes`. Initially, only the font family attribute is handled, but more can be added in the future (s.a. the gtk3/atk and Qt implementations). With this in place, formatting some text in a Writer paragraph with font "Linux Libertine G" now shows the "family-name" text attribute with a value of "Linux Libertine G" as expected in Accerciser when selecting the paragraph object in Accerciser's treeview of the LO a11y tree and choosing an appropriate offset when using the gtk4 VCL plugin, just as with the gtk3 or qt6 VCL plugins. (Implementation inspired by GTK's internal `gtk_text_view_accessible_text_get_attributes` [1]) [1] https://gitlab.gnome.org/GNOME/gtk/-/blob/fe4cd7cf0f497ace134a39243b0a44ef09e181be/gtk/gtktextview.c#L10459 Change-Id: Iba565753b3143548492ccc817a159ebfb92a8c88 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164858 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-02-23gtk4 a11y: Fix '--enable-werror' GCC buildMichael Weghorn
`offset` is unsigned int, so can't be negative, causing an `--enable-werror --enable-gtk4` GCC 13.2 build on Debian testing to fail like this: .../libreoffice-WORKTREE/vcl/unx/gtk4/gtkaccessibletext.cxx: In function ‘GBytes* lo_accessible_text_get_contents_at(GtkAccessibleText*, unsigned int, GtkAccessibleTextGranularity, unsigned int*, unsigned int*)’: .../libreoffice-WORKTREE/vcl/unx/gtk4/gtkaccessibletext.cxx:79:16: error: comparison of unsigned expression in ‘< 0’ is always false [-Werror=type-limits] 79 | if (offset < 0 || offset > o3tl::make_unsigned(xText->getCharacterCount())) | ~~~~~~~^~~ cc1plus: all warnings being treated as errors Change-Id: Ib5a67c9d5948802fe269275c79f624df09712011 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163802 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-02-22gtk4 a11y: Forward text change eventsMichael Weghorn
Bridge text-related a11y change events for the gtk4 VCL plugin by using the new functions to notify about text, text caret and text selection changes recently introduced in Gtk in commit [1] commit 0ca8d74842837b1ad5dc42c1fcff8b1270e5750b Author: Matthias Clasen <mclasen@redhat.com> Date: Tue Feb 20 12:18:27 2024 -0500 a11y: Add GtkAccessibleText interface With this in place, having a Writer paragraph selected in Accerciser's treeview, the text in the "Text" section of the "Interface Viewer" tab in Accerciser now updates when typing in LibreOffice (i.e. text changes are propagated there right away as expected). [1] https://gitlab.gnome.org/GNOME/gtk/-/commit/0ca8d74842837b1ad5dc42c1fcff8b1270e5750b Change-Id: I33c93613ddde3650d81ce11d605dc70b0569080a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163746 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-02-22gtk4 a11y: Implement new GtkAccessibleTextInterfaceMichael Weghorn
Implement most of the methods of the `GtkAccessibleInterface` newly added to Gtk 4 in Gtk commit [1] commit 0ca8d74842837b1ad5dc42c1fcff8b1270e5750b Author: Matthias Clasen <mclasen@redhat.com> Date: Tue Feb 20 12:18:27 2024 -0500 a11y: Add GtkAccessibleText interface The AccessibleText interface is meant to be implemented by widgets and other accessible objects that expose selectable, navigatable, or rich text to assistive technologies. This kind of text is not covered by the plain accessible name and description, as it contains things like a caret, or text attributes. This commit adds a stub GtkAccessibleText with its basic virtual functions; the interface will be implemented by widgets like GtkLabel, GtkInscription, GtkText, and GtkTextView. A further commit will ensure that the AT-SPI implementation will convert from GTK to AT-SPI through a generic (internal API); and, finally, we'll remove the widget type checks in the AT-SPI implementation of GtkATContext, and only check for GtkAccessibleText. Fixes: #5912 and follow-up commits. The `css::accessibility::XAccessibleText` interface provides the required functionality. With a Writer paragraph consisting of the text "Hello world. And another sentence." and the word "world" selected, using some of the AT-SPI Text interface methods via Accerciser's IPython console behaves as expected now when the paragraph's a11y object is selected in Accerciser's treeview: In [9]: text = acc.queryText() In [10]: text.get_caretOffset() Out[10]: 11 In [11]: text.getText(0, -1) Out[11]: 'Hello world. And another sentence.' In [12]: text.getText(2,5) Out[12]: 'llo' In [13]: text.getStringAtOffset(10, pyatspi.TEXT_GRANULARITY_CHAR) Out[13]: ('d', 10, 11) In [14]: text.getStringAtOffset(10, pyatspi.TEXT_GRANULARITY_WORD) Out[14]: ('world', 6, 11) In [15]: text.getStringAtOffset(10, pyatspi.TEXT_GRANULARITY_SENTENCE) Out[15]: ('Hello world. ', 0, 13) In [16]: text.getStringAtOffset(10, pyatspi.TEXT_GRANULARITY_PARAGRAPH) Out[16]: ('Hello world. And another sentence.', 0, 34) In [17]: text.getNSelections() Out[17]: 1 In [18]: text.getSelection(0) Out[18]: (6, 11) Actual handling of text attributes is left for later (s. TODO comment in the newly added `lo_accessible_text_get_attributes`). [1] https://gitlab.gnome.org/GNOME/gtk/-/commit/0ca8d74842837b1ad5dc42c1fcff8b1270e5750b Change-Id: Icad236cd87285d9a336883e67b191f633e9e4413 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163733 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-02-22gtk4 a11y: Move LO_ACCESSIBLE define to headerMichael Weghorn
... and the LO_TYPE_ACCESSIBLE one as well, for use elsewhere in an upcoming commit. Change-Id: Ib7294ce0aa0c275a405c2ff87c8de8493c36a61b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163732 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-12-22gtk4 a11y: Fix build for Gtk < 4.9Michael Weghorn
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::star::uno::Reference<com::sun::star::accessibility::XAccessible> const&) > >>> referenced by gtkaccessibleregistry.cxx > >>> /home/etna/Tmpdir/libreoffice/build/workdir/CxxObject/vcl/unx/gtk4/gtkaccessibleregistry.o:(GtkAccessibleRegistry::getLOAccessible(com::sun::star::uno::Reference<com::sun::star::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 ( https://github.com/LibreOffice/core/commit/70ef230aae4f961c8197cc11a7ff5feaf1d96c20 ) [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-20gtk4 a11y: Take SELECTABLE/EXPANDABLE states into accountMichael Weghorn
The Gtk API has no direct equivalent for the selectable and expandable states, but sets them on the AT-SPI layer whenever a value for the selected/expanded states is explicitly set. Therefore, only explicitly set values for these if the selectable/expandable state is present, to avoid the expandable/selectable state being set on AT-SPI layer when it shouldn't. Change-Id: Ib0cf2095d4834869856bf786e662115f6a328e13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161046 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-12-20gtk4 a11y: Remember LoAccessible for XAccessibleMichael Weghorn
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 812fe185fba48b439fb1229517d62aa67c209016 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>
2023-12-20gtk4 a11y: Silence loplugin:unreffun a different wayMichael Weghorn
Including the `a11y.hxx` header in another source file would result in an `--enable-werror` gcc 13.2.0-7 build on Debian testing failing like this (real use case is in a following commit, but this is also reproducible by including the header in `vcl/unx/gtk4/gtkaccessibleeventlistener.cxx`): In file included from .../vcl/unx/gtk4/gtkaccessibleeventlistener.cxx:15: .../vcl/unx/gtk4/a11y.hxx:19:24: error: ‘void* lo_accessible_get_instance_private(LoAccessible*)’ declared ‘static’ but never defined [-Werror=unused-function] 19 | static inline gpointer lo_accessible_get_instance_private(LoAccessible*); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../vcl/unx/gtk4/a11y.hxx:21:24: error: ‘void* ooo_fixed_get_instance_private(OOoFixed*)’ declared ‘static’ but never defined [-Werror=unused-function] 21 | static inline gpointer ooo_fixed_get_instance_private(OOoFixed*); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors make[1]: *** [.../solenv/gbuild/LinkTarget.mk:337: .../workdir/CxxObject/vcl/unx/gtk4/gtkaccessibleeventlistener.o] Error 1 make: *** [Makefile:290: build] Error 2 However, just removing the declarations would make loplugin:unreffun unhappy: .../vcl/unx/gtk4/a11y.cxx:568:1: error: Unreferenced externally invisible function definition [loplugin:unreffun] G_DEFINE_TYPE_WITH_CODE(LoAccessible, lo_accessible, G_TYPE_OBJECT, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:1842:56: note: expanded from macro 'G_DEFINE_TYPE_WITH_CODE' #define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:2325:3: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN' _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:2280:24: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN_PRE' static inline gpointer \ ~~~~~~~~~~~~~~~~~~~~~~~^ <scratch space>:101:1: note: expanded from here lo_accessible_get_instance_private ^ .../vcl/unx/gtk4/a11y.cxx:857:1: error: Unreferenced externally invisible function definition [loplugin:unreffun] G_DEFINE_TYPE_WITH_CODE(OOoFixed, ooo_fixed, GTK_TYPE_FIXED, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:1842:56: note: expanded from macro 'G_DEFINE_TYPE_WITH_CODE' #define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:2325:3: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN' _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:2280:24: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN_PRE' static inline gpointer \ ~~~~~~~~~~~~~~~~~~~~~~~^ <scratch space>:131:1: note: expanded from here ooo_fixed_get_instance_private ^ 2 errors generated. make[1]: *** [.../solenv/gbuild/LinkTarget.mk:337: .../workdir/CxxObject/vcl/unx/gtk4/a11y.o] Error 1 make: *** [Makefile:290: build] Error 2 Silence these 2 loplugin:unreffun errors using a different approach instead, as suggested by Stephan Bergmann in [1]. [1] https://gerrit.libreoffice.org/c/core/+/161060/comments/3e6ccbd5_87243200 Change-Id: I4c3a1c34bfaa5ac6c306881e3caff2e04d6992dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161060 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-12-19gtk4 a11y: Map COMMENT role to new gtk equivalentMichael Weghorn
Map `AccessibleRole::COMMENT` to the Gtk 4 equivalent `GTK_ACCESSIBLE_ROLE_COMMENT` newly added in upstream gtk commit [1] commit ab7592ee4f8ded4c3990cff5daf7f28ef26ac41f Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Dec 6 14:34:43 2023 +0100 a11y: Add article and comment roles [1] https://gitlab.gnome.org/GNOME/gtk/-/commit/ab7592ee4f8ded4c3990cff5daf7f28ef26ac41f Change-Id: I2816f2caf04e7c70c5eed63c1ae7aea0c9e48dd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160396 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2023-12-19gtk4 a11y: Add initial event handlingMichael Weghorn
Add a `GtkAccessibleEventListener` that is in charge of handling a11y events for the gtk4 VCL plugin. This is inspired by how the Qt-based VCL plugins do it (see `QtAccessibleEventListener`). Initially, only handle the `css::accessibility::AccessibleEventId::STATE_CHANGED` for the `AccessibleStateType::CHECKED` state by updating the value for the corresponding Gtk state. With this in place, toggling e.g. the "Bold" toggle button in Writer's formatting toolbar now properly updates the "checked" state of the corresponding a11y object in Accerciser's tree view of LO's a11y hierarchy. Gtk takes care of sending a corresponding "state-changed" event on the AT-SPI layer: 10.8 object:state-changed:checked(1, 0, 0) source: [toggle button | Bold] application: [application | soffice] Handling state changes to other states that map to a `GtkAccessibleState` should be possible in a similar way. However, other states - like the FOCUSED state - map to a `GtkAccessiblePlatformState` in Gtk 4, and the function `gtk_accessible_platform_changed` to update these that is used by Gtk's own widgets is private API for now, so cannot be used by LibreOffice, so I currently don't see a way to handle these without changes on Gtk side (see [1]). [1] https://gitlab.gnome.org/GNOME/gtk/-/issues/6272 Change-Id: I2a5ca4448ad14a61dc96aef7b22af36baeeed5c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160929 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-17gtk4 a11y: Map BLOCK_QUOTE role to new gtk equivalentMichael Weghorn
Map the role to the `GTK_ACCESSIBLE_ROLE_BLOCK_QUOTE` equivalent newly added to Gtk 4 in commit [1]: commit bbb0150383e6aabdbead635f1751322530392b3a Author: Michael Weghorn <m.weghorn@posteo.de> a11y: Add block quote role With this and the gtk commit in place, Accerciser shows the block quote role for Writer paragraphs using the "Block Quotation" paragraph style as expected. Also needs a bump of the gtk version to >= 4.13.4 on the gtk "main" branch after the 4.13.3 release for the `GTK_CHECK_VERSION` check to pass and actually make use of the new role, see MR [2]. Omit the fallback to `GTK_ACCESSIBLE_ROLE_PARAGRAPH` for Gtk versions >= 4.13.1 but < 4.13.4, since they are all development versions for the same stable release 4.14. [1] https://gitlab.gnome.org/GNOME/gtk/-/commit/bbb0150383e6aabdbead635f1751322530392b3a [2] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6574 Change-Id: I2c17da13867a61f0e6819913583392962cfd44a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158685 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2023-11-15tdf#158030 gtk4 a11y Map {col,row}indextext obj attributesMichael Weghorn
Map the "colindextext" and "rowindextext" object attributes introduced for Calc cells in Change-Id Ib675abafa2028d986b31d64ea7f5a38b1d54fc11 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Nov 14 10:18:37 2023 +0100 tdf158030 sc a11y: Report cell coords via {row,col}indextext obj attr to the corresponding gtk a11y relations. Together with a suggested MR for gtk [1] to add the corresponding mapping to AT-SPI2 there, following the Core Accessibility API Mappings specification [2], this makes these available on the AT-SPI2 layer. Interacting with Calc cells e.g. in Accerciser currently doesn't really work though, because LibreOffice freezes due to the Gtk implemenation of "GetChildCount" currently trying to iterate over all children, s. Gtk issue [3]. (Tested by hard-coding dummy values for a Writer paragraph in `SwAccessibleParagraph::getExtendedAttributes` instead.) [1] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6563 [2] https://www.w3.org/TR/core-aam-1.2/ [3] https://gitlab.gnome.org/GNOME/gtk/-/issues/6204 Change-Id: Ie53cb3cba51f5020c5a90d33dc27f2b6cd581b92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159412 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-14tdf#123864 gtk4 a11y: Handle CHECKABLE/CHECKED state independent of roleMichael Weghorn
The GtkAccessibleState doc [1] says for `GTK_ACCESSIBLE_STATE_CHECKED`: > A “checked” state; indicates the current state of a GtkCheckButton. > Value type: GtkAccessibleTristate The CHECKED state is actually used for more than just for checkboxes, (e.g. for toggle buttons in the toolbar), so don't restrict its use to the CHECK_BOX role in LibreOffice. Explicitly setting `GTK_ACCESSIBLE_STATE_CHECKED` makes Gtk report `ATSPI_STATE_CHECKABLE` on the AT-SPI layer [2], so this should only be set for objects that actually have `AccessibleStateType::CHECKABLE` set on LO side. This also implies that the gtk4 a11y bridge now depends on the recently introduced CHECKABLE state being set properly. (Reporting of that state in the different a11y classes will be added in follow-up commits.) For more background, see the commit adding the new role: Change-Id I6aa7fec3b3bd728a5cfedcdc8d6b66f06337f7ce Author: Michael Weghorn <m.weghorn@posteo.de> Date: Mon Nov 13 15:53:44 2023 +0100 tdf#123864 a11y: Add new AccessibleStateType::CHECKABLE [1] https://docs.gtk.org/gtk4/enum.AccessibleState.html [2] https://gitlab.gnome.org/GNOME/gtk/-/blob/a9e4993184605bc70e930b5c1e69d8f49c689c76/gtk/a11y/gtkatspicontext.c#L204-220 Change-Id: I898898f6117fb2ff62310c65e4baa140486deb16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159390 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-14gtk4 a11y: Set accessible name and descriptionMichael Weghorn
Set the accessible name and accessible description via the corresponding properties in the gtk4 a11y API, `GTK_ACCESSIBLE_PROPERTY_LABEL` (accessible name) and `GTK_ACCESSIBLE_PROPERTY_DESCRIPTION` (accessible description). Drop the initial proof of concept that was setting the text returned by the Text interface as accessible name instead. This also makes it much easier to find a specific item in the LO a11y tree in Accerciser. Change-Id: I9dac4c33185b589a63dda03fa7dd342a6ed460ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159385 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-10Fix errors gtk4Julien Nabet
[AWK] CustomTarget/postprocess/registry/fcfg_langpack_qtz.list /home/julien/lo/libreoffice/vcl/unx/gtk4/a11y.cxx:249:85: error: passing 'css::uno::Reference<css::accessibility::XAccessibleContext>' by value, rather pass by const lvalue reference [loplugin:passparamsbyref] css::uno::Reference<css::accessibility::XAccessibleContext> xContext) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ /home/julien/lo/libreoffice/vcl/unx/gtk4/a11y.cxx:329:83: error: passing 'css::uno::Reference<css::accessibility::XAccessibleContext>' by value, rather pass by const lvalue reference [loplugin:passparamsbyref] css::uno::Reference<css::accessibility::XAccessibleContext> xContext) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ [XCD] registry_qtz [CUS] filter/source/svg [CUS] sw/generated [PY ] CustomTarget/writerfilter/source/ooxml/OOXMLFactory_generated.cxx [PY ] CustomTarget/writerfilter/source/ooxml/OOXMLFactory_generated.hxx [PY ] CustomTarget/writerfilter/source/ooxml/OOXMLFactory_values.hxx [PY ] CustomTarget/writerfilter/source/ooxml/qnametostr.cxx /home/julien/lo/libreoffice/vcl/unx/gtk4/a11y.cxx:311:81: error: replace function parameter of type 'const OUString &' with 'std::u16string_view' [loplugin:stringviewparam] static void applyObjectAttribute(GtkAccessible* pGtkAccessible, const OUString& rName, ~~~~~~~~~~~~~~~~^~~~~ /home/julien/lo/libreoffice/vcl/unx/gtk4/a11y.cxx:312:50: error: replace function parameter of type 'const OUString &' with 'std::u16string_view' [loplugin:stringviewparam] const OUString& rValue) ~~~~~~~~~~~~~~~~^~~~~~ 4 errors generated. /home/julien/lo/libreoffice/vcl/unx/gtk4/a11y.cxx:329:83: error: passing 'css::uno::Reference<css::accessibility::XAccessibleContext>' by value, rather pass by const lvalue reference [loplugin:passparamsbyref] css::uno::Reference<css::accessibility::XAccessibleContext> xContext) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ /home/julien/lo/libreoffice/vcl/unx/gtk4/a11y.cxx:312:50: error: replace function parameter of type 'const OUString &' with 'std::u16string_view' [loplugin:stringviewparam] const OUString& rValue) ~~~~~~~~~~~~~~~~^~~~~~ /home/julien/lo/libreoffice/vcl/unx/gtk4/a11y.cxx:318:52: error: no member named 'toInt32' in 'std::basic_string_view<char16_t>' const int nLevel = static_cast<int>(rValue.toInt32()); ~~~~~~ ^ 1 error generated. Change-Id: I01942a3f65e87e33a093f8994e4bf44e74bafc65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159291 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-11-09gtk4 a11y: Handle the "level" object attributeMichael Weghorn
Add initial handling/mapping for object attributes. In LibreOffice and Gtk 3/ATK/AT-SPI, object attributes are currently key-value pairs, so arbitrary attribute names and values can be set. For Gtk 4, there's currently a discussion on how AT-SPI object attributes should be handled, s. [1]. One potential option is for them to be handled as `GtkAccessibleProperty`s. In any case, there's already a `GTK_ACCESSIBLE_PROPERTY_LEVEL` property that matches the "level" object attribute that Writer sets for headings to specify what heading level this is (s. `SwAccessibleParagraph::getExtendedAttributes`) and that the gtk3 VCL plugin reports as an ATK/AT-SPI object attribute with the same name and semantics for AT-SPI, which is in line with the specification in the Core Accessibility API Mappings 1.2 [2]. Map that LO object attribute to the above-mentioned `GTK_ACCESSIBLE_PROPERTY_LEVEL`. The property is currently not yet mapped to an AT-SPI attribute in Gtk 4, but together with a corresponding merge request [3], the object attribute can be seen in Accerciser as expected. While object properties in LO are currently generally only generated/updated when they're queried (via `XAccessibleExtendedAttributes::getExtendedAttributes`), the `GtkAccessibleProperty` handling in Gtk 4 would require to explicitly call `gtk_accessible_update_property` with the new value. This may require further adjustments on LO side to keep the properties up-to-date (e.g. adding something like a new `AccessibleEventId::OBJECT_PROPERTY_CHANGED` event and then implementing corresponding handling in all places that provide object properties). But that's something to look into later, also depending on the outcome of the discussion in [1]. (As of now, the gtk4 VCL plugin doesn't handle any a11y events, not even the existing ones.) [1] https://gitlab.gnome.org/GNOME/gtk/-/issues/6196 [2] https://www.w3.org/TR/core-aam-1.2/#ariaLevelHeading [3] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6549 Change-Id: I024afd7b527a20922e69156e1562dda783be2b49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159216 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09gtk4 a11y: Extract state handling to helper functionMichael Weghorn
Change-Id: I1f6dba461b328fc41de6d944bd8657daa9b05370 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159215 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-07loplugin:unnecessaryparenStephan Bergmann
Change-Id: Ic236de610c956c81f7eb8b0c27cee0b0ed6910ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159055 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-07gtk4 a11y: Map states to corresponding GtkAccessibleStateMichael Weghorn
Set those states that Gtk handles as `GtkAccessibleState`, see documentation at [1]. For the LO a11y states, the Gtk 4 a11y API differentiates between three different enums/ways of handling those: * `AccessibleProperty`, for which handling was added in the previous commit, Change-Id Ic033e66dd89021defca449bbe2251102bbd61015, "gtk4 a11y: Map states to corresponding gtk a11y properties" * `GtkAccessibleState`, for which this commit implements the handling * `GtkAccessiblePlatformState`, for which handling was implemented in `lo_accessible_get_platform_state` in commit 341ff232aec77c2b46325389da933315613b6f2d Author: Caolán McNamara <caolanm@redhat.com> Date: Mon Mar 20 20:37:15 2023 +0000 gtk4: get a11y to say hello world already. [1] https://docs.gtk.org/gtk4/enum.AccessibleState.html Change-Id: If22725dc2ccab5f73518e4171209a80a9c4df6d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159006 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-07gtk4 a11y: Map states to corresponding gtk a11y propertiesMichael Weghorn
For those states in `com::sun::star::accessibility::AccessibleStateType::EDITABLE` that have a corresponding `GTK_ACCESSIBLE_PROPERTY_*`, set that property when creating a new `LoAccessible`. This e.g. makes Accerciser show the "multiline" and "multi selectable" AT-SPI states for a Writer paragraph when using the gtk4 VCL plugin. State updates are not handled yet, since a11y event handling is currently not implemented in the gtk4 VCL plugin yet. Change-Id: Ic033e66dd89021defca449bbe2251102bbd61015 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159005 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-07gtk4 a11y: Map PASSWORD_TEXT role to gtk text box roleMichael Weghorn
This is in line with what the `GtkPasswordEntry` doc [1] says: > `GtkPasswordEntry` uses the `GTK_ACCESSIBLE_ROLE_TEXT_BOX` role. Note however, that gtk's AT-SPI bridge has specific code to map that to AT-SPI's `ATSPI_ROLE_PASSWORD_TEXT` for `GtkPasswordEntry` [2], which won't apply for any custom LO widgets. Currently, LO uses `GtkEntry` for password entries for gtk4 as well, e.g. the one in the "Tools" -> "Options" -> "Security" -> "Password for Web Connections" -> "Master Password" dialog, so those currently have an AT-SPI role of `ATSPI_ROLE_TEXT` for gtk4, while it is `ATSPI_ROLE_PASSWORD_TEXT` for gtk3. (That's independent of this change, since a native `GtkEntry` is used there. Changing this to use `GtkPasswordEntry` instead of `GtkEntry` for the gtk4 case should cause that to use `ATSPI_ROLE_PASSWORD_TEXT` as well.) [1] https://docs.gtk.org/gtk4/class.PasswordEntry.html#accessibility [2] https://gitlab.gnome.org/GNOME/gtk/-/blob/fe4b7a5159e8cc3e4918ad1829d71ff39edd5ba7/gtk/a11y/gtkatspiutils.c#L308-310 Change-Id: Iec6c8685f017b565553fbc63b4403484be20ed1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158984 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-28tdf#135586 a11y: Add a new BLOCK_QUOTE a11y roleMichael Weghorn
A block quote role exists in all of WAI-ARIA 1.3 (role "blockquote", [1]), IAccessible2 (`IA2_ROLE_BLOCK_QUOTE`, [2]) and AT-SPI (`ROLE_BLOCK_QUOTE`, [3]). Take over the definition that is the same in WAI-ARIA and IAccessible2: > A section of content that is quoted from another source. The intended use for now is for a Writer paragraph using the "Block Quotation" paragraph style, similar to how the HEADING role is used for paragraphs using a corresponding paragraph style. For gtk3 (ATK) and winaccessibility (IAccessible2), map the new role to the equivalant roles. For macOS and the gtk4 as well as the Qt-based VCL plugins on Linux which currently don't have an equivalent role, fall back to the same role that the PARAGRAPH role is mapped to. This way, the behavior there will remain unchanged once the BLOCK_QUOTE role is used for Writer paragraphs with the corresponding style. In general, treat BLOCK_QUOTE like PARAGRAPH in code applying special handling for the PARAGRAPH role. [1] https://w3c.github.io/aria/#blockquote [2] https://github.com/LinuxA11y/IAccessible2/blob/3d8c7f0b833453f761ded6b12d8be431507bfe0b/api/AccessibleRole.idl#L318 [3] https://gitlab.gnome.org/GNOME/at-spi2-core/-/blob/7cc4cee53ddbd22631fd110f0e5ce045dec2e411/xml/Accessible.xml#L615-616 Change-Id: I248c183a2e7ec5d6f0a89bf3cb4829bbd8588c77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158573 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-28gtk4 a11y: Map more a11y roles to gtk equivalentsMichael Weghorn
Most of these have a direct match in Gtk, the others are fairly similar. Helpful: https: //w3c.github.io/core-aam/#mapping_role Change-Id: I1575943dc44b6c41a54d35eaef0e8afdf64d1bc3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158566 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-27gtk4 a11y: Implement GtkAccessibleRange ifaceMichael Weghorn
Implement the `GtkAccessibleRange` range interface [1] added in gtk 4.10, which is bridged to the AT-SPI Value interface on Linux inside gtk. Also set the related properties to their values retrieved from the `XAccessibleValue` interface. (Those already existed before gtk 4.10.) The GType handling for implementing the interface only if the `XAccessibleContext` of the underlying LO a11y object implements `XAccessibleValue` is mostly copied over from the gtk3 a11y implementation (in vcl/unx/gtk3/a11y/atkwrapper.cxx) and adapted a bit. Let `lo_accessible_range_set_current_value` always return true independent of whether the given value was actually set, since LibreOffice (together with Accerciser) otherwise crashes due to no proper DBus reply being sent, when trying to set a new value via AT-SPI API, s.a. [2] and [3]. When setting a new value, take the type of the current value into account, as done for gtk3 in commit a0b7b47e3ec843d8012a7526c1e8e72d67cc41b1 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Oct 24 12:29:54 2023 +0200 gtk3 a11y: Take current type into account when setting new value With this change in place, the AT-SPI Value interface is now shown as available for a checkbox form control in a Writer doc when selecting the corresponding a11y object in Accerciser's tree view of the LO a11y hierarchy. When changing the value via Accerciser, the checkbox in LibreOffice gets (un)checked as expected. (Setting the value to 1.0 causes the checkbox to be checked, 0.0 to become unchecked.). The initial values (current value, min and max value) are set properly. However, when querying the current value after changing it, the initial value is still returned. This likely needs to be addressed by bridging the corresponding `AccessibleEventId::VALUE_CHANGED` event to Gtk/AT-SPI by calling `gtk_accessible_update_property` with the new value. However, there's currently no implementation for handling a11y events in the gtk4 VCL plugin yet, so leave that for later. More interfaces to expose more functionality to the a11y layer will likely be implemented in upcoming gtk versions (like an interface for Text [4]) and bridging those should presumably be possible in a similar way. [1] https://docs.gtk.org/gtk4/iface.AccessibleRange.html [2] https://gitlab.gnome.org/GNOME/gtk/-/issues/6150 [3] https://gitlab.gnome.org/GNOME/gtk/-/commit/0dbd2bd09eff8c9233e45338a05daf2a835529ab [4] https://gitlab.gnome.org/GNOME/gtk/-/issues/5912 Change-Id: I84136fd80361d21cf4f79ab17118bb14079ab785 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158556 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-26gtk4 a11y: Map checkbox role to gtk equivalentMichael Weghorn
This makes a checkbox form control in a Writer document show up with the proper role in Accerciser, no longer as a filler. Change-Id: I5566d27ecfbe9ec54dcfbf20693899b72d3af738 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158505 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-09-27gtk4 a11y: Map paragraph role to Gtk equivalentMichael Weghorn
Map `css::accessibility::AccessibleRole::PARAGRAPH` to the new `GTK_ACCESSIBLE_ROLE_PARAGRAPH` role newly added to Gtk in commit [1] commit 9f078bd5c975f33d832b6da71cba2923450d3127 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Mon Sep 25 10:41:42 2023 +0200 a11y: Add paragraph role Add new GTK_ACCESSIBLE_ROLE_PARAGRAPH role for paragraphs. ARIA has a paragraph role as well. The paragraph role is used e.g. in document editors like LibreOffice or web browsers like Firefox. According to the ARIA spec [1], naming paragraphs is forbidden (§ 5.2.8.6), and the superclass role is section. This role will be more useful once a way to expose the textual data via the AT-SPI Text interface is also available (s. issue #5912 [2]). [1] https://www.w3.org/TR/wai-aria-1.2/ [2] https://gitlab.gnome.org/GNOME/gtk/-/issues/5912 With this in place, a Writer paragraph reports the proper role to AT-SPI. There's however currently no way to expose the paragraph text via the AT-SPI Text interface since Gtk 4 currently lacks the required API for that (s. [2]). Without this change in place, the paragraph text was exposed as the accessible name of the a11y object (see the "for now set GTK_ACCESSIBLE_PROPERTY_LABEL as a proof of concept" comment in `lo_accessible_get_property`), but since ARIA does not allow naming paragraphs and Gtk 4 follows ARIA, this is no longer the case with the new mapping in place. But then, I don't see how to have proper a11y without supporting the Text interface, so that will be needed at some point anyway. [1] https://gitlab.gnome.org/GNOME/gtk/-/commit/9f078bd5c975f33d832b6da71cba2923450d3127 [2] https://gitlab.gnome.org/GNOME/gtk/-/issues/5912 Change-Id: I44315754a6376ecc06bee01d16eedb8a769c3d4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157241 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-05-23Avoid -Werror=unused-function when building against older GTK4Stephan Bergmann
...as reported in the comment at <https://gerrit.libreoffice.org/c/core/+/151866/2#message-daf995784c18439280d3280877cfcf73d0bb5e9b> "Silence loplugin:external and lopluign:unreffun in (WIP?) a11y.cxx for now", > In file included from /home/michi/development/git/libreoffice/vcl/unx/gtk4/a11y.cxx:17: > /home/michi/development/git/libreoffice/vcl/unx/gtk4/a11y.hxx:19:24: error: ‘void* lo_accessible_get_instance_private(LoAccessible*)’ declared ‘static’ but never defined [-Werror=unused-function] > 19 | static inline gpointer lo_accessible_get_instance_private(LoAccessible*); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/michi/development/git/libreoffice/vcl/unx/gtk4/a11y.hxx:21:24: error: ‘void* ooo_fixed_get_instance_private(OOoFixed*)’ declared ‘static’ but never defined [-Werror=unused-function] > 21 | static inline gpointer ooo_fixed_get_instance_private(OOoFixed*); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I40811235a66e429e2472b50bcbaa3e6fefa6a593 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152147 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-05-18Fix typoAndrea Gelmini
Change-Id: I89d8b370cf95d43de33c35b788fc955adfb85a0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151948 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-17Silence loplugin:external and lopluign:unreffun in (WIP?) a11y.cxx for nowStephan Bergmann
Change-Id: Iea207bca4fee57e8c7dd5d307ccd42efc0dd2542 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151866 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-05-17Avoid loplugin:unreffunStephan Bergmann
> vcl/unx/gtk4/a11y.cxx:295:1: error: redundant function redeclaration [loplugin:unreffun] > G_DEFINE_TYPE_WITH_CODE(LoAccessible, lo_accessible, G_TYPE_OBJECT, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /usr/include/glib-2.0/gobject/gtype.h:1730:56: note: expanded from macro 'G_DEFINE_TYPE_WITH_CODE' > #define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /usr/include/glib-2.0/gobject/gtype.h:2213:3: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN' > _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /usr/include/glib-2.0/gobject/gtype.h:2160:17: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN_PRE' > static void type_name##_class_init (TypeName##Class *klass); \ > ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > <scratch space>:47:1: note: expanded from here > lo_accessible_class_init > ^ > vcl/unx/gtk4/a11y.cxx:236:13: note: previous declaration is here [loplugin:unreffun] > static void lo_accessible_class_init(LoAccessibleClass* klass) > ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I22bad5cf5e546d3a4dff4c1de3b3bb06638d1200 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151865 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-05-17loplugin:externalStephan Bergmann
"externally available entity '...' is not previously declared in an included file (if it is only used in this translation unit, make it static; otherwise, provide a declaration of it in an included file)" Change-Id: Id53a4fd0b01ea7a91735231750c32200ea1529b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151864 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-05-17loplugin:reservedidStephan Bergmann
Change-Id: Ia24f5214f44a5ef4f5ac4397b8adcd6d46a99676 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151863 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-05-17loplugin:fakeboolStephan Bergmann
Change-Id: I8c7fe59223dfda4c376e50bb4b6fedee341bd85f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151862 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>