Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorWayland::BackgroundEffect Class Reference

Compositor blur behind a region of a window, through the standard ext-background-effect-v1 protocol. More...

#include <PhosphorWayland/BackgroundEffect.h>

Inheritance diagram for PhosphorWayland::BackgroundEffect:
[legend]

Signals

void blurSupportedChanged (bool supported)

Public Member Functions

bool isBlurSupported () const
 Whether the compositor applies blur requested through this class right now: the protocol is advertised and its blur capability is reported.
void setBlurRegion (QWindow *window, const QRegion &region)
 Blur the backdrop behind region of window, in window-local logical coordinates (the coordinates a QQuickItem in that window maps to).
QRegion blurRegion (const QWindow *window) const
 The region last set for window, whether or not it is applied.

Static Public Member Functions

static BackgroundEffect * instance ()
 The process's instance, created on first use as a child of the application object.

Detailed Description

Compositor blur behind a region of a window, through the standard ext-background-effect-v1 protocol.

A Wayland client cannot read what lies behind its own surface, so a translucent material over live windows needs the compositor to blur that backdrop. This asks for it on any QWindow whose platform window comes from the phosphorwayland shell integration: layer surfaces, and the regular windows it hands to xdg-shell. The window then paints its own tint over the blurred backdrop.

Process-wide and GUI-thread only. Every call is a no-op toward the compositor while blur is unsupported: when the phosphorwayland shell integration is not loaded, when the compositor does not advertise ext_background_effect_manager_v1, or when it does not report the blur capability. The region a window asks for is remembered regardless, and sent once the window has a surface and blur is supported, so a caller sets it once and updates it when its shape changes. It is sent again whenever Qt recreates the window's wl_surface (as it does on hide and show) and whenever the compositor reports the blur capability again after dropping it.

Member Function Documentation

◆ blurRegion()

QRegion PhosphorWayland::BackgroundEffect::blurRegion ( const QWindow * window) const
nodiscard

The region last set for window, whether or not it is applied.

◆ blurSupportedChanged

void PhosphorWayland::BackgroundEffect::blurSupportedChanged ( bool supported)
signal

◆ instance()

BackgroundEffect * PhosphorWayland::BackgroundEffect::instance ( )
static

The process's instance, created on first use as a child of the application object.

Requires a QGuiApplication. On Wayland, creating it loads Qt's shell integration if no window has yet, so blurSupported is known from the start.

◆ isBlurSupported()

bool PhosphorWayland::BackgroundEffect::isBlurSupported ( ) const
nodiscard

Whether the compositor applies blur requested through this class right now: the protocol is advertised and its blur capability is reported.

Can change at runtime; blurSupportedChanged() says when.

◆ setBlurRegion()

void PhosphorWayland::BackgroundEffect::setBlurRegion ( QWindow * window,
const QRegion & region )

Blur the backdrop behind region of window, in window-local logical coordinates (the coordinates a QQuickItem in that window maps to).

An empty region removes the effect. Applied with the window's next frame: this requests one.


The documentation for this class was generated from the following file: