Fix the overlay crashing the program on Wayland - #9
Open
raman78 wants to merge 1 commit into
Open
Conversation
OverlayInner.current_size started at Vec2::ZERO, so the deferred
viewport was first built with an inner size of 0x0. Wayland rejects a
0x0 xdg_surface geometry ("invalid window geometry size (0x0)"), which
leaves the wgpu surface unconfigured and panics with "Surface is not
configured for presentation". X11 and Windows silently clamp the size,
so the crash only shows on Wayland.
Initialize current_size to the same min_inner_size (240x80) used when
building the viewport. The overlay still resizes itself to its content
on the first frame, so this only affects the very first size.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What & why
Switching the overlay on crashes the program on Wayland.
OverlayInner::current_sizestarts atVec2::ZERO, so the deferred viewport is first built with an inner size of 0x0, and Wayland rejects a 0x0xdg_surfacegeometry. The wgpu surface is then left unconfigured:X11 and Windows clamp the size silently, so it only shows up on Wayland.
The change
current_sizenow starts at the same 240x80 that is passed towith_min_inner_sizewhen the viewport is built a few lines below. The overlay resizes itself to its content on the first frame, so this only affects the very first size.Reproduced and verified on KDE/Wayland.
Relation to #6
This is a subset of #6 — the exact same four lines are in that branch too, because #6 replaces the overlay with a layer-shell surface on Linux and needed the same fix along the way.
Nothing has to be coordinated between the two: merge either one and the crash is gone, merge both and the change is identical. This is here on its own so the crash can be fixed cheaply without deciding on the much larger layer-shell change. If you merge #6, just close this PR.