| 1 | # sctk-adwaita, vendored |
| 2 | |
| 3 | Upstream: [sctk-adwaita](https://github.com/PolyMeilex/sctk-adwaita) 0.10.1 from |
| 4 | crates.io (the version winit resolves to in `Cargo.lock`), copied without its |
| 5 | `examples/`, `Cargo.lock` and CI files. The workspace `Cargo.toml` points |
| 6 | `[patch.crates-io]` here. |
| 7 | |
| 8 | `Cargo.toml` gains a `[lints.rust]` table silencing a lint newer than the |
| 9 | release, since Cargo does not cap a path dependency's warnings, and takes |
| 10 | tiny-skia 0.12, as resvg does, in place of 0.11, whose API it shares. The first source |
| 11 | change drops the 1 px border line under the header bar, so the title |
| 12 | bar flows into Snowbound's toolbar as it does in a GTK 4 app: |
| 13 | |
| 14 | ```diff |
| 15 | --- a/src/lib.rs |
| 16 | +++ b/src/lib.rs |
| 17 | @@ fn draw_headerbar_bg( |
| 18 | None, |
| 19 | ); |
| 20 | |
| 21 | - pixmap.fill_rect( |
| 22 | - Rect::from_xywh(0., h - 1., w, h)?, |
| 23 | - &colors.border_paint(), |
| 24 | - Transform::identity(), |
| 25 | - None, |
| 26 | - ); |
| 27 | - |
| 28 | Some(()) |
| 29 | } |
| 30 | ``` |
| 31 | |
| 32 | The second change serves GNOME, where Snowbound cuts its window's bottom |
| 33 | corners as libadwaita does. With `LIBADWAITA_EDGE` set, the frame draws |
| 34 | libadwaita 1.7's `window.csd` edge in place of its own border |
| 35 | (`draw_libadwaita_edge`): the 15 px `WINDOW_RADIUS`, the box shadows focused |
| 36 | and not with their 1 px ring, and the 7 % white outline 1 px inside the |
| 37 | edge. The header keeps the body's width, the sides overlap the body by the |
| 38 | outline and the bottom by the radius, so the frame paints the outline and the |
| 39 | bottom corners' shadow over the application's pixels. |
| 40 | |
| 41 | The third change makes the header bar zero height, so Snowbound's toolbar row |
| 42 | is the title bar, as a GTK 4 header bar holding tools is (`theme.rs`): |
| 43 | |
| 44 | ```diff |
| 45 | -pub(crate) const HEADER_SIZE: u32 = 35; |
| 46 | +pub(crate) const HEADER_SIZE: u32 = 0; |
| 47 | ``` |
| 48 | |
| 49 | Around it: `FRAMED` is set once a frame is made, which tells Snowbound to draw |
| 50 | the title bar and the window's buttons itself; the empty header part is not |
| 51 | drawn; the top part draws a border line as the bottom does; and with |
| 52 | `LIBADWAITA_EDGE` the top part reaches down over the body's top corners by the |
| 53 | radius, as the bottom reaches up, owning them from the sides, since Snowbound |
| 54 | cuts those corners too. |
| 55 | |
| 56 | To bump: copy the new release's `src/`, `Cargo.toml`, `LICENSE`, `README.md` |
| 57 | and `CHANGELOG.md` over this folder, reapply the three changes, and update the version |
| 58 | above. The patch applies only while the version here satisfies winit's |
| 59 | requirement; `cargo tree -i sctk-adwaita` shows the path source when it does. |