Skip to content

Add Blur API #2293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions blur-protocol/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
dep_scanner = dependency('wayland-scanner', native: true)
prog_scanner = find_program(dep_scanner.get_variable(pkgconfig: 'wayland_scanner'))

blur_protocol_file = files('pantheon-blur-v1.xml')

pantheon_blur_sources = []
pantheon_blur_sources += custom_target(
'pantheon-blur-server-protocol.h',
command: [ prog_scanner, 'server-header', '@INPUT@', '@OUTPUT@' ],
input: blur_protocol_file,
output: 'pantheon-blur-server-protocol.h',
)

output_type = 'private-code'
if dep_scanner.version().version_compare('< 1.14.91')
output_type = 'code'
endif
pantheon_blur_sources += custom_target(
'pantheon-blur-protocol.c',
command: [ prog_scanner, output_type, '@INPUT@', '@OUTPUT@' ],
input: blur_protocol_file,
output: 'pantheon-blur-protocol.c',
)

pantheon_blur_dep = declare_dependency(
dependencies: [
vala.find_library('pantheon-blur', dirs: meson.current_source_dir()),
dependency('wayland-server'),
],
include_directories: include_directories('.'),
sources: pantheon_blur_sources
)
46 changes: 46 additions & 0 deletions blur-protocol/pantheon-blur-v1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="pantheon_blur_v1">
<copyright><![CDATA[
SPDX-FileCopyrightText: 2025 elementary <https://elementary.io>

SPDX-License-Identifier: LGPL-2.1-or-later
]]></copyright>

<interface name="io_elementary_pantheon_blur_manager_v1" version="1">
<description summary="blur object factory">
This protocol provides a way for Pantheon applications to ask for background blur.
</description>

<request name="get_blur">
<description summary="get blur object">
Get blur object for the given wl_surface to blur background behind it.
If the given wl_surface already has a io_elementary_pantheon_blur_v1 object associated,
an error will be raised.
</description>
<arg name="output" type="new_id" interface="io_elementary_pantheon_blur_v1"/>
<arg name="surface" type="object" interface="wl_surface"/>
</request>
</interface>

<interface name="io_elementary_pantheon_blur_v1" version="1">
<description summary="blur object for surface">
This interface provides a way for Pantheon applications to specify region of the window to be blurred.
By default the region to blur is considered to be null.
</description>

<request name="destroy" type="destructor"/>

<request name="set_region">
<description summary="set blur region">
Tell the window manager to crop blur to a given region.
The coordinates must be relative to the associated surface.
</description>

<arg name="x" type="uint"/>
<arg name="y" type="uint"/>
<arg name="width" type="uint"/>
<arg name="height" type="uint"/>
<arg name="clip_radius" type="uint"/>
</request>
</interface>
</protocol>
1 change: 1 addition & 0 deletions blur-protocol/pantheon-blur.deps
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wayland-server
29 changes: 29 additions & 0 deletions blur-protocol/pantheon-blur.vapi
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2025 elementary, Inc. <https://elementary.io>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

namespace Pantheon.Blur {
[CCode (cheader_filename = "pantheon-blur-server-protocol.h", cname = "struct io_elementary_pantheon_blur_manager_v1_interface")]
public struct BlurManagerInterface {
[CCode (cheader_filename = "pantheon-blur-server-protocol.h", cname = "io_elementary_pantheon_blur_manager_v1_interface")]
public static Wl.Interface iface;
public Pantheon.Blur.GetBlur get_blur;

}

[CCode (cheader_filename = "pantheon-blur-server-protocol.h", cname = "struct io_elementary_pantheon_blur_v1_interface")]
public struct BlurInterface {
[CCode (cheader_filename = "pantheon-blur-server-protocol.h", cname = "io_elementary_pantheon_blur_v1_interface")]
public static Wl.Interface iface;
public Destroy destroy;
public SetRegion set_region;
}

[CCode (has_target = false, has_typedef = false)]
public delegate void GetBlur (Wl.Client client, Wl.Resource resource, uint32 output, Wl.Resource surface);
[CCode (has_target = false, has_typedef = false)]
public delegate void SetRegion (Wl.Client client, Wl.Resource resource, uint x, uint y, uint width, uint height, uint clip_radius);
[CCode (has_target = false, has_typedef = false)]
public delegate void Destroy (Wl.Client client, Wl.Resource resource);
}
2 changes: 2 additions & 0 deletions docs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ all_doc_target = custom_target(
'--pkg', 'gmodule-2.0',
'--pkg', 'wayland-server',
'--pkg', 'pantheon-desktop-shell',
'--pkg', 'pantheon-blur',
'--vapidir=' + join_paths(meson.global_source_root(), 'protocol'),
'--vapidir=' + join_paths(meson.global_source_root(), 'blur-protocol'),
'-o', '@OUTPUT@',
'@INPUT@'
],
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ endif

subdir('data')
subdir('protocol')
subdir('blur-protocol')
subdir('lib')
subdir('src')
subdir('daemon')
Expand Down
Loading
Loading