W42: Wayland: compile the KDE blur protocol only with wayland-kde-blur

The `wayland` feature, which is on by default, enabled
wayland-protocols-plasma for the org_kde_kwin_blur_manager protocol. That
crate is MIT, but the blur protocol XML it turns into code is
LGPL-2.1-or-later, so every Linux build compiled LGPL-derived bindings.

The new `wayland-kde-blur` feature, off by default and not part of
`wayland`, enables the dependency and the blur code. Without it,
Window::set_blur and WindowAttributes::with_blur are ignored on Wayland
and the window logs the request at info level. With it, blur works as
before.

CI gets a job that fails when the default features, or any feature other
than `wayland-kde-blur`, bring in wayland-protocols-plasma, and a Linux
row that builds, tests and lints with `wayland-kde-blur`.
This commit is contained in:
dotCooCoo committed 2026-11-22 08:56:28 -08:00
1 parent ad81a32589
commit 0ecdbe5e51
8 files changed
+58 -2

No files matched your search

+27
View File
@@ -35,6 +35,32 @@ jobs:
echo 'To check for a diff, run `typos`'
echo 'You can find typos here: https://crates.io/crates/typos'
kde-blur-opt-in:
name: Check that the KDE blur protocol is opt-in
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: dtolnay/rust-toolchain@stable
- name: Only `wayland-kde-blur` brings in wayland-protocols-plasma
# The protocol XML in wayland-protocols-plasma is LGPL-2.1-or-later.
run: |
set -eu
plasma() {
tree=$(cargo tree -e normal,build --target x86_64-unknown-linux-gnu --prefix none "$@") \
|| { echo "cargo tree $* failed"; exit 2; }
printf '%s\n' "$tree" | grep -q '^wayland-protocols-plasma '
}
others=$(cargo metadata --format-version 1 --no-deps \
| jq -r '[.packages[] | select(.name == "winit") | .features | keys[]
| select(. != "default" and . != "wayland-kde-blur")] | join(",")')
if plasma; then echo 'the default features bring in wayland-protocols-plasma'; exit 1; fi
if plasma --features="$others"; then
echo "one of $others brings in wayland-protocols-plasma"; exit 1
fi
if ! plasma --no-default-features --features=wayland-kde-blur; then
echo 'wayland-kde-blur does not bring in wayland-protocols-plasma'; exit 1
fi
tests:
name: Test ${{ matrix.toolchain }} ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
@@ -53,6 +79,7 @@ jobs:
- { name: 'Linux 64bit', target: x86_64-unknown-linux-gnu, os: ubuntu-latest, }
- { name: 'X11', target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: '--no-default-features --features=x11' }
- { name: 'Wayland', target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: '--no-default-features --features=wayland,wayland-dlopen' }
- { name: 'Wayland KDE blur', target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: '--features=wayland-kde-blur' }
- { name: 'Android', target: aarch64-linux-android, os: ubuntu-latest, options: '--package=winit --features=android-native-activity', cmd: 'apk --' }
- { name: 'Redox OS', target: x86_64-unknown-redox, os: ubuntu-latest, }
- { name: 'macOS', target: x86_64-apple-darwin, os: macos-latest, }