diff --git a/org.kde.Sdk.json b/org.kde.Sdk.json --- a/org.kde.Sdk.json +++ b/org.kde.Sdk.json @@ -137,6 +137,10 @@ "type": "patch", "path": "patch/qtbase-revert-reset-qwidget-winid-when-backing-window-surface-destroyed.patch" }, + { + "type": "patch", + "path": "patch/qtbase-use-wayland-on-gnome.patch" + }, { "type": "shell", "commands": [ "mv configure configure.qt" ] @@ -416,6 +420,14 @@ { "type": "patch", "path": "patch/qtwayland-fix-expose-event-compression.patch" + }, + { + "type": "patch", + "path": "patch/qtwayland-do-not-redraw-decorations-everytime.patch" + }, + { + "type": "patch", + "path": "patch/qtwayland-use-gnome-platform-theme-on-gnome-based-desktops.patch" } ] }, diff --git a/patch/qtbase-use-wayland-on-gnome.patch b/patch/qtbase-use-wayland-on-gnome.patch new file mode 100644 --- /dev/null +++ b/patch/qtbase-use-wayland-on-gnome.patch @@ -0,0 +1,20 @@ +diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp +index b8bfad4f16..676fdfad5e 100644 +--- a/src/gui/kernel/qguiapplication.cpp ++++ b/src/gui/kernel/qguiapplication.cpp +@@ -1376,14 +1376,7 @@ void QGuiApplicationPrivate::createPlatformIntegration() + if (sessionType == QByteArrayLiteral("x11") && !platformName.contains(QByteArrayLiteral("xcb"))) { + platformName = QByteArrayLiteral("xcb"); + } else if (sessionType == QByteArrayLiteral("wayland") && !platformName.contains(QByteArrayLiteral("wayland"))) { +- QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toLower(); +- QByteArray sessionDesktop = qgetenv("XDG_SESSION_DESKTOP").toLower(); +- if (currentDesktop.contains("gnome") || sessionDesktop.contains("gnome")) { +- qInfo() << "Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome." +- << "Use QT_QPA_PLATFORM=wayland to run on Wayland anyway."; +- } else { +- platformName = QByteArrayLiteral("wayland"); +- } ++ platformName = QByteArrayLiteral("wayland"); + } + } + #ifdef QT_QPA_DEFAULT_PLATFORM_NAME diff --git a/patch/qtwayland-do-not-redraw-decorations-everytime.patch b/patch/qtwayland-do-not-redraw-decorations-everytime.patch new file mode 100644 --- /dev/null +++ b/patch/qtwayland-do-not-redraw-decorations-everytime.patch @@ -0,0 +1,33 @@ +diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp +index 3fe2ce80..6d660e64 100644 +--- a/src/client/qwaylandshmbackingstore.cpp ++++ b/src/client/qwaylandshmbackingstore.cpp +@@ -289,11 +289,13 @@ void QWaylandShmBackingStore::resize(const QSize &size) + buffer = getBuffer(sizeWithMargins); + } + +- qsizetype oldSize = mBackBuffer ? mBackBuffer->image()->sizeInBytes() : 0; ++ qsizetype oldSizeInBytes = mBackBuffer ? mBackBuffer->image()->sizeInBytes() : 0; ++ qsizetype newSizeInBytes = buffer->image()->sizeInBytes(); ++ + // mBackBuffer may have been deleted here but if so it means its size was different so we wouldn't copy it anyway +- if (mBackBuffer != buffer && oldSize == buffer->image()->sizeInBytes()) { +- memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), buffer->image()->sizeInBytes()); +- } ++ if (mBackBuffer != buffer && oldSizeInBytes == newSizeInBytes) ++ memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), newSizeInBytes); ++ + mBackBuffer = buffer; + // ensure the new buffer is at the beginning of the list so next time getBuffer() will pick + // it if possible +@@ -302,8 +304,9 @@ void QWaylandShmBackingStore::resize(const QSize &size) + mBuffers.prepend(buffer); + } + +- if (windowDecoration() && window()->isVisible()) ++ if (windowDecoration() && window()->isVisible() && oldSizeInBytes != newSizeInBytes) { + windowDecoration()->update(); ++ } + } + + QImage *QWaylandShmBackingStore::entireSurface() const diff --git a/patch/qtwayland-use-gnome-platform-theme-on-gnome-based-desktops.patch b/patch/qtwayland-use-gnome-platform-theme-on-gnome-based-desktops.patch new file mode 100644 --- /dev/null +++ b/patch/qtwayland-use-gnome-platform-theme-on-gnome-based-desktops.patch @@ -0,0 +1,39 @@ +diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp +index 97e0203c..5bee160a 100644 +--- a/src/client/qwaylandintegration.cpp ++++ b/src/client/qwaylandintegration.cpp +@@ -99,20 +99,26 @@ public: + + if (QGuiApplication::desktopSettingsAware()) { + const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); +- ++ QList gtkBasedEnvironments; ++ gtkBasedEnvironments << "GNOME" ++ << "X-CINNAMON" ++ << "UNITY" ++ << "MATE" ++ << "XFCE" ++ << "LXDE"; + if (desktopEnvironment == QByteArrayLiteral("KDE")) { + #if QT_CONFIG(settings) + result.push_back(QStringLiteral("kde")); + #endif +- } else if (!desktopEnvironment.isEmpty() && +- desktopEnvironment != QByteArrayLiteral("UNKNOWN") && +- desktopEnvironment != QByteArrayLiteral("GNOME") && +- desktopEnvironment != QByteArrayLiteral("UNITY") && +- desktopEnvironment != QByteArrayLiteral("MATE") && +- desktopEnvironment != QByteArrayLiteral("XFCE") && +- desktopEnvironment != QByteArrayLiteral("LXDE")) ++ } else if (gtkBasedEnvironments.contains(desktopEnvironment)) { ++ // prefer the GTK3 theme implementation with native dialogs etc. ++ result.push_back(QStringLiteral("gtk3")); ++ // fallback to the generic Gnome theme if loading the GTK3 theme fails ++ result.push_back(QLatin1String(QGnomeTheme::name)); ++ } else if (!desktopEnvironment.isEmpty() && desktopEnvironment != QByteArrayLiteral("UNKNOWN")) { + // Ignore X11 desktop environments + result.push_back(QString::fromLocal8Bit(desktopEnvironment.toLower())); ++ } + } + + if (result.isEmpty())