Hello community, here is the log from the commit of package kwindowsystem for openSUSE:Leap:15.2 checked in at 2020-02-16 18:27:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/kwindowsystem (Old) and /work/SRC/openSUSE:Leap:15.2/.kwindowsystem.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kwindowsystem" Sun Feb 16 18:27:31 2020 rev:60 rq:773953 version:5.67.0 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/kwindowsystem/kwindowsystem.changes 2020-01-19 15:49:39.697780008 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.kwindowsystem.new.26092/kwindowsystem.changes 2020-02-16 18:28:24.830720934 +0100 @@ -1,0 +2,18 @@ +Sun Feb 2 18:07:14 UTC 2020 - Christophe Giboudeaux <[email protected]> + +- Replace %make_jobs with %cmake_build. + +------------------------------------------------------------------- +Sun Feb 2 14:33:03 UTC 2020 - Christophe Giboudeaux <[email protected]> + +- Update to 5.67.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.67.0.php +- Changes since 5.66.0: + * [KWindowShadows] Check for X connection + * Fix build on FreeBSD + * Introduce shadows API + * Deprecate KWindowEffects::markAsDashboard() + +------------------------------------------------------------------- Old: ---- kwindowsystem-5.66.0.tar.xz kwindowsystem-5.66.0.tar.xz.sig New: ---- kwindowsystem-5.67.0.tar.xz kwindowsystem-5.67.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kwindowsystem.spec ++++++ --- /var/tmp/diff_new_pack.O8qFbr/_old 2020-02-16 18:28:25.122721087 +0100 +++ /var/tmp/diff_new_pack.O8qFbr/_new 2020-02-16 18:28:25.122721087 +0100 @@ -17,14 +17,14 @@ %define lname libKF5WindowSystem5 -%define _tar_path 5.66 +%define _tar_path 5.67 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} %bcond_without lang Name: kwindowsystem -Version: 5.66.0 +Version: 5.67.0 Release: 0 Summary: KDE Access to window manager License: LGPL-2.1-or-later @@ -41,16 +41,16 @@ BuildRequires: fdupes BuildRequires: kf5-filesystem BuildRequires: pkgconfig -BuildRequires: cmake(Qt5Test) >= 5.11.0 -BuildRequires: cmake(Qt5Widgets) >= 5.11.0 -BuildRequires: cmake(Qt5X11Extras) >= 5.11.0 +BuildRequires: cmake(Qt5Test) >= 5.12.0 +BuildRequires: cmake(Qt5Widgets) >= 5.12.0 +BuildRequires: cmake(Qt5X11Extras) >= 5.12.0 BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(xcb) BuildRequires: pkgconfig(xcb-keysyms) BuildRequires: pkgconfig(xfixes) BuildRequires: pkgconfig(xrender) %if %{with lang} -BuildRequires: cmake(Qt5LinguistTools) >= 5.11.0 +BuildRequires: cmake(Qt5LinguistTools) >= 5.12.0 %endif %description @@ -81,8 +81,8 @@ Group: Development/Libraries/KDE Requires: %{lname} = %{version} Requires: extra-cmake-modules -Requires: cmake(Qt5Core) >= 5.11.0 -Requires: cmake(Qt5Widgets) >= 5.11.0 +Requires: cmake(Qt5Core) >= 5.12.0 +Requires: cmake(Qt5Widgets) >= 5.12.0 Requires: pkgconfig(x11) Requires: pkgconfig(xcb) @@ -101,7 +101,7 @@ %build %cmake_kf5 -d build -- -Dlconvert_executable=%{_kf5_libdir}/qt5/bin/lconvert - %make_jobs + %cmake_build %install %kf5_makeinstall -C build ++++++ kwindowsystem-5.66.0.tar.xz -> kwindowsystem-5.67.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/CMakeLists.txt new/kwindowsystem-5.67.0/CMakeLists.txt --- old/kwindowsystem-5.66.0/CMakeLists.txt 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/CMakeLists.txt 2020-02-02 13:55:51.000000000 +0100 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.5) -set(KF5_VERSION "5.66.0") # handled by release scripts +set(KF5_VERSION "5.67.0") # handled by release scripts project(KWindowSystem VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.66.0 NO_MODULE) +find_package(ECM 5.67.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/autotests/kwindoweffectstest.cpp new/kwindowsystem-5.67.0/autotests/kwindoweffectstest.cpp --- old/kwindowsystem-5.66.0/autotests/kwindoweffectstest.cpp 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/autotests/kwindoweffectstest.cpp 2020-02-02 13:55:51.000000000 +0100 @@ -49,7 +49,9 @@ void testBlur_data(); void testBlur(); void testBlurDisable(); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 67) void testMarkAsDashboard(); +#endif void testEffectAvailable_data(); void testEffectAvailable(); @@ -362,6 +364,7 @@ performAtomIsRemoveTest(m_window->winId(), m_blur); } +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 67) void KWindowEffectsTest::testMarkAsDashboard() { const QByteArray className = QByteArrayLiteral("dashboard"); @@ -390,6 +393,7 @@ data = data + 10; QCOMPARE(QByteArray(data), className); } +#endif void KWindowEffectsTest::testEffectAvailable_data() { @@ -401,7 +405,9 @@ QTest::newRow("PresentWindowsGroup") << KWindowEffects::PresentWindowsGroup << QByteArrayLiteral("_KDE_PRESENT_WINDOWS_GROUP"); QTest::newRow("HighlightWindows") << KWindowEffects::HighlightWindows << QByteArrayLiteral("_KDE_WINDOW_HIGHLIGHT"); QTest::newRow("BlurBehind") << KWindowEffects::BlurBehind << QByteArrayLiteral("_KDE_NET_WM_BLUR_BEHIND_REGION"); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 67) QTest::newRow("Dashboard") << KWindowEffects::Dashboard << QByteArrayLiteral("_WM_EFFECT_KDE_DASHBOARD"); +#endif QTest::newRow("BackgroundContrast") << KWindowEffects::BackgroundContrast << QByteArrayLiteral("_KDE_NET_WM_BACKGROUND_CONTRAST_REGION"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/po/ko/kwindowsystem5_qt.po new/kwindowsystem-5.67.0/po/ko/kwindowsystem5_qt.po --- old/kwindowsystem-5.66.0/po/ko/kwindowsystem5_qt.po 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/po/ko/kwindowsystem5_qt.po 2020-02-02 13:55:51.000000000 +0100 @@ -1,14 +1,14 @@ # Korean messages for kdelibs. # Copyright (C) Free Software Foundation, Inc. # Cho Sung Jae <[email protected]>, 2007. -# Shinjo Park <[email protected]>, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015. +# Shinjo Park <[email protected]>, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2020. # msgid "" msgstr "" "Project-Id-Version: kdelibs4\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2014-03-23 01:50+0000\n" -"PO-Revision-Date: 2015-01-18 17:09+0900\n" +"PO-Revision-Date: 2020-01-28 23:54+0100\n" "Last-Translator: Shinjo Park <[email protected]>\n" "Language-Team: Korean <[email protected]>\n" "Language: ko\n" @@ -16,7 +16,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Lokalize 1.5\n" +"X-Generator: Lokalize 19.04.3\n" "X-Qt-Contexts: true\n" #: platforms/osx/kwindowsystem.cpp:578 platforms/windows/kwindowsystem.cpp:630 @@ -24,4 +24,4 @@ #, qt-format msgctxt "KWindowSystem|" msgid "Desktop %1" -msgstr "데스크톱 %1" +msgstr "바탕 화면 %1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/po/zh_CN/kwindowsystem5_qt.po new/kwindowsystem-5.67.0/po/zh_CN/kwindowsystem5_qt.po --- old/kwindowsystem-5.66.0/po/zh_CN/kwindowsystem5_qt.po 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/po/zh_CN/kwindowsystem5_qt.po 2020-02-02 13:55:51.000000000 +0100 @@ -13,8 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: kdeorg\n" -"PO-Revision-Date: 2019-11-19 23:01\n" -"Last-Translator: Guo Yunhe (guoyunhe)\n" +"PO-Revision-Date: 2020-01-20 21:49\n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" "MIME-Version: 1.0\n" @@ -22,7 +21,6 @@ "Content-Transfer-Encoding: 8bit\n" "X-Qt-Contexts: true\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: crowdin.com\n" "X-Crowdin-Project: kdeorg\n" "X-Crowdin-Language: zh-CN\n" "X-Crowdin-File: /kf5-trunk/messages/frameworks/kwindowsystem5_qt.pot\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/CMakeLists.txt new/kwindowsystem-5.67.0/src/CMakeLists.txt --- old/kwindowsystem-5.66.0/src/CMakeLists.txt 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/CMakeLists.txt 2020-02-02 13:55:51.000000000 +0100 @@ -11,6 +11,7 @@ kwindoweffects.cpp kwindoweffects_dummy.cpp kwindowinfo.cpp + kwindowshadow.cpp kwindowsystem.cpp platforms/wayland/kwindowsystem.cpp pluginwrapper.cpp @@ -76,7 +77,7 @@ GROUP_BASE_NAME KF VERSION ${KF5_VERSION} DEPRECATED_BASE_VERSION 0 - DEPRECATION_VERSIONS 5.0 5.18 5.38 5.62 + DEPRECATION_VERSIONS 5.0 5.18 5.38 5.62 5.67 EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} ) @@ -109,6 +110,7 @@ KUserTimestamp KWindowEffects KWindowInfo + KWindowShadow,KWindowShadowTile KWindowSystem REQUIRED_HEADERS KWindowSystem_HEADERS @@ -129,6 +131,7 @@ FILES kwindoweffects_p.h kwindowinfo_p.h + kwindowshadow_p.h kwindowsystem_p.h kwindowsystemplugininterface_p.h DESTINATION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/kwindoweffects.cpp new/kwindowsystem-5.67.0/src/kwindoweffects.cpp --- old/kwindowsystem-5.66.0/src/kwindoweffects.cpp 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/kwindoweffects.cpp 2020-02-02 13:55:51.000000000 +0100 @@ -55,10 +55,12 @@ KWindowSystemPluginWrapper::self().effects()->highlightWindows(controller, ids); } +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 67) void markAsDashboard(WId window) { KWindowSystemPluginWrapper::self().effects()->markAsDashboard(window); } +#endif void presentWindows(WId controller, const QList< WId > &ids) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/kwindoweffects.h new/kwindowsystem-5.67.0/src/kwindoweffects.h --- old/kwindowsystem-5.66.0/src/kwindoweffects.h 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/kwindoweffects.h 2020-02-02 13:55:51.000000000 +0100 @@ -36,7 +36,9 @@ PresentWindowsGroup = 4, HighlightWindows = 5, BlurBehind = 7, +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 67) Dashboard = 8, +#endif BackgroundContrast = 9 }; @@ -153,14 +155,18 @@ */ KWINDOWSYSTEM_EXPORT void enableBackgroundContrast(WId window, bool enable = true, qreal contrast = 1, qreal intensity = 1, qreal saturation = 1, const QRegion ®ion = QRegion()); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 67) /** * Instructs the window manager to handle the given window as dashboard window as * Dashboard windows should be handled diffrently and may have special effects * applied to them. * * @param window The window for which to enable the blur effect + * @deprecated since 5.67, support for dashboard windows was removed */ +KWINDOWSYSTEM_DEPRECATED_VERSION(5, 67, "Support for dashboard windows was removed") KWINDOWSYSTEM_EXPORT void markAsDashboard(WId window); +#endif } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/kwindoweffects_dummy.cpp new/kwindowsystem-5.67.0/src/kwindoweffects_dummy.cpp --- old/kwindowsystem-5.66.0/src/kwindoweffects_dummy.cpp 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/kwindoweffects_dummy.cpp 2020-02-02 13:55:51.000000000 +0100 @@ -84,7 +84,9 @@ Q_UNUSED(region) } +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 67) void KWindowEffectsPrivateDummy::markAsDashboard(WId window) { Q_UNUSED(window) } +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/kwindoweffects_dummy_p.h new/kwindowsystem-5.67.0/src/kwindoweffects_dummy_p.h --- old/kwindowsystem-5.66.0/src/kwindoweffects_dummy_p.h 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/kwindoweffects_dummy_p.h 2020-02-02 13:55:51.000000000 +0100 @@ -34,7 +34,9 @@ void highlightWindows(WId controller, const QList<WId> &ids) override; void enableBlurBehind(WId window, bool enable = true, const QRegion& region = QRegion()) override; void enableBackgroundContrast(WId window, bool enable = true, qreal contrast = 1, qreal intensity = 1, qreal saturation = 1, const QRegion ®ion = QRegion()) override; +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 67) void markAsDashboard(WId window) override; +#endif }; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/kwindoweffects_p.h new/kwindowsystem-5.67.0/src/kwindoweffects_p.h --- old/kwindowsystem-5.66.0/src/kwindoweffects_p.h 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/kwindoweffects_p.h 2020-02-02 13:55:51.000000000 +0100 @@ -33,7 +33,9 @@ virtual void highlightWindows(WId controller, const QList<WId> &ids) = 0; virtual void enableBlurBehind(WId window, bool enable = true, const QRegion ®ion = QRegion()) = 0; virtual void enableBackgroundContrast(WId window, bool enable = true, qreal contrast = 1, qreal intensity = 1, qreal saturation = 1, const QRegion ®ion = QRegion()) = 0; +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 67) virtual void markAsDashboard(WId window) = 0; +#endif protected: KWindowEffectsPrivate(); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/kwindowshadow.cpp new/kwindowsystem-5.67.0/src/kwindowshadow.cpp --- old/kwindowsystem-5.66.0/src/kwindowshadow.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/kwindowshadow.cpp 2020-02-02 13:55:51.000000000 +0100 @@ -0,0 +1,335 @@ +/* + Copyright (C) 2019 Vlad Zahorodnii <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "kwindowshadow.h" +#include "kwindowshadow_dummy_p.h" +#include "kwindowshadow_p.h" +#include "kwindowsystem_debug.h" +#include "pluginwrapper_p.h" + +#include <array> + +KWindowShadowTile::KWindowShadowTile() + : d(KWindowSystemPluginWrapper::self().createWindowShadowTile()) +{ +} + +KWindowShadowTile::~KWindowShadowTile() +{ + if (d->isCreated) { + d->destroy(); + } +} + +QImage KWindowShadowTile::image() const +{ + return d->image; +} + +void KWindowShadowTile::setImage(const QImage &image) +{ + if (d->isCreated) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot change the image on a tile that already has native " + "platform resources allocated."); + return; + } + d->image = image; +} + +bool KWindowShadowTile::isCreated() const +{ + return d->isCreated; +} + +bool KWindowShadowTile::create() +{ + if (d->isCreated) { + return true; + } + d->isCreated = d->create(); + return d->isCreated; +} + +KWindowShadow::KWindowShadow(QObject *parent) + : QObject(parent) + , d(KWindowSystemPluginWrapper::self().createWindowShadow()) +{ +} + +KWindowShadow::~KWindowShadow() +{ + destroy(); +} + +KWindowShadowTile::Ptr KWindowShadow::leftTile() const +{ + return d->leftTile; +} + +void KWindowShadow::setLeftTile(KWindowShadowTile::Ptr tile) +{ + if (d->isCreated) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot attach a left tile to a shadow that already has " + "native platform resources allocated. To do so, destroy() the shadow and then " + "setLeftTile() and create()"); + return; + } + d->leftTile = tile; +} + +KWindowShadowTile::Ptr KWindowShadow::topLeftTile() const +{ + return d->topLeftTile; +} + +void KWindowShadow::setTopLeftTile(KWindowShadowTile::Ptr tile) +{ + if (d->isCreated) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot attach a top-left tile to a shadow that already has " + "native platform resources allocated. To do so, destroy() the shadow and then " + "setTopLeftTile() and create()"); + return; + } + d->topLeftTile = tile; +} + +KWindowShadowTile::Ptr KWindowShadow::topTile() const +{ + return d->topTile; +} + +void KWindowShadow::setTopTile(KWindowShadowTile::Ptr tile) +{ + if (d->isCreated) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot attach a top tile to a shadow that already has " + "native platform resources allocated. To do so, destroy() the shadow and then " + "setTopTile() and create()"); + return; + } + d->topTile = tile; +} + +KWindowShadowTile::Ptr KWindowShadow::topRightTile() const +{ + return d->topRightTile; +} + +void KWindowShadow::setTopRightTile(KWindowShadowTile::Ptr tile) +{ + if (d->isCreated) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot attach a top-right tile to a shadow that already " + "has native platform resources allocated. To do so, destroy() the shadow and " + "then setTopRightTile() and create()"); + return; + } + d->topRightTile = tile; +} + +KWindowShadowTile::Ptr KWindowShadow::rightTile() const +{ + return d->rightTile; +} + +void KWindowShadow::setRightTile(KWindowShadowTile::Ptr tile) +{ + if (d->isCreated) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot attach a right tile to a shadow that already has " + "native platform resources allocated. To do so, destroy() the shadow and then " + "setRightTile() and create()"); + return; + } + d->rightTile = tile; +} + +KWindowShadowTile::Ptr KWindowShadow::bottomRightTile() const +{ + return d->bottomRightTile; +} + +void KWindowShadow::setBottomRightTile(KWindowShadowTile::Ptr tile) +{ + if (d->isCreated) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot attach a bottom-right tile to a shadow that already " + "has native platform resources allocated. To do so, destroy() the shadow and " + "then setBottomRightTile() and create()"); + return; + } + d->bottomRightTile = tile; +} + +KWindowShadowTile::Ptr KWindowShadow::bottomTile() const +{ + return d->bottomTile; +} + +void KWindowShadow::setBottomTile(KWindowShadowTile::Ptr tile) +{ + if (d->isCreated) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot attach a bottom tile to a shadow that already has " + "native platform resources allocated. To do so, destroy() the shadow and then " + "setBottomTile() and create()"); + return; + } + d->bottomTile = tile; +} + +KWindowShadowTile::Ptr KWindowShadow::bottomLeftTile() const +{ + return d->bottomLeftTile; +} + +void KWindowShadow::setBottomLeftTile(KWindowShadowTile::Ptr tile) +{ + if (d->isCreated) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot attach a bottom-left tile to a shadow that already " + "has native platform resources allocated. To do so, destroy() the shadow and " + "then setBottomLeftTile() and create()"); + return; + } + d->bottomLeftTile = tile; +} + +QMargins KWindowShadow::padding() const +{ + return d->padding; +} + +void KWindowShadow::setPadding(const QMargins &padding) +{ + if (d->isCreated) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot set the padding on a shadow that already has " + "native platform resources allocated. To do so, destroy() the shadow and " + "then setPadding() and create()"); + return; + } + d->padding = padding; +} + +QWindow *KWindowShadow::window() const +{ + return d->window; +} + +void KWindowShadow::setWindow(QWindow *window) +{ + if (d->isCreated) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot set the target window on a shadow that already has " + "native platform resources allocated. To do so, destroy() the shadow and then " + "setWindow() and create()"); + return; + } + d->window = window; +} + +bool KWindowShadow::isCreated() const +{ + return d->isCreated; +} + +bool KWindowShadow::create() +{ + if (d->isCreated) { + return true; + } + if (!d->window) { + qCWarning(LOG_KWINDOWSYSTEM, "Cannot allocate the native platform resources for the shadow " + "because the target window is not specified."); + return false; + } + if (!d->prepareTiles()) { + return false; + } + d->isCreated = d->create(); + return d->isCreated; +} + +void KWindowShadow::destroy() +{ + if (!d->isCreated) { + return; + } + d->destroy(); + d->isCreated = false; +} + +KWindowShadowTilePrivate::~KWindowShadowTilePrivate() +{ +} + +KWindowShadowTilePrivate *KWindowShadowTilePrivate::get(const KWindowShadowTile *tile) +{ + return tile->d.data(); +} + +KWindowShadowPrivate::~KWindowShadowPrivate() +{ +} + +bool KWindowShadowPrivate::create() +{ + return false; +} + +void KWindowShadowPrivate::destroy() +{ +} + +bool KWindowShadowPrivate::prepareTiles() +{ + const std::array<KWindowShadowTile *, 8> tiles { + leftTile.data(), + topLeftTile.data(), + topTile.data(), + topRightTile.data(), + rightTile.data(), + bottomRightTile.data(), + bottomTile.data(), + bottomLeftTile.data(), + }; + + for (KWindowShadowTile *tile : tiles) { + if (!tile) { + continue; + } + if (tile->isCreated()) { + continue; + } + if (!tile->create()) { + return false; + } + } + + return true; +} + +bool KWindowShadowTilePrivateDummy::create() +{ + return false; +} + +void KWindowShadowTilePrivateDummy::destroy() +{ +} + +bool KWindowShadowPrivateDummy::create() +{ + return false; +} + +void KWindowShadowPrivateDummy::destroy() +{ +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/kwindowshadow.h new/kwindowsystem-5.67.0/src/kwindowshadow.h --- old/kwindowsystem-5.66.0/src/kwindowshadow.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/kwindowshadow.h 2020-02-02 13:55:51.000000000 +0100 @@ -0,0 +1,236 @@ +/* + Copyright (C) 2019 Vlad Zahorodnii <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef KWINDOWSHADOW_H +#define KWINDOWSHADOW_H + +#include "kwindowsystem_export.h" + +#include <QImage> +#include <QMargins> +#include <QSharedPointer> +#include <QWindow> + +class KWindowShadowPrivate; +class KWindowShadowTilePrivate; + +/** + * The KWindowShadowTile class provides a platform-indendent shadow tile representation. + */ +class KWINDOWSYSTEM_EXPORT KWindowShadowTile +{ +public: + using Ptr = QSharedPointer<KWindowShadowTile>; + + KWindowShadowTile(); + ~KWindowShadowTile(); + + /** + * Returns the image stored in the KWindowShadowTile. + */ + QImage image() const; + + /** + * Sets the image on the KWindowShadowTile. + * + * Notice that once the native platform resouces have been allocated for the tile, you are + * not allowed to change the image. In order to do so, you need to create a new tile. + */ + void setImage(const QImage &image); + + /** + * Returns @c true if the platform resources associated with the tile have been allocated. + */ + bool isCreated() const; + + /** + * Allocates the native platform resources associated with the KWindowShadowTile. + * + * Normally it should not be necessary to call this method as KWindowShadow will implicitly + * call create() on your behalf. + * + * Returns @c true if the creation succeeded, otherwise returns @c false. + */ + bool create(); + +private: + QScopedPointer<KWindowShadowTilePrivate> d; + + friend class KWindowShadowTilePrivate; +}; + +/** + * The KWindowShadow class represents a drop-shadow that is drawn by the compositor. + * + * The KWindowShadow is composed of multiple tiles. The top left tile, the top right tile, the bottom + * left tile, and the bottom right tile are rendered as they are. The top tile and the bottom tile are + * stretched in x direction; the left tile and the right tile are stretched in y direction. Several + * KWindowShadow objects can share shadow tiles to reduce memory usage. You have to specify padding() + * along the shadow tiles. The padding values indicate how much the KWindowShadow sticks outside the + * decorated window. + * + * Once the KWindowShadow is created, you're not allowed to attach or detach any shadow tiles, change + * padding(), or change window(). In order to do so, you have to destroy() the shadow first, update + * relevant properties, and create() the shadow again. + */ +class KWINDOWSYSTEM_EXPORT KWindowShadow : public QObject +{ + Q_OBJECT + +public: + explicit KWindowShadow(QObject *parent = nullptr); + ~KWindowShadow(); + + /** + * Returns the left tile attached to the KWindowShadow. + */ + KWindowShadowTile::Ptr leftTile() const; + + /** + * Attaches the left @p tile to the KWindowShadow. + */ + void setLeftTile(KWindowShadowTile::Ptr tile); + + /** + * Returns the top-left tile attached to the KWindowShadow. + */ + KWindowShadowTile::Ptr topLeftTile() const; + + /** + * Attaches the top-left @p tile to the KWindowShadow. + */ + void setTopLeftTile(KWindowShadowTile::Ptr tile); + + /** + * Returns the top tile attached to the KWindowShadow. + */ + KWindowShadowTile::Ptr topTile() const; + + /** + * Attaches the top @p tile to the KWindowShadow. + */ + void setTopTile(KWindowShadowTile::Ptr tile); + + /** + * Returns the top-right tile attached to the KWindowShadow. + */ + KWindowShadowTile::Ptr topRightTile() const; + + /** + * Attaches the top-right @p tile to the KWindowShadow. + */ + void setTopRightTile(KWindowShadowTile::Ptr tile); + + /** + * Returns the right tile attached to the KWindowShadow. + */ + KWindowShadowTile::Ptr rightTile() const; + + /** + * Attaches the right @p tile to the KWindowShadow. + */ + void setRightTile(KWindowShadowTile::Ptr tile); + + /** + * Returns the bottom-right tile attached to the KWindowShadow. + */ + KWindowShadowTile::Ptr bottomRightTile() const; + + /** + * Attaches the bottom-right tile to the KWindowShadow. + */ + void setBottomRightTile(KWindowShadowTile::Ptr tile); + + /** + * Returns the bottom tile attached to the KWindowShadow. + */ + KWindowShadowTile::Ptr bottomTile() const; + + /** + * Attaches the bottom @p tile to the KWindowShadow. + */ + void setBottomTile(KWindowShadowTile::Ptr tile); + + /** + * Returns the bottom-left tile attached to the KWindowShadow. + */ + KWindowShadowTile::Ptr bottomLeftTile() const; + + /** + * Attaches the bottom-left @p tile to the KWindowShadow. + */ + void setBottomLeftTile(KWindowShadowTile::Ptr tile); + + /** + * Returns the padding of the KWindowShadow. + * + * The padding values specify the visible extents of the shadow. The top left tile is rendered + * with an offset of -padding().left() and -padding().top(). + */ + QMargins padding() const; + + /** + * Sets the padding on the KWindowShadow. + * + * If the padding values are smaller than the sizes of the shadow tiles, then the shadow will + * overlap with the window() and will be rendered behind window(). E.g. if all padding values + * are set to 0, then the shadow will be completely occluded by the window(). + */ + void setPadding(const QMargins &padding); + + /** + * Returns the window behind which the KWindowShadow will be rendered. + */ + QWindow *window() const; + + /** + * Sets the window behind which the KWindowShadow will be rendered. + * + * Note that the KWindowShadow does not track the platform surface. If for whatever reason the + * native platform surface is deleted and then created, you must to destroy() the shadow and + * create() it again yourself. + */ + void setWindow(QWindow *window); + + /** + * Returns @c true if the platform resources associated with the shadow have been allocated. + */ + bool isCreated() const; + + /** + * Allocates the platform resources associated with the KWindowShadow. + * + * Once the native platform resouces have been allocated, you're not allowed to attach or + * detach shadow tiles, change the padding or the target window. If you want to do so, you + * must destroy() the shadow, change relevant attributes and call create() again. + * + * Returns @c true if the creation succeeded, otherwise returns @c false. + */ + bool create(); + + /** + * Releases the platform resources associated with the KWindowShadow. + * + * Calling destroy() after window() had been destroyed will result in a no-op. + */ + void destroy(); + +private: + QScopedPointer<KWindowShadowPrivate> d; +}; + +#endif // KWINDOWSHADOW_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/kwindowshadow_dummy_p.h new/kwindowsystem-5.67.0/src/kwindowshadow_dummy_p.h --- old/kwindowsystem-5.66.0/src/kwindowshadow_dummy_p.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/kwindowshadow_dummy_p.h 2020-02-02 13:55:51.000000000 +0100 @@ -0,0 +1,37 @@ +/* + Copyright (C) 2019 Vlad Zahorodnii <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef KWINDOWSHADOW_DUMMY_P_H +#define KWINDOWSHADOW_DUMMY_P_H + +#include "kwindowshadow_p.h" + +class KWindowShadowTilePrivateDummy final : public KWindowShadowTilePrivate +{ +public: + bool create() override; + void destroy() override; +}; + +class KWindowShadowPrivateDummy final : public KWindowShadowPrivate +{ +public: + bool create() override; + void destroy() override; +}; + +#endif // KWINDOWSHADOW_DUMMY_P_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/kwindowshadow_p.h new/kwindowsystem-5.67.0/src/kwindowshadow_p.h --- old/kwindowsystem-5.66.0/src/kwindowshadow_p.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/kwindowshadow_p.h 2020-02-02 13:55:51.000000000 +0100 @@ -0,0 +1,73 @@ +/* + Copyright (C) 2019 Vlad Zahorodnii <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef KWINDOWSHADOW_P_H +#define KWINDOWSHADOW_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the KF API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "kwindowshadow.h" + +#include <QPointer> + +class KWINDOWSYSTEM_EXPORT KWindowShadowTilePrivate +{ +public: + virtual ~KWindowShadowTilePrivate(); + + virtual bool create() = 0; + virtual void destroy() = 0; + + static KWindowShadowTilePrivate *get(const KWindowShadowTile *tile); + + QImage image; + bool isCreated = false; +}; + +class KWINDOWSYSTEM_EXPORT KWindowShadowPrivate +{ +public: + virtual ~KWindowShadowPrivate(); + + virtual bool create() = 0; + virtual void destroy() = 0; + + bool prepareTiles(); + + QPointer<QWindow> window; + KWindowShadowTile::Ptr leftTile; + KWindowShadowTile::Ptr topLeftTile; + KWindowShadowTile::Ptr topTile; + KWindowShadowTile::Ptr topRightTile; + KWindowShadowTile::Ptr rightTile; + KWindowShadowTile::Ptr bottomRightTile; + KWindowShadowTile::Ptr bottomTile; + KWindowShadowTile::Ptr bottomLeftTile; + QMargins padding; + bool isCreated = false; +}; + +#endif // KWINDOWSHADOW_P_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/kwindowsystemplugininterface.cpp new/kwindowsystem-5.67.0/src/kwindowsystemplugininterface.cpp --- old/kwindowsystem-5.66.0/src/kwindowsystemplugininterface.cpp 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/kwindowsystemplugininterface.cpp 2020-02-02 13:55:51.000000000 +0100 @@ -45,3 +45,13 @@ Q_UNUSED(properties2) return nullptr; } + +KWindowShadowPrivate *KWindowSystemPluginInterface::createWindowShadow() +{ + return nullptr; +} + +KWindowShadowTilePrivate *KWindowSystemPluginInterface::createWindowShadowTile() +{ + return nullptr; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/kwindowsystemplugininterface_p.h new/kwindowsystem-5.67.0/src/kwindowsystemplugininterface_p.h --- old/kwindowsystem-5.66.0/src/kwindowsystemplugininterface_p.h 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/kwindowsystemplugininterface_p.h 2020-02-02 13:55:51.000000000 +0100 @@ -27,6 +27,8 @@ class KWindowEffectsPrivate; class KWindowInfoPrivate; +class KWindowShadowPrivate; +class KWindowShadowTilePrivate; class KWindowSystemPrivate; class KWINDOWSYSTEM_EXPORT KWindowSystemPluginInterface : public QObject @@ -39,6 +41,8 @@ virtual KWindowEffectsPrivate *createEffects(); virtual KWindowSystemPrivate *createWindowSystem(); virtual KWindowInfoPrivate *createWindowInfo(WId window, NET::Properties properties, NET::Properties2 properties2); + virtual KWindowShadowPrivate *createWindowShadow(); + virtual KWindowShadowTilePrivate *createWindowShadowTile(); }; Q_DECLARE_INTERFACE(KWindowSystemPluginInterface, "org.kde.kwindowsystem.KWindowSystemPluginInterface") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/platforms/xcb/CMakeLists.txt new/kwindowsystem-5.67.0/src/platforms/xcb/CMakeLists.txt --- old/kwindowsystem-5.66.0/src/platforms/xcb/CMakeLists.txt 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/platforms/xcb/CMakeLists.txt 2020-02-02 13:55:51.000000000 +0100 @@ -1,6 +1,7 @@ set(xcb_plugin_SRCS kwindoweffects.cpp kwindowinfo.cpp + kwindowshadow.cpp kwindowsystem.cpp kxerrorhandler.cpp kxutils.cpp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/platforms/xcb/kwindoweffects.cpp new/kwindowsystem-5.67.0/src/platforms/xcb/kwindoweffects.cpp --- old/kwindowsystem-5.66.0/src/platforms/xcb/kwindoweffects.cpp 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/platforms/xcb/kwindoweffects.cpp 2020-02-02 13:55:51.000000000 +0100 @@ -28,7 +28,6 @@ #include <QX11Info> #include <QMatrix4x4> -static const char DASHBOARD_WIN_CLASS[] = "dashboard\0dashboard"; using namespace KWindowEffects; KWindowEffectsPrivateX11::KWindowEffectsPrivateX11() @@ -62,10 +61,12 @@ case BlurBehind: effectName = QByteArrayLiteral("_KDE_NET_WM_BLUR_BEHIND_REGION"); break; +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 67) case Dashboard: // TODO: Better namespacing for atoms effectName = QByteArrayLiteral("_WM_EFFECT_KDE_DASHBOARD"); break; +#endif case BackgroundContrast: effectName = QByteArrayLiteral("_KDE_NET_WM_BACKGROUND_CONTRAST_REGION"); break; @@ -331,8 +332,10 @@ } } +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 67) void KWindowEffectsPrivateX11::markAsDashboard(WId window) { + static const char DASHBOARD_WIN_CLASS[] = "dashboard\0dashboard"; xcb_connection_t *c = QX11Info::connection(); if (!c) { return; @@ -340,4 +343,4 @@ xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8, 19, DASHBOARD_WIN_CLASS); } - +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/platforms/xcb/kwindoweffects_x11.h new/kwindowsystem-5.67.0/src/platforms/xcb/kwindoweffects_x11.h --- old/kwindowsystem-5.66.0/src/platforms/xcb/kwindoweffects_x11.h 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/platforms/xcb/kwindoweffects_x11.h 2020-02-02 13:55:51.000000000 +0100 @@ -34,7 +34,9 @@ void highlightWindows(WId controller, const QList<WId> &ids) override; void enableBlurBehind(WId window, bool enable = true, const QRegion& region = QRegion()) override; void enableBackgroundContrast(WId window, bool enable = true, qreal contrast = 1, qreal intensity = 1, qreal saturation = 1, const QRegion ®ion = QRegion()) override; +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 67) void markAsDashboard(WId window) override; +#endif }; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/platforms/xcb/kwindowshadow.cpp new/kwindowsystem-5.67.0/src/platforms/xcb/kwindowshadow.cpp --- old/kwindowsystem-5.66.0/src/platforms/xcb/kwindowshadow.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/platforms/xcb/kwindowshadow.cpp 2020-02-02 13:55:51.000000000 +0100 @@ -0,0 +1,219 @@ +/* + Copyright (C) 2019 Vlad Zahorodnii <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "kwindowshadow_p_x11.h" + +#include <QX11Info> + +static const QByteArray s_atomName = QByteArrayLiteral("_KDE_NET_WM_SHADOW"); + +bool KWindowShadowTilePrivateX11::create() +{ + xcb_connection_t *connection = QX11Info::connection(); + xcb_window_t rootWindow = QX11Info::appRootWindow(); + + const uint16_t width = uint16_t(image.width()); + const uint16_t height = uint16_t(image.height()); + const uint8_t depth = uint8_t(image.depth()); + + pixmap = xcb_generate_id(connection); + gc = xcb_generate_id(connection); + + xcb_create_pixmap(connection, depth, pixmap, rootWindow, width, height); + xcb_create_gc(connection, gc, pixmap, 0, nullptr); + + xcb_put_image(connection, XCB_IMAGE_FORMAT_Z_PIXMAP, pixmap, gc, width, height, + 0, 0, 0, depth, image.sizeInBytes(), image.constBits()); + + return true; +} + +void KWindowShadowTilePrivateX11::destroy() +{ + xcb_connection_t *connection = QX11Info::connection(); + if (connection) { + xcb_free_pixmap(connection, pixmap); + xcb_free_gc(connection, gc); + } + pixmap = XCB_PIXMAP_NONE; + gc = XCB_NONE; +} + +KWindowShadowTilePrivateX11 *KWindowShadowTilePrivateX11::get(const KWindowShadowTile *tile) +{ + KWindowShadowTilePrivate *d = KWindowShadowTilePrivate::get(tile); + return static_cast<KWindowShadowTilePrivateX11 *>(d); +} + +static xcb_atom_t lookupAtom(const QByteArray &atomName) +{ + xcb_connection_t *connection = QX11Info::connection(); + if (!connection) { + return XCB_ATOM_NONE; + } + + xcb_intern_atom_cookie_t atomCookie = xcb_intern_atom_unchecked(connection, false, + atomName.size(), + atomName.constData()); + xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, atomCookie, nullptr); + + if (!reply) { + return XCB_ATOM_NONE; + } + + xcb_atom_t atom = reply->atom; + free(reply); + + return atom; +} + +static xcb_pixmap_t nativeHandleForTile(const KWindowShadowTile::Ptr &tile) +{ + const auto d = KWindowShadowTilePrivateX11::get(tile.data()); + return d->pixmap; +} + +bool KWindowShadowPrivateX11::create() +{ + xcb_connection_t *connection = QX11Info::connection(); + + const xcb_atom_t atom = lookupAtom(s_atomName); + if (atom == XCB_ATOM_NONE) { + return false; + } + + QVector<quint32> data(12); + int i = 0; + + // Unfortunately we cannot use handle of XCB_PIXMAP_NONE for missing shadow tiles because + // KWin expects **all** shadow tile handles to be valid. Maybe we could address this small + // inconvenience and then remove the empty tile stuff. + + if (topTile) { + data[i++] = nativeHandleForTile(topTile); + } else { + data[i++] = nativeHandleForTile(getOrCreateEmptyTile()); + } + + if (topRightTile) { + data[i++] = nativeHandleForTile(topRightTile); + } else { + data[i++] = nativeHandleForTile(getOrCreateEmptyTile()); + } + + if (rightTile) { + data[i++] = nativeHandleForTile(rightTile); + } else { + data[i++] = nativeHandleForTile(getOrCreateEmptyTile()); + } + + if (bottomRightTile) { + data[i++] = nativeHandleForTile(bottomRightTile); + } else { + data[i++] = nativeHandleForTile(getOrCreateEmptyTile()); + } + + if (bottomTile) { + data[i++] = nativeHandleForTile(bottomTile); + } else { + data[i++] = nativeHandleForTile(getOrCreateEmptyTile()); + } + + if (bottomLeftTile) { + data[i++] = nativeHandleForTile(bottomLeftTile); + } else { + data[i++] = nativeHandleForTile(getOrCreateEmptyTile()); + } + + if (leftTile) { + data[i++] = nativeHandleForTile(leftTile); + } else { + data[i++] = nativeHandleForTile(getOrCreateEmptyTile()); + } + + if (topLeftTile) { + data[i++] = nativeHandleForTile(topLeftTile); + } else { + data[i++] = nativeHandleForTile(getOrCreateEmptyTile()); + } + + if (topLeftTile || topTile || topRightTile) { + data[i++] = uint32_t(padding.top()); + } else { + data[i++] = 1; + } + + if (topRightTile || rightTile || bottomRightTile) { + data[i++] = uint32_t(padding.right()); + } else { + data[i++] = 1; + } + + if (bottomRightTile || bottomTile || bottomLeftTile) { + data[i++] = uint32_t(padding.bottom()); + } else { + data[i++] = 1; + } + + if (bottomLeftTile || leftTile || topLeftTile) { + data[i++] = uint32_t(padding.left()); + } else { + data[i++] = 1; + } + + xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window->winId(), atom, + XCB_ATOM_CARDINAL, 32, data.size(), data.constData()); + xcb_flush(connection); + + return true; +} + +void KWindowShadowPrivateX11::destroy() +{ + emptyTile = nullptr; + + // For some reason, QWindow changes visibility of QSurface::surfaceHandle(). + const QSurface *surface = window; + + // Attempting to uninstall the shadow after the platform window had been destroyed. + if (!(surface && surface->surfaceHandle())) { + return; + } + + xcb_connection_t *connection = QX11Info::connection(); + + const xcb_atom_t atom = lookupAtom(s_atomName); + if (atom == XCB_ATOM_NONE) { + return; + } + + xcb_delete_property(connection, window->winId(), atom); +} + +KWindowShadowTile::Ptr KWindowShadowPrivateX11::getOrCreateEmptyTile() +{ + if (!emptyTile) { + QImage image(QSize(1, 1), QImage::Format_ARGB32); + image.fill(Qt::transparent); + + emptyTile = KWindowShadowTile::Ptr::create(); + emptyTile->setImage(image); + emptyTile->create(); + } + + return emptyTile; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/platforms/xcb/kwindowshadow_p_x11.h new/kwindowsystem-5.67.0/src/platforms/xcb/kwindowshadow_p_x11.h --- old/kwindowsystem-5.66.0/src/platforms/xcb/kwindowshadow_p_x11.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/platforms/xcb/kwindowshadow_p_x11.h 2020-02-02 13:55:51.000000000 +0100 @@ -0,0 +1,48 @@ +/* + Copyright (C) 2019 Vlad Zahorodnii <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef KWINDOWSHADOW_P_X11_H +#define KWINDOWSHADOW_P_X11_H + +#include "kwindowshadow_p.h" + +#include <xcb/xcb.h> + +class KWindowShadowTilePrivateX11 final : public KWindowShadowTilePrivate +{ +public: + bool create() override; + void destroy() override; + + static KWindowShadowTilePrivateX11 *get(const KWindowShadowTile *tile); + + xcb_pixmap_t pixmap = XCB_PIXMAP_NONE; + xcb_gcontext_t gc = XCB_NONE; +}; + +class KWindowShadowPrivateX11 final : public KWindowShadowPrivate +{ +public: + bool create() override; + void destroy() override; + + KWindowShadowTile::Ptr getOrCreateEmptyTile(); + + KWindowShadowTile::Ptr emptyTile; +}; + +#endif // KWINDOWSHADOW_P_X11_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/platforms/xcb/plugin.cpp new/kwindowsystem-5.67.0/src/platforms/xcb/plugin.cpp --- old/kwindowsystem-5.66.0/src/platforms/xcb/plugin.cpp 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/platforms/xcb/plugin.cpp 2020-02-02 13:55:51.000000000 +0100 @@ -20,6 +20,7 @@ #include "plugin.h" #include "kwindoweffects_x11.h" #include "kwindowinfo_p_x11.h" +#include "kwindowshadow_p_x11.h" #include "kwindowsystem_p_x11.h" X11Plugin::X11Plugin(QObject *parent) @@ -45,3 +46,13 @@ { return new KWindowInfoPrivateX11(window, properties, properties2); } + +KWindowShadowPrivate *X11Plugin::createWindowShadow() +{ + return new KWindowShadowPrivateX11(); +} + +KWindowShadowTilePrivate *X11Plugin::createWindowShadowTile() +{ + return new KWindowShadowTilePrivateX11(); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/platforms/xcb/plugin.h new/kwindowsystem-5.67.0/src/platforms/xcb/plugin.h --- old/kwindowsystem-5.66.0/src/platforms/xcb/plugin.h 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/platforms/xcb/plugin.h 2020-02-02 13:55:51.000000000 +0100 @@ -35,6 +35,8 @@ KWindowEffectsPrivate *createEffects() override; KWindowSystemPrivate *createWindowSystem() override; KWindowInfoPrivate *createWindowInfo(WId window, NET::Properties properties, NET::Properties2 properties2) override; + KWindowShadowPrivate *createWindowShadow() override final; + KWindowShadowTilePrivate *createWindowShadowTile() override final; }; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/pluginwrapper.cpp new/kwindowsystem-5.67.0/src/pluginwrapper.cpp --- old/kwindowsystem-5.66.0/src/pluginwrapper.cpp 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/pluginwrapper.cpp 2020-02-02 13:55:51.000000000 +0100 @@ -21,6 +21,7 @@ #include "kwindowinfo_dummy_p.h" #include "kwindowsystemplugininterface_p.h" #include "kwindoweffects_dummy_p.h" +#include "kwindowshadow_dummy_p.h" #include "kwindowsystem_dummy_p.h" #include "kwindowsystem_debug.h" @@ -127,6 +128,30 @@ } return p; } + +KWindowShadowPrivate *KWindowSystemPluginWrapper::createWindowShadow() const +{ + KWindowShadowPrivate *p = nullptr; + if (!m_plugin.isNull()) { + p = m_plugin->createWindowShadow(); + } + if (!p) { + p = new KWindowShadowPrivateDummy(); + } + return p; +} + +KWindowShadowTilePrivate *KWindowSystemPluginWrapper::createWindowShadowTile() const +{ + KWindowShadowTilePrivate *p = nullptr; + if (!m_plugin.isNull()) { + p = m_plugin->createWindowShadowTile(); + } + if (!p) { + p = new KWindowShadowTilePrivateDummy(); + } + return p; +} const KWindowSystemPluginWrapper &KWindowSystemPluginWrapper::self() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.66.0/src/pluginwrapper_p.h new/kwindowsystem-5.67.0/src/pluginwrapper_p.h --- old/kwindowsystem-5.66.0/src/pluginwrapper_p.h 2020-01-04 11:15:04.000000000 +0100 +++ new/kwindowsystem-5.67.0/src/pluginwrapper_p.h 2020-02-02 13:55:51.000000000 +0100 @@ -27,6 +27,8 @@ class KWindowEffectsPrivate; class KWindowInfoPrivate; +class KWindowShadowPrivate; +class KWindowShadowTilePrivate; class KWindowSystemPluginInterface; class KWindowSystemPrivate; @@ -40,6 +42,8 @@ KWindowEffectsPrivate *effects() const; KWindowSystemPrivate *createWindowSystem() const; KWindowInfoPrivate *createWindowInfo(WId window, NET::Properties properties, NET::Properties2 properties2) const; + KWindowShadowPrivate *createWindowShadow() const; + KWindowShadowTilePrivate *createWindowShadowTile() const; private: QScopedPointer<KWindowSystemPluginInterface> m_plugin;
