fix(desktop): address KDE feedback and keep local builds in sync with CI (#488)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-09 21:35:37 +00:00
1 parent c761b83112
commit d99ed8e00b
41 files changed
+1252 -191

No files matched your search

+12
View File
@@ -21,3 +21,15 @@ at every session): Plasma's own `startplasma-wayland`, with KWin nested in the a
through `kwin_wayland_wrapper`. KWin composites in software (QPainter) - the Adreno node is not a
DRM device - so games and emulators from the menu go through `droiddeck-gpu`, and Steam goes back
to the app as a Steam session.
`build-kwin.sh` builds KWin 6.7.5's Wayland executable and library on a native ARM64 runner, using a disposable
Arch Linux ARM chroot with every build package signature-checked. The KDE source tarball is pinned
by SHA-256 (the same digest in Arch's KWin PKGBUILD); `patches/0001-respect-nested-desktop-scale.patch`
lets Display Settings control the inner desktop scale independently of the outer window size.
It keeps layer sizes, pointer/touch coordinates and the cursor in the same physical pixels.
The behavior is enabled only with `DROIDDECK_NESTED_SCALE`, which the desktop script supplies.
The desktop workflow replaces the same-version `kwin_wayland` executable and `libkwin.so`; the rest
comes from the signature-checked Arch packages. `desktop-kde.kwin.txt` records the source, patch,
executable, library and build package hashes. Corresponding source is
https://download.kde.org/stable/plasma/6.7.5/kwin-6.7.5.tar.xz plus the patch in this repository.
+69
View File
@@ -0,0 +1,69 @@
#!/bin/bash
# Build the pinned KWin executable with the nested-scale patch on native aarch64 Linux.
# Its dependencies come from signature-checked Arch Linux ARM packages in a disposable chroot.
set -euo pipefail
out=$(realpath -m "${1:?out dir}")
here=$(cd "$(dirname "$0")" && pwd)
[ "$(uname -m)" = aarch64 ] || { echo 'KWin needs a native aarch64 runner' >&2; exit 1; }
version=6.7.5
source_sha=6baa910b732d93c48c90f9c1cc685cc93d0b8de0cdf138c24192c045bc3a48e2
mirror=https://fl.us.mirror.archlinuxarm.org/aarch64
builder=68B3537F39A313B3E574D06777193F152BDBE6A6
work=$(mktemp -d)
trap 'sudo umount "$work/root/proc" 2>/dev/null || true; sudo rm -rf "$work"' EXIT
mkdir -p "$work/db" "$work/root" "$work/pkgs" "$out"
fetch() { curl -fsSL --proto '=https' --proto-redir '=https' --retry 6 --retry-all-errors -o "$1" "$2"; }
for repo in core extra alarm; do
fetch "$work/db/$repo.db" "$mirror/$repo/$repo.db"
mkdir -p "$work/db/x_$repo"
tar -xzf "$work/db/$repo.db" -C "$work/db/x_$repo"
done
touch "$work/runtime.txt"
python3 "$here/closure.py" "$work/db" "$work/runtime.txt" "$here/kwin-build-seeds.txt" > "$work/packages.txt"
# Refuse a repository whose KWin headers/libraries have moved beyond the pinned source.
grep -Eq '^extra/kwin-6\.7\.5-[0-9]+-aarch64\.pkg\.tar\.' "$work/packages.txt"
export work mirror builder here
download() {
local entry=$1 sum=$2 file=${1#*/}
fetch "$work/pkgs/$file" "$mirror/$entry"
fetch "$work/pkgs/$file.sig" "$mirror/$entry.sig"
gpgv --status-fd 1 --keyring "$here/archlinuxarm-builder.gpg" "$work/pkgs/$file.sig" "$work/pkgs/$file" 2>/dev/null \
| grep -Eq "^\[GNUPG:\] VALIDSIG .* $builder\$"
echo "$sum $work/pkgs/$file" | sha256sum -c - >/dev/null
}
export -f fetch download
xargs -P 8 -n 2 bash -c 'set -euo pipefail; download "$@"' _ < "$work/packages.txt"
while read -r entry sum; do
sudo tar -xf "$work/pkgs/${entry#*/}" -C "$work/root" --no-same-owner \
--exclude=.PKGINFO --exclude=.MTREE --exclude=.INSTALL --exclude=.BUILDINFO --exclude=.CHANGELOG
done < "$work/packages.txt"
fetch "$work/kwin.tar.xz" "https://download.kde.org/stable/plasma/$version/kwin-$version.tar.xz"
echo "$source_sha $work/kwin.tar.xz" | sha256sum -c -
sudo mkdir -p "$work/root/build" "$work/root/proc" "$work/root/dev"
sudo mknod -m 666 "$work/root/dev/null" c 1 3
sudo mknod -m 666 "$work/root/dev/zero" c 1 5
sudo mknod -m 666 "$work/root/dev/random" c 1 8
sudo mknod -m 666 "$work/root/dev/urandom" c 1 9
sudo mount -t proc proc "$work/root/proc"
sudo tar -xf "$work/kwin.tar.xz" -C "$work/root/build"
sudo patch -d "$work/root/build/kwin-$version" -p1 < "$here/patches/0001-respect-nested-desktop-scale.patch"
sudo chroot "$work/root" /usr/bin/env PATH=/usr/bin:/bin HOME=/root LC_ALL=C.UTF-8 \
/usr/bin/cmake -S "/build/kwin-$version" -B /build/out -G Ninja \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBEXECDIR=lib -DBUILD_TESTING=OFF
sudo chroot "$work/root" /usr/bin/env PATH=/usr/bin:/bin HOME=/root LC_ALL=C.UTF-8 \
/usr/bin/cmake --build /build/out --target kwin_wayland --parallel 4
sudo cp "$work/root/build/out/bin/kwin_wayland" "$out/kwin_wayland"
sudo cp "$work/root/build/out/bin/libkwin.so.$version" "$out/libkwin.so.$version"
sudo chown "$(id -u):$(id -g)" "$out/kwin_wayland" "$out/libkwin.so.$version"
strip --strip-unneeded "$out/kwin_wayland" "$out/libkwin.so.$version"
# The backend lives in libkwin, not the small launcher. Catch accidentally shipping only the
# executable, which boots successfully but still loads the distribution's unpatched backend.
grep -aq DROIDDECK_NESTED_SCALE "$out/libkwin.so.$version"
{
echo "KWin $version source sha256 $source_sha"
echo "Patch sha256 $(sha256sum "$here/patches/0001-respect-nested-desktop-scale.patch" | cut -d' ' -f1)"
echo "Executable sha256 $(sha256sum "$out/kwin_wayland" | cut -d' ' -f1)"
echo "Library sha256 $(sha256sum "$out/libkwin.so.$version" | cut -d' ' -f1)"
echo 'Build packages (Arch Linux ARM signatures verified):'
cat "$work/packages.txt"
} > "$out/desktop-kde.kwin.txt"
+6
View File
@@ -56,6 +56,12 @@ done < "$work/pkglist.txt"
cp -a "$here/overlay/." "$work/root/"
# Same-version KWin, built by build-kwin.sh with the nested desktop scale patch.
if [ -n "${KDE_KWIN_OVERRIDE:-}" ]; then
install -m 755 "$KDE_KWIN_OVERRIDE/kwin_wayland" "$work/root/usr/bin/kwin_wayland"
install -m 755 "$KDE_KWIN_OVERRIDE/libkwin.so.6.7.5" "$work/root/usr/lib/libkwin.so.6.7.5"
fi
# Weight that no desktop on a phone reads.
rm -rf "$work/root/usr/share/doc" "$work/root/usr/share/man" "$work/root/usr/share/info" \
"$work/root/usr/share/gtk-doc" "$work/root/usr/include" "$work/root/usr/lib/pkgconfig" \
+16
View File
@@ -0,0 +1,16 @@
# Native build tools and KWin's Arch makedepends; dependencies are resolved and signature-checked.
kwin
base-devel
cmake
ninja
gcc
make
pkgconf
extra-cmake-modules
kdoctools
krunner
plasma-wayland-protocols
python
vulkan-headers
wayland-protocols
xorg-xwayland
@@ -8,5 +8,10 @@ Third-party files in DroidDeck's KDE desktop package (tools/desktop-kde/overlay)
- steam.svg: Papirus icon theme (https://github.com/PapirusDevelopmentTeam/papirus-icon-theme),
GPL-3.0.
- kwin_wayland: KWin 6.7.5, GPL-2.0-or-later. Built with DroidDeck's nested desktop scale patch.
Corresponding source: https://download.kde.org/stable/plasma/6.7.5/kwin-6.7.5.tar.xz and
https://github.com/Droid-Deck/DroidDeck/tree/fix/kde-desktop-followups/tools/desktop-kde/patches
(the source and patch hashes are recorded in desktop-kde.kwin.txt beside the package).
Everything else in the package is Arch Linux ARM's own packages, under their own licenses
(/usr/share/licenses).
@@ -0,0 +1,158 @@
--- a/src/backends/wayland/wayland_output.cpp
+++ b/src/backends/wayland/wayland_output.cpp
@@ -294,6 +294,11 @@
}
}
+qreal WaylandOutput::presentationScale() const
+{
+ return qEnvironmentVariableIsSet("DROIDDECK_NESTED_SCALE") ? m_pendingScale : scale();
+}
+
bool WaylandOutput::present(const QList<OutputLayer *> &layersToUpdate, const std::shared_ptr<OutputFrame> &frame)
{
auto cursorLayers = layersToUpdate | std::views::filter([](OutputLayer *layer) {
@@ -312,7 +317,7 @@
m_surface->attachBuffer(buffer);
m_mapped = true;
}
- m_viewport->setDestination(QSize(std::round(modeSize().width() / scale()), std::round(modeSize().height() / scale())));
+ m_viewport->setDestination(QSize(std::round(modeSize().width() / presentationScale()), std::round(modeSize().height() / presentationScale())));
m_surface->setScale(1);
// commit the subsurfaces before the main surface
for (OutputLayer *layer : layersToUpdate) {
@@ -375,9 +380,11 @@
next.enabled = props->enabled.value_or(m_state.enabled);
next.transform = props->transform.value_or(m_state.transform);
next.position = props->pos.value_or(m_state.position);
- // intentionally ignored, as it would get overwritten
- // with the fractional scale protocol anyways
- // next.scale = props->scale.value_or(m_state.scale);
+ // DroidDeck owns the outer window size; Display Settings owns the inner UI scale.
+ if (qEnvironmentVariableIsSet("DROIDDECK_NESTED_SCALE")) {
+ next.scale = props->scale.value_or(m_state.scale);
+ next.scaleSetting = props->scaleSetting.value_or(m_state.scaleSetting);
+ }
next.desiredMode = props->desiredMode.value_or(m_state.desiredMode);
next.uuid = props->uuid.value_or(m_state.uuid);
next.replicationSource = props->replicationSource.value_or(m_state.replicationSource);
@@ -466,7 +473,9 @@
State next = m_state;
next.modes = {mode};
next.currentMode = mode;
- next.scale = m_pendingScale;
+ if (!qEnvironmentVariableIsSet("DROIDDECK_NESTED_SCALE")) {
+ next.scale = m_pendingScale;
+ }
setState(next);
Q_EMIT m_backend->outputsQueried();
--- a/src/backends/wayland/wayland_output.h
+++ b/src/backends/wayland/wayland_output.h
@@ -93,6 +93,8 @@
void init(const QSize &pixelSize, qreal scale, bool fullscreen);
+ // The outer window scale, independent of the desktop UI scale in DroidDeck.
+ qreal presentationScale() const;
bool isReady() const;
KWayland::Client::Surface *surface() const;
WaylandCursor *cursor() const;
--- a/src/backends/wayland/wayland_backend.cpp
+++ b/src/backends/wayland/wayland_backend.cpp
@@ -107,8 +107,9 @@
WaylandOutput *output = m_seat->backend()->findOutput(m_pointer->enteredSurface());
Q_ASSERT(output);
const auto subsurface = m_seat->backend()->findSubSurface(m_pointer->enteredSurface());
- const QPointF absolutePos = output->position() + relativeToSurface
- + (subsurface ? subsurface->position() : QPoint());
+ const QPointF absolutePos = output->position()
+ + (relativeToSurface + (subsurface ? subsurface->position() : QPoint()))
+ * output->presentationScale() / output->scale();
Q_EMIT pointerMotionAbsolute(absolutePos, std::chrono::milliseconds(time), this);
});
connect(pointer, &Pointer::buttonStateChanged, this, [this](quint32 serial, quint32 time, quint32 button, Pointer::ButtonState nativeState) {
@@ -182,7 +183,11 @@
, m_relativePointer(relativePointer)
{
connect(relativePointer, &RelativePointer::relativeMotion, this, [this](const QSizeF &delta, const QSizeF &deltaNonAccelerated, quint64 timestamp) {
- Q_EMIT pointerMotion(sizeToPoint(delta), sizeToPoint(deltaNonAccelerated), std::chrono::microseconds(timestamp), this);
+ const auto pointer = m_seat->pointerDevice();
+ const auto output = pointer && pointer->m_pointer
+ ? m_seat->backend()->findOutput(pointer->m_pointer->enteredSurface()) : nullptr;
+ const qreal factor = output ? output->presentationScale() / output->scale() : 1.0;
+ Q_EMIT pointerMotion(sizeToPoint(delta) * factor, sizeToPoint(deltaNonAccelerated) * factor, std::chrono::microseconds(timestamp), this);
});
}
@@ -199,13 +204,19 @@
connect(touch, &Touch::sequenceStarted, this, [this](TouchPoint *tp) {
auto o = m_seat->backend()->findOutput(tp->surface());
Q_ASSERT(o);
- const QPointF position = o->position() + tp->position();
+ const auto subsurface = m_seat->backend()->findSubSurface(tp->surface());
+ const QPointF position = o->position()
+ + (tp->position() + (subsurface ? subsurface->position() : QPoint()))
+ * o->presentationScale() / o->scale();
Q_EMIT touchDown(tp->id(), position, std::chrono::milliseconds(tp->time()), this);
});
connect(touch, &Touch::pointAdded, this, [this](TouchPoint *tp) {
auto o = m_seat->backend()->findOutput(tp->surface());
Q_ASSERT(o);
- const QPointF position = o->position() + tp->position();
+ const auto subsurface = m_seat->backend()->findSubSurface(tp->surface());
+ const QPointF position = o->position()
+ + (tp->position() + (subsurface ? subsurface->position() : QPoint()))
+ * o->presentationScale() / o->scale();
Q_EMIT touchDown(tp->id(), position, std::chrono::milliseconds(tp->time()), this);
});
connect(touch, &Touch::pointRemoved, this, [this](TouchPoint *tp) {
@@ -214,7 +225,10 @@
connect(touch, &Touch::pointMoved, this, [this](TouchPoint *tp) {
auto o = m_seat->backend()->findOutput(tp->surface());
Q_ASSERT(o);
- const QPointF position = o->position() + tp->position();
+ const auto subsurface = m_seat->backend()->findSubSurface(tp->surface());
+ const QPointF position = o->position()
+ + (tp->position() + (subsurface ? subsurface->position() : QPoint()))
+ * o->presentationScale() / o->scale();
Q_EMIT touchMotion(tp->id(), position, std::chrono::milliseconds(tp->time()), this);
});
}
--- a/src/backends/wayland/wayland_layer.cpp
+++ b/src/backends/wayland/wayland_layer.cpp
@@ -95,7 +95,7 @@
// this is a bit annoying, we need a new Wayland protocol
// to do this properly with fractional scaling. Until we
// have that, it may cause blurriness in some cases!
- const Rect logicalTarget = targetRect().scaled(1.0 / m_output->scale()).rounded();
+ const Rect logicalTarget = targetRect().scaled(1.0 / output->presentationScale()).rounded();
if (m_viewport) {
m_viewport->setSource(sourceRect());
m_viewport->setDestination(logicalTarget.size());
--- a/src/backends/wayland/wayland_qpainter_backend.cpp
+++ b/src/backends/wayland/wayland_qpainter_backend.cpp
@@ -124,7 +124,9 @@
wl_buffer *buffer = static_cast<WaylandOutput *>(m_output.get())->backend()->importBuffer(m_back->buffer());
Q_ASSERT(buffer);
- static_cast<WaylandOutput *>(m_output.get())->cursor()->update(buffer, m_back->buffer()->size() / m_output->scale(), hotspot().toPoint());
+ auto output = static_cast<WaylandOutput *>(m_output.get());
+ output->cursor()->update(buffer, m_back->buffer()->size() / output->presentationScale(),
+ (hotspot() * output->scale() / output->presentationScale()).toPoint());
m_swapchain->release(m_back);
return true;
}
--- a/src/backends/wayland/wayland_egl_backend.cpp
+++ b/src/backends/wayland/wayland_egl_backend.cpp
@@ -202,7 +202,9 @@
wl_buffer *buffer = m_backend->backend()->importBuffer(m_buffer->buffer());
Q_ASSERT(buffer);
- static_cast<WaylandOutput *>(m_output.get())->cursor()->update(buffer, m_buffer->buffer()->size() / m_output->scale(), (hotspot() / m_output->scale()).toPoint());
+ auto output = static_cast<WaylandOutput *>(m_output.get());
+ output->cursor()->update(buffer, m_buffer->buffer()->size() / output->presentationScale(),
+ (hotspot() / output->presentationScale()).toPoint());
EGLNativeFence releaseFence{m_backend->eglDisplayObject()};
m_swapchain->release(m_buffer, releaseFence.takeFileDescriptor());
+3 -3
View File
@@ -1,4 +1,4 @@
DESKTOP_KDE_REPO=Droid-Deck/DroidDeck-Components
DESKTOP_KDE_TAG=desktop-kde-r1
DESKTOP_KDE_SHA256=55747e75d0ec055ab7ea1e92a757f3be227cc3205bb9101f5b53cadef6318579
DESKTOP_KDE_SIZE=846370256
DESKTOP_KDE_TAG=desktop-kde-r2
DESKTOP_KDE_SHA256=9ba832677b498654136c69d8c8330434d17e4d53cd099acac9bde3ba429b35bf
DESKTOP_KDE_SIZE=846933224