summaryrefslogtreecommitdiffstats
path: root/src/gui/platform/unix
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Qt Gui: Mark private APIs \internalTopi Reinio44 hours1-0/+1
| | | | | | | | | | Resolves multiple QDoc warnings of type "No output generated for X::Y because X is undocumented." Pick-to: 6.11 Task-number: QTBUG-141665 Change-Id: I6a597f6979151565fcee36964f892976964be75d Reviewed-by: Topi Reinio <topi.reinio@qt.io>
* Hook Qt::Key_Call and Qt::Key_Hangup for xkbMéven Car11 days1-0/+6
| | | | | | | | | As found in laptops, like thinkpads. And Key_Call for directfb. Change-Id: I7858f5c81cff43c1550716e4141eef8209e4794f Reviewed-by: David Edmundson <davidedmundson@kde.org>
* platform/unix: fix build with -no-feature-systemtrayiconNick Shaforostov2025-11-144-5/+9
| | | | | | | | | | | | make sure qdbustrayicon_p.h is included only once and only when systemtrayicon feature is enabled qdbuslistener: stop including unused qdbustrayicon_p.h this is a refactoring left-over Pick-to: 6.10 Change-Id: Ib848dae56e865dc05453f25c31a08fb2ec2e8305 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QDesktopUnixServices: Register with host app registryDavid Redondo2025-10-102-1/+57
| | | | | | | | | | | | | | | | | | | This is useful when accessing portal APIs when not sandboxed as it allows the portal to display info which app is making the request. For example the dialog that will be shown when QScreenCapture goes through the portal can show the app name. We need to do this as it can only be set before making any call to the portal at all which are done here for color picking or by the relevant platformthemes for settings. See the paragraph at the top of https://flatpak.github.io/xdg-desktop-portal/docs/api-reference.html and https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.host.portal.Registry.html Fixes: QTBUG-133401 Pick-to: 6.10 Change-Id: Ie55c371c6a19b3197f7798ee6233c2f19b18a6f6 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* CRA review: gui/platform/unix/*Liang Qi2025-09-2525-0/+25
| | | | | | | | | | | | | | | | | | The files that we maintain by hand are marked as significant. * QDBus and QSettings are in used very often in most classes. * D-Bus and QSettings are security critical, but the implementation is merely a user, and does not do any parsing or communication on its own. Notes: * dbusmenu and dbustray sub directories in seperate changes. * qdesktopunixservices_p.h as security critical which just follows qdesktopunixservices.cpp in ad98583911a8252e56648cd2efc748b09b3691f3 QUIP: 23 Task-number: QTBUG-134573 Pick-to: 6.10 6.8 Change-Id: I5cdcaedb1f987a86cf7a16c843ebfe7f0e7238c7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CRA review: gui/platform/unix/dbustray/*Liang Qi2025-09-258-1/+8
| | | | | | | | | | | | The files that we maintain by hand are marked as significant. * D-Bus is security critical, but the Qt DBus Tray implementation is merely a user, and does not do any parsing or communication on its own. QUIP: 23 Task-number: QTBUG-134573 Pick-to: 6.10 6.8 Change-Id: I91d58c1598bb92bedfe613294897233073edc4f2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CRA review: gui/platform/unix/dbusmenu/*Liang Qi2025-09-2512-0/+12
| | | | | | | | | | | | | The files that we maintain by hand are marked as significant. D-Bus is security critical, but the Qt DBus Menu implementation is merely a user, and does not do any parsing or communication on its own. QUIP: 23 Task-number: QTBUG-134573 Pick-to: 6.10 6.8 Change-Id: I2404638024884c0daa53fa9da6252b89d596f3ee Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QWaylandApplication::xkbContext()Dmitry Kazakov2025-09-121-0/+5
| | | | | | | | It is necessary for the apps that want to manually parse the stream of events from wl_keyborad. Change-Id: I8229ae6e43640d0e7b9597f5f7b35cba59db0f64 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* gui: Mark qdesktopunixservices.cpp as security criticalLiang Qi2025-07-221-0/+1
| | | | | | | | It tries to launch external applications like browser and etc. Pick-to: 6.10 6.9 6.8 Change-Id: I6564dc3af7c2bf76c99c2d5aa6dad2feacc94ff1 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QGnomeTheme, QGtk3Theme: Refactor and Simplify DBus InteractionsMohammadHossein Qanbari2025-05-308-282/+436
| | | | | | | | | | | | | | | | | | | | This patch refactors the DBus integration in both QGnomeTheme and QGtk3Theme to centralize and simplify the portal and settings access logic. Previously, the codebase contained duplicated and scattered DBus logic for querying GNOME/GTK appearance settings, such as color scheme and contrast, which were implemented separately in both QGnomeTheme and QGtk3Theme. The patch introduces a new QGnomePortalInterface class which encapsulates all DBus interactions related to GNOME/GTK appearance settings. The old DBus interface logic is removed from QGtk3Theme and QGnomeTheme, and replaced with calls to the unified QGnomePortalInterface. The update also ensures signal-based updates for theme and appearance changes via the new interface. Change-Id: I5440f7ac00f956b846b18bd890113af0044482f0 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Dbus: Enhance process of determining color scheme and contrastMohammadHossein Qanbari2025-05-303-36/+170
| | | | | | | | | | | | | | | | | | | | | | The XDG portal has changed some interfaces since version 2. We already support the changes in version 2. The DBus listener and GNOME theme do not work properly if the machine uses version 1. This patch ensures that the color scheme and contrast preferences work fine with the older version. Regarding contrast preference, the XDG desktop portal introduces the `contrast` interface in version 2. This patch uses the GNOME settings as a fallback method to determine the contrast preference in case the XDG contrast interface is not accessible. The contrast value retrieved from the DBus varies depending on the provider. Regarding the color-scheme interface, the only difference between XDG portal versions 1 and 2 is the method name. The method name to read the color-scheme value from the portal setting changed to `ReadOne` from `Read`. This is also used for reading the contrast value. Change-Id: Id4d81ecf5465bbbab64c41e431a8d4d86e63849a Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* QGnomeTheme: Enhance system color scheme detectionMohammadHossein Qanbari2025-05-292-28/+72
| | | | | | | | | | | | | | | | | | | | | | Previously, QGnomeTheme relied on the theme name to determine the system's color scheme when a "SettingChanged" signal was emitted via dbus. However, this approach overlooked the "color-scheme" property in the signal, which directly provides the updated light/dark mode information. This patch updates QGnomeTheme to use the "color-scheme" property from the dbus signal, ensuring accurate detection of changes in the system's color scheme. The theme name fallback is retained for scenarios where "color-scheme" data is not provided. See also the XDG Desktop Portal documentation: https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Settings.html Related to this commit: 4ac89dad78772ce90649b9846efa17319deba28f Task-number: QTBUG-133595 Change-Id: I2c3982fd9871d76184f1b4233d95e7a5e0a34ad1 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* dbusmenu: Skip registration with the registrar on WaylandVlad Zahorodnii2025-04-111-14/+19
| | | | | | | | | | | | | | | | | | The RegisterWindow request expects a window id. The QDBusMenuBar uses the QWindow::winId() property for that. On X11, the winId() returns the XID of the window. On Wayland, the winId() returns an integer that has meaning only to the application, there are no global window ids on Wayland. The menubar should be registered using other means, for example using the kde-appmenu protocol, which QtWayland already does. The QDBusMenuBar can skip synchronously calling the RegisterWindow request on Wayland because the menu will be registered using a different api. Pick-to: 6.9 Change-Id: I6b2968624c5c9ddbdc93807f65eac369dc7a993a Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Liang Qi <liang.qi@qt.io>
* QGnomeTheme: Prevent leak of QDBusPendingCallWatcherDavid Redondo2025-04-102-3/+4
| | | | | | | | Otherwise the watcher can outlive the theme and the connected lambda calls into the already destroyed theme. Change-Id: I55e7834d1eb806d9f5f1945a4e1016d14b2969b6 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Remove double negation ifdefs in QKdeThemeAxel Spoerl2025-04-072-10/+10
| | | | | | | Replace ifndef QT_NO_DBUS antipattern by if QT_CONFIG(dbus). Change-Id: I186c779f3c4ed36a1fb082993e792e9c28ee20f0 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Remove double negation ifdefs in QGnomethemeAxel Spoerl2025-04-072-14/+14
| | | | | | | Replace ifndef QT_NO_DBUS antipattern by if QT_CONFIG(dbus). Change-Id: I7dd44a6f5496e6f12c16ee1ecef3a004e5580d17 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Remove double negation ifdefs in QGenericUnixThemeAxel Spoerl2025-04-072-12/+12
| | | | | | | Replace ifndef QT_NO_DBUS antipattern by if QT_CONFIG(dbus). Change-Id: Ifca080594358df0d836db25721b43ad31129cf48 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* GnomeTheme: Add missing QtDBus includesMichael Weghorn2025-03-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following build error seen in a local -no-pch Clang 19 build: [1677/16903] Building CXX object qtbase/src/gui/CMakeFiles/Gui.dir/platform/unix/qgnometheme.cpp.o FAILED: qtbase/src/gui/CMakeFiles/Gui.dir/platform/unix/qgnometheme.cpp.o /usr/bin/ccache /usr/bin/clang++ -DENABLE_PIXMAN_DRAWHELPERS -DGui_EXPORTS -DMD4C_USE_UTF8 -DQT_ASCII_CAST_WARNINGS -DQT_BUILDING_QT -DQT_BUILD_GUI_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_DEPRECATED_WARNINGS -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_LEAN_HEADERS=1 -DQT_MOC_COMPAT -DQT_NO_CAST_TO_ASCII -DQT_NO_CONTEXTLESS_CONNECT -DQT_NO_EXCEPTIONS -DQT_NO_FOREACH -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_QASCONST -DQT_NO_QEXCHANGE -DQT_NO_QSNPRINTF -DQT_NO_STD_FORMAT_SUPPORT -DQT_NO_USING_NAMESPACE -DQT_QPA_DEFAULT_PLATFORM_NAME=\"xcb\" -DQT_STRICT_QLIST_ITERATORS -DQT_USE_NODISCARD_FILE_OPEN -DQT_USE_QSTRINGBUILDER -D_GLIBCXX_ASSERTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/home/michi/development/git/qt5/qtbase/src/gui/Gui_autogen/include -I/home/michi/development/git/qt5/qtbase/include -I/home/michi/development/git/qt5/qtbase/include/QtGui -I/home/michi/development/git/qt5/qtbase/src/gui -I/home/michi/development/git/qt5/qtbase/src/gui/../3rdparty/VulkanMemoryAllocator -I/home/michi/development/git/qt5/qtbase/src/gui/../3rdparty/D3D12MemoryAllocator -I/home/michi/development/git/qt5/qtbase/include/QtGui/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtGui/6.10.0/QtGui -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/libmount -I/usr/include/blkid -I/home/michi/development/git/qt5/qtbase/src/gui/../3rdparty/md4c -I/home/michi/development/git/qt5/qtbase/include/QtCore -I/home/michi/development/git/qt5/qtbase/mkspecs/linux-clang -I/home/michi/development/git/qt5/qtbase/src/corelib -I/home/michi/development/git/qt5/qtbase/include/QtCore/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtCore/6.10.0/QtCore -I/home/michi/development/git/qt5/qtbase/include/QtDBus -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/sysprof-6 -isystem /usr/include/harfbuzz -isystem /usr/include/freetype2 -isystem /usr/include/libpng16 -D_GLIBCXX_DEBUG -g -std=gnu++17 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fPIC -Werror "-Wno-error=#warnings" -Wno-error=deprecated-declarations -Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated-copy-with-user-provided-copy -Wno-error=unused-but-set-variable -fcf-protection=full -ftrivial-auto-var-init=pattern -fstack-protector-strong -fno-exceptions -pthread -MD -MT qtbase/src/gui/CMakeFiles/Gui.dir/platform/unix/qgnometheme.cpp.o -MF qtbase/src/gui/CMakeFiles/Gui.dir/platform/unix/qgnometheme.cpp.o.d -o qtbase/src/gui/CMakeFiles/Gui.dir/platform/unix/qgnometheme.cpp.o -c /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:41:32: error: incomplete type 'QDBusMessage' named in nested name specifier 41 | QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), | ^~~~~~~~~~~~~~ /home/michi/development/git/qt5/qtbase/src/dbus/qdbusconnection.h:34:7: note: forward declaration of 'QDBusMessage' 34 | class QDBusMessage; | ^ /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:41:22: error: variable has incomplete type 'QDBusMessage' 41 | QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), | ^ /home/michi/development/git/qt5/qtbase/src/dbus/qdbusconnection.h:34:7: note: forward declaration of 'QDBusMessage' 34 | class QDBusMessage; | ^ /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:47:9: error: no template named 'QDBusReply' 47 | QDBusReply<QVariant> reply = dbus.call(message); | ^ /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:66:9: error: unknown type name 'QDBusPendingCallWatcher'; did you mean 'QDBusPendingCall'? 66 | QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(dbus.asyncCall(message)); | ^~~~~~~~~~~~~~~~~~~~~~~ | QDBusPendingCall /home/michi/development/git/qt5/qtbase/src/dbus/qdbusconnection.h:35:7: note: 'QDBusPendingCall' declared here 35 | class QDBusPendingCall; | ^ /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:66:48: error: unknown type name 'QDBusPendingCallWatcher'; did you mean 'QDBusPendingCall'? 66 | QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(dbus.asyncCall(message)); | ^~~~~~~~~~~~~~~~~~~~~~~ | QDBusPendingCall /home/michi/development/git/qt5/qtbase/src/dbus/qdbusconnection.h:35:7: note: 'QDBusPendingCall' declared here 35 | class QDBusPendingCall; | ^ /home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qgnometheme.cpp:66:48: error: allocation of incomplete type 'QDBusPendingCall' 66 | QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(dbus.asyncCall(message)); | ^~~~~~~~~~~~~~~~~~~~~~~ /home/michi/development/git/qt5/qtbase/src/dbus/qdbusconnection.h:35:7: note: forward declaration of 'QDBusPendingCall' 35 | class QDBusPendingCall; ... Change-Id: I40bc994f7af3dd5a314d051018991d81087844b4 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* GnomeTheme: read the initial color-scheme value from dbusOliver Eftevaag2025-03-281-18/+39
| | | | | | | | | | | | | | The initial color-scheme value was never initialized, and would thus, always be 'Unknown', until the user changes the color scheme in the system settings. The xdg settings portal method ReadAll is currently omitting the contrast setting from the reply. Because of this, two separate dbus calls are necessary to get both the initial color-scheme and contrast setting. Change-Id: Ie32371efd830e19727922efd2c9c32595395d11a Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Add virtual member QPlatformTheme::contrastPreference()Oliver Eftevaag2025-03-285-12/+70
| | | | | | | | | | | | | | | | | This function can be overridden by individual platform themes, in order to read contrast settings from the platform's system settings, and report the result back to Qt. This information is relevant for our styles, and can be used to determine color palette values, and additional elements like outline thickness for controls/widgets. Currently only the Windows, macOS, Gnome and Flatpak themes support this feature. Task-number: QTBUG-133595 Change-Id: I3aff519aa7f07c8b2fdcc1e7fb35ec719ab8efcc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QDesktopUnixServices: don't leak the QDBusPendingCallWatcherMarc Mutz2025-03-282-3/+6
| | | | | | | | | | | | | | | | | | | | | When, like in tst_QApplication::qtbug_103611(), a QApplication object is destroyed without calling exec(), then QDesktopUnixServices leaked its QDBusPendingCallWatcher, because the connection to the slot that would deleteLater() the watcher was disconnected, and the watcher had no QObject parent that would otherwise reap it. Fix by actually deleting the watcher in ~QDesktopUnixServices(), if it still exists (which implies disconnecting, of course). This makes tst_QApplication asan-clean on Linux/X11 (was: "75466 bytes leaked in 965 allocations"). Amends de609d84b9cee4a481d1718c00b09105d8c2ae69. Pick-to: 6.9 6.8 6.5 Change-Id: I28a08abdb1be65a8746702ad304282de4e1100d7 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QGenericUnixTheme: Fix build w/o xcb and waylandAxel Spoerl2025-03-271-3/+4
| | | | | | | | | Add ifdef condition to consider QKdeTheme only if Qt is built either with wayland or xcb. Fixes: QTBUG-135204 Change-Id: I27941bf6bd576c1532ac23992c1c94f9ace53683 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Correctly name pragma macro in qgenericunixtheme_p.hAxel Spoerl2025-03-251-3/+3
| | | | | | | | | | | It was forgotten to rename the macro from plural to singular. Fix it. Amends 53fb13456fffe8bfd192f9197c6d1703854b49a2. Task-number: QTBUG-132929 Change-Id: I76def400324ae47e61528e62f8589c05c5b3e4e2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QKdeTheme: de-inline dtor; make ctor explicitMarc Mutz2025-03-242-1/+5
| | | | | | | | | | | | | | | | | | | | 1/ A QStringList and an int are not a faithful representation of a KDE Theme, so the ctor should be explicit. Make it so™. 2/ As a polymorphic class, the (undeclared, therefore inline) dtor may cause weak vtables to be emitted, with all the bad side-effects described in the docs of -Wweak-vtable and QTBUG-45582. Mark the dtor out-of-line in the usual way (= default'ing, but in the .cpp file). Amends 53fb13456fffe8bfd192f9197c6d1703854b49a2. Task-number: QTBUG-45582 Task-number: QTBUG-132929 Task-number: QTBUG-135037 Change-Id: Ie0c14e60d76d2205c2025598ac31a917dbf870b1 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QKdeTheme: Don't leak resources on shutdownFabian Kosmale2025-03-211-0/+1
| | | | | | | | | | | | The theme stores an array of pointers to allocated QFonts, which need to be freed. While this is not a "hard" leak (the OS will clean up the memory on shutdown, and QKdeTheme lives as long as the application), it creates ASAN warnings, which distract from more severe issues. Change-Id: Iaa57138e5273c300c616ba85340283f18a267b09 Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
* QDBusListener: remove ChangeSignal's defaut ctorMarc Mutz2025-03-212-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Coverity complained that the default ctor didn't initialize its two members. This is true, and it even remains true if the user of the type explicitly asks for value-initialization (ChangeSignal s = {}) as opposed to default-construction (ChangeSignal s;). Remove the default ctor as the minimally-possible fix. It was only needed because of a call to QFlatMap::value(1-arg), which, incidentally, constitutes a double-lookup, because it is following a contains() call. Replacing that combo with find() and it.value() avoids the double-lookup and removes the need for the type to be default-constructible. Amends 0328e4297e339de8a2acd84979c667936f6fadf8. Coverity picked this up as a new issue following 53fb13456fffe8bfd192f9197c6d1703854b49a2, so there probably is another CID for this for the same code in the old location, but my Coverity search-foo is insufficient to find the corresponding CID, without undue effort, so I didn't try. Coverity-Id: 478089 Pick-to: 6.9 6.8 6.5 Change-Id: I912bf2af343b98fe62faf2d4bf8a6d1f385593e8 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QGenericUnixTheme: de-pessimise xdgFileIcon()Marc Mutz2025-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coverity complained about a missing std::move() on the return in L270, but adding that would, of course, not help, because the QIcon object being returned is const. If NRVO would (at least theoretically) kick in, this would be harmless, but NRVO can't kick in, because it's unknown at the time of construction whether this will be the object that end up being returned to the caller, so the compiler will have to copy the object into the return value when that decision is made (post the isNull() check). By not making the object const, we enable it to be moved instead, which is what Coverity originally wanted us to do. Amends 46ea82188e3678c5b7a2338d536da6c621822f2f. Coverity picked this up as a new issue following 53fb13456fffe8bfd192f9197c6d1703854b49a2, so there probably is another CID for this for the same code in the old location, but my Coverity search-foo is insufficient to find the corresponding CID, without undue effort, so I didn't try. Not picking back, as this is a "low impact" issue, according to Coverity (and me). Coverity-Id: 478087 Change-Id: I7f36cdbe83525a23ea0dfa27157091dbdf73a28b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Clean up QKdeThemeAxel Spoerl2025-03-192-62/+68
| | | | | | | | | | | | | | | | QKdeTheme used a ResourceHelper class to implement std::array of QFont and QPalette points. The latter has never been used: Only the first row was polulated with a KDE system palette. All other rows remained nullptr. Remove ResourceHelper. Make the font array a member of QKdeThemePrivate. Use a QPalette pointer member of QKdeThemePrivate instead of the obsolete array a member of QKdeThemePrivate. Task-number: QTBUG-132929 Change-Id: Ia8254182b2b824363253e2bfc71648cdfe55a403 Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
* Re-implement QPlatformTheme::requestColorScheme() in QKdeThemeAxel Spoerl2025-03-172-13/+46
| | | | | | | | | | | | | | | | | | | QKdeTheme remained unresponsive to programmatic color scheme changes, after QPlatformTheme::requestColorScheme() had been introduced. Add functionality to QKdeTheme. Fall back to qt_fusion_palette, when the requested color scheme isn't supported by the current KDE theme (e.g. Adwaita-dark doesn't support light mode). Functionality has to be manually tested with the widget gallery example. Task-number: QTBUG-132929 Fixes: QTBUG-134023 Change-Id: I37e56cc36803dcb8527a897ddcada29b322a5ada Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
* QGenericUnixTheme: Fix build, adding missing #includesThiago Macieira2025-03-123-0/+6
| | | | | | | | | | | | qdbuslistener.cpp:105:5: error: ‘QJsonParseError’ was not declared in this scope qgenericunixtheme.cpp:247:21: error: invalid use of incomplete type ‘class QDBusConnectionInterface’ qkdetheme.cpp:91:109: error: ‘QSettings’ was not declared in this scope; did you mean ‘QString’? qkdetheme.cpp:712:30: error: ‘QStandardPaths’ has not been declared Probably amends 53fb13456fffe8bfd192f9197c6d1703854b49a2. Change-Id: I673a2fa3f34c162d4d76fffdf160ed8a7af1fc66 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Refactor qgeneericunixthemes_p.h/cppAxel Spoerl2025-03-119-933/+1090
| | | | | | | | | | | | | | | Header and implementation file of QGenericUnixTheme contained several helper functions and classes. It also contained the implementation of QGnomeTheme and QKdeTheme, both of which are not generic. Split qgenericunixthemes_p.h/cpp up into separate files. Group all helpers as static member functions in QGenericUnixTheme. Inherit QGnomeTheme and QKdeTheme from QGenericUnixTheme. Task-number: QTBUG-132929 Change-Id: Idfa6198a2b7f669edd009dc165375a9b2960fcad Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
* QGenericUnixTheme: reduce unnecessary relocationsMarc Mutz2025-03-061-32/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of static constexpr QL1SV objects (which force the compiler to allocate storage for them and therefore cause relocations), use inline functions or mere automatic objects (which don't). We'd normally call the inline functions fooKey() { return "foo"_L1; }, but since one of them "foo"s ends with "Key" already, put them into a namespace instead, the name of which is taken from the comment that used to introduce the static constexpr objects in the old code. For the QL1SVs in the ctor: port them to QStringLiterals, because their only use is to pass them to a function taking const QString&, so this saves allocations. There never was a need to make these objects static, as constexpr would be enough to force the compiler to constant-fold them. Unlike my earlier advice about how to create an empty QString most efficiently, don't keep using ""_L1, use u""_s. This is because there's no shared empty QString in Qt 6 anymore. It might still make sense to add a more light-weight way to create an empty QString, esp. one which is not referencing local data, but QString::_empty, to extend the lifetime of the payload until QtCore unload time, but that is outside the scope of the current patch. Difference: qgenericunixthemes.cpp.o: - 0000000000000000 l O .data.rel.ro.local 0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::signal - 0000000000000040 l O .data.rel.ro.local 0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::interface - 0000000000000080 l O .data.rel.ro.local 0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::path 00000000000000c0 l O .data.rel.ro.local 0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::service 0000000000000000 l d .data.rel.ro.local._ZTV24QGenericUnixThemePrivate 0000000000000000 .data.rel.ro.local._ZTV24QGenericUnixThemePrivate 0000000000000000 l d .data.rel.ro.local._ZTV16QKdeThemePrivate 0000000000000000 .data.rel.ro.local._ZTV16QKdeThemePrivate 0000000000000000 l d .data.rel.ro.local._ZTV18QGnomeThemePrivate 0000000000000000 .data.rel.ro.local._ZTV18QGnomeThemePrivate 0000000000000000 l d .data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE 0000000000000000 .data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE 0000000000000000 l d .data.rel.ro.local 0000000000000000 .data.rel.ro.local - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE - 0000000000000000 l d .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE 0000000000000000 l d .data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE 0000000000000000 .data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE 0000000000000000 u O .data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE 00000000000000d8 QMetaSequence::MetaSequence<QList<Qt::Key> >::value 0000000000000000 w O .data.rel.ro.local._ZTV24QGenericUnixThemePrivate 0000000000000020 .hidden vtable for QGenericUnixThemePrivate 0000000000000000 w O .data.rel.ro.local._ZTV18QGnomeThemePrivate 0000000000000020 .hidden vtable for QGnomeThemePrivate 0000000000000000 w O .data.rel.ro.local._ZTV16QKdeThemePrivate 0000000000000020 .hidden vtable for QKdeThemePrivate - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_root - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_signals - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_dbusLocation - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_dbusKey - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_provider - 0000000000000000 u O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_setting - 0000000000000000 u O .data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE 0000000000000070 .hidden QtPrivate::QMetaTypeInterfaceWrapper<void>::metaType RELOCATION RECORDS FOR [.data.rel.ro.local._ZTV24QGenericUnixThemePrivate]: RELOCATION RECORDS FOR [.data.rel.ro.local._ZTV16QKdeThemePrivate]: RELOCATION RECORDS FOR [.data.rel.ro.local._ZTV18QGnomeThemePrivate]: RELOCATION RECORDS FOR [.data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE]: - RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE]: RELOCATION RECORDS FOR [.data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE]: See https://stackoverflow.com/questions/19067010/finding-where-relocations-originate/19338343#19338343 for the script to generate this output. See https://www.akkadia.org/drepper/dsohowto.pdf Section 1.6 for why we care. Amends 0328e4297e339de8a2acd84979c667936f6fadf8. Pick-to: 6.9 6.8 6.5 Task-number: QTBUG-100536 Change-Id: I1fd65e3ed5bceeb2a49141834dbd12f4bf42cc8c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Add logging category for platform servicesDavid Redondo2025-02-251-9/+5
| | | | | | | Rather than being hidden behind a compile time flag or uncategorized Change-Id: I3bc1781351220441134fb9815644e905273a1e40 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add Qt::Key_KeyboardKai Uwe Broulik2025-02-171-0/+1
| | | | | | | | | Adds a "media key" for the "Keyboard settings" key found on some laptops. Change-Id: Id041a551844f095f1d7d2fd25d37346da30407a3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* QDesktopUnixServices: Fix #endif commentDavid Redondo2025-01-301-1/+1
| | | | | | | | So it doesn't confuse me or anyone else again Pick-to: 6.9 Change-Id: I8ad5d4cb1b00e0edaffa90ed67e30246211e1a97 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Platform: unix - avoid modifying the environmentTim Blechmann2025-01-291-7/+16
| | | | | | | | | | | | | | Modifying the process environment can cause crashes in application code that accesses the environment via non-qt functions on worker threads. When launching a process, we can avoid modifying the environment of the caller by using QProcess with setEnvironment. The codepaths without QProcess support is still prone to these issues and could potentially be improved via execve Task-number: QTBUG-129222 Pick-to: 6.8 6.9 Change-Id: I4e2d93abaa0e392b341041faaae0ffd11e225bcb Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QDesktopUnixServices: avoid to call virtual function in constructorLiang Qi2025-01-231-1/+1
| | | | | | | | This amends 1969b1a90a79dad049694bd1540f8627d5f26875 . Pick-to: 6.9 6.8 6.5 Change-Id: I1be4e229d531f8a91e1ad3133a5b62784d18bb41 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* platforms: rename QGenericUnixServices to QDesktopUnixServicesLiang Qi2025-01-213-28/+28
| | | | | | | | | | The implementation follows XDG Desktop Portal mostly, and is for desktop, not generic unix. Task-number: QTBUG-130884 Pick-to: 6.9 Change-Id: I88456abb37b8b23cfec00ee8eac8ffee9a65ed9f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QGenericUnixServices: avoid dbus calls on non xdg envsLiang Qi2025-01-211-0/+3
| | | | | | | Fixes: QTBUG-130884 Pick-to: 6.9 6.8 6.5 Change-Id: I2525293f776676cda63e61c3c5093045dbafcf38 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix the unsupported Q_UNREACHABLE_RETURN statement in constexpr functionsAlexey Edelev2025-01-171-3/+18
| | | | | | | | | | | | | | | GCC 8.x does not treat __builtin_unreachable() as constexpr and disallows using the Q_UNREACHABLE_RETURN macro. Guard the statements with the respective checks. Amends b0b34c56a99130bfc9c82cb006653ce6b8f0516e Pick-to: 6.8 6.9 Task-number: QTBUG-125285 Fixes: QTBUG-132804 Change-Id: I88cdbe3bae1a336edc255e3e93e8d948bde253da Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Replace qgetenv() calls converted to QString with qEnvironmentVariable()Thiago Macieira2025-01-012-5/+5
| | | | | | | | It's slightly more efficient. Pick-to: 6.9 Change-Id: Id5ac04fc27eee108c8e5fffd786c3d5f793a0a9d Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Guard the usages of QPlatformIntegration::services()Liang Qi2024-11-251-1/+2
| | | | | | | Task-number: QTBUG-130884 Pick-to: 6.8 6.5 Change-Id: I6c8060ce8b7a4e525c46e2e1fec227f46fe8c4d6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Introduce VxKeyboard input pluginMichał Łoś2024-10-301-0/+15
| | | | | | | | | | | | | | | | | | Introduce VxKeyboard plugin which is responsible for handling keyboard on VxWorks OS. Due to the fact that VxWorks is using its own, not fully compatible with Unix/Linux implementation of libevdev, it requires it's own plugin. This way, changes in evdev plugins will not be blocked/complicated by VxWorks stalled implementation. Implement VxKeyboard plugin and its backend, adding support for it in eglfs. This is a preparatory change, as there is no keyboard detection for VxWorks yet. Task-number: QTBUG-115777 Change-Id: I4ca5729c6f210fb7477bc31371a137071e12fdad Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* xcb: Report location of DBus menubar on window propertiesDavid Edmundson2024-10-104-7/+36
| | | | | | | | | | | | | | | KDE extended the DBus menubar protocol to report the DBus service and path on the window itself, this makes looking it up easier than going through a broker. On Qt5 this worked because we handled the entire DBus menu from scratch in KDE's own platformtheme, but given Qt now has direct dbusmenu bar support it makes sense to have the remaining reporting side all in one place. Change-Id: I78044992fa1840c40a66384033ed790ce0cd7f96 Task-number: QTBUG-116352 Reviewed-by: Liang Qi <liang.qi@qt.io>
* De-inline dtors of QAbstractEventDispatcherPrivate subclassesMarc Mutz2024-10-082-0/+4
| | | | | | | | | | | ... pinning the vtables to a single TU each, instead of duplicating them for every user. Pick-to: 6.8 Task-number: QTBUG-45582 Change-Id: I3b7bce14567dc8be89795a48f6871eb24fe908aa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
* QGenericUnixServices: properly disconnect signals in dtorChristian Ehrlicher2024-08-302-1/+14
| | | | | | | | | | | | Since QGenericUnixServices does not derive from QObject, the connection to QDBusPendingCallWatcher made in the ctor might outlive the lifetime of QGenericUnixServices. Fix it by explicitly disconnecting it in the dtor. Fixes: QTBUG-125239 Pick-to: 6.8 6.7 6.5 Change-Id: I5fac4fd5831b2dde16b3d7b479a8ee616bfb7e3a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QGUTheme: add Pantheon to the list of GTK based desktop environmentsLiang Qi2024-07-121-0/+1
| | | | | | | | | | Pantheon is the desktop environment of elementary OS. It is written in Vala, using GTK 3 and Granite. Fixes: QTBUG-52292 Pick-to: 6.8 6.7 6.5 6.2 5.15 Change-Id: I01140d8a2f3b0f2736515c1279e5d3150a0c313d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QKdeTheme: Fix default value for ItemViewActivateItemOnSingleClickNicolas Fella2024-06-241-0/+4
| | | | | | | | | | | Plasma 6 defaults to double click. When the default value is read we get an invalid QVariant. Use the proper default value in that case Pick-to: 6.8 6.7 6.5 Fixes: QTBUG-124481 Change-Id: I4cdbb04ee8f56b48bb6ab66ec6b3cd42bcf1b187 Reviewed-by: David Redondo <qt@david-redondo.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Gui: Make more logging categories staticUlf Hermann2024-06-241-1/+1
| | | | | | | Non-static, non-forward-declared logging categories are deprecated. Change-Id: I818ab0b192bed72e6a0ecdda2bb288bce1110a4c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Straighten out various logging categoriesUlf Hermann2024-06-191-2/+0
| | | | | | | | | | | | Either make them static or declare them in a header. We want them to be static wherever possible, in order to reduce the number of visible symbols. If they can't be static, however, they should at least be declared in only one place. Task-number: QTBUG-67692 Change-Id: I6f3b596ed4f0adc9873dd0a5f54f055a991a6207 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>