Repository navigation
Wayland: a decorated window's bottom corners round under the client-side frame - #1188
Merged
Merged
Conversation
… the client-side frame The adwaita frame's headerbar rounds the top two corners and its shadow has always cut a 10-point rounded window, but the frame's visible one-point border was straight on the left, right and bottom, and the content's surface is a rectangle, so every decorated window showed square bottom corners over a rounded shadow. - vendor/sctk-adwaita (new, 0.10.1 + vendor/sctk-adwaita.patch): the bottom part reaches a corner radius above the window's bottom edge and the border is drawn as a ring whose outer edge is the shadow's disc, square while maximized, tiled or fullscreen like the headerbar. The part draws the shadow's crescents only inside the content's own corner squares, so the composite beside a corner is a square frame's pixel for pixel and nothing is doubled, and its `content_corner_radius` says what radius the content leaves the corners to. - vendor/winit (`content_corner_radius`, `has_client_side_frame`): the radius the content's bottom corners take, and whether the window's decorations are a client-side frame's at all, so an app only asks its surface to keep alpha when there is a frame to round, and the opaque region keeps every pixel but the two corner squares. - rune: `window::surface::corners` owns the radius and the pass; `render::csd_corners` fades the composition outside the two bottom arcs by coverage, before a straight-alpha surface converts it. An app's own transparency keeps the alpha mode it always had; a window that only needs its corners takes premultiplied alpha or keeps square ones. Every other platform, a borderless window, a square frame and a surface without alpha paint what they did.
…rowed The type-erasure change passes `app` mutably to `rescale` and reads `app.rt().env.scale` in the same call, which the borrow checker refuses on the Linux-only layer-overlay path (`cargo check --workspace --all-targets` fails there; macOS never compiles it). Reads the scale first.
thdxr
force-pushed
the
fix-csd-bottom-corners
branch
from
November 19, 2026 01:17
37f3398 to
6e73734
Compare
…e window reorganisation `Cargo.toml`'s sctk-adwaita comment and `window::surface::corners` still named the pre-rebase paths.
thdxr
added a commit
to anomalyco/hex
that referenced
this pull request
Nov 19, 2026
Bump Rune to 5f68f577 (anomalyco/rune#1188). Under GNOME Wayland winit draws the client-side frame, whose headerbar rounds the top corners and whose shadow cuts a 10-point rounded window, but the content's surface stayed square: the bottom corners showed past the frame's border and the border's straight bands crossed the shadow's cut-out (#1779). Rune rounds the content's bottom corners with the frame while the window floats, and keeps them square when it is maximized, tiled or fullscreen; a compositor that draws the decorations itself (KDE, sway, Hyprland) keeps the surface it had. Patch sctk-adwaita from the same rev as winit, since Rune's winit calls the vendored frame's `AdwaitaFrame::content_corner_radius`. The bump also brings the type-erased `window::Host` and window/ reorganisation, the rune-core/rune-gpu/rune-image/rune-spell extraction and non-generic `RuntimeCore`, windows-sys 0.61, deep Taffy stack segments, the new wheel distance and chaining, and text, markdown and scroll fixes. One wheel test position moves 24 pt inside the list's right edge, where Rune's new overlay scroll bar doesn't take the wheel (anomalyco/rune#1200). Goldens are refreshed for Rune's icon catalog and glyphs. cargo check --all-targets, cargo test (2775 passed), cargo clippy --all-targets --all-features, cargo fmt --check, code-shape.py and check-nix-git-pins.py pass.
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.
on GNOME Wayland (no server-side decorations) winit draws the sctk-adwaita client-side frame. its headerbar rounds the top two corners and its shadow has always cut a 10-point rounded window, but the frame's visible one-point border was straight rects on the left, right and bottom, and the content's surface is a rectangle, so every decorated window showed square bottom corners over a rounded shadow.
this makes all four corners round together while the window floats, and square while it's maximized, tiled or fullscreen.
what changed
vendor/sctk-adwaita(new crate, 0.10.1 +vendor/sctk-adwaita.patch, re-made byscripts/vendor-sctk-adwaita.sh): the bottom part reaches a corner radius above the window's bottom edge and the visible border is drawn as a ring whose outer edge is the shadow's disc, so it joins the straight bands at each tangent and sits exactly over the shadow's cut-out. the part draws the shadow's crescents only inside the content's own corner squares — outside them the side parts already draw the shadow down to the window's edge, and a second copy there would composite over theirs (the parts stack) and double it — and the shadow below the window is a square frame's, pixel for pixel. the side parts' bottom corner pieces reach the border's own column, where no border is drawn below the arc's tangent. square when the state intersectsMAXIMIZED | TILED | FULLSCREEN, the same rule the headerbar uses.AdwaitaFrame::content_corner_radiusandCONTENT_CORNER_RADIUSsay what radius the content leaves the corners to.vendor/winit(vendor/winit.patch):platform::wayland::WindowExtWayland::content_corner_radiusreturns the radius the content's bottom corners take, in logical points. it'sCORNER_RADIUS - VISIBLE_BORDER_SIZE(9), not 10, because the frame's 1pt border is drawn outside the content's arc: the app can then clip a plain rounded rect of that radius on its own surface. zero when there is no client-side frame (server decorations, decorations off), when the frame is square (maximized, tiled, fullscreen), and on X11.has_client_side_framesays whether the window's decorations are a client-side frame's at all — true in fullscreen too, where the frame draws square corners — so an app only asks its surface to keep alpha when there is a frame to round; and the opaque region an opaque window gets is cut to everything but the two corner squares the arcs cross, reloaded at the end ofconfigurewhen the frame appears, goes or changes state.window/corners.rsowns the radius (wayland + a client-side frame + a premultiplied surface) and the pass;render/csd_corners.rsfades the composition outside the two bottom arcs after the frame is drawn (one draw of two corner squares,Zero/OneMinusSrcAlpha, a pixel of fade across the arc so it meets the frame's antialiased ring without a seam, the same on the sRGB and the linear view). a window with a client-side frame keeps its surface's pixels' alpha, but the window stays opaque to rune:rt.transparent, the clear colour, the device and GPU choice are the ones an opaque window had, and only those corner pixels are transparent. the surface's alpha mode comes fromcreate::alpha_mode: an app that asked for a translucent window keeps every mode it always had (PostMultipliedincluded, Metal's only one), andPreMultipliedalone is for a window that only needs its corner pixels; a window under a compositor that draws the decorations itself (KDE, sway, Hyprland) never has a frame, so it keeps exactly the surface config it had —Opaque, no fade, full opaque region. also fixed:rt.transparentfollows a new surface's alpha mode on reattach,corner/heightnever go negative on the square path, and shapes are clamped or skipped for tiny windows.testing
vendor/sctk-adwaitahas nine unit tests kept in the patch: the radius by state (9/10 floating, 0 for maximized, tiled and fullscreen), the border along the bottom arcs, the shadow below the window against a square frame's (every pixel within 1/255), the side and bottom parts composited at their window positions against the square frame outside the content rect and the corner squares (within 2/255, and the worst pixel reported), the crescent's continuity with the shadow across the window's edges, a square window's straight band and untouched corners, the bottom part's input zone starting at the window's edge, and a narrow window's clamped arcs. the composite test fails on the previous commit (the worst pixel is (-2, 110): round corners composite 72, the square frame 39) and passes now.create::alpha_modeis unit-tested over every mode a surface can offer (transparent windows keepPostMultiplied/Inherit/PreMultiplied, corner-only windows takePreMultipliedor opaque), andrender::csd_cornershas GPU tests on an offscreen target: both bottom corners fade, the foot inside each arc stays, nothing above the arc centres or at the top corners changes, a wider radius clears more, a square window prepares and draws nothing, and the fade's colour and alpha hold in both target views.cargo check --workspace --all-targets,cargo test -p sctk-adwaita(ten tests),cargo test -p rune --lib render::csd_corners,cargo test -p rune --lib window::tests,cargo clippy -p rune --libandcargo clippy -p sctk-adwaita --all-targets(no new warnings in the changed files),bash scripts/file-size.sh, and both vendor scripts re-run to confirm each vendored tree equals its script output.window::Hosttype-erased,host/,surface/,win32/); the corner pass lives inwindow::surface::corners, and the alpha-mode test inwindow/tests. the branch also carries one unrelated Linux build fix,Linux: an overlay's scale is read before the type-erased app is reborrowed: the type-erasure commit passesappmutably torescaleand readsapp.rt().env.scalein the same call, which the borrow checker refuses on the Linux-only layer-overlay path, socargo check --workspace --all-targetsfails ondevwithout it (macOS never compiles that path).weston(pixman renderer) on its own socket and runtime dir, with a solid desktop background so shadow pixels can be compared, and a second capture of the same probe built with the corner radius forced to zero (the square frame). beside the bottom-left corner the two composites are identical at every probed pixel — columns x = -2, -4, -10 and rows h - 15 … h + 5, e.g.srgb(47,51,60),(49,53,63),(53,58,69)in both — with no step at the window's edge or a corner radius above it; the right side matches the same way. the floating window's corners are the shadow (srgb(48,53,63), desktopsrgb(58,63,75)), the crescent just outside the arc issrgb(47,51,61), and maximized, fullscreen and under sway (server-side decorations,get_subsurfacenever sent) the corner pixels are the content coloursrgb(69,124,253)withset_opaque_region(wl_region…)nevernil.limits
— from 𝕆𝕡𝕖𝕟𝕮𝖔𝖉𝖊