Skip to content

wayland: use ext-background-effect if available#4496

Open
HigherOrderLogic wants to merge 1 commit intorust-windowing:masterfrom
HigherOrderLogic:master
Open

wayland: use ext-background-effect if available#4496
HigherOrderLogic wants to merge 1 commit intorust-windowing:masterfrom
HigherOrderLogic:master

Conversation

@HigherOrderLogic
Copy link

Add ext-background-effect-v1 backend for blur windows on Wayland. Tested with niri-wm/niri#3483.

  • Tested on all platforms changed
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

/// - **Android / iOS / X11 / Web / Windows:** Unsupported.
/// - **Wayland:** Only works with org_kde_kwin_blur_manager protocol.
/// - **Wayland:** Only works with `org_kde_kwin_blur_manager` and
/// `ext_background_effect_manager_v1` protocol.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be an extreme nitpick but should this comment say "or", so it's clear that blur works with either the KDE or the generic protocol? Instead of sounding like it might require both

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good idea.

@madsmtm madsmtm added the DS - wayland Affects the Wayland backend, or generally free Unix platforms label Feb 27, 2026
Comment on lines +44 to +60
#[derive(Debug)]
pub enum BlurSurface {
Ext(WlSurface, ExtBackgroundEffectSurfaceV1),
Kwin(OrgKdeKwinBlur),
}

impl BlurSurface {
pub fn commit(&self) {
match self {
BlurSurface::Ext(s, _) => s.commit(),
BlurSurface::Kwin(s) => s.commit(),
}
}
}

impl Drop for BlurSurface {
fn drop(&mut self) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move all of that somewhere else, like types/blur.

self.blur_manager.as_ref().unwrap().unset(self.window.wl_surface());
self.blur.take().unwrap().release();
self.blur_manager.as_mut().unwrap().unset(self.window.wl_surface());
drop(self.blur.take().unwrap());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
drop(self.blur.take().unwrap());
self.blur = None;

size: LogicalSize<u32>,
) -> ExtBackgroundEffectSurfaceV1 {
let region = Region::new(compositor_state.deref()).unwrap();
region.add(0, 0, size.width as i32, size.height as i32);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just follow KDE blur impl? It's the same protocol, so not sure why it has to be different to what we have. Not sure about region though, but usually i32::MAX does the job because it's clipped.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same protocol, so not sure why it has to be different to what we have.

I asked Yalter about this and he said that the surface object when created has no effect, so the client have to call set_blur_region to ask the compositor to blur the surface. I'll try to see if i32::MAX works here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DS - wayland Affects the Wayland backend, or generally free Unix platforms

Development

Successfully merging this pull request may close these issues.

4 participants