feat: advertise alpha-modifier-v1 (passive surface alpha)

This commit is contained in:
Andrew Hamilton 2026-09-10 02:30:55 +10:00
parent 33526c7a4e
commit 8bdaa970cc
4 changed files with 28 additions and 1 deletions

View file

@ -502,6 +502,14 @@ compositor (sound, visual flash, or nothing); kick logs each ring as
`[bell] ring` at `KICK_LOG=1` and otherwise renders nothing, keeping
the quiet-by-default contract.
## Alpha modifier (`alpha-modifier-v1`)
Kick advertises `wp_alpha_modifier_v1`, so clients can multiply their
surface's alpha (fades, translucent video) without repainting.
wlroots applies the multiplier when rendering, so like color
representation this is a passive correctness handshake rather than
visible compositor work.
## Logging (`KICK_LOG`)
Quiet by default: a plain launch prints nothing to the launching terminal

8
kick.c
View file

@ -75,6 +75,7 @@
#include <wlr/render/swapchain.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/render/wlr_texture.h>
#include <wlr/types/wlr_alpha_modifier_v1.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_color_management_v1.h>
#include <wlr/types/wlr_color_representation_v1.h>
@ -405,6 +406,10 @@ struct kick_server {
internally, we only query the type for the debug log. */
struct wlr_content_type_manager_v1 *content_type_mgr;
struct wlr_single_pixel_buffer_manager_v1 *single_pixel_mgr;
/* Alpha modifier (wp_alpha_modifier_v1): a surface multiplies its own
alpha (fades, translucent video). Fully passive: wlroots applies
the multiplier when rendering, so advertising is the whole job. */
struct wlr_alpha_modifier_v1 *alpha_modifier_mgr;
/* Primary selection (zwp_primary_selection_v1). Clients request the
selection on their seat device; the request handler below is what
actually installs it on the seat, mirroring the clipboard path. */
@ -11875,6 +11880,9 @@ int main(int argc, char *argv[]) {
wlr_content_type_manager_v1_create(server.wl_display, 1);
server.single_pixel_mgr =
wlr_single_pixel_buffer_manager_v1_create(server.wl_display);
/* Alpha modifier: one passive global (see the field comment). */
server.alpha_modifier_mgr =
wlr_alpha_modifier_v1_create(server.wl_display);
/* Let nested clients pick their cursor shape (cursor-shape-v1); the
manager is passive, so we handle request_set_shape ourselves below:

View file

@ -311,6 +311,14 @@ protocols = {
wl_protocols_dir / 'staging/single-pixel-buffer/single-pixel-buffer-v1.xml',
'single-pixel-buffer-v1',
],
# Alpha modifier (a surface multiplies its own alpha): staging
# protocol from the system wayland-protocols. Only client stubs are
# needed for wltest; the server side is wlroots'
# wlr_alpha_modifier_v1.
'alpha-modifier': [
wl_protocols_dir / 'staging/alpha-modifier/alpha-modifier-v1.xml',
'alpha-modifier-v1',
],
# Viewporter (stable): only the client stub is needed (the server side
# is wlroots' wlr_viewporter_create). wltest uses it to scale a 1x1
# single-pixel buffer up to the window size.
@ -436,6 +444,7 @@ executable('wltest',
code_by_name['input-method'],
code_by_name['content-type'],
code_by_name['single-pixel'],
code_by_name['alpha-modifier'],
code_by_name['viewporter'],
code_by_name['gamma-control'],
code_by_name['xdg-dialog'],
@ -464,6 +473,7 @@ executable('wltest',
client_headers['input-method'],
client_headers['content-type'],
client_headers['single-pixel'],
client_headers['alpha-modifier'],
client_headers['viewporter'],
client_headers['gamma-control'],
client_headers['xdg-dialog'],

View file

@ -1360,7 +1360,8 @@ def test_standalone_headless_protocol_globals(globals_session, tmp_path):
"wp_presentation", "zxdg_output_manager_v1",
"wp_viewporter", "wl_fixes",
"xdg_toplevel_tag_manager_v1",
"wp_color_representation_manager_v1"):
"wp_color_representation_manager_v1",
"wp_alpha_modifier_v1"):
assert want in names, \
f"missing global {want}; advertised: {sorted(names)}"