summaryrefslogtreecommitdiff
path: root/vcl/qt5
AgeCommit message (Collapse)Author
2023-10-18tdf#157696 qt a11y: Move handling for text attr offsets to helperMichael Weghorn
Add a new method `AccessibleTextAttributeHelper::GetIAccessible2TextAttributes` and move some more of the logic from `QtAccessibleWidget::attributes` there to prepare adding handling for spelling errors via the "invalid:spelling" IAccessible2 text attribute and for reuse in winaccessibility. Change-Id: I3b4a89ee680437fa2c35c429639b372a55f5a4b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158088 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-18qt: Drop now obsolete workaround for Qt < 5.12Michael Weghorn
This workaround was only applied for Qt < 5.12 and is no longer needed now that support for Qt < 5.15 has been dropped in commit afb4c96d271958ced3175dfc2cf8bb9e8b0a9d3b Author: Michael Weghorn <m.weghorn@posteo.de> Date: Thu Aug 3 21:30:22 2023 +0200 qt: Drop code for Qt < 5.15 Commit originally adding the workaround: commit fe2baf9e84e0ca9aeaa683e37076f57fa3f38dca Author: Jan-Marek Glogowski <jan-marek.glogowski@extern.cib.de> Date: Tue Dec 3 08:32:58 2019 +0100 Qt5 fix missing XCB_ICCCM_WM_HINT_WINDOW_GROUP This is the application level equivalent of the Qt5 fix for bug QTBUG-46626 / commit 0de4b32 ("xcb: fix issue with dialogs hidden by other windows"), which was broken since Qt 5.4 and is just fixed since Qt 5.12. It is needed for some window managers, which don't know about the WM_CLIENT_LEADER property. Both settings are the same, but just the latter is set by older Qt5 releases. This probably isn't a real problem, as GNOME or XFCE would use the gtk VCL plugin, but since I already wrote the code when debugging tdf#129071, there is also no reason to drop it (except: more code, more bugs...). This fix is optional and needs development headers for xcb-icccm, which can actually be compiled into Qt5. If missing configure will just print a warning, since it's a runtime requirement and we explicitly drop the linked Qt version symbol, so the potential build Qt version won't matter. Change-Id: Ifc5a8f8a40ee13779a911efb53e8b8b868614d0b Reviewed-on: https://gerrit.libreoffice.org/84299 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> Change-Id: I56b708449cf686f787f55256c76673be604d31e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158102 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-18qt: Drop code for Qt < 5.15Michael Weghorn
Our new AlmaLinux 8 baseline provides Qt 5.15.3, so require 5.15 and drop the code for older, now unsupported Qt versions. Change-Id: I512ade1ba503fc7a86527a45142f37f043db6784 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155325 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-14Add NUMBERSIGN key handler.Gökay Şatır
German keyboard layout has number sign key. Users can print number sign without using modification keys. So this key can be assigned a shortcut. Subscript is assigned to CTRL + NUMBERSIGN. Below PR is used as reference when adding the new key handler: https://gerrit.libreoffice.org/c/core/+/86713 Signed-off-by: Gökay Şatır <gokaysatir@collabora.com> Change-Id: I340dc47764e9200d2477f8db740a629f62f48004 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157554 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> (cherry picked from commit 1db8f6d484b884301a7d3673f4d05478e28cd853) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157959 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-12tdf#157696 vcl a11y: Move qt's translation to IA2 text attrs for reuseMichael Weghorn
Qt expects the text attributes to be reported as IAccessible2 attributes. Therefore, there is a translation/conversion from the LO-internal text attributes to IAccessible2 text attributes in `QtAccessibleWidget::attributes`. Move the logic from the qt-VCL-specific code into a new VCL helper class `AccessibleTextAttributeHelper`, so it can be reused in winaccessibility in following commits. Change-Id: I434481faa53c74bae95cae5b2c9f0907b87fb1bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157804 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-07loplugin:ostr: automatic rewriteStephan Bergmann
Change-Id: I2d09b2b83e1b50493ec88d0b2c323a83c0c86395 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157647 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2023-09-13loplugin:unusedmethodsNoel Grandin
Change-Id: I00f228451574ca9f9e352d233c7f326c88e90a95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156892 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-07qt a11y: Forward CHILD event for removed childMichael Weghorn
No longer comment out the code to send a `QAccessible::ObjectDestroyed` event when receiving an `AccessibleEventId::CHILD` event with its `OldValue` set. The underlying issues causing crashes previously seem to be fixed, I can no longer reproduce these on Debian testing with Orca 44.1-2 when using the font color popup as described in commit 734d10ed3612d75edcee145475ddd0b0165efeac Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Apr 14 16:57:09 2023 +0300 qt a11y: Send QAccessible::ObjectCreated event for correct object > Adapting this for the case where a child has > been removed (bridged to Qt as `QAccessible::ObjectDestroyed` > event) would currently results in crashes when closing the > application e.g. after using the character font color popup in > the Writer toolbar. This needs further investigation, so don't > send the event for now, but add a `SAL_WARN`. Change-Id: Ib8f21850dd56645cf64a74be0e1ff8242615b928 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156647 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-09-02tdf#149611 qt: Make auto-selection of dark app colors workMichael Weghorn
Rename the newly introduced method `QtFrame::isUsingDarkColorScheme` to detect whether a dark color scheme is in use from Change-Id I8f347c6e7f775cc55377c5c84481de3051c3cf24 tdf#156894 qt: Prefer dark icon theme in dark mode and let it override `SalFrame::GetUseDarkMode`. This gets used (via `MiscSettings::GetUseDarkMode`) in `ColorConfig::GetDefaultColor` to determine what application colors to use. With this, setting "Tools" -> "Options" -> "LibreOfficeDev" -> "Application Colors" -> "Automatic" to "System Theme" will now automatically switch to dark application colors (like a dark doc background instead of white) for kf5/qt6 when a dark global theme is active (e.g. because "Breeze Dark" has been selected in Plasma system settings). Change-Id: I151e7eb35a94a9c525452a7d90b24283f6226904 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156467 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-09-02tdf#156894 qt: Prefer dark icon theme in dark modeMichael Weghorn
When in dark mode, pass the param to prefer a dark icon theme to `StyleSettings::SetPreferredIconTheme`. For Qt >= 6.5 use `QStyleHints::colorScheme` introduced in Qt 6.5 to get the color scheme. For older Qt versions, use the same algorithm based on the gray value of the window background as xdg-desktop-portal-kde does for evaluating whether a light or dark color scheme is preferred [1]. On my Debian testing, the Breeze dark icon theme is now used as expected with kf5 or qt6 when setting the Global KDE Plasma theme to "Breeze Dark" and manually setting the Icon theme to "GNOME" afterwards. Previously, this would not use a dark icon theme and icons would be hard to see. Without manually setting the icon theme to "GNOME", the Breeze Dark icon theme would already be used before, because selecting "Breeze Dark" as the global KDE Plasma theme also selects the "Breeze Dark" icon theme by default, and therefore "breeze-dark" was already passed as the first param to `StyleSettings::SetPreferredIconTheme` and since that icon theme is present, the `bPreferDarkTheme` wouldn't be evaluated at all; it's only used when determining the fallback icon theme when the specified icon theme is not present. (Likewise, by enabling the "Breeze Dark" global theme and then manually setting the icon theme to "Breeze" in Plasma System settings, the Breeze light icon theme will be used in LibreOffice as well, resulting in hard to see icons, but I tend to think that that behavior is correct and works as designed - it's a misconfiguration.) The color scheme is also specified in xdg-desktop-portal (s. commit [2]) and can be retrived via dbus. Example with "Breeze Light" active: $ dbus-send --session --print-reply=literal --reply-timeout=1000 --dest=org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read string:'org.freedesktop.appearance' string:'color-scheme' variant variant uint32 2 With "Breeze Dark": $ dbus-send --session --print-reply=literal --reply-timeout=1000 --dest=org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read string:'org.freedesktop.appearance' string:'color-scheme' variant variant uint32 1 [1] https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/blob/0a4237549debf9518f8cfbaf531456850c0729bd/src/settings.cpp#L213-227 [2] https://github.com/flatpak/xdg-desktop-portal/commit/d7a304a00697d7d608821253cd013f3b97ac0fb6 Change-Id: I8f347c6e7f775cc55377c5c84481de3051c3cf24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156465 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-09-01qt: Set window title etc. in main threadMichael Weghorn
These QWidget methods need to be called in the main thread. Otherwise, opening the Update dialog ("Help" -> "Check for Updates", enabled by `--enable-online-update` autogen switch) triggers asserts like the one below with a self-compiled Qt 6 development build (qtbase dev branch as of c802a9e987c9e38c01580f467eab92a651b3e033). ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 0x0x7fff780160e0. Receiver '' (of type 'QtWidget') was created in thread 0x0x5555555fcd30", file /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp, line 537 Thread 40 "InitUpdateCheck" received signal SIGABRT, Aborted. [Switching to Thread 0x7fff7ffff6c0 (LWP 1516868)] __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. (gdb) 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 0x00007ffff78a815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78 #2 0x00007ffff785a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #3 0x00007ffff78444b2 in __GI_abort () at ./stdlib/abort.c:79 #4 0x00007fffe32eb45a in qAbort() () at /home/michi/development/git/qt5/qtbase/src/corelib/global/qglobal.cpp:161 #5 0x00007fffe32f9ee5 in qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&) (context=..., message=...) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:2057 #6 0x00007fffe32f620c in QMessageLogger::fatal(char const*, ...) const (this=0x7fff7fffb980, msg=0x7fffe37fd9a0 "ASSERT failure in %s: \"%s\", file %s, line %d") at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:938 #7 0x00007fffe32e9d54 in qt_assert_x(char const*, char const*, char const*, int) (where=0x7fffe38131e9 "QCoreApplication::sendEvent", what=0x7fff78180110 "Cannot send events to objects owned by a different thread. Current thread 0x0x7fff780160e0. Receiver '' (of type 'QtWidget') was created in thread 0x0x5555555fcd30", file=0x7fffe3812e18 "/home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp", line=537) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:77 #8 0x00007fffe33a4d74 in QCoreApplicationPrivate::checkReceiverThread(QObject*) (receiver=0x55555d27d5d0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:537 #9 0x00007fffe19a3a81 in QApplication::notify(QObject*, QEvent*) (this=0x5555555fcb80, receiver=0x55555d27d5d0, e=0x7fff7fffc0b0) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2584 #10 0x00007fffe33a5ed0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55555d27d5d0, event=0x7fff7fffc0b0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1125 #11 0x00007fffe33a6991 in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x55555d27d5d0, event=0x7fff7fffc0b0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1559 #12 0x00007fffe1a279b4 in QWidget::setWindowTitle(QString const&) (this=0x55555d27d5d0, title=...) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:6119 #13 0x00007fffe3c9d4c4 in QtFrame::SetTitle(rtl::OUString const&) (this=0x555555619d20, rTitle="Check for Updates") at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:365 #14 0x00007fffedd98d44 in vcl::Window::SetText(rtl::OUString const&) (this=0x7fff7803cd90, rStr="Check for Updates") at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:3042 #15 0x00007fffedd311c9 in SystemWindow::SetText(rtl::OUString const&) (this=0x7fff7803cd90, rStr="Check for Updates") at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:1048 #16 0x00007ffff048bd6b in VCLXWindow::setProperty(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x7fff7804ac00, PropertyName="Title", Value=uno::Any("string": "Check for Updates")) at /home/michi/development/git/libreoffice/toolkit/source/awt/vclxwindow.cxx:1515 #17 0x00007ffff03e486d in VCLXContainer::setProperty(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x7fff7804ac00, PropertyName="Title", Value=uno::Any("string": "Check for Updates")) at /home/michi/development/git/libreoffice/toolkit/source/awt/vclxcontainer.cxx:260 #18 0x00007ffff04dfa2c in VCLXDialog::setProperty(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x7fff7804ac00, PropertyName="Title", Value=uno::Any("string": "Check for Updates")) at /home/michi/development/git/libreoffice/toolkit/source/awt/vclxwindows.cxx:2364 #19 0x00007ffff06a89b7 in UnoControl::ImplSetPeerProperty(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x7fff7803b4f0, rPropName="Title", rVal=uno::Any("string": "Check for Updates")) at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrol.cxx:288 #20 0x00007ffff06aa701 in UnoControl::ImplModelPropertiesChanged(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> const&) (this=0x7fff7803b4f0, rEvents=uno::Sequence of length 51 = {...}) at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrol.cxx:649 #21 0x00007ffff0531ae9 in ControlContainerBase::ImplModelPropertiesChanged(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> const&) (this=0x7fff7803b4f0, rEvents=uno::Sequence of length 51 = {...}) at /home/michi/development/git/libreoffice/toolkit/source/controls/controlmodelcontainerbase.cxx:1600 #22 0x00007ffff0575a25 in UnoDialogControl::ImplModelPropertiesChanged(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> const&) (this=0x7fff7803b4f0, rEvents=uno::Sequence of length 51 = {...}) at /home/michi/development/git/libreoffice/toolkit/source/controls/dialogcontrol.cxx:651 #23 0x00007ffff06a95f3 in UnoControl::propertiesChange(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> const&) (this=0x7fff7803b4f0, rEvents=uno::Sequence of length 51 = {...}) at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrol.cxx:431 #24 0x00007ffff66bc4ee in cppu::OPropertySetHelper::firePropertiesChangeEvent(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Reference<com::sun::star::beans::XPropertiesChangeListener> const&) (this=0x7fff78006170, rPropertyNames=uno::Sequence of length 51 = {...}, rListener=uno::Reference to (UnoDialogControl *) 0x7fff7803b540) at /home/michi/development/git/libreoffice/cppuhelper/source/propshlp.cxx:961 #25 0x00007ffff06a8c6b in UnoControl::updateFromModel() (this=0x7fff7803b4f0) at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrol.cxx:320 #26 0x00007ffff06aefc9 in UnoControl::createPeer(com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&) (this=0x7fff7803b4f0, rxToolkit=empty uno::Reference, rParentPeer=empty uno::Reference) at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrol.cxx:1325 #27 0x00007ffff06c9905 in UnoControlContainer::createPeer(com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&) (this=0x7fff7803b4f0, rxToolkit=empty uno::Reference, rParent=empty uno::Reference) at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrolcontainer.cxx:727 #28 0x00007ffff057336d in UnoDialogControl::createPeer(com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&) (this=0x7fff7803b4f0, rxToolkit=empty uno::Reference, rParentPeer=empty uno::Reference) at /home/michi/development/git/libreoffice/toolkit/source/controls/dialogcontrol.cxx:358 #29 0x00007fffb7264e62 in UpdateHandler::createDialog() (this=0x7fff78003aa0) at /home/michi/development/git/libreoffice/extensions/source/update/check/updatehdl.cxx:1232 #30 0x00007fffb725b0e1 in UpdateHandler::setVisible(bool) (this=0x7fff78003aa0, bVisible=true) at /home/michi/development/git/libreoffice/extensions/source/update/check/updatehdl.cxx:188 #31 0x00007fffb7235887 in UpdateCheck::showDialog(bool) (this=0x7fff78000b90, forceCheck=true) at /home/michi/development/git/libreoffice/extensions/source/update/check/updatecheck.cxx:1171 #32 0x00007fffb7255c5e in (anonymous namespace)::InitUpdateCheckJobThread::run() (this=0x55555d192690) at /home/michi/development/git/libreoffice/extensions/source/update/check/updatecheckjob.cxx:148 #33 0x00007fffb723a74a in osl::threadFunc(void*) (param=0x55555d192690) at /home/michi/development/git/libreoffice/include/osl/thread.hxx:189 #34 0x00007ffff7f3f693 in osl_thread_start_Impl(void*) (pData=0x55555d1a68b0) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:237 #35 0x00007ffff78a63ec in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444 #36 0x00007ffff7926a1c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81 Change-Id: I6ccdee00fe26619f201459ebbe6c4d8cf8b57b45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156426 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-14qt: Implement pinch/zoom gesture handlingMichael Weghorn
Subscribe to receive pinch gestures by calling `QWidget::grabGesture(Qt::PinchGesture)` and forward that as the corresponding `SalGestureZoomEvent`. From looking at what values the gtk implementation uses, `1 + pPinchGesture->totalScaleFactor()` seems to be a proper choice for the `SalGestureZoomEvent::mfScaleDelta` value. With this in place, zooming in and out of a Writer document with a two-finger zoom gesture works for me with the Qt-based VCL plugins in Writer on my laptop that has a touch screen. (It seems to be a bit more smooth with qt5/kf5 than with qt6, where doing several zoom gestures after each other sometimes requires to wait a bit before doing another gesture in order for that one to be processed properly.) Qt documentation for gestures: [1] Corresponding commit for gtk VCL plugins: commit f2bd19f6720239db228cd4388be8e928505c51b6 Author: Povilas Kanapickas <povilas@radix.lt> Date: Thu Aug 25 00:18:30 2022 +0300 vcl: implement touchpad zoom gesture support on gtk backend [1] https://doc.qt.io/qt-6/gestures-overview.html Change-Id: I288943d923463fee44314969648e03dca84c483f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155649 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-02vcl: Drop the PrintFont -> FastPrintFontInfo -> FontAttributes indirectionKhaled Hosny
We want FontAttributes at the end, so lets have them up front instead of the intermediary structures. Change-Id: Iafdf17f4a7615f0c3d972e6080cebea0183840b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155191 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-08-02split Point/Size/Rectangle into AbsoluteScreenPixel* typesNoel Grandin
to attempt to make it obvious in code what kind of coordinate system we are dealing with. The idea is that by doing this, the compile-time type checking will flush out inconsistencies between different code. I started with vcl::Window::OutputToAbsoluteScreenPixel and worked outwards from there. Change-Id: Ia967d7a0bb38886695f3a761b85c8b9340ddb1c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154676 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-01tdf#156376 qt: Open help for focused native menu entry on F1Michael Weghorn
In order to allow have pressing F1 (`QKeySequence::HelpContents`) open the corresponding help entry for the currently selected menu entry, connect to the signal that gets emitted when a menu entry is selected (`QAction::hovered`) and remember its help ID. Register the F1 shortcut for the menu and connect its `activated`/`activatedAmbiguously` signal with a slot that opens the help for the current/ last selected menu entry. Change-Id: I24eec4806e5a202052a49c239e4836b92c9f0228 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155055 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-07-31all drawPolyPolygon variants return true nowCaolán McNamara
since: commit 4998de76ed1da4039e30718941d50d6f1dfe4f82 Date: Sun Jul 30 07:40:48 2023 +0000 tdf#156230: Drop freshly unused GenPspGfxBackend Change-Id: I7fc2a068f807777ed392c5d58772d130bf7f51c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155076 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-07-31supportsOperation OutDevSupportType::B2DDraw is always true nowCaolán McNamara
since: commit 4998de76ed1da4039e30718941d50d6f1dfe4f82 Date: Sun Jul 30 07:40:48 2023 +0000 tdf#156230: Drop freshly unused GenPspGfxBackend Change-Id: I1adc30a60aec0c5aab9289e9c0505d1dbad10631 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155074 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-07-27qt a11y: Return app as parent for top-level objectsMichael Weghorn
If an accessible object does not have a parent in the LO a11y hierarchy or in the QObject hierarchy, return the app as accessible parent. Top-level items (like dialogs) don't have another accessible parent, but are children of the app. This can also be seen e.g. in Accerciser: For example Writer's "Page Style" dialog is listed as a child of the application, but it had no parent without this change in place, breaking automatically selecting the bookmarked a11y object in Accerciser's treeview of the LO a11y hierarchy when restoring the bookmark, since that relies being able to walk up the a11y hierarchy. This is in line with what Qt itself does, s. e.g. qtbase commit [1]: commit 6ec35ff8c56222a317b838b6aac390eb6974de85 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Sat Jul 8 15:16:12 2023 +0200 a11y: Report app as parent for top-level item views As happens for other widgets (s. QAccessibleWidget::parentObject), report the app as accessible parent for item views that don't have another parent set. Otherwise, the accessible tree is broken when there's a top-level item view: The application has the item view as a child, but the child does not have any parent set. Extend a QListView autotest accordingly. Fixes: QTBUG-115135 Pick-to: 6.6 6.5 Change-Id: Ie06874681180a30fc6248dc98f80c4158d837278 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=6ec35ff8c56222a317b838b6aac390eb6974de85 Change-Id: Ia20bf1d5311dd918eb7563161745cdb70edc0787 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154982 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-07-25tdf#155414 kf a11y: Honor KDE Plasma setting to reduce animationMichael Weghorn
When using the kf5/kf6 VCL plugin on KDE Plasma, use the animation speed setting to determine whether animations should be disabled, in line with what is documented in MDN docs for Firefox using for the "prefers-reduced-motion" CSS media feature [1] and how kde-gtk-config maps that to the "gtk-enable-animations" setting [2]. The setting can be set as described in [2]: > In Plasma/KDE: System Settings > Workspace Behavior -> General Behavior > > "Animation speed" is set all the way to right to "Instant". On top of commit 9d68c794d67259a38de1465090f6f1e7fb588d62 Author: Patrick Luby <plubius@neooffice.org> Date: Fri Jul 21 19:55:02 2023 -0400 tdf#155414 include system "reduce animation" preferences , this basically implements the KF5/KDE Plasma equivalent of what that change does for macOS. Other than Gtk, Qt does not seem to have a general way to specify that animations should be reduced/disabled, so evaluate that based on the desktop environment instead, and implement for KDE Plasma for the kf5/kf6 VCL plugin only for now, which is probably the most common use case. Logically, this would better fit in the qt5/qt6 VCL plugin than the kf5/kf6 one, but do it in the KF-specific code to avoid a dependency on KF5/KF6 libraries in qt5/qt6. (And other than qt5/qt6, kf5/kf6 are auto-selected in Qt-based desktop environments, so it shouldn't make much of a difference in practice.) Another alternative - should the need aries - might be to move this from the VCL plugin to the desktop backend (`shell/source/backends/kf5be/` for the case of KDE Plasma 5.) and introduce a new property for that. [1] https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion [2] https://docs.gtk.org/gtk4/property.Settings.gtk-enable-animations.html [3] https://invent.kde.org/plasma/kde-gtk-config/-/blob/881ae01ad361a03396f7f327365f225ef87688e8/kded/gtkconfig.cpp#L205 Change-Id: I35cd6c2568a3716491581e51dfaeaf32cad454aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154888 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-07-25Convert internal vcl bitmap formats transparency->alpha (II)Noel Grandin
(Second attempt at landing this) Image formats and graphics APIs use alpha, not transparency, so change our internal formats and data structures to work directly with alpha, so we don't need to modify data before we push it to graphics APIs. Add a couple of new Color constants to make the intention of the vcl code clearer. Notes (*) On macOS, tweaking the logic in CreateWithSalBitmapAndMask to more accurately reflect the requirements of the CGImageCreateWithMask function seems to fix some tests. (*) The vcl code does not properly support gradients with transparency. So the previous code was wrong, and this change is going to result in slightly different wrongness. Change-Id: I9e21c2e98d88ecfdc5f75db13bd1ffff7c38db98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114168 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-24tdf#154447 qt: Take menu bar into account for popup posMichael Weghorn
Change-Id I66b312fe09e078ec067773a483f9e59f627fcf93 ("tdf#154447 Fix menu position in kf5") fixes the position for menu popups for the case where no menu bar is present, e.g. the default after switching to the Tabbed interface. While it improves the case where a menu bar is present, the menu would would still open a bit too far up for that case. Adapt the position by the menu bar height to make that case work as expected as well. Do this in `QtMenu::ShowNativePopupMenu` for now since that's easiest. Potentially, the height should have been taken into consideration somewhere earlier, but since the whole handling of menu bar height is quite "special", don't aim to address that elsewhere now, s.a. an earlier attempt to rework the whole handling in commit afc828b9833b7a612369e95606ba56d41ef2c369 Date: Sat May 28 23:47:21 2022 +0200 VCL expect correct frame size for native menubars which was later reverted in commit f51b220b953ec71fb742f799fbe645a93cf3d944 Date: Fri Mar 24 08:06:56 2023 +0100 tdf#149805 tdf#151677 tdf#152217 tdf#154043 tdf#153458 tdf#153800 Revert "VCL expect ... correct frame size for native menubars" Change-Id: Iafd80997f9f506cb22afe1aaf6d1a3f716700ea3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154839 Tested-by: Jenkins Tested-by: Rafael Lima <rafael.palma.lima@gmail.com> Tested-by: Gabor Kelemen <kelemeng@ubuntu.com> Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
2023-07-24tdf#154447 Fix menu position in kf5Rafael Lima
Prior to this patch the menus were using "topLeft" as reference for positioning the menu, which made them appear on top of the control that originated their appearance. With this patch, it now uses "bototmLeft" to place the menu below the control (similar to gtk3). Change-Id: I66b312fe09e078ec067773a483f9e59f627fcf93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154771 Tested-by: Jenkins Tested-by: Gabor Kelemen <kelemeng@ubuntu.com> Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-07-23vcl: Drop now unneeded DevicePoint typedefKhaled Hosny
It has been always typedef'd to basegfx::B2DPoint since: commit 5e218b5c51f7d9cd10bd9db832879efca41b9c75 Date: Wed Jan 12 21:19:32 2022 +0000 always use B2DPoint for DevicePoint Change-Id: I9f5202d5a71c77dd79f1759923917c26bf68a9af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154632 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-23vcl: TextRenderModeForResolutionIndependentLayout → SubpixelPositioningKhaled Hosny
Change-Id: I8698d0f74889ac8a7de64a97e8cf0e8878ef7fc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154517 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-23vcl: Use HarfBuzz to get glyph bounding rectangleKhaled Hosny
For consistent cross-platform results that also matches our glyph advances since platform functions might be using hints which we don’t use. Change-Id: I4aebd3e7c5f460dff584f5eba74f7a11bab0f9b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154388 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-12qt a11y: Check child index in QtAccessibleWidget::childMichael Weghorn
Check the child index is valid. Otherwise, calling the method with an invalid index would result in a crash due to a com::sun::star::lang::IndexOutOfBoundsException, e.g. when manually using an invalid index in Accerciser's IPython console: In [12]: acc.get_child_count() Out[12]: 3 In [13]: acc.get_child_at_index(3) In [14]: Change-Id: I95f680a5ac6ee1052f3046a83000fa5b07009239 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154345 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-07-09qt: Check for SAL_VCL_QT_USE_QFONT in a central placeKhaled Hosny
Change-Id: I7f0a2cf8daaf72de02261e2a9a5c3a70f5a42270 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154224 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-09tdf#151273, tdf#151925: Don’t use QFont text layout by defaultKhaled Hosny
We were enabling QFont for qt5 VCL plugin by default, but it is buggy and some distributions seem to enabled qt5 VCL plugin even if we don't recommend it. Since the QFont code is incomplete and no one is working on it, lets make people’s life easier by making it always off by default. This removed the SAL_VCL_QT5_USE_CAIRO envvar and replaces it with SAL_VCL_QT_USE_QFONT that does the reverse. Also SAL_VCL_KF5_USE_QFONT is dropped in favor of SAL_VCL_QT_USE_QFONT. Change-Id: Id7471acd12fe277908f567140b63ae8d27b03033 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154222 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-03Rename ImplFontMetricData -> FontMetricDataKhaled Hosny
Change-Id: I0f8753a5ef1865f4ea0431125e74d0f52aa1c396 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153868 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-05-28Use getXWeak in vclMike Kaganski
Change-Id: I665c9dc8c4f9cc4a996d9bf990cbfa33822bd07f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150885 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-05-23Resolves tdf#145080 - Use accent color for focused cellHeiko Tietze
Accent color added but effectively working only on macOS See inline comments for gtk, qt, and win Change-Id: I1e4a729331735683921f94b27bb2bb02555c0165 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151887 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2023-05-13tdf#148251 qt: Use std::swap instead of using temporary valuesDr. David Alan Gilbert
Another std::swap case in drawLine Change-Id: I207fe3c8c6c88532c23faf3aa3188acdcda3a5b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151654 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-05-09Related: tdf#142176 rearrange screensaver inhibiter to be more genericCaolán McNamara
and for not-x11 I see gtk just uses 0 for xid (which is called window_system_id there now) Change-Id: I9248bcceaa2d21d34133dea80697776df0aa8c6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151560 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-04-28qt a11y: Forward changes to active stateMichael Weghorn
Forwarding of a11y state change events had in general been implemented in commit 8c3e8af0e60865ec6d38e2117efdb4ed2f10a20c Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Jun 17 17:29:19 2022 +0200 qt a11y: Forward STATE_CHANGED event as such , but that commit explicitly did not yet enable forwarding of changes to the `active` state; quoting from the commit message: > For some reason, forwarding changes to state `AccessibleStateType::ACTIVE` > resulted in Orca becoming unresponsive (stop talking) quite quickly. > That needs further analysis, so that state change isn't forwarded > to Qt for now. I no longer see this problem on Debian testing with Orca 43.1-1, current LO master and qtbase dev branch as of commit 589c6d066f84833a7c3dda1638037f4b2e91b7aa plus the pending Qt Gerrit change [1] ("a11y atspi: Implement TableCell methods Get{Column,Row}HeaderCells") in place. Without the latter qtbase change, I can observe Orca becoming unresponsive quite quickly when moving around in Calc after pressing Shift, which may be due to waiting for a timeout instead of receiving the proper reply to the AT-SPI methods that that Gerrit change implements. (S.a. QTBUG-113110 [2] for another scenario using a simple pyatspi script to trigger what is potentially the same underlying issue.) Therefore, drop the old workaround. With this LO and the Qt change in place, Orca announces the focused and selected cell(s) in Calc with the qt6 VCL plugin and these steps: 1) start LO Calc with the qt6 VCL plugin 2) press Shift and wait a few seconds 3) move around using the arrow keys 4) select cells using Shift + arrow keys Ideally, this should also work without step 2, but apparently that step currently somehow triggers something relevant (creation of relevant a11y objects and registration of their listeners?) that doesn't yet happen without step 2. [1] https://codereview.qt-project.org/c/qt/qtbase/+/473907 [2] https://bugreports.qt.io/browse/QTBUG-113110 Change-Id: Icff8bbe7a6ee233407804c9098166945cdef4315 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151176 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-04-22qt a11y: Implement QAccessibleSelectionInterface added in Qt 6.5Michael Weghorn
This adds an implementation of the `QAccessibleSelectionInterface` that was added in Qt 6.5 in commit [1] commit 9d16d5e2245c26e5746fd7609300b84a2a983457 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Oct 11 15:23:54 2022 +0200 a11y: Add new QAccessibleSelectionInterface , s.a. QTBUG-105909 [2]. The `QAccessibleSelectionInterface` is currently still marked as preliminary in Qt, so changes to the API *might* still happen and require an update of the implementation here as well). Quoting from the commit message of the above commit: > This interface is marked \preliminary until: > > 1. There is a working a11y bridge for macOS/VoiceOver > 2. There is a working a11y bridge for Windows/UI Automation > 3. There is a working a11y bridge for linux/AT-SPI > 4. There is at least one implementation (e.g. QAccessibleTable) > that implements it successfully (second candidate: > Qt Quick TableView [...]) The AT-SPI bridge (point 3 from above) has been implemented in [3] commit ece2feee0317b582a56a0bfc783f11fe67d3edee Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Oct 11 15:24:04 2022 +0200 a11y atspi: Bridge newly introduced QAccessibleSelectionInterface , an implementation for `QAccessibleTable` (point 4 from above) was added in [4] commit 092bbc9ad30c6cd7389053dc4b332cc762693676 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Oct 12 07:07:48 2022 +0200 a11y: Implement QAccessibleSelectionInterface for item views . The Qt Gerrit changes for the macOS implementation (point 1 from above) and the Windows/UIA implementation (point 2 from above) are currently still awaiting review: [5] [6] To avoid duplication, just call the newly added methods `QtAccessibleWidget::selectedItemCount` and `QtAccessibleWidget::selectedItem` from the `QAccessibleTableInterface` methods `QtAccessibleWidget::selectedCellCount` and and `QtAccessibleWidget::selectedCells`, and therefore implement the former also for Qt < 6.5. Sample use of the interface from Accerciser's IPython console (with 18 cells selected in Calc and the spreadsheet object selected in Accerciser's a11y object tree; screencast attached to QTBUG-105909 [2]): In [10]: acc.get_interfaces() Out[10]: ['Accessible', 'Component', 'Selection', 'Table'] In [11]: sel = acc.querySelection() In [12]: sel.nSelectedChildren Out[12]: 18 In [13]: sel.getSelectedChild(0).name Out[13]: 'B1' In [14]: sel.deselectSelectedChild(1) Out[14]: True In [15]: sel.deselectChild(1) Out[15]: True In [16]: sel.selectChild(0) Out[16]: True In [17]: sel.clearSelection() Out[17]: True In [18]: sel.selectAll() Out[18]: True [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=9d16d5e2245c26e5746fd7609300b84a2a983457 [2] https://bugreports.qt.io/browse/QTBUG-105909 [3] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=ece2feee0317b582a56a0bfc783f11fe67d3edee [4] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=092bbc9ad30c6cd7389053dc4b332cc762693676 [5] https://codereview.qt-project.org/c/qt/qtbase/+/451353 [6] https://codereview.qt-project.org/c/qt/qtbase/+/451646 Change-Id: Iac3c050448183610af3bd3b10a56e82d7d52cb91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138750 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-04-15qt a11y: Send QAccessible::ObjectCreated event for correct objectMichael Weghorn
When an `AccessibleEventId::CHILD` event with its s `NewValue` set is received, that means that this a11y child object has been created, so the `QAccessible::ObjectCreated` event needs to be sent for the newly created object, not the accessible interface of the listener (which is the parent). This makes announcement of (part of) the font color popup button in Writer's toolbar generally work with Orca and the qt6 VCL plugin e.g. the buttons in the popup are now announced (but the colors are not yet). Adapting this for the case where a child has been removed (bridged to Qt as `QAccessible::ObjectDestroyed` event) would currently results in crashes when closing the application e.g. after using the character font color popup in the Writer toolbar. This needs further investigation, so don't send the event for now, but add a `SAL_WARN`. Also warn when receiving a `CHILD` event with neither `OldValue` nore `NewValue` set, since that shouldn't happen, s.a. documentation in `offapi/com/sun/star/accessibility/AccessibleEventId.idl`. Change-Id: I183e71de061489fdc9751620820268f280f1949f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150417 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-04-12qt: Don't show non-visible menu entriesMichael Weghorn
Take the visibility of the menu item (that e.g. gets set in `QtMenu::ShowItem`) into account when updating the menu in `QtMenu::DoFullMenuUpdate`. With this in place, only the relevant entry is shown in the context menu for items in the character table in the special characters dialog (Writer: "Insert" -> "Special Character") while previously, the "Add to favorites" and "Remove from favorites" entries would both be shown at the same time regardless of whether the character was present in the favorites or not. (Both entries would actually do the same: add the character if it was not present in the favorites, remove it if it was already there...). Change-Id: Ica5f07d6009d97db2df0540293b096565bf1dd52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150285 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-04-02tdf#152979 qt: Re-add workaround for X11 modality change w/ hide/showMichael Weghorn
Essentially add back the workaround originally added in commit e770bacc85a0eec96de77068d61b03f374b3cdec Date: Sun Jun 2 21:01:33 2019 +0000 Qt5 workaround modal change after show bug but then dropped again in commit 2dc6bdd1d5789ace0500cad90f5d2eb930888bb9 Date: Wed Jun 5 17:39:45 2019 +0000 tdf#125692 SalObject always holds a SystemChildWindow , since it turns out that it is still needed for other use cases than the original one from tdf#125692, as the freeze of the basic IDE dialog dialog preview described in tdf#152979. The qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window issue mentioned there is apparently also worked around in upstream Qt tests, s. this qtbase commit [1]: commit 3714e51436eebb64873c58dc36cf89ef8f139f09 Author: Volker Hilsheimer <volker.hilsheimer@qt.io> Date: Mon Sep 20 13:44:26 2021 +0200 QWidgetWindow: Stabilize test on Xcb Showing, hiding, and showing a window can result in the Xcb QPA plugin warning about qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window The point of the test is to verify that we get a paint event on a window that is shown again after having been hidden, not to verify that async windowing systems can handle a show/hide/show sequence. So wait for the window being exposed before we hide it. Pick-to: 6.2 5.15 Change-Id: If91a9926613645e78e332dacff34bd57e4034b6f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Decrease the sleep from the original 250 ms to 100 ms, since tdf#152979 comment 14 mentions that this is enough. [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3714e51436eebb64873c58dc36cf89ef8f139f09 Change-Id: I57ed520d0df85b7a3bcf47c2f9314754649482ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149912 Tested-by: Jenkins Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com>
2023-03-29tdf#149805 tdf#151677 tdf#152217 tdf#154043 tdf#153458 tdf#153800 Revert ↵Michael Weghorn
"VCL expect ... correct frame size for native menubars" This reverts commit afc828b9833b7a612369e95606ba56d41ef2c369 Date: Sat May 28 23:47:21 2022 +0200 VCL expect correct frame size for native menubars ... and renove the wrong framesize hack in the Qt backend because it caused several regressions and unfortunately the commit also doesn't fix all of the bugs mentioned in its commit message (while some previous patch sets of the change did address more, yet had other issues, s.a. the discussion in the commit's Gerrit change [1]). While e.g. the drag and drop issues reported in tdf#153458 and tdf#153800 could be fixed by translating the event position using `mapToParent()` (as is done in `QtWidget::fillSalAbstractMouseEvent` with the above commit in place), I currently don't see how to address the other issues and the overall direction of the change is not fully clear to me at this point. (There are also other pending changes in the relation change still pending in Gerrit that would presumably need more work/analysis.) After all, it seems the best way forward to revert the commit for now. This also reverts the follow-up commit commit 25da92004038c03c0feedf373e8038e7ee3e0c37 Date: Thu Jul 21 11:33:02 2022 +0200 Make JunitTest_toolkit_unoapi_1 succeed again on macOS that fixed a test failure introduced by the above commit. Luckily, there seem to be no follow-up commits that depend on this and the commits can be reverted cleanly without the need to resolve any conflicts manually. This reverts commit 25da92004038c03c0feedf373e8038e7ee3e0c37. This reverts commit afc828b9833b7a612369e95606ba56d41ef2c369. [1] https://gerrit.libreoffice.org/c/core/+/135082 Change-Id: I4c099ad7de8cbbad10da391ede4770d8c748fbde Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149495 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-03-14Related tdf#129547 and tdf#154136: add COLON keyJulien Nabet
Change-Id: I17978dbb100fbfa6f6ddbbbdf96872076bc2a289 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86713 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-03-06qt a11y: Handle all QAccessible::Relation flagsMichael Weghorn
The bits/flags in `QAccessible::Relation` can be set in any combination, while the previous code would only properly handle the case that `QAccessible::AllRelations` is set. This would e.g. mean that QtAccessibleWidget::relations(QAccessible::FlowsTo | QAccessible::FlowsFrom) would not return both relations as it should. The previous handling of the case that just a single flag is set also looks odd, since it would use the sal_Int16 value of the UNO relation as an index into the set of relations... Fix this by always iterating over all relations and applying the filter in `lcl_appendRelation` (only append those that match the filter). (At least for AT-SPI, the previous handling should not have caused any issues in practice, since Qt's AT-SPI bridge always passes `QAccessible::AllRelations` from what I can see.) Change-Id: Icc21ac252db026f607fe8d6041252916b1d9e3a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148352 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-03-06qt a11y: Add mapping for relations added in Qt 6.6Michael Weghorn
Map `AccessibleRelationType::CONTENT_FLOWS_FROM`, `AccessibleRelationType::CONTENT_FLOWS_TO` and `AccessibleRelationType::DESCRIBED_BY` to the Qt equivalents added in Qt 6.6 and vice versa. As described in more detail in commit e55713dffbe8d8eba18068f6c2af14c10b787220 Date: Fri Feb 17 15:25:37 2023 +0100 qt a11y: Invert relation type to match Qt's semantic , the "inverse" relation needs to be used when mapping to/from the Qt relation. For example the Orca screen reader on Linux makes use of the FlOWS_FROM and FLOWS_TO relations. So far, when using the qt6 VCL plugin with Orca running, moving focus to a Writer paragraph resulted in these warnings being emitted: warn:vcl.qt:220606:220606:vcl/qt6/../qt5/QtAccessibleWidget.cxx:218: Unmatched relation: 1 warn:vcl.qt:220606:220606:vcl/qt6/../qt5/QtAccessibleWidget.cxx:218: Unmatched relation: 2 and thus Orca not being able to make use of those relations. Sample use in Accerciser's Python console, with a Writer document having three paragraphs with texts "First", "second", and "third" and the a11y object of the second paragraph's a11y object selected in Accerciser's a11y tree view: In [1]: acc.queryText().getStringAtOffset(0, pyatspi.TEXT_GRANULARITY_PARAGRAPH) Out[1]: ('second', 0, 6) In [2]: acc.get_relation_set() Out[2]: [<Atspi.Relation object at 0x7fccc36862c0 (AtspiRelation at 0x421e100)>, <Atspi.Relation object at 0x7fccc358c280 (AtspiRelation at 0x4493c60)>] In [3]: first_relation = acc.get_relation_set()[0] In [4]: first_relation.get_n_targets() Out[4]: 1 In [5]: first_relation.get_relation_type() Out[5]: <enum ATSPI_RELATION_FLOWS_FROM of type Atspi.RelationType> In [6]: first_relation.get_target(0) Out[6]: <Atspi.Accessible object at 0x7fccc35aa4c0 (AtspiAccessible at 0x4479820)> In [7]: first_relation.get_target(0).queryText().getStringAtOffset(0, 1) Out[7]: ('First', 0, 5) In [8]: second_relation = acc.get_relation_set()[1] In [9]: second_relation.get_n_targets() Out[9]: 1 In [10]: second_relation.get_relation_type() Out[10]: <enum ATSPI_RELATION_FLOWS_TO of type Atspi.RelationType> In [11]: second_relation.get_target(0).queryText().getStringAtOffset(0,1) Out[11]: ('third', 0, 5) (QTBUG-105864 [1] also has a sample doc and pyatspi script that can be used for testing.) Qt commit adding the relations [2]: commit f5358e5932bc8701621389c265c4ea86c92c536c Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Feb 17 13:48:38 2023 +0100 a11y: Add new relations DescriptionFor, Described, Flows{From,To} This is equivalent to the corresponding relation types defined in the IAccessible2 spec [1] (IA2_RELATION_DESCRIPTION_FOR, IA2_RELATION_DESCRIBED_BY, IA2_RELATION_FLOWS_FROM, IA2_RELATION_FLOWS_TO) and for AT-SPI on Linux [2] (relation types ATSPI_RELATION_DESCRIPTION_FOR, ATSPI_RELATION_DESCRIBED_BY, ATSPI_RELATION_FLOWS_FROM, ATSPI_RELATION_FLOWS_TO). User Interface Automation (UIA) on Windows also has corresponding properties for 3 of them [3]: UIA_DescribedByPropertyId, UIA_FlowsFromPropertyId, UIA_FlowsToPropertyId. This commit adds the new flags and implements the mapping for the AT-SPI case. Note that the relation type is conceptually always "inverted" when comparing Qt and AT-SPI (or Qt and UIA) as clarified in afbfe30093d49eff0ec4c28c220d33c233b9f807. "QAccessible::Description" instead of "QAccessible::DescriptionFor" would align better with the naming scheme of the other relations, but that is already used in the Text enum. [1] https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/group__grp_relations.html [2] https://lazka.github.io/pgi-docs/Atspi-2.0/enums.html#Atspi.RelationType [3] https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids [ChangeLog][QtGui][QAccessible::RelationFlag] Added new relation flags DescriptionFor, Described, FlowsFrom and FlowsTo. Fixes: QTBUG-105864 Change-Id: If2d46099eeea75e177358c821d1ae833a553bd0e Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> [1] https://bugreports.qt.io/browse/QTBUG-105864 [2] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=f5358e5932bc8701621389c265c4ea86c92c536c Change-Id: I6e5d78fb26f62a6f1745d4f94647e8dc0fe2abfd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138687 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-03-04tdf#153803 qt: Let Qt style draw combobox popup bordersMichael Weghorn
... and listbox popup borders as well. Declare suppport for native drawing of focus for pushbuttons, since the Qt-based VCL plugins take care of drawing focus for controls. As far as I can see, there is no need to actually implement drawing of focus separately for the Qt-based VCL plugins, though, since that is already handled by the `ControlState::FOCUSED` state when drawing the entire control. Support for this is what `ComboBox::ImplInit` and `ListBox::ImplInit` check and if it's not supported, they enable double buffering for the window (which would have the result that the `pWin` in `ImplDrawFrame` in vcl/source/window/decoview.cxx would be nullptr and thus no native drawing of the frame would happen), s.a. commit d4714b0fdb81e6e561ae526cc517ecc9a40a603e Date: Mon Jun 17 17:02:54 2019 +0200 tdf#101978 vcl combobox/listbox floating window: avoid flicker With this in place, the border in the popup windows for listboxes and comboboxes are drawn by the Qt style. Yet another way to achieve this would be to support drawing `ControlPart::ListboxWindow` for `ControlType::Listbox`, so that the other rendering path in `ImplSmallBorderWindowView::DrawWindow` is taken, but that is currently complicated by the fact that bounding and content rect are not really used consequently there, so that would have to be cleaned up first, s.a. the commit message in commit 5c96e813bed3293605f8d746f188cc051d1e5949 Date: Thu Feb 2 15:27:37 2023 +0000 tdf#150451 Fix borders in Editbox controls (kf5) for more details. Change-Id: I8cd2396e7075a475e53e016acbb16d6fb54bad2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148160 Tested-by: Jenkins Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com>
2023-03-02tdf#152073 tdf#153895 basicide: Set bg color for border winMichael Weghorn
As described in the original commit to address tdf#152073 ("Glitch rendering line numbers in Basic IDE editor (kf5 only)"), the fact that the KDE Breeze style's frame border is partly transparent was causing artifacts in the Basic IDE: commit 6f4b8b7cfe2907b7da46eec6951a0e09b836a6de Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Jan 31 16:08:53 2023 +0100 tdf#152073 qt: Draw background when drawing frame For native drawing of a frame (border), use the window background color as default color. As mentioned in commit f39f21d92ec83c3a5062f29dd26214fc83012c06 ("tdf#138010 (IV) VclScrolledWindow: Use actual border width"), the Qt/KDE Breeze style uses a frame width of 2, with the actual 1 pixel border being surrounded by a 1 pixel padding/margin. Transparent background did not ensure that the 1 pixel padding/margin is repainted and could thus result in artifacts from what was painted to that location previously (s. the Basic IDE editor example from tdf#152073). [...] However, there are cases when a transparent background is actually wanted, like in the print dialog (tdf#153895). Therefore, revert the original commit mentioned above and explicitly set a background color for the border windows of the involved windows in the Basic IDE instead, which is in line with the alternative already mentioned in the above commit ("An alternative might be to explicitly draw the background further up the call stack, [...]."), but enables transparency in the qt5/qt6/kf5-specific drawing for the frame again. Change-Id: Ifb4deb80c6ae245ec630a4fdc23f675e5587836c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148117 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-03-01tdf#153869 qt: Unminimize window when requestedMichael Weghorn
Remove the `Qt::WindowMinimized` state from the widget's window states if the `SalFrameToTop::RestoreWhenMin` flag is set to request restoring the minimized window. Change-Id: I0cb67f28c1e9c3f48a9a234702a4aaa7e3ffec8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148036 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-21tdf#144302 tdf#153333 qt: Load cursor from icon themeMichael Weghorn
Load cursor from the icon theme similar to how the gtk VCL plugins do it. This not only allows using the themed cursor icons, but also helps avoid QTBUG-95434 [1] ("Bitmap cursors not supported on QtWayland") that would result in no cursor being shown on Wayland at all when our custom bitmap cursors are used. [1] https://bugreports.qt.io/browse/QTBUG-95434 Change-Id: Id65db4e7d71b8cee8a514c06c21c59dcc2afa889 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147379 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-20qt a11y: Invert relation type to match Qt's semanticMichael Weghorn
As Jan Arve Sæther pointed out in a review comment [1] for a pending Qt change to add more a11y relation types to Qt, Qt's semantic for relations is basically the other way around (i.e. inversed) as compared to the semantic used by AT-SPI or LO. For example, if an a11y interface `interfaceA` is the label for another a11y interface `interfaceB`, interfaceA->relations() will contain a pair { interfaceB, QAccessible::Labelled } since the target `interfaceB` is labelled by `interfaceA`. On the other hand in LO, the `XAccessibleRelationSet` for an `XAccessibleContext` has the role that the a11y object itself has *for* the targets, i.e. in that case the interfaceA->getAccessibleRelationSet() would contain an item of type `AccessibleRelationType::LABEL_FOR` because `interfaceA` is a label for the relation target `interfaceB`. Therefore, adapt the mapping between the relation types accordingly. AT-SPI's semantic/handling matches the one that LO has again, which is taken care of by the fact that Qt maps the relation types the other way around in it's AT-SPI bridge again. [2] There's also a pending Qt change [3] to clarify the Qt doc. [1] https://codereview.qt-project.org/c/qt/qtbase/+/428174/comment/eef0cf38_e6ff7dea/ [2] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/qspi_constant_mappings.cpp?id=e8322a4cc043e1a150cc4c6b86ee2f9cf858cd24#n98 [3] https://codereview.qt-project.org/c/qt/qtbase/+/460414 Change-Id: Ic30d878afc477ad3c6a188d22f35078034f8123c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147223 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-20tdf#153614 qt: Set keyboard focus state when focused, tooMichael Weghorn
For example the Breeze theme only draws a light blue focus rectangle for list boxes when the `QStyle::State_KeyboardFocusChange` state is set in addition to `QStyle::State_HasFocus`. Therefore, set that state in addition to ensure that the focused control actually gets a focus indicator when moving there using the keyboard. Change-Id: Ib4b85f9140629e6b69c80b85e85913392a6c000f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147019 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-10Fix typoAndrea Gelmini
Change-Id: I14c04884eab36560c96dbc59b809a5871d87b75f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146750 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2023-02-10tdf#150451 Fix borders in Editbox controls (kf5)Rafael Lima
The bounding rectangle calculated for an Editbox in QtGraphics_Controls::getNativeControlRegion was not always enough to accommodate content and the borders. The KDE Breeze does not draw any borders if the total height of the bounding rectangle is smaller than the minimum size needed for content + frame at top and bottom, s. Style::drawFrameLineEditPrimitive in the Breeze style [1]. Therefore, ensure a minimum height of that size. The Breeze style also considers the type of the passed widget when retrieving the frame width using QStyle::pixelMetric [2], so pass a dummy `QLineEdit` in order to get the actual frame width of 6 that the Breeze style uses for line edits, rather than the default value of 2 that is returned when not passing any widget. Just do that for the minimum size calculation for now and not everywhere, because the handling for edit boxes here in the qt VCL plugins and in the calling code currently does all kinds of "interesting" things like doing extra size adjustments or passing the content rect where the bounding rect would be expected,... Ideally this should be cleaned up in the callers and all platform integrations in a follow-up commit to adhere to what the doc in vcl/inc/WidgetDrawInterface.hxx says, but this here keeps it working with existing code for now. (s.a. discussion in the Gerrit change for more details) Tested using various scaling factors: 1, 1.25, 1.5, 1.75 and 2.0. [1] https://invent.kde.org/plasma/breeze/-/blob/144ea45018d28758db07afd987d97318d56c4981/kstyle/breezestyle.cpp#L3527 [2] https://invent.kde.org/plasma/breeze/-/blob/144ea45018d28758db07afd987d97318d56c4981/kstyle/breezestyle.cpp#L555 Co-authored-by: Michael Weghorn <m.weghorn@posteo.de> Change-Id: If8cb4794c7f3ce1be4d1ee421c9c27ad5adf5da2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146516 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>