sctk-adwaita-0.8.1/.cargo_vcs_info.json0000644000000001360000000000100134160ustar { "git": { "sha1": "a65adcc487496edc09cd6b87860d313d1c43c602" }, "path_in_vcs": "" }sctk-adwaita-0.8.1/.github/workflows/changelog.yml000064400000000000000000000005141046102023000202550ustar 00000000000000name: Changelog check on: pull_request: branches: [ master ] types: [ opened, synchronize, reopened, labeled, unlabeled ] jobs: Changelog-Entry-Check: name: Check Changelog Action runs-on: ubuntu-latest steps: - uses: tarides/changelog-check-action@v2 with: changelog: CHANGELOG.md sctk-adwaita-0.8.1/.github/workflows/rust.yml000064400000000000000000000046231046102023000173300ustar 00000000000000on: [push, pull_request] name: Continuous integration jobs: fmt: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true components: rustfmt - uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check clippy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true components: clippy - name: Run cargo clippy uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} args: -- -D clippy::print_stderr -D clippy::print_stdout -D clippy::dbg_macro -D clippy::exit -D clippy::unwrap_used -D clippy::expect_used -D clippy::panic default-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - uses: actions-rs/cargo@v1 with: command: build no-default-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - uses: actions-rs/cargo@v1 with: command: build args: --no-default-features crossfont-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: System dependencies run: sudo apt-get update && sudo apt-get install pkg-config cmake libfreetype6-dev libfontconfig1-dev - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - uses: actions-rs/cargo@v1 with: command: build args: --no-default-features --features crossfont ab-glyph-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - uses: actions-rs/cargo@v1 with: command: build args: --no-default-features --features ab_glyph sctk-adwaita-0.8.1/.gitignore000064400000000000000000000000221046102023000141700ustar 00000000000000/target Cargo.locksctk-adwaita-0.8.1/CHANGELOG.md000064400000000000000000000037501046102023000140240ustar 00000000000000## [Unreleased] ## 0.8.1 - Fix `ab_glyph` renderer panicking with integer scale factor 3 (#50) - Improved roundness of headerbar (#51) ## 0.8.0 - **Breaking:** `AdwaitaFrame::new` now takes `Arc` as an argument - Fix leftmost title pixel sometimes being cut off (#45) - Fix transparency in ab_glyph renderer (#44) - Extended resize corners (#47) - Center maximize icon (#46) - Window shadows (#43) ### Dependencies updates - Bump crossfont to 0.6.0 (#52) ## 0.7.0 - **Breaking:** `wayland-csd-frame` is now used as a part of the public interface. ## 0.6.1 - Bump tiny-skia to v0.11 (#32) - cleanup: Remove debug println (#29) - Support custom header buttons layouts (#30) - The double click threshold value was raised to `400ms` ## 0.6.0 - Update the `smithay-client-toolkit` to `0.17.0` - Don't use tiny-skia's default features ## 0.5.4 - Timeout dbus call to settings portal (100ms) ## 0.5.3 - `ab_glyph` titles will read the system title font using memory mapped buffers instead of reading to heap. Lowers RAM usage. - Improve titlebar-font config parsing to correctly handle more font names. ## 0.5.2 - `ab_glyph` & `crossfont` titles will use gnome "titlebar-font" config if available. - `ab_glyph` titles are now more consistent with `crossfont` titles both using system sans if no better font config is available. - Rounded corners are now disabled on maximized and tiled windows. - Double click interval is now 400ms (as previous 1s interval was caused by bug fixed in 0.5.1) ## 0.5.1 - Use dbus org.freedesktop.portal.Settings to automatically choose light or dark theming. - Double click detection fix. - Apply button click on release instead of press. ## 0.5.0 - `title` feature got removed - `ab_glyph` default feature got added (for `ab_glyph` based title rendering) - `crossfont` feature got added (for `crossfont` based title rendering) - Can be enable like this: ```toml sctk-adwaita = { default-features = false, features = ["crossfont"] } ``` sctk-adwaita-0.8.1/Cargo.lock0000644000000530770000000000100114050ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "ab_glyph" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5110f1c78cf582855d895ecd0746b653db010cec6d9f5575293f27934d980a39" dependencies = [ "ab_glyph_rasterizer", "owned_ttf_parser", ] [[package]] name = "ab_glyph_rasterizer" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "arrayref" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "block" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] name = "bytemuck" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" [[package]] name = "cc" version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" dependencies = [ "libc", ] [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cmake" version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" dependencies = [ "cc", ] [[package]] name = "cocoa" version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c" dependencies = [ "bitflags 1.3.2", "block", "cocoa-foundation", "core-foundation", "core-graphics", "foreign-types 0.5.0", "libc", "objc", ] [[package]] name = "cocoa-foundation" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "931d3837c286f56e3c58423ce4eba12d08db2374461a785c86f672b08b5650d6" dependencies = [ "bitflags 1.3.2", "block", "core-foundation", "core-graphics-types", "foreign-types 0.3.2", "libc", "objc", ] [[package]] name = "core-foundation" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "core-foundation-sys" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "core-graphics" version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212" dependencies = [ "bitflags 1.3.2", "core-foundation", "core-graphics-types", "foreign-types 0.5.0", "libc", ] [[package]] name = "core-graphics-types" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" dependencies = [ "bitflags 1.3.2", "core-foundation", "libc", ] [[package]] name = "core-text" version = "20.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9d2790b5c08465d49f8dc05c8bcae9fea467855947db39b0f8145c091aaced5" dependencies = [ "core-foundation", "core-graphics", "foreign-types 0.5.0", "libc", ] [[package]] name = "crossfont" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89c65306ecd118368d875f48d69394b5c3ff6bb7c57ae6deb638782735a093c" dependencies = [ "cocoa", "core-foundation", "core-foundation-sys", "core-graphics", "core-text", "dwrote", "foreign-types 0.5.0", "freetype-rs", "libc", "log", "objc", "once_cell", "pkg-config", "servo-fontconfig", "winapi", ] [[package]] name = "cursor-icon" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "740bb192a8e2d1350119916954f4409ee7f62f149b536911eeb78ba5a20526bf" [[package]] name = "dlib" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ "libloading", ] [[package]] name = "downcast-rs" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dwrote" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" dependencies = [ "lazy_static", "libc", "serde", "serde_derive", "winapi", "wio", ] [[package]] name = "errno" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ "libc", "windows-sys", ] [[package]] name = "expat-sys" version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa" dependencies = [ "cmake", "pkg-config", ] [[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ "foreign-types-shared 0.1.1", ] [[package]] name = "foreign-types" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", "foreign-types-shared 0.3.1", ] [[package]] name = "foreign-types-macros" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "foreign-types-shared" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "foreign-types-shared" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" [[package]] name = "freetype-rs" version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74eadec9d0a5c28c54bb9882e54787275152a4e36ce206b45d7451384e5bf5fb" dependencies = [ "bitflags 1.3.2", "freetype-sys", "libc", ] [[package]] name = "freetype-sys" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a" dependencies = [ "cmake", "libc", "pkg-config", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libloading" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb" dependencies = [ "cfg-if", "windows-sys", ] [[package]] name = "linux-raw-sys" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "malloc_buf" version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" dependencies = [ "libc", ] [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deaba38d7abf1d4cca21cc89e932e542ba2b9258664d2a9ef0e61512039c9375" dependencies = [ "libc", ] [[package]] name = "memoffset" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" dependencies = [ "autocfg", ] [[package]] name = "minimal-lexical" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "nix" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", "memoffset", "static_assertions", ] [[package]] name = "nom" version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", ] [[package]] name = "objc" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" dependencies = [ "malloc_buf", ] [[package]] name = "once_cell" version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "owned_ttf_parser" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "706de7e2214113d63a8238d1910463cfce781129a6f263d13fdb09ff64355ba4" dependencies = [ "ttf-parser", ] [[package]] name = "pkg-config" version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "proc-macro2" version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] [[package]] name = "quick-xml" version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" dependencies = [ "memchr", ] [[package]] name = "quote" version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] [[package]] name = "rustix" version = "0.38.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" dependencies = [ "bitflags 2.4.0", "errno", "libc", "linux-raw-sys", "windows-sys", ] [[package]] name = "scoped-tls" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "sctk-adwaita" version = "0.8.1" dependencies = [ "ab_glyph", "crossfont", "log", "memmap2", "smithay-client-toolkit", "tiny-skia", ] [[package]] name = "serde" version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" [[package]] name = "serde_derive" version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "servo-fontconfig" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7e3e22fe5fd73d04ebf0daa049d3efe3eae55369ce38ab16d07ddd9ac5c217c" dependencies = [ "libc", "servo-fontconfig-sys", ] [[package]] name = "servo-fontconfig-sys" version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e36b879db9892dfa40f95da1c38a835d41634b825fbd8c4c418093d53c24b388" dependencies = [ "expat-sys", "freetype-sys", "pkg-config", ] [[package]] name = "smallvec" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "smithay-client-toolkit" version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60e3d9941fa3bacf7c2bf4b065304faa14164151254cd16ce1b1bc8fc381600f" dependencies = [ "bitflags 2.4.0", "cursor-icon", "libc", "log", "memmap2", "rustix", "thiserror", "wayland-backend", "wayland-client", "wayland-csd-frame", "wayland-cursor", "wayland-protocols", "wayland-protocols-wlr", "wayland-scanner", "xkeysym", ] [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strict-num" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" [[package]] name = "syn" version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "thiserror" version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dedd246497092a89beedfe2c9f176d44c1b672ea6090edc20544ade01fbb7ea0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d7b1fadccbbc7e19ea64708629f9d8dccd007c260d66485f20a6d41bc1cf4b3" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "tiny-skia" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4e37fdc219ee3d551882d24dc5e4df5f72fd9723cbca1ffaa57f7348bf7a47d" dependencies = [ "arrayref", "arrayvec", "bytemuck", "cfg-if", "log", "tiny-skia-path", ] [[package]] name = "tiny-skia-path" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93a323d1de20dad9bc8b32daf57702c585ce76e80792d8151de1fc9dfc8d1ca7" dependencies = [ "arrayref", "bytemuck", "strict-num", ] [[package]] name = "ttf-parser" version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a464a4b34948a5f67fddd2b823c62d9d92e44be75058b99939eae6c5b6960b33" [[package]] name = "unicode-ident" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "wayland-backend" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19152ddd73f45f024ed4534d9ca2594e0ef252c1847695255dae47f34df9fbe4" dependencies = [ "cc", "downcast-rs", "nix", "scoped-tls", "smallvec", "wayland-sys", ] [[package]] name = "wayland-client" version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ca7d52347346f5473bf2f56705f360e8440873052e575e55890c4fa57843ed3" dependencies = [ "bitflags 2.4.0", "nix", "wayland-backend", "wayland-scanner", ] [[package]] name = "wayland-csd-frame" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" dependencies = [ "bitflags 2.4.0", "cursor-icon", "wayland-backend", ] [[package]] name = "wayland-cursor" version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44aa20ae986659d6c77d64d808a046996a932aa763913864dc40c359ef7ad5b" dependencies = [ "nix", "wayland-client", "xcursor", ] [[package]] name = "wayland-protocols" version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e253d7107ba913923dc253967f35e8561a3c65f914543e46843c88ddd729e21c" dependencies = [ "bitflags 2.4.0", "wayland-backend", "wayland-client", "wayland-scanner", ] [[package]] name = "wayland-protocols-wlr" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" dependencies = [ "bitflags 2.4.0", "wayland-backend", "wayland-client", "wayland-protocols", "wayland-scanner", ] [[package]] name = "wayland-scanner" version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb8e28403665c9f9513202b7e1ed71ec56fde5c107816843fb14057910b2c09c" dependencies = [ "proc-macro2", "quick-xml", "quote", ] [[package]] name = "wayland-sys" version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" dependencies = [ "dlib", "log", "pkg-config", ] [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1eeca1c172a285ee6c2c84c341ccea837e7c01b12fbb2d0fe3c9e550ce49ec8" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b10d0c968ba7f6166195e13d593af609ec2e3d24f916f081690695cf5eaffb2f" [[package]] name = "windows_aarch64_msvc" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "571d8d4e62f26d4932099a9efe89660e8bd5087775a2ab5cdd8b747b811f1058" [[package]] name = "windows_i686_gnu" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2229ad223e178db5fbbc8bd8d3835e51e566b8474bfca58d2e6150c48bb723cd" [[package]] name = "windows_i686_msvc" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "600956e2d840c194eedfc5d18f8242bc2e17c7775b6684488af3a9fff6fe3287" [[package]] name = "windows_x86_64_gnu" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea99ff3f8b49fb7a8e0d305e5aec485bd068c2ba691b6e277d29eaeac945868a" [[package]] name = "windows_x86_64_gnullvm" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f1a05a1ece9a7a0d5a7ccf30ba2c33e3a61a30e042ffd247567d1de1d94120d" [[package]] name = "windows_x86_64_msvc" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d419259aba16b663966e29e6d7c6ecfa0bb8425818bb96f6f1f3c3eb71a6e7b9" [[package]] name = "wio" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" dependencies = [ "winapi", ] [[package]] name = "xcursor" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7" dependencies = [ "nom", ] [[package]] name = "xkeysym" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "054a8e68b76250b253f671d1268cb7f1ae089ec35e195b2efb2a4e9a836d0621" sctk-adwaita-0.8.1/Cargo.toml0000644000000025010000000000100114120ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" name = "sctk-adwaita" version = "0.8.1" authors = ["Poly "] description = "Adwaita-like SCTK Frame" documentation = "https://docs.rs/sctk-adwaita" readme = "README.md" keywords = ["sctk"] license = "MIT" repository = "https://github.com/PolyMeilex/sctk-adwaita" [dependencies.ab_glyph] version = "0.2.17" optional = true [dependencies.crossfont] version = "0.7.0" features = ["force_system_fontconfig"] optional = true [dependencies.log] version = "0.4" [dependencies.memmap2] version = "0.9.0" optional = true [dependencies.smithay-client-toolkit] version = "0.18.0" default_features = false [dependencies.tiny-skia] version = "0.11" features = [ "std", "simd", ] default-features = false [features] ab_glyph = [ "dep:ab_glyph", "memmap2", ] crossfont = ["dep:crossfont"] default = ["ab_glyph"] sctk-adwaita-0.8.1/Cargo.toml.orig000064400000000000000000000016151046102023000151000ustar 00000000000000[package] name = "sctk-adwaita" version = "0.8.1" edition = "2021" authors = ["Poly "] keywords = ["sctk"] license = "MIT" repository = "https://github.com/PolyMeilex/sctk-adwaita" documentation = "https://docs.rs/sctk-adwaita" description = "Adwaita-like SCTK Frame" [dependencies] log = "0.4" memmap2 = { version = "0.9.0", optional = true } tiny-skia = { version = "0.11", default-features = false, features = [ "std", "simd", ] } smithay-client-toolkit = { version = "0.18.0", default_features = false } # Draw title text using crossfont `--features crossfont` crossfont = { version = "0.7.0", features = [ "force_system_fontconfig", ], optional = true } # Draw title text using ab_glyph `--features ab_glyph` ab_glyph = { version = "0.2.17", optional = true } [features] default = ["ab_glyph"] crossfont = ["dep:crossfont"] ab_glyph = ["dep:ab_glyph", "memmap2"] sctk-adwaita-0.8.1/LICENSE000064400000000000000000000020671046102023000132200ustar 00000000000000MIT License Copyright (c) 2022 Bartłomiej Maryńczak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. sctk-adwaita-0.8.1/README.md000064400000000000000000000012111046102023000134600ustar 00000000000000# Adwaita-like SCTK Frame | | | |---|---| |![active](https://i.imgur.com/WdO8e0i.png)|![hover](https://i.imgur.com/TkUq2WF.png)| ![inactive](https://i.imgur.com/MTFdSjK.png)| ### Dark mode: ![image](https://user-images.githubusercontent.com/20758186/169424673-3b9fa022-f112-4928-8360-305a714ba979.png) ## Title text: ab_glyph By default title text is drawn with _ab_glyph_ crate. This can be disabled by disabling default features. ## Title text: crossfont Alternatively title text may be drawn with _crossfont_ crate. This adds a requirement on _freetype_. ```toml sctk-adwaita = { default-features = false, features = ["crossfont"] } ``` sctk-adwaita-0.8.1/examples/window.rs000064400000000000000000000470111046102023000157040ustar 00000000000000// Based on https://github.com/Smithay/client-toolkit/blob/master/examples/themed_window.rs. use std::sync::Arc; use std::time::Duration; use std::{convert::TryInto, num::NonZeroU32}; use smithay_client_toolkit::reexports::client::{ globals::registry_queue_init, protocol::{wl_output, wl_pointer, wl_seat, wl_shm, wl_surface}, Connection, Proxy, QueueHandle, }; use smithay_client_toolkit::reexports::csd_frame::{ CursorIcon, DecorationsFrame, FrameAction, FrameClick, ResizeEdge, }; use smithay_client_toolkit::reexports::protocols::xdg::shell::client::xdg_toplevel::ResizeEdge as XdgResizeEdge; use smithay_client_toolkit::{ compositor::{CompositorHandler, CompositorState}, delegate_compositor, delegate_output, delegate_pointer, delegate_registry, delegate_seat, delegate_shm, delegate_subcompositor, delegate_xdg_shell, delegate_xdg_window, output::{OutputHandler, OutputState}, registry::{ProvidesRegistryState, RegistryState}, registry_handlers, seat::{ pointer::{ PointerData, PointerEvent, PointerEventKind, PointerHandler, ThemeSpec, ThemedPointer, }, Capability, SeatHandler, SeatState, }, shell::{ xdg::{ window::{DecorationMode, Window, WindowConfigure, WindowDecorations, WindowHandler}, XdgShell, XdgSurface, }, WaylandSurface, }, shm::{ slot::{Buffer, SlotPool}, Shm, ShmHandler, }, subcompositor::SubcompositorState, }; use sctk_adwaita::{AdwaitaFrame, FrameConfig}; fn main() { let conn = Connection::connect_to_env().unwrap(); let (globals, mut event_queue) = registry_queue_init(&conn).unwrap(); let qh = event_queue.handle(); let registry_state = RegistryState::new(&globals); let seat_state = SeatState::new(&globals, &qh); let output_state = OutputState::new(&globals, &qh); let compositor_state = CompositorState::bind(&globals, &qh).expect("wl_compositor not available"); let subcompositor_state = SubcompositorState::bind(compositor_state.wl_compositor().clone(), &globals, &qh) .expect("wl_subcompositor not available"); let shm_state = Shm::bind(&globals, &qh).expect("wl_shm not available"); let xdg_shell_state = XdgShell::bind(&globals, &qh).expect("xdg shell not available"); let width = 256; let height = 256; let pool = SlotPool::new(width as usize * height as usize * 4, &shm_state) .expect("Failed to create pool"); let window_surface = compositor_state.create_surface(&qh); let window = xdg_shell_state.create_window(window_surface, WindowDecorations::ServerDefault, &qh); window.set_title("A wayland window"); // GitHub does not let projects use the `org.github` domain but the `io.github` domain is fine. window.set_app_id("simple-window"); window.set_min_size(Some((2, 1))); // In order for the window to be mapped, we need to perform an initial commit with no attached buffer. // For more info, see WaylandSurface::commit // // The compositor will respond with an initial configure that we can then use to present to the window with // the correct options. window.commit(); let mut simple_window = SimpleWindow { title: String::from("/usr/lib/xorg/modules/input"), registry_state, seat_state, output_state, compositor_state: Arc::new(compositor_state), subcompositor_state: Arc::new(subcompositor_state), shm_state, _xdg_shell_state: xdg_shell_state, exit: false, first_configure: true, pool, width: NonZeroU32::new(width).unwrap(), height: NonZeroU32::new(height).unwrap(), shift: None, buffer: None, window, window_frame: None, themed_pointer: None, set_cursor: false, cursor_icon: CursorIcon::Crosshair, }; // We don't draw immediately, the configure will notify us when to first draw. loop { event_queue.blocking_dispatch(&mut simple_window).unwrap(); if simple_window.exit { println!("exiting example"); break; } } } struct SimpleWindow { title: String, registry_state: RegistryState, seat_state: SeatState, output_state: OutputState, compositor_state: Arc, subcompositor_state: Arc, shm_state: Shm, _xdg_shell_state: XdgShell, exit: bool, first_configure: bool, pool: SlotPool, width: NonZeroU32, height: NonZeroU32, shift: Option, buffer: Option, window: Window, window_frame: Option>, themed_pointer: Option, set_cursor: bool, cursor_icon: CursorIcon, } impl CompositorHandler for SimpleWindow { fn scale_factor_changed( &mut self, _conn: &Connection, _qh: &QueueHandle, surface: &wl_surface::WlSurface, new_factor: i32, ) { if self.window.wl_surface() == surface { if let Some(frame) = self.window_frame.as_mut() { frame.set_scaling_factor(new_factor as f64); } } } fn transform_changed( &mut self, _: &Connection, _: &QueueHandle, _: &wl_surface::WlSurface, _: wl_output::Transform, ) { // Not needed for this example. } fn frame( &mut self, conn: &Connection, qh: &QueueHandle, _surface: &wl_surface::WlSurface, _time: u32, ) { self.draw(conn, qh); } } impl OutputHandler for SimpleWindow { fn output_state(&mut self) -> &mut OutputState { &mut self.output_state } fn new_output( &mut self, _conn: &Connection, _qh: &QueueHandle, _output: wl_output::WlOutput, ) { } fn update_output( &mut self, _conn: &Connection, _qh: &QueueHandle, _output: wl_output::WlOutput, ) { } fn output_destroyed( &mut self, _conn: &Connection, _qh: &QueueHandle, _output: wl_output::WlOutput, ) { } } impl WindowHandler for SimpleWindow { fn request_close(&mut self, _: &Connection, _: &QueueHandle, _: &Window) { self.exit = true; } fn configure( &mut self, conn: &Connection, qh: &QueueHandle, window: &Window, configure: WindowConfigure, _serial: u32, ) { self.buffer = None; println!( "Configure size {:?}, decorations: {:?}", configure.new_size, configure.decoration_mode ); let (width, height) = if configure.decoration_mode == DecorationMode::Client { let window_frame = self.window_frame.get_or_insert_with(|| { let mut frame = AdwaitaFrame::new( &self.window, &self.shm_state, self.compositor_state.clone(), self.subcompositor_state.clone(), qh.clone(), FrameConfig::auto(), ) .expect("failed to create client side decorations frame."); frame.set_title(self.title.clone()); frame }); // Un-hide the frame. window_frame.set_hidden(false); // Configure state before touching any resizing. window_frame.update_state(configure.state); // Configure the button state. window_frame.update_wm_capabilities(configure.capabilities); let (width, height) = match configure.new_size { (Some(width), Some(height)) => { // The size could be 0. window_frame.subtract_borders(width, height) } _ => { // You might want to consider checking for configure bounds. (Some(self.width), Some(self.height)) } }; // Clamp the size to at least one pixel. let width = width.unwrap_or(NonZeroU32::new(1).unwrap()); let height = height.unwrap_or(NonZeroU32::new(1).unwrap()); window_frame.resize(width, height); let (x, y) = window_frame.location(); let outer_size = window_frame.add_borders(width.get(), height.get()); window.xdg_surface().set_window_geometry( x, y, outer_size.0 as i32, outer_size.1 as i32, ); (width, height) } else { // Hide the frame, if any. if let Some(frame) = self.window_frame.as_mut() { frame.set_hidden(true) } let width = configure.new_size.0.unwrap_or(self.width); let height = configure.new_size.1.unwrap_or(self.height); self.window.xdg_surface().set_window_geometry( 0, 0, width.get() as i32, height.get() as i32, ); (width, height) }; // Update new width and height; self.width = width; self.height = height; // Initiate the first draw. if self.first_configure { self.first_configure = false; self.draw(conn, qh); } } } impl SeatHandler for SimpleWindow { fn seat_state(&mut self) -> &mut SeatState { &mut self.seat_state } fn new_seat(&mut self, _: &Connection, _: &QueueHandle, _: wl_seat::WlSeat) {} fn new_capability( &mut self, _conn: &Connection, qh: &QueueHandle, seat: wl_seat::WlSeat, capability: Capability, ) { if capability == Capability::Pointer && self.themed_pointer.is_none() { println!("Set pointer capability"); println!("Creating pointer theme"); let surface = self.compositor_state.create_surface(qh); let themed_pointer = self .seat_state .get_pointer_with_theme( qh, &seat, self.shm_state.wl_shm(), surface, ThemeSpec::default(), ) .expect("Failed to create pointer"); self.themed_pointer.replace(themed_pointer); } } fn remove_capability( &mut self, _conn: &Connection, _: &QueueHandle, _: wl_seat::WlSeat, capability: Capability, ) { if capability == Capability::Pointer && self.themed_pointer.is_some() { println!("Unset pointer capability"); self.themed_pointer.take().unwrap().pointer().release(); } } fn remove_seat(&mut self, _: &Connection, _: &QueueHandle, _: wl_seat::WlSeat) {} } impl PointerHandler for SimpleWindow { fn pointer_frame( &mut self, _conn: &Connection, _qh: &QueueHandle, pointer: &wl_pointer::WlPointer, events: &[PointerEvent], ) { use PointerEventKind::*; for event in events { let (x, y) = event.position; match event.kind { Enter { .. } => { self.set_cursor = true; self.cursor_icon = self .window_frame .as_mut() .and_then(|frame| { frame.click_point_moved(Duration::ZERO, &event.surface.id(), x, y) }) .unwrap_or(CursorIcon::Crosshair) .to_owned(); if &event.surface == self.window.wl_surface() { println!("Pointer entered @{:?}", event.position); } } Leave { .. } => { if &event.surface != self.window.wl_surface() { if let Some(window_frame) = self.window_frame.as_mut() { window_frame.click_point_left(); } } println!("Pointer left"); } Motion { time } => { if let Some(new_cursor) = self.window_frame.as_mut().and_then(|frame| { frame.click_point_moved( Duration::from_millis(time as u64), &event.surface.id(), x, y, ) }) { self.set_cursor = true; self.cursor_icon = new_cursor.to_owned(); } } Press { button, serial, time, } | Release { button, serial, time, } => { let pressed = if matches!(event.kind, Press { .. }) { true } else { false }; if &event.surface != self.window.wl_surface() { let click = match button { 0x110 => FrameClick::Normal, 0x111 => FrameClick::Alternate, _ => continue, }; if let Some(action) = self.window_frame.as_mut().and_then(|frame| { frame.on_click(Duration::from_millis(time as u64), click, pressed) }) { self.frame_action(pointer, serial, action); } } else if pressed { println!("Press {:x} @ {:?}", button, event.position); self.shift = self.shift.xor(Some(0)); } } Axis { horizontal, vertical, .. } => { if &event.surface == self.window.wl_surface() { println!("Scroll H:{horizontal:?}, V:{vertical:?}"); } } } } } } impl SimpleWindow { fn frame_action(&mut self, pointer: &wl_pointer::WlPointer, serial: u32, action: FrameAction) { let pointer_data = pointer.data::().unwrap(); let seat = pointer_data.seat(); match action { FrameAction::Close => self.exit = true, FrameAction::Minimize => self.window.set_minimized(), FrameAction::Maximize => self.window.set_maximized(), FrameAction::UnMaximize => self.window.unset_maximized(), FrameAction::ShowMenu(x, y) => self.window.show_window_menu(seat, serial, (x, y)), FrameAction::Resize(edge) => { let edge = match edge { ResizeEdge::None => XdgResizeEdge::None, ResizeEdge::Top => XdgResizeEdge::Top, ResizeEdge::Bottom => XdgResizeEdge::Bottom, ResizeEdge::Left => XdgResizeEdge::Left, ResizeEdge::TopLeft => XdgResizeEdge::TopLeft, ResizeEdge::BottomLeft => XdgResizeEdge::BottomLeft, ResizeEdge::Right => XdgResizeEdge::Right, ResizeEdge::TopRight => XdgResizeEdge::TopRight, ResizeEdge::BottomRight => XdgResizeEdge::BottomRight, _ => return, }; self.window.resize(seat, serial, edge); } FrameAction::Move => self.window.move_(seat, serial), _ => (), } } } impl ShmHandler for SimpleWindow { fn shm_state(&mut self) -> &mut Shm { &mut self.shm_state } } impl SimpleWindow { pub fn draw(&mut self, conn: &Connection, qh: &QueueHandle) { if self.set_cursor { let _ = self .themed_pointer .as_mut() .unwrap() .set_cursor(conn, self.cursor_icon); self.set_cursor = false; } let width = self.width.get(); let height = self.height.get(); let stride = width as i32 * 4; let buffer = self.buffer.get_or_insert_with(|| { self.pool .create_buffer( width as i32, height as i32, stride, wl_shm::Format::Argb8888, ) .expect("create buffer") .0 }); let canvas = match self.pool.canvas(buffer) { Some(canvas) => canvas, None => { // This should be rare, but if the compositor has not released the previous // buffer, we need double-buffering. let (second_buffer, canvas) = self .pool .create_buffer( width as i32, height as i32, stride, wl_shm::Format::Argb8888, ) .expect("create buffer"); *buffer = second_buffer; canvas } }; // Draw to the window: { let shift = self.shift.unwrap_or(0); canvas .chunks_exact_mut(4) .enumerate() .for_each(|(index, chunk)| { let x = ((index + shift as usize) % width as usize) as u32; let y = (index / width as usize) as u32; let a = 0xFF; let r = u32::min(((width - x) * 0xFF) / width, ((height - y) * 0xFF) / height); let g = u32::min((x * 0xFF) / width, ((height - y) * 0xFF) / height); let b = u32::min(((width - x) * 0xFF) / width, (y * 0xFF) / height); let color = (a << 24) + (r << 16) + (g << 8) + b; let array: &mut [u8; 4] = chunk.try_into().unwrap(); *array = color.to_le_bytes(); }); if let Some(shift) = &mut self.shift { *shift = (*shift + 1) % width; } } // Draw the decorations frame. self.window_frame.as_mut().map(|frame| { if frame.is_dirty() && !frame.is_hidden() { frame.draw(); } }); // Damage the entire window self.window.wl_surface().damage_buffer( 0, 0, self.width.get() as i32, self.height.get() as i32, ); // Request our next frame self.window .wl_surface() .frame(qh, self.window.wl_surface().clone()); // Attach and commit to present. buffer .attach_to(self.window.wl_surface()) .expect("buffer attach"); self.window.wl_surface().commit(); } } delegate_compositor!(SimpleWindow); delegate_subcompositor!(SimpleWindow); delegate_output!(SimpleWindow); delegate_shm!(SimpleWindow); delegate_seat!(SimpleWindow); delegate_pointer!(SimpleWindow); delegate_xdg_shell!(SimpleWindow); delegate_xdg_window!(SimpleWindow); delegate_registry!(SimpleWindow); impl ProvidesRegistryState for SimpleWindow { fn registry(&mut self) -> &mut RegistryState { &mut self.registry_state } registry_handlers![OutputState, SeatState,]; } sctk-adwaita-0.8.1/src/buttons.rs000064400000000000000000000270051046102023000150450ustar 00000000000000use log::{debug, warn}; use smithay_client_toolkit::reexports::csd_frame::{WindowManagerCapabilities, WindowState}; use tiny_skia::{FillRule, PathBuilder, PixmapMut, Rect, Stroke, Transform}; use crate::{theme::ColorMap, Location, SkiaResult}; /// The size of the button on the header bar in logical points. const BUTTON_SIZE: f32 = 24.; const BUTTON_MARGIN: f32 = 5.; const BUTTON_SPACING: f32 = 13.; #[derive(Debug)] pub(crate) struct Buttons { // Sorted by order vec of buttons for the left and right sides buttons_left: Vec