Skip to content

fix(wayland): use the current wl_output mode - #5150

Merged
ReenigneArcher merged 3 commits into
LizardByte:masterfrom
zacharydenton:fix/wayland-current-mode-reinit
Aug 21, 2026
Merged

fix(wayland): use the current wl_output mode#5150
ReenigneArcher merged 3 commits into
LizardByte:masterfrom
zacharydenton:fix/wayland-current-mode-reinit

Conversation

@zacharydenton

@zacharydenton zacharydenton commented May 18, 2026

Copy link
Copy Markdown
Contributor

Description

wl_output.mode is emitted for every advertised mode, not just the active one.

The current code overwrites viewport.width and viewport.height on every mode event, which can leave Sunshine latched to a supported mode instead of the current mode.

When that happens, wlgrab sees every captured frame as a size mismatch and reinitializes endlessly.

This tracks the compositor's current mode explicitly and only falls back to the first advertised mode until a current one is seen.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • fix: Bug fix (non-breaking change which fixes an issue)
  • feat: New feature (non-breaking change which adds functionality)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@sonarqubecloud

Copy link
Copy Markdown

@ReenigneArcher

Copy link
Copy Markdown
Member

Thank you for the PR submission, but I noticed you didn't use our PR template.

Please update the PR to use the correct template. You can find it at https://github.com/LizardByte/.github/blob/master/.github/pull_request_template.md?plain=1

@zacharydenton zacharydenton changed the title platform/linux/wayland: use the current wl_output mode fix(wayland): use the current wl_output mode May 19, 2026
@zacharydenton

Copy link
Copy Markdown
Contributor Author

@ReenigneArcher Done.

@ReenigneArcher ReenigneArcher added the ai PR has signs of heavy ai usage (either indicated by user or assumed) label May 19, 2026
@LizardByte-bot

Copy link
Copy Markdown
Member

It looks like this PR has been idle for 90 days. If it's still something you're working on or would like to pursue, please leave a comment or update your branch. Otherwise, we'll be closing this PR in 10 days to reduce our backlog. Thanks!

wl_output.mode is emitted for every advertised mode, not just the active one. The current code overwrites viewport.width and viewport.height on every mode event, which can leave Sunshine latched to a supported mode instead of the current mode.

When that happens, wlgrab sees every captured frame as a size mismatch and reinitializes endlessly.

Track the compositor's current mode explicitly and only fall back to the first advertised mode until a current one is seen.

Signed-off-by: Zach Denton <z@chdenton.com>
@ReenigneArcher
ReenigneArcher force-pushed the fix/wayland-current-mode-reinit branch from 418fa2f to 3956142 Compare August 20, 2026 23:47
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

Only apply wl_output mode updates when the compositor marks them as current, preventing stale advertised modes from overwriting the active resolution. Remove the now-unneeded current-mode tracking flag and add unit tests covering ignored non-current modes and current-mode updates.
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 32.45%. Comparing base (ebc4f96) to head (079c178).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/linux/wayland.cpp 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #5150     +/-   ##
=========================================
  Coverage   32.45%   32.45%             
=========================================
  Files         104      104             
  Lines       24998    25000      +2     
  Branches    11078    11077      -1     
=========================================
+ Hits         8112     8113      +1     
+ Misses      15052    13937   -1115     
- Partials     1834     2950   +1116     
Flag Coverage Δ
Archlinux 0.00% <0.00%> (ø)
FreeBSD-amd64 18.38% <75.00%> (+0.06%) ⬆️
Homebrew-macos-14 28.11% <ø> (?)
Homebrew-macos-15 28.82% <ø> (ø)
Homebrew-macos-26 28.92% <ø> (-0.02%) ⬇️
Homebrew-ubuntu-24.04 19.06% <66.66%> (+0.07%) ⬆️
Linux-AppImage 18.47% <66.66%> (+0.06%) ⬆️
Windows-AMD64 23.80% <ø> (ø)
Windows-ARM64 20.52% <ø> (-0.02%) ⬇️
macOS-arm64 25.37% <ø> (ø)
macOS-x86_64 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/platform/linux/wayland.cpp 7.22% <75.00%> (+4.28%) ⬆️

... and 58 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ebc4f96...079c178. Read the comment docs.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Last Updated 2026-08-21 02:52:44 UTC
Source Run CI Run #5056
Commit 079c178d1112ef560f42dd10ba70871a677a4a04

Screenshot Comparison

PR #5150 screenshots vs screenshots baseline.

Matrix: AppImage

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-AMD64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-ARM64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-arm64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-x86_64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

@ReenigneArcher
ReenigneArcher merged commit 3dfbfe0 into LizardByte:master Aug 21, 2026
68 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai PR has signs of heavy ai usage (either indicated by user or assumed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants