fix: handle display rotation in wallpaper rendering#126
Open
olafkfreund wants to merge 1 commit intopop-os:masterfrom
Open
fix: handle display rotation in wallpaper rendering#126olafkfreund wants to merge 1 commit intopop-os:masterfrom
olafkfreund wants to merge 1 commit intopop-os:masterfrom
Conversation
Implement the `transform_changed` handler (previously a TODO stub) to properly track output transform changes. When a display is rotated 90° or 270°, the wallpaper dimensions need to be swapped so the image is scaled to the correct orientation. Changes: - Add `transform` field to `CosmicBgLayer` to track output orientation - Add `effective_size()` method that swaps width/height for rotated displays - Implement `transform_changed()` to update transform and trigger redraw - Use `effective_size()` instead of raw `size` when calculating wallpaper dimensions in the draw path Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mmstick
reviewed
Feb 12, 2026
| } | ||
|
|
||
| /// Returns `true` if the given transform represents a 90° or 270° rotation. | ||
| fn is_rotated_90_or_270(transform: wl_output::Transform) -> bool { |
Member
There was a problem hiding this comment.
transform_is_vertical would be more readable.
mmstick
reviewed
Feb 12, 2026
|
|
||
| impl CosmicBgLayer { | ||
| /// Returns the effective size, swapping width and height for 90°/270° rotations. | ||
| pub fn effective_size(&self) -> Option<(u32, u32)> { |
Member
There was a problem hiding this comment.
rotated_size is also more descriptive
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
transform_changedhandler (previously a// TODOstub) to properly track output transform changeseffective_size()method toCosmicBgLayerthat accounts for rotation transformsProblem
On displays with 90°/270° rotation (including flipped variants), wallpapers are rendered with the wrong aspect ratio because the raw layer size is used without accounting for the output transform. The
transform_changedhandler was left as a TODO stub.Changes
src/main.rs:transformfield toCosmicBgLayerstruct, initialized fromoutput_info.transformis_rotated_90_or_270()helper for detecting rotated transformsCosmicBgLayer::effective_size()that swaps width/height when rotatedtransform_changed()to update the stored transform and trigger a redrawsrc/wallpaper.rs:layer.effective_size()instead oflayer.sizein the draw pathTest plan
🤖 Generated with Claude Code