Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit ee2663b8 authored by David Edmundson's avatar David Edmundson

Disable KDE ServerDecoration on Qt > 5.12

Summary:
XdgDecoration is built into QtWayland 5.12. Running two interfaces to do
the same thing would be messy.

We cannot just remove this code as Plasma 5.15 will depend on Qt5.11.

Detection of the ShellSurfaceInterface was used to test if we have run
shellSurfaceCreated which we still need for other functions, so this check
is replaced with a new explicit property.

Test Plan:
Got the correct decorations still.
I haven't tested on Qt5.11. I would appreciate someone checking that
things still work the same.

Reviewers: #kwin, #plasma, graesslin

Reviewed By: #kwin, #plasma, graesslin

Subscribers: graesslin, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D17758
parent 8df8dea5
......@@ -20,6 +20,8 @@
#include "kwaylandintegration.h"
#include <QGuiApplication>
#include <QLibraryInfo>
#include <QVersionNumber>
#include <QPlatformSurfaceEvent>
#include <qpa/qplatformnativeinterface.h>
......@@ -85,7 +87,7 @@ bool KWaylandIntegration::eventFilter(QObject *watched, QEvent *event)
if (!w || w->parent() || !w->isVisible()) {
return false;
}
if(w->property("org.kde.plasma.integration.waylandserverdecoration").isNull()) {
if (w->property("org.kde.plasma.integration.shellSurfaceCreated").isNull()) {
shellSurfaceCreated(w);
}
} else if (event->type() == QEvent::Hide) {
......@@ -119,22 +121,28 @@ void KWaylandIntegration::shellSurfaceCreated(QWindow *w)
if (!s) {
return;
}
auto deco = m_decoration->create(s, w);
connect(deco, &ServerSideDecoration::modeChanged, w,
[deco, w] {
const auto flags = w->flags();
const auto ourMode = (flags.testFlag(Qt::FramelessWindowHint) || flags.testFlag(Qt::Popup) || flags.testFlag(Qt::ToolTip)) ? ServerSideDecoration::Mode::None : ServerSideDecoration::Mode::Server;
if (deco->mode() != ourMode) {
deco->requestMode(ourMode);
w->setProperty("org.kde.plasma.integration.shellSurfaceCreated", true);
if (QLibraryInfo::version() >= QVersionNumber(5, 12, 0))
{
auto deco = m_decoration->create(s, w);
connect(deco, &ServerSideDecoration::modeChanged, w,
[deco, w] {
const auto flags = w->flags();
const auto ourMode = (flags.testFlag(Qt::FramelessWindowHint) || flags.testFlag(Qt::Popup) || flags.testFlag(Qt::ToolTip)) ? ServerSideDecoration::Mode::None : ServerSideDecoration::Mode::Server;
if (deco->mode() != ourMode) {
deco->requestMode(ourMode);
}
}
);
const auto flags = w->flags();
const auto ourMode = (flags.testFlag(Qt::FramelessWindowHint) || flags.testFlag(Qt::Popup) || flags.testFlag(Qt::ToolTip)) ? ServerSideDecoration::Mode::None : ServerSideDecoration::Mode::Server;
if (deco->defaultMode() != ourMode) {
deco->requestMode(ourMode);
}
);
const auto flags = w->flags();
const auto ourMode = (flags.testFlag(Qt::FramelessWindowHint) || flags.testFlag(Qt::Popup) || flags.testFlag(Qt::ToolTip)) ? ServerSideDecoration::Mode::None : ServerSideDecoration::Mode::Server;
if (deco->defaultMode() != ourMode) {
deco->requestMode(ourMode);
w->setProperty("org.kde.plasma.integration.waylandserverdecoration", QVariant::fromValue(deco));
}
w->setProperty("org.kde.plasma.integration.waylandserverdecoration", QVariant::fromValue(deco));
if (m_appMenuManager) {
auto menu = m_appMenuManager->create(s, w);
......@@ -145,6 +153,8 @@ void KWaylandIntegration::shellSurfaceCreated(QWindow *w)
void KWaylandIntegration::shellSurfaceDestroyed(QWindow *w)
{
w->setProperty("org.kde.plasma.integration.shellSurfaceCreated", QVariant());
delete w->property("org.kde.plasma.integration.waylandserverdecoration").value<ServerSideDecoration*>();
w->setProperty("org.kde.plasma.integration.waylandserverdecoration", QVariant());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment