# Forked to apply Plasma Mobile specific fixes that are not in a release yet
pkgname=kwin
pkgver=5.18.80
_pkgver=5.18.3
pkgrel=1
pkgdesc="An easy to use, but flexible, composited Window Manager"
arch="all !armhf" # armhf blocked by qt5-qtdeclarative
url="https://www.kde.org/workspaces/plasmadesktop/"
license="GPL-2.0-or-later AND (GPL-2.0-only OR GPL-3.0-only) AND LGPL-2.1-only"
depends="qt5-qtwayland qt5-qtmultimedia kirigami2 xorg-server-xwayland"
depends_dev="qt5-qtbase-dev qt5-qtdeclarative-dev qt5-qtscript-dev qt5-qtsensors-dev qt5-qtx11extras-dev kconfig-dev kconfigwidgets-dev kcoreaddons-dev kcrash-dev kglobalaccel-dev ki18n-dev kinit-dev knotifications-dev kpackage-dev plasma-framework-dev kwidgetsaddons-dev kwindowsystem-dev kiconthemes-dev kidletime-dev kwayland-dev kcompletion-dev kdeclarative-dev kcmutils-dev kio-dev ktextwidgets-dev knewstuff-dev kservice-dev kxmlgui-dev kactivities-dev kdecoration-dev kscreenlocker-dev breeze-dev libepoxy-dev mesa-dev wayland-dev xcb-util-cursor-dev xcb-util-image-dev xcb-util-wm-dev libinput-dev eudev-dev libdrm-dev mesa-gbm fontconfig-dev libxkbcommon-dev libxi-dev"
makedepends="$depends_dev extra-cmake-modules qt5-qttools-dev qt5-qttools-static kdoctools-dev"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/plasma/$_pkgver/kwin-$_pkgver.tar.xz
	make-virtualkeyboard-disappear-when-locking-screen.patch"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
options="!check" # Broken
builddir="$srcdir/$pkgname-$_pkgver"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	make -C build
}

check() {
	cd "$builddir"/build
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest
}

package() {
	DESTDIR="$pkgdir" make -C build install
}
sha512sums="2eda8f94e095b9941e528e05c9c5720d213eae97c46ff5caff673a94ba4e20826f97a32d53704b422875d26be8eb38101a17ae99b726067dd89c7c62fbaf0bff  kwin-5.18.3.tar.xz
2ac077422221c04f9a81ebb78796f6975647adbe39abd4111af2919f89a665308d69ac2aeb279130633a425f8ce27778562589d66780e1ee30686edc912162f8  make-virtualkeyboard-disappear-when-locking-screen.patch"
