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>
This commit is contained in:
parent
dce4d1a351
commit
610bcae568
@ -245,6 +245,11 @@ qt_feature("wayland-vulkan-server-buffer" PRIVATE
|
||||
qt_feature("wayland-datadevice" PRIVATE
|
||||
CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard
|
||||
)
|
||||
qt_feature("wayland-decoration-adwaita" PRIVATE
|
||||
LABEL "GNOME-like client-side decorations"
|
||||
CONDITION NOT WIN32 AND QT_FEATURE_wayland_client AND TARGET Qt::DBus AND TARGET Qt::Svg
|
||||
)
|
||||
|
||||
|
||||
qt_configure_add_summary_entry(ARGS "wayland-client")
|
||||
qt_configure_add_summary_entry(ARGS "wayland-server")
|
||||
@ -257,6 +262,9 @@ qt_configure_add_summary_entry(ARGS "wayland-dmabuf-server-buffer")
|
||||
qt_configure_add_summary_entry(ARGS "wayland-shm-emulation-server-buffer")
|
||||
qt_configure_add_summary_entry(ARGS "wayland-vulkan-server-buffer")
|
||||
qt_configure_end_summary_section() # end of "Qt Wayland Drivers" section
|
||||
qt_configure_add_summary_section(NAME "Qt Wayland Decoration Plugins")
|
||||
qt_configure_add_summary_entry(ARGS "wayland-decoration-adwaita")
|
||||
qt_configure_end_summary_section() # end of "Qt Wayland Decoration Plugins" section
|
||||
|
||||
qt_configure_add_report_entry(
|
||||
TYPE ERROR
|
||||
|
@ -2,5 +2,8 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
# Generated from decorations.pro.
|
||||
if (QT_FEATURE_wayland_decoration_adwaita)
|
||||
add_subdirectory(adwaita)
|
||||
endif()
|
||||
|
||||
add_subdirectory(bradient)
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user