diff options
author | Jan Grulich <jgrulich@redhat.com> | 2023-12-12 10:08:17 +0100 |
---|---|---|
committer | Jan Grulich <jgrulich@redhat.com> | 2024-03-19 14:38:40 +0100 |
commit | 40116ae353fd5f40d386c5398911d1aee483bb13 (patch) | |
tree | de1c413fc39b511a0a0164032c7407108e4404c9 /src/client | |
parent | e6f04ce6c1849009bcdc382e7e1da62afee029c8 (diff) |
Add GNOME-like client-side decoration plugin
Adds a client-side decoration plugin implementing GNOME's Adwaita style.
This is trying to follow GTK4 Adwaita style, using xdg-desktop-portal to
get user's configuration in order to get whether a light or dark colors
should be used and to get the titlebar button layout. This plugin is now
used on GNOME by default, while defaulting to the original behavior for
non-GNOME DEs. It depends on QtSvg used to draw titlebar buttons so in
case QtSvg is not found, this plugin will not be build.
[ChangeLog][QtWaylandClient][Added GNOME-like client-side decoration
plugin]
Fixes: QTBUG-120070
Change-Id: I0f1777c4e0aa3467dafbbae8004b594cc82f9aa0
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/qwaylandwindow.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 215193a7b..c0a415725 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -26,6 +26,7 @@ #include <QGuiApplication> #include <qpa/qwindowsysteminterface.h> +#include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qwindow_p.h> #include <QtCore/QDebug> @@ -36,6 +37,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + namespace QtWaylandClient { Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore") @@ -1092,6 +1095,22 @@ bool QWaylandWindow::createDecoration() } } + if (targetKey.isEmpty()) { + auto unixServices = dynamic_cast<QGenericUnixServices *>( + QGuiApplicationPrivate::platformIntegration()->services()); + const QByteArray currentDesktop = unixServices->desktopEnvironment(); + if (currentDesktop == "GNOME") { + if (decorations.contains("adwaita"_L1)) + targetKey = "adwaita"_L1; + else if (decorations.contains("gnome"_L1)) + targetKey = "gnome"_L1; + } else { + // Do not use Adwaita/GNOME decorations on other DEs + decorations.removeAll("adwaita"_L1); + decorations.removeAll("gnome"_L1); + } + } + if (targetKey.isEmpty()) targetKey = decorations.first(); // first come, first served. |