New blur protocol
The current blur effect suffers from the so called korner bug where windows with blurred background have glitchy rounded corners. The reason why that glitch can be observed is that the blur region is specified in the logical pixels, also in part due to anti-aliasing.
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="kde_blur_v1">
<copyright>
Copyright (C) 2024 Vlad Zahorodnii
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="kde_blur_manager_v1" version="1">
<description summary="blur object factory">
This protocol provides a way to improve visuals of translucent surfaces
by blurring background behind them.
Warning! The protocol described in this file is currently in the testing
phase. Backward compatible changes may be added together with the
corresponding interface version bump. Backward incompatible changes can
only be done by creating a new major version of the extension.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the blur manager object">
Informs the server that the client will no longer be using this
protocol object. Existing objects created by this object are not
affected.
</description>
</request>
<enum name="error">
<entry name="blur_exists" value="0"
summary="the surface has already a blur object associated"/>
</enum>
<request name="get_blur">
<description summary="get a blur object">
Instantiate an interface extension for the given wl_surface to
blur background behind it. If the given wl_surface already has
a kde_blur_surface_v1 object associated, the blur_exists protocol
error will be raised.
</description>
<arg name="id" type="new_id" interface="kde_blur_surface_v1"
summary="the new kde_blur_surface_v1 object"/>
<arg name="surface" type="object" interface="wl_surface"
summary="the surface"/>
</request>
<request name="get_blur_mask">
<description summary="get a blur mask">
Create a blur mask object. A blur mask object is used to specify
the portions of the surface background that shows through.
</description>
<arg name="id" type="new_id" interface="kde_blur_mask_v1"
summary="the new kde_blur_mask_v1 object"/>
</request>
</interface>
<interface name="kde_blur_mask_v1" version="1">
<description summary="blur mask">
The blur mask specifies the portions of the surface background that
show through.
The blur mask is a nine patch image. It is stretched to fit the surface.
</description>
<enum name="error">
<entry name="invalid_mask" value="0"
summary="tried to set an invalid mask"/>
</enum>
<request name="destroy" type="destructor">
Notify the compositor that the blur mask object will no longer be used.
</request>
<request name="set_mask">
<description summary="set the alpha mask">
Sets the alpha mask.
The alpha mask buffer has the WL_SHM_FORMAT_R8 format. A value of 0
indicates background as is and a value of 255 indicates blurred background.
The alpha mask buffer must have wl_shm_buffer type, otherwise the
invalid_mask protocol error is raised.
</description>
<arg name="mask" type="object" interface="wl_buffer"/>
</request>
<request name="set_scale">
<description summary="sets the alpha mask buffer scale">
Sets the alpha mask buffer scale.
The scale is premultiplied by 120. For example, 120 corresponds to a scale
value of 1 and 240 corresponds to a scale value of 2.
</description>
<arg name="scale" type="uint">
</request>
<request name="set_center">
<description summary="set the center tile geometry">
Sets the geometry of the center tile. The geometry is specified in the
surface local coordinates.
</description>
<arg name="x" type="uint"/>
<arg name="y" type="uint"/>
<arg name="width" type="uint"/>
<arg name="height" type="uint"/>
</request>
</interface>
<interface name="kde_blur_surface_v1" version="1">
<description summary="blur object for a surface">
The blur object provides a way to specify a region behind a surface
that should be blurred by the compositor.
If the wl_surface associated with the kde_blur_surface_v1 object has been
destroyed, this object becomes inert.
</description>
<request name="destroy" type="destructor">
<description summary="release the blur object">
Informs the server that the client will no longer be using this
protocol object. The blur region will be unset on the next commit.
</description>
</request>
<request name="set_mask">
<description summary="set the alpha mask">
Sets the blur alpha mask.
The blur mask can be destroyed after calling this request.
The blur mask is double buffered, and will be applied at the
time wl_surface.commit of the corresponding wl_surface is called.
</description>
<arg name="mask" type="object" interface="kde_blur_mask_v1"/>
</request>
<request name="unset_mask">
<description summary="unset the alpha mask">
Unsets the blur alpha mask.
The blur mask is double buffered, and will be applied at the
time wl_surface.commit of the corresponding wl_surface is called.
</description>
</request>
<request name="set_shape">
<description summary="set the blur shape">
Sets the region of the surface that will have its background blurred.
The blur shape is specified in the surface-local coordinates.
The blur shape is double buffered, and will be applied at the
time wl_surface.commit of the corresponding wl_surface is called.
</description>
<arg name="shape" type="object" interface="wl_region"/>
</request>
<request name="unset_shape">
<description summary="unset the blur shape">
Unsets the blur shape. The blur effect will apply to the whole surface.
The blur shape is double buffered, and will be applied at the
time wl_surface.commit of the corresponding wl_surface is called.
</description>
</request>
</interface>
</protocol>
The proposed blur protocol should help with this issue. In order to blur the background, a window would need to specify the blur region same as in the current protocol, but it could also specify an optional alpha mask. The alpha mask is a nine tile patch image, it's stretched to fit the whole window. The alpha mask specifies what parts of the blurred background are visible or how much.
Edited by Vlad Zahorodnii