wayland/alpha_modifier: add AlphaModifierSurfaceCachedState::set_multiplier#2065
Open
gaoyia wants to merge 1 commit into
Open
wayland/alpha_modifier: add AlphaModifierSurfaceCachedState::set_multiplier#2065gaoyia wants to merge 1 commit into
gaoyia wants to merge 1 commit into
Conversation
Member
|
Hmm, that primitive is really not meant to be written into from the outside by to represent protocol state. An out-of-tree implementation of a similar protocol should simply add it's own That said, I don't really see an issue with simply merging an implementation of the chromium-protocol in smithay. That way we could safely re-use the same code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
set_multiplier()accessor toAlphaModifierSurfaceCachedState, so compositors can drive the alpha multiplier from sources other than thewp_alpha_modifierprotocol.Problem
AlphaModifierSurfaceCachedStateexposes read accessors (multiplier(),multiplier_f32(),multiplier_f64()), but themultiplierfield itself is private outside thealpha_modifiermodule. Only smithay's ownwp_alpha_modifierdispatch code can write it.Compositors that receive per-surface opacity through other channels cannot reuse this state — and with it the built-in rendering support in
WaylandSurfaceRenderElement— without patching smithay. A concrete example is bridging Chromium'szcr_alpha_compositing_v1extension: itsset_alpharequest carries the same double-buffered per-surface opacity semantics, and mapping it ontoAlphaModifierSurfaceCachedStatelets the existing render path apply it for free.Solution
Add a minimal setter:
Callers are expected to write the pending state (
cached_state.get::<AlphaModifierSurfaceCachedState>().pending()), mirroring what thewp_alpha_modifierdispatch code does; the value is then merged into the current state onwl_surface.commitlike any otherCacheablestate.No behavior change for existing users; this only widens the public API surface by one method, symmetric with the existing getters.
Test plan
cargo check --no-default-features --features wayland_frontendbuilds.cargo docproduces no new warnings.set_multiplier(Some(...))/set_multiplier(None)on the pending state and commits;WaylandSurfaceRenderElementrenders the surface with the expected opacity.Related
wp_alpha_modifierstaging protocol — multiplier is double-buffered onwl_surface.commit.zcr_alpha_compositing_v1— downstream compositors bridge it ontoAlphaModifierSurfaceCachedStateto reuse the same rendering path.