diff --git a/Cargo.lock b/Cargo.lock index bd240099..a0dc4848 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,10 +3,75 @@ version = 3 [[package]] -name = "anyhow" -version = "1.0.43" +name = "aho-corasick" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28ae2b3dec75a406790005a200b1bd89785afc02517a00ca99ecfe093ee9e6cf" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3" + +[[package]] +name = "async-broadcast" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90622698a1218e0b2fb846c97b5f19a0831f6baddee73d9454156365ccfa473b" +dependencies = [ + "easy-parallel", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "once_cell", + "slab", +] + +[[package]] +name = "async-fs" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b3ca4f8ff117c37c278a2f7415ce9be55560b846b5bc4412aaa5d29c1c3dae2" +dependencies = [ + "async-lock", + "blocking", + "futures-lite", +] [[package]] name = "async-io" @@ -27,18 +92,127 @@ dependencies = [ "winapi", ] +[[package]] +name = "async-lock" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-net" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5373304df79b9b4395068fb080369ec7178608827306ce4d081cba51cac551df" +dependencies = [ + "async-io", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-oneshot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec7c75bcbcb0139e9177f30692fd617405ca4e0c27802e128d53171f7042e2c" +dependencies = [ + "futures-micro", +] + +[[package]] +name = "async-process" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83137067e3a2a6a06d67168e49e68a0957d215410473a740cea95a2425c0b7c6" +dependencies = [ + "async-io", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "libc", + "once_cell", + "signal-hook", + "winapi", +] + +[[package]] +name = "async-recursion" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d78656ba01f1b93024b7c3a0467f1608e4be67d725749fdcd7d2c7678fd7a2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-task" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" + +[[package]] +name = "async-trait" +version = "0.1.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atomic" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "atomic-waker" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" + [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +[[package]] +name = "blocking" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046e47d4b2d391b1f6f8b407b1deb8dee56c1852ccd868becf2710f601b5f427" +dependencies = [ + "async-channel", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", + "once_cell", +] + [[package]] name = "byte_string" version = "1.0.0" @@ -52,16 +226,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] -name = "cache-padded" -version = "1.1.1" +name = "bytes" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + +[[package]] +name = "cache-padded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" [[package]] name = "cairo-rs" -version = "0.14.3" +version = "0.14.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f859ade407c19810ae920b4fafab92189ed312adad490d08fb16b5f49f1e2207" +checksum = "33b5725979db0c586d98abad2193cdb612dd40ef95cd26bd99851bf93b3cb482" dependencies = [ "bitflags", "cairo-sys-rs", @@ -72,9 +252,9 @@ dependencies = [ [[package]] name = "cairo-sys-rs" -version = "0.14.0" +version = "0.14.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c9c3928781e8a017ece15eace05230f04b647457d170d2d9641c94a444ff80" +checksum = "b448b876970834fda82ba3aeaccadbd760206b75388fc5c1b02f1e343b697570" dependencies = [ "glib-sys", "libc", @@ -89,9 +269,9 @@ checksum = "f18c6a921baae2d947e4cf96f6ef1b5774b3056ae8edbdf5c5cfce4f33260921" [[package]] name = "cc" -version = "1.0.69" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" +checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" [[package]] name = "cfg-expr" @@ -111,12 +291,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -145,6 +319,81 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "const_format" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22bc6cd49b0ec407b680c3e380182b6ac63b73991cb7602de350352fc309b614" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef196d5d972878a48da7decb7686eded338b4858fbabeed513d63a7c98b2b82d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b10ddc024425c88c2ad148c1b0fd53f4c6d38db9697c9f1588381212fa657c9" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +dependencies = [ + "cfg-if", + "lazy_static", +] + +[[package]] +name = "darling" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "derivative" version = "2.2.0" @@ -156,6 +405,26 @@ dependencies = [ "syn", ] +[[package]] +name = "dirs" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "dlib" version = "0.5.0" @@ -171,6 +440,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +[[package]] +name = "easy-parallel" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6907e25393cdcc1f4f3f513d9aac1e840eb1cc341a0fccb01171f7d14d10b946" + [[package]] name = "either" version = "1.6.1" @@ -183,7 +458,17 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0" dependencies = [ - "enumflags2_derive", + "enumflags2_derive 0.6.4", + "serde", +] + +[[package]] +name = "enumflags2" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a25c90b056b3f84111cf183cbeddef0d3a0bbe9a674f057e1a1533c315f24def" +dependencies = [ + "enumflags2_derive 0.7.3", "serde", ] @@ -199,10 +484,27 @@ dependencies = [ ] [[package]] -name = "fastrand" -version = "1.5.0" +name = "enumflags2_derive" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e" +checksum = "144ec79496cbab6f84fa125dc67be9264aef22eb8a28da8454d9c33f15108da4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "event-listener" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" + +[[package]] +name = "fastrand" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2" dependencies = [ "instant", ] @@ -218,10 +520,16 @@ dependencies = [ ] [[package]] -name = "futures" -version = "0.3.16" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adc00f486adfc9ce99f77d717836f0c5aa84965eb0b4f051f4e83f7cab53f8b" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "futures" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4" dependencies = [ "futures-channel", "futures-core", @@ -234,9 +542,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.16" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74ed2411805f6e4e3d9bc904c95d5d423b89b3b25dc0250aa74729de20629ff9" +checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" dependencies = [ "futures-core", "futures-sink", @@ -244,15 +552,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.16" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af51b1b4a7fdff033703db39de8802c673eb91855f2e0d47dcf3bf2c0ef01f99" +checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" [[package]] name = "futures-executor" -version = "0.3.16" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d0d535a57b87e1ae31437b892713aee90cd2d7b0ee48727cd11fc72ef54761c" +checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a" dependencies = [ "futures-core", "futures-task", @@ -261,9 +569,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.16" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0e06c393068f3a6ef246c75cdca793d6a46347e75286933e5e75fd2fd11582" +checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" [[package]] name = "futures-lite" @@ -282,36 +590,42 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.16" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54913bae956fb8df7f4dc6fc90362aa72e69148e3f39041fbe8742d21e0ac57" +checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c" dependencies = [ - "autocfg", - "proc-macro-hack", "proc-macro2", "quote", "syn", ] [[package]] -name = "futures-sink" -version = "0.3.16" +name = "futures-micro" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0f30aaa67363d119812743aa5f33c201a7a66329f97d1a887022971feea4b53" +checksum = "b460264b3593d68b16a7bc35f7bc226ddfebdf9a1c8db1ed95d5cc6b7168c826" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "futures-sink" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" [[package]] name = "futures-task" -version = "0.3.16" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe54a98670017f3be909561f6ad13e810d9a51f3f061b902062ca3da80799f2" +checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" [[package]] name = "futures-util" -version = "0.3.16" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eb846bfd58e44a8481a00049e82c43e0ccb5d61f8dc071057cb19249dd4d78" +checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" dependencies = [ - "autocfg", "futures-channel", "futures-core", "futures-io", @@ -321,11 +635,21 @@ dependencies = [ "memchr", "pin-project-lite", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", "slab", ] +[[package]] +name = "futures_codec" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b" +dependencies = [ + "bytes", + "futures", + "memchr", + "pin-project 0.4.29", +] + [[package]] name = "gdk-pixbuf" version = "0.14.0" @@ -437,10 +761,40 @@ dependencies = [ ] [[package]] -name = "gio" -version = "0.14.3" +name = "gen-z" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a7057cd21d64bfa7ac027b344a7f50f677fb3308693df0e8c70fb55d29f0d" +checksum = "0e87038e64f38cb7fcd57f54c8d6654ad65712babbf70f38d1834d3150ad2415" +dependencies = [ + "futures", +] + +[[package]] +name = "gethostname" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e692e296bfac1d2533ef168d0b60ff5897b8b70a4009276834014dd8924cc028" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "getrandom" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gio" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711c3632b3ebd095578a9c091418d10fed492da9443f58ebc8f45efbeb215cb0" dependencies = [ "bitflags", "futures-channel", @@ -468,9 +822,9 @@ dependencies = [ [[package]] name = "glib" -version = "0.14.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fb802e3798d75b415bea8f016eed88d50106ce82f1274e80f31d80cfd4b056" +checksum = "7c515f1e62bf151ef6635f528d05b02c11506de986e43b34a5c920ef0b3796a4" dependencies = [ "bitflags", "futures-channel", @@ -493,7 +847,7 @@ checksum = "2aad66361f66796bfc73f530c51ef123970eb895ffba991a234fcf7bea89e518" dependencies = [ "anyhow", "heck", - "proc-macro-crate 1.0.0", + "proc-macro-crate 1.1.0", "proc-macro-error", "proc-macro2", "quote", @@ -523,9 +877,9 @@ dependencies = [ [[package]] name = "graphene-rs" -version = "0.14.0" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1460a39f06e491e6112f27e71e51435c833ba370723224dd1743dfd1f201f19" +checksum = "e3380f132530ef9eb9e0a2bac180e30390aa5e49892d20294f822a974117a563" dependencies = [ "glib", "graphene-sys", @@ -534,9 +888,9 @@ dependencies = [ [[package]] name = "graphene-sys" -version = "0.14.0" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d23fb7a9547e5f072a7e0cd49cd648fedeb786d122b106217511980cbb8962" +checksum = "9a9ac7450b3aa80792513a3c029920a2ede419de13fb5169a4e51b07a5685332" dependencies = [ "glib-sys", "libc", @@ -608,7 +962,7 @@ dependencies = [ "anyhow", "heck", "itertools", - "proc-macro-crate 1.0.0", + "proc-macro-crate 1.1.0", "proc-macro-error", "proc-macro2", "quote", @@ -644,28 +998,92 @@ dependencies = [ ] [[package]] -name = "instant" -version = "0.1.10" +name = "hermit-abi" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ - "cfg-if 1.0.0", + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", ] [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" dependencies = [ "either", ] [[package]] -name = "libc" -version = "0.2.100" +name = "itoa" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fa8cddc8fbbee11227ef194b5317ed014b8acbf15139bd716a18ad3fe99ec5" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" + +[[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.112" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" + +[[package]] +name = "libcosmic" +version = "0.1.0" +source = "git+https://github.com/pop-os/libcosmic#6195ab2db956d1178c853fa4b5e07d4898e31cc4" +dependencies = [ + "cascade", + "derivative", + "futures", + "futures-util", + "gdk4", + "gdk4-wayland", + "gdk4-x11", + "gio", + "gobject-sys", + "gtk4", + "once_cell", + "pop-launcher", + "pop-launcher-service", + "serde", + "serde_json", + "tokio", + "wayland-client", + "wayland-protocols", + "x11", + "x11rb", + "xdg", + "zbus 2.0.0", + "zvariant 3.0.0", + "zvariant_derive 3.0.0", +] [[package]] name = "libloading" @@ -673,7 +1091,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "winapi", ] @@ -683,7 +1101,7 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -694,9 +1112,9 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] @@ -711,19 +1129,6 @@ dependencies = [ "socket2", ] -[[package]] -name = "nix" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363" -dependencies = [ - "bitflags", - "cc", - "cfg-if 0.1.10", - "libc", - "void", -] - [[package]] name = "nix" version = "0.20.2" @@ -732,7 +1137,33 @@ checksum = "f5e06129fb611568ef4e868c14b326274959aa70ff7776e9d55323531c374945" dependencies = [ "bitflags", "cc", - "cfg-if 1.0.0", + "cfg-if", + "libc", + "memoffset", +] + +[[package]] +name = "nix" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3bb9a13fa32bc5aeb64150cd3f32d6cf4c748f8f8a417cce5d2eb976a8370ba" +dependencies = [ + "bitflags", + "cc", + "cfg-if", + "libc", + "memoffset", +] + +[[package]] +name = "nix" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" +dependencies = [ + "bitflags", + "cc", + "cfg-if", "libc", "memoffset", ] @@ -757,16 +1188,36 @@ dependencies = [ ] [[package]] -name = "once_cell" -version = "1.8.0" +name = "num_cpus" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" + +[[package]] +name = "ordered-stream" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44630c059eacfd6e08bdaa51b1db2ce33119caa4ddc1235e923109aa5f25ccb1" +dependencies = [ + "futures-core", + "pin-project-lite", +] [[package]] name = "pango" -version = "0.14.3" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fc88307d9797976ea62722ff2ec5de3fae279c6e20100ed3f49ca1a4bf3f96" +checksum = "546fd59801e5ca735af82839007edd226fe7d3bb06433ec48072be4439c28581" dependencies = [ "bitflags", "glib", @@ -803,10 +1254,50 @@ dependencies = [ ] [[package]] -name = "pin-project-lite" -version = "0.2.7" +name = "pin-project" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" +checksum = "9615c18d31137579e9ff063499264ddc1278e7b1982757ebc111028c4d1dc909" +dependencies = [ + "pin-project-internal 0.4.29", +] + +[[package]] +name = "pin-project" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +dependencies = [ + "pin-project-internal 1.0.10", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "044964427019eed9d49d9d5bbce6047ef18f37100ea400912a9fa4a3523ab12a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" [[package]] name = "pin-utils" @@ -816,23 +1307,29 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.19" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" [[package]] name = "polling" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25" +checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "wepoll-ffi", "winapi", ] +[[package]] +name = "pollster" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb20dcc30536a1508e75d47dd0e399bb2fe7354dcf35cda9127f2bf1ed92e30e" + [[package]] name = "pop-cosmic-panel" version = "0.1.0" @@ -845,14 +1342,79 @@ dependencies = [ "gdk4-x11", "gobject-sys", "gtk4", + "libcosmic", "once_cell", "toml", - "wayland-client", - "wayland-protocols", "x11", - "zbus", + "zbus 1.9.2", ] +[[package]] +name = "pop-launcher" +version = "1.1.0" +source = "git+https://github.com/wash2/launcher.git#95781d7ba463ddde1416ba99217d222dffd36637" +dependencies = [ + "blocking", + "const_format", + "futures-lite", + "serde", + "serde_json", + "serde_with", +] + +[[package]] +name = "pop-launcher-service" +version = "1.1.0" +source = "git+https://github.com/wash2/launcher.git#95781d7ba463ddde1416ba99217d222dffd36637" +dependencies = [ + "anyhow", + "async-io", + "async-oneshot", + "async-process", + "async-trait", + "futures", + "futures-core", + "futures-lite", + "futures_codec", + "gen-z", + "num_cpus", + "pop-launcher", + "postage", + "regex", + "ron", + "serde", + "serde_json", + "serde_with", + "slab", + "smol", + "strsim", + "toml", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "postage" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a63d25391d04a097954b76aba742b6b5b74f213dfe3dbaeeb36e8ddc1c657f0b" +dependencies = [ + "atomic", + "crossbeam-queue", + "futures", + "log", + "pin-project 1.0.10", + "pollster", + "static_assertions", + "thiserror", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + [[package]] name = "proc-macro-crate" version = "0.1.5" @@ -864,9 +1426,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fdbd1df62156fbc5945f4762632564d7d038153091c3fcf1067f6aef7cff92" +checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83" dependencies = [ "thiserror", "toml", @@ -896,36 +1458,111 @@ dependencies = [ "version_check", ] -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - -[[package]] -name = "proc-macro-nested" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" - [[package]] name = "proc-macro2" -version = "1.0.28" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] [[package]] name = "quote" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +dependencies = [ + "getrandom", + "redox_syscall", +] + +[[package]] +name = "regex" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "ron" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b861ecaade43ac97886a512b360d01d66be9f41f3c61088b42cedf92e03d678" +dependencies = [ + "base64", + "bitflags", + "serde", +] + [[package]] name = "rustc_version" version = "0.3.3" @@ -935,6 +1572,18 @@ dependencies = [ "semver", ] +[[package]] +name = "rustversion" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" + +[[package]] +name = "ryu" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" + [[package]] name = "scoped-tls" version = "1.0.0" @@ -961,24 +1610,35 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.128" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1056a0db1978e9dbf0f6e4fca677f6f9143dc1c19de346f22cac23e422196834" +checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.128" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13af2fbb8b60a8950d6c72a56d2095c28870367cc8e10c55e9745bac4995a2c4" +checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "serde_json" +version = "1.0.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142" +dependencies = [ + "itoa", + "ryu", + "serde", +] + [[package]] name = "serde_repr" version = "0.1.7" @@ -991,22 +1651,97 @@ dependencies = [ ] [[package]] -name = "slab" -version = "0.4.4" +name = "serde_with" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" +checksum = "ad6056b4cb69b6e43e3a0f055def223380baecc99da683884f205bf347f7c4b3" +dependencies = [ + "rustversion", + "serde", + "serde_with_macros", +] + +[[package]] +name = "serde_with_macros" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e47be9471c72889ebafb5e14d5ff930d89ae7a67bbdb5f8abb564f845a927e" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" + +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signal-hook" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" [[package]] name = "smallvec" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" + +[[package]] +name = "smol" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cf3b5351f3e783c1d79ab5fc604eeed8b8ae9abd36b166e8b87a089efd85e4" +dependencies = [ + "async-channel", + "async-executor", + "async-fs", + "async-io", + "async-lock", + "async-net", + "async-process", + "blocking", + "futures-lite", + "once_cell", +] [[package]] name = "socket2" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" +checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" dependencies = [ "libc", "winapi", @@ -1018,6 +1753,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strum" version = "0.21.0" @@ -1038,9 +1779,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.75" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7" +checksum = "ecb2e6da8ee5eb9a61068762a32fa9619cc591ceb055b3687f4cd4051ec2e06b" dependencies = [ "proc-macro2", "quote", @@ -1080,18 +1821,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.26" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" +checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.26" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" +checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ "proc-macro2", "quote", @@ -1099,16 +1840,33 @@ dependencies = [ ] [[package]] -name = "time" -version = "0.1.44" +name = "thread_local" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +dependencies = [ + "once_cell", +] + +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "wasi", "winapi", ] +[[package]] +name = "tokio" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.5.8" @@ -1118,6 +1876,63 @@ dependencies = [ "serde", ] +[[package]] +name = "tracing" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-log" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d81bfa81424cc98cb034b837c985b7a290f592e5b4322f353f94a0ab0f9f594" +dependencies = [ + "ansi_term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", +] + [[package]] name = "ucd-trie" version = "0.1.3" @@ -1144,15 +1959,9 @@ checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b" [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "waker-fn" @@ -1162,9 +1971,9 @@ checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" [[package]] name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wayland-client" @@ -1252,6 +2061,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-wsapoll" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -1260,14 +2078,35 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "x11" -version = "2.18.2" +version = "2.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ecd092546cb16f25783a5451538e73afc8d32e242648d54f4ae5459ba1e773" +checksum = "6dd0565fa8bfba8c5efe02725b14dff114c866724eff2cfd44d76cea74bcd87a" dependencies = [ "libc", "pkg-config", ] +[[package]] +name = "x11rb" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e99be55648b3ae2a52342f9a870c0e138709a3493261ce9b469afe6e4df6d8a" +dependencies = [ + "gethostname", + "nix 0.22.2", + "winapi", + "winapi-wsapoll", +] + +[[package]] +name = "xdg" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a23fe958c70412687039c86f578938b4a0bb50ec788e96bce4d6ab00ddd5803" +dependencies = [ + "dirs", +] + [[package]] name = "xml-rs" version = "0.8.4" @@ -1276,32 +2115,67 @@ checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" [[package]] name = "zbus" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2326acc379a3ac4e34b794089f5bdb17086bf29a5fdf619b7b4cc772dc2e9dad" +checksum = "e5983c3d035549ab80db67c844ec83ed271f7c1f2546fd9577c594d34c1b6c85" dependencies = [ "async-io", "byteorder", "derivative", - "enumflags2", + "enumflags2 0.6.4", "fastrand", "futures", "nb-connect", - "nix 0.17.0", + "nix 0.20.2", "once_cell", "polling", "scoped-tls", "serde", "serde_repr", - "zbus_macros", - "zvariant", + "zbus_macros 1.9.2", + "zvariant 2.10.0", +] + +[[package]] +name = "zbus" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b6202696b4dc8ee26ff92939c79a0307e7cd683374fdf500902d74d914fef6" +dependencies = [ + "async-broadcast", + "async-channel", + "async-executor", + "async-io", + "async-lock", + "async-recursion", + "async-task", + "async-trait", + "byteorder", + "derivative", + "enumflags2 0.7.3", + "event-listener", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix 0.23.1", + "once_cell", + "ordered-stream", + "rand", + "serde", + "serde_repr", + "sha1", + "static_assertions", + "zbus_macros 2.0.0", + "zbus_names", + "zvariant 3.0.0", ] [[package]] name = "zbus_macros" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a482c56029e48681b89b92b5db3c446db0915e8dd1052c0328a574eda38d5f93" +checksum = "bce54ac7b2150a2fa21ad5842a7470ce2288158d7da1f9bfda8ad455a1c59a97" dependencies = [ "proc-macro-crate 0.1.5", "proc-macro2", @@ -1310,25 +2184,76 @@ dependencies = [ ] [[package]] -name = "zvariant" -version = "2.8.0" +name = "zbus_macros" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4b785b8b32b0f8433b4474e6bb4ea77b37c1960e84d7598e01dd199b2b23ef" +checksum = "fd2ea67f43e8abd245eabc480e597990340d9870b585d40bf4350d742acb2219" +dependencies = [ + "proc-macro-crate 1.1.0", + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "zbus_names" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1f142d242d6854815a8c5c2aea83d9508f72f5757d0a137c21ef4b07bfee66" dependencies = [ - "byteorder", - "enumflags2", "serde", "static_assertions", - "zvariant_derive", + "zvariant 3.0.0", +] + +[[package]] +name = "zvariant" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a68c7b55f2074489b7e8e07d2d0a6ee6b4f233867a653c664d8020ba53692525" +dependencies = [ + "byteorder", + "enumflags2 0.6.4", + "libc", + "serde", + "static_assertions", + "zvariant_derive 2.10.0", +] + +[[package]] +name = "zvariant" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a946c049b2eac1a253f98e9267a8ce7a3d93be274ea146e6dd7a0965232a911" +dependencies = [ + "byteorder", + "enumflags2 0.7.3", + "libc", + "serde", + "static_assertions", + "zvariant_derive 3.0.0", ] [[package]] name = "zvariant_derive" -version = "2.8.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42af4ee88fb928781391216c34be77ec7cdb3546042b2947ce38d86aa5f37dd" +checksum = "e4ca5e22593eb4212382d60d26350065bf2a02c34b85bc850474a74b589a3de9" dependencies = [ - "proc-macro-crate 1.0.0", + "proc-macro-crate 1.1.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zvariant_derive" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28fce5afb8d639bff79b1e8cdb258a3ca22d458f4603b23d794b4cb4e878c990" +dependencies = [ + "proc-macro-crate 1.1.0", "proc-macro2", "quote", "syn", diff --git a/Cargo.toml b/Cargo.toml index 42d4b186..ce868ac3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,12 +13,11 @@ gdk4-x11 = "0.3" gdk4-wayland = { version = "0.3", optional = true } gtk4 = "0.3" gobject-sys = "0.14.0" +libcosmic = { git = "https://github.com/pop-os/libcosmic" } once_cell = "1" toml = "0.5" -wayland-client = { version = "0.28", optional = true } -wayland-protocols = { version = "0.28", features = [ "client", "unstable_protocols" ], optional = true } x11 = { version = "2", features = ["xlib"] } zbus = "1" [features] -layer-shell = ["gdk4-wayland", "wayland-client", "wayland-protocols"] +layer-shell = ["gdk4-wayland", "libcosmic/layer-shell"] diff --git a/src/main.rs b/src/main.rs index fe436502..03a40bde 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,12 +13,7 @@ mod status_area; mod status_menu; mod status_notifier_watcher; mod time_button; -#[cfg(feature = "layer-shell")] -mod wayland; -#[cfg(feature = "layer-shell")] -mod wayland_custom_surface; mod window; -mod x; use application::PanelApp; diff --git a/src/wayland.rs b/src/wayland.rs deleted file mode 100644 index 065147e5..00000000 --- a/src/wayland.rs +++ /dev/null @@ -1,563 +0,0 @@ -// TODO: scale-factor? - -use derivative::Derivative; -use gdk4_wayland::prelude::*; -use gtk4::{ - cairo, gdk, - glib::{self, clone, subclass::prelude::*, translate::*}, - gsk::{self, traits::RendererExt}, - prelude::*, - subclass::prelude::*, -}; -use std::{ - cell::{Cell, RefCell}, - os::raw::c_int, - ptr, - rc::Rc, -}; -use wayland_client::{event_enum, sys::client::wl_proxy, Filter, GlobalManager, Main, Proxy}; -use wayland_protocols::{ - wlr::unstable::layer_shell::v1::client::{zwlr_layer_shell_v1, zwlr_layer_surface_v1}, - xdg_shell::client::xdg_popup, -}; - -use crate::{deref_cell::DerefCell, wayland_custom_surface::WaylandCustomSurface}; - -pub use wayland_protocols::wlr::unstable::layer_shell::v1::client::{ - zwlr_layer_shell_v1::Layer, - zwlr_layer_surface_v1::{Anchor, KeyboardInteractivity}, -}; - -event_enum!( - Events | - LayerSurface => zwlr_layer_surface_v1::ZwlrLayerSurfaceV1 -); - -struct CosmicWaylandDisplay { - event_queue: RefCell, - wayland_display: wayland_client::Display, - wlr_layer_shell: Option>, -} - -impl CosmicWaylandDisplay { - fn for_display(display: &gdk4_wayland::WaylandDisplay) -> Rc { - const DATA_KEY: &str = "cosmic-wayland-display"; - - // `GdkWaylandDisplay` already associated with a `CosmicWaylandDisplay` - if let Some(data) = unsafe { display.data::>(DATA_KEY) } { - return unsafe { data.as_ref() }.clone(); - } - - let wayland_display = unsafe { - wayland_client::Display::from_external_display( - display.wl_display().as_ref().c_ptr() as *mut _ - ) - }; // XXX is this sound? - - let mut event_queue = wayland_display.create_event_queue(); - let attached_display = wayland_display.attach(event_queue.token()); - let globals = GlobalManager::new(&attached_display); - - event_queue.sync_roundtrip(&mut (), |_, _, _| {}).unwrap(); - - let wlr_layer_shell = globals - .instantiate_exact::(1) - .ok(); - - let cosmic_wayland_display = Rc::new(Self { - event_queue: RefCell::new(event_queue), - wayland_display, - wlr_layer_shell, - }); - - unsafe { display.set_data(DATA_KEY, cosmic_wayland_display.clone()) }; - - // XXX Efficient way to poll? - // XXX unwrap? - glib::idle_add_local( - clone!(@weak cosmic_wayland_display => @default-return Continue(false), move || { - cosmic_wayland_display.wayland_display.flush().unwrap(); - let mut event_queue = cosmic_wayland_display.event_queue.borrow_mut(); - if let Some(guard) = event_queue.prepare_read() { - guard.read_events().unwrap(); - } - event_queue.dispatch_pending(&mut (), |_, _, _| {}).unwrap(); - Continue(true) - }), - ); - - cosmic_wayland_display - } -} - -#[derive(Derivative)] -#[derivative(Default)] -pub struct LayerShellWindowInner { - display: DerefCell, - surface: RefCell>, - renderer: RefCell>, - wlr_layer_surface: RefCell>>, - constraint_solver: DerefCell, - child: RefCell>, - monitor: DerefCell>, - #[derivative(Default(value = "Cell::new(Layer::Background)"))] - layer: Cell, - #[derivative(Default(value = "Cell::new(Anchor::empty())"))] - anchor: Cell, - exclusive_zone: Cell, - margin: Cell<(i32, i32, i32, i32)>, - #[derivative(Default(value = "Cell::new(KeyboardInteractivity::None)"))] - keyboard_interactivity: Cell, - namespace: DerefCell, - focus_widget: RefCell>, -} - -#[glib::object_subclass] -impl ObjectSubclass for LayerShellWindowInner { - const NAME: &'static str = "S76CosmicLayerShellWindow"; - type ParentType = gtk4::Widget; - type Interfaces = (gtk4::Native, gtk4::Root); - type Type = LayerShellWindow; -} - -impl ObjectImpl for LayerShellWindowInner { - fn constructed(&self, obj: &Self::Type) { - self.display - .set(gdk::Display::default().unwrap().downcast().unwrap()); // XXX any issue unwrapping? - self.constraint_solver.set(glib::Object::new(&[]).unwrap()); - - obj.add_css_class("background"); - } -} - -impl WidgetImpl for LayerShellWindowInner { - fn realize(&self, widget: &Self::Type) { - let surface = WaylandCustomSurface::new(&*self.display); - surface.set_get_popup_func(Some(Box::new(clone!(@strong widget => move |_surface, popup| { - if let Some(wlr_layer_surface) = widget.inner().wlr_layer_surface.borrow().as_ref() { - let xdg_popup: xdg_popup::XdgPopup = - unsafe { Proxy::from_c_ptr(gdk_wayland_popup_get_xdg_popup(popup.to_glib_none().0)).into() }; - wlr_layer_surface.get_popup(&xdg_popup); - } - true - })))); - widget.layer_shell_init(&surface); - - let widget_ptr: *mut _ = widget.to_glib_none().0; - let surface_ptr: *mut _ = surface.to_glib_none().0; - unsafe { gdk_surface_set_widget(surface_ptr as *mut _, widget_ptr as *mut _) }; - *self.surface.borrow_mut() = Some(surface.clone()); - surface.connect_render(move |_surface, region| { - unsafe { - gtk_widget_render( - widget_ptr as *mut _, - surface_ptr as *mut _, - region.to_glib_none().0, - ) - }; - true - }); - surface.connect_event(|_, event| { - unsafe { gtk_main_do_event(event.to_glib_none().0) }; - true - }); - - self.parent_realize(widget); - - *self.renderer.borrow_mut() = - Some(gsk::Renderer::for_surface(surface.upcast_ref()).unwrap()); // XXX unwrap? - - unsafe { gtk4::ffi::gtk_native_realize(widget_ptr as *mut _) }; - } - - fn unrealize(&self, widget: &Self::Type) { - let widget_ptr: *mut Self::Instance = widget.to_glib_none().0; - - unsafe { gtk4::ffi::gtk_native_unrealize(widget_ptr as *mut _) }; - - self.parent_unrealize(widget); - - if let Some(renderer) = self.renderer.borrow_mut().take() { - renderer.unrealize(); - } - - if let Some(surface) = self.surface.borrow().as_ref() { - let surface_ptr: *mut _ = surface.to_glib_none().0; - unsafe { gdk_surface_set_widget(surface_ptr as *mut _, ptr::null_mut()) }; - } - } - - fn map(&self, widget: &Self::Type) { - if let Some(surface) = self.surface.borrow().as_ref() { - let width = widget.measure(gtk4::Orientation::Horizontal, -1).1; - let height = widget.measure(gtk4::Orientation::Vertical, width).1; - widget.set_size(width as u32, height as u32); - surface.present(width, height); - } - - self.parent_map(widget); - - if let Some(child) = self.child.borrow().as_ref() { - child.map(); - } - } - - fn unmap(&self, widget: &Self::Type) { - self.parent_unmap(widget); - - if let Some(surface) = self.surface.borrow().as_ref() { - surface.hide(); - } - - if let Some(child) = self.child.borrow().as_ref() { - child.unmap(); - } - } - - fn measure( - &self, - _widget: &Self::Type, - orientation: gtk4::Orientation, - for_size: i32, - ) -> (i32, i32, i32, i32) { - if let Some(child) = self.child.borrow().as_ref() { - child.measure(orientation, for_size) - } else { - (0, 0, 0, 0) - } - } - - fn size_allocate(&self, _widget: &Self::Type, width: i32, height: i32, baseline: i32) { - if let Some(child) = self.child.borrow().as_ref() { - child.allocate(width, height, baseline, None) - } - } - - fn show(&self, widget: &Self::Type) { - widget.realize(); - self.parent_show(widget); - widget.map(); - } - - fn hide(&self, widget: &Self::Type) { - self.parent_hide(widget); - widget.unmap(); - } -} - -// TODO: Move into gtk4-rs when support merged/released in gtk -unsafe impl IsImplementable for gtk4::Native { - fn interface_init(iface: &mut glib::Interface) { - let iface = unsafe { &mut *(iface as *mut _ as *mut GtkNativeInterface) }; - iface.get_surface = Some(get_surface); - iface.get_renderer = Some(get_renderer); - iface.get_surface_transform = Some(get_surface_transform); - iface.layout = Some(layout); - } - - fn instance_init(_instance: &mut glib::subclass::InitializingObject) {} -} - -// TODO: Move into gtk4-rs when support merged/released in gtk -unsafe impl IsImplementable for gtk4::Root { - fn interface_init(iface: &mut glib::Interface) { - let iface = unsafe { &mut *(iface as *mut _ as *mut GtkRootInterface) }; - iface.get_display = Some(get_display); - iface.get_constraint_solver = Some(get_constraint_solver); - iface.get_focus = Some(get_focus); - iface.set_focus = Some(set_focus); - } - - fn instance_init(_instance: &mut glib::subclass::InitializingObject) {} -} - -glib::wrapper! { - pub struct LayerShellWindow(ObjectSubclass) - @extends gtk4::Widget, @implements gtk4::Accessible, gtk4::Buildable, gtk4::ConstraintTarget, gtk4::Native, gtk4::Root; -} -// TODO handle configure/destroy -// TODO presumably call destroy() when appropriate? -// What do wayland-client types do when associated connection is gone? Panic? UB? -impl LayerShellWindow { - pub fn new( - monitor: Option<&gdk4_wayland::WaylandMonitor>, - layer: Layer, - namespace: &str, - ) -> Self { - let obj: Self = glib::Object::new(&[]).unwrap(); - obj.inner().monitor.set(monitor.cloned()); - obj.inner().layer.set(layer); - obj.inner().namespace.set(namespace.to_string()); - obj - } - - fn inner(&self) -> &LayerShellWindowInner { - LayerShellWindowInner::from_instance(self) - } - - pub fn set_child>(&self, w: Option<&T>) { - let mut child = self.inner().child.borrow_mut(); - if let Some(child) = child.take() { - child.unparent(); - } - if let Some(w) = w { - w.set_parent(self); - } - *child = w.map(|x| x.clone().upcast()); - } - - fn layer_shell_init(&self, surface: &WaylandCustomSurface) { - let width = self.measure(gtk4::Orientation::Horizontal, -1).1; - let height = self.measure(gtk4::Orientation::Vertical, width).1; - // XXX needed for wl_surface to exist - surface.present(width, height); - - let wl_surface = surface.wl_surface(); - - let cosmic_wayland_display = CosmicWaylandDisplay::for_display(&*self.inner().display); - let wlr_layer_shell = match cosmic_wayland_display.wlr_layer_shell.as_ref() { - Some(wlr_layer_shell) => wlr_layer_shell, - None => { - eprintln!("Error: Layer shell not supported by compositor"); - return; - } - }; - - let output = self.inner().monitor.as_ref().map(|x| x.wl_output()); - let layer = self.layer(); - let namespace = self.namespace().to_string(); - let wlr_layer_surface = - wlr_layer_shell.get_layer_surface(&wl_surface, output.as_ref(), layer, namespace); - - wlr_layer_surface.set_anchor(self.anchor()); - wlr_layer_surface.set_exclusive_zone(self.exclusive_zone()); - let margin = self.margin(); - wlr_layer_surface.set_margin(margin.0, margin.1, margin.2, margin.3); - wlr_layer_surface.set_keyboard_interactivity(self.keyboard_interactivity()); - wlr_layer_surface.set_size(width as u32, height as u32); - - let filter = Filter::new( - clone!(@strong self as self_ => move |event, _, _| match event { - Events::LayerSurface { event, object } => match event { - zwlr_layer_surface_v1::Event::Configure { - serial, - width: _, - height: _, - } => { - // TODO: should size window to match `width`/`height` - object.ack_configure(serial); - } - zwlr_layer_surface_v1::Event::Closed => {} - _ => {} - }, - }), - ); - wlr_layer_surface.assign(filter); - - wl_surface.commit(); - - cosmic_wayland_display - .event_queue - .borrow_mut() - .sync_roundtrip(&mut (), |_, _, _| {}) - .unwrap(); - - *self.inner().wlr_layer_surface.borrow_mut() = Some(wlr_layer_surface); - } - - fn set_size(&self, width: u32, height: u32) { - if let Some(wlr_layer_surface) = self.inner().wlr_layer_surface.borrow().as_ref() { - wlr_layer_surface.set_size(width, height); - }; - } - - pub fn anchor(&self) -> Anchor { - self.inner().anchor.get() - } - - pub fn set_anchor(&self, anchor: Anchor) { - if let Some(wlr_layer_surface) = self.inner().wlr_layer_surface.borrow().as_ref() { - wlr_layer_surface.set_anchor(anchor); - }; - self.inner().anchor.set(anchor); - } - - pub fn exclusive_zone(&self) -> i32 { - self.inner().exclusive_zone.get() - } - - pub fn set_exclusive_zone(&self, zone: i32) { - if let Some(wlr_layer_surface) = self.inner().wlr_layer_surface.borrow().as_ref() { - wlr_layer_surface.set_exclusive_zone(zone); - }; - self.inner().exclusive_zone.set(zone); - } - - pub fn margin(&self) -> (i32, i32, i32, i32) { - self.inner().margin.get() - } - - pub fn set_margin(&self, top: i32, right: i32, bottom: i32, left: i32) { - if let Some(wlr_layer_surface) = self.inner().wlr_layer_surface.borrow().as_ref() { - wlr_layer_surface.set_margin(top, right, bottom, left); - }; - self.inner().margin.set((top, right, bottom, left)); - } - - pub fn keyboard_interactivity(&self) -> KeyboardInteractivity { - self.inner().keyboard_interactivity.get() - } - - pub fn set_keyboard_interactivity(&self, interactivity: KeyboardInteractivity) { - if let Some(wlr_layer_surface) = self.inner().wlr_layer_surface.borrow().as_ref() { - wlr_layer_surface.set_keyboard_interactivity(interactivity); - }; - self.inner().keyboard_interactivity.set(interactivity); - } - - pub fn layer(&self) -> Layer { - self.inner().layer.get() - } - - pub fn set_layer(&self, layer: Layer) { - if let Some(wlr_layer_surface) = self.inner().wlr_layer_surface.borrow().as_ref() { - wlr_layer_surface.set_layer(layer); - }; - self.inner().layer.set(layer); - } - - pub fn namespace(&self) -> &str { - self.inner().namespace.as_str() - } -} - -pub struct GtkConstraintSolver { - _private: [u8; 0], -} - -// XXX needs to be public in gtk -#[link(name = "gtk-4")] -extern "C" { - pub fn gtk_constraint_solver_get_type() -> glib::ffi::GType; - - pub fn gdk_surface_set_widget(surface: *mut gdk::ffi::GdkSurface, widget: glib::ffi::gpointer); - - pub fn _gtk_widget_set_visible_flag( - widget: *mut gtk4::ffi::GtkWidget, - visible: glib::ffi::gboolean, - ); - - pub fn gtk_widget_render( - widget: *mut gtk4::ffi::GtkWidget, - surface: *mut gdk::ffi::GdkSurface, - region: *const cairo::ffi::cairo_region_t, - ); - - pub fn gtk_main_do_event(event: *mut gdk::ffi::GdkEvent); - - // Added API - pub fn gdk_wayland_popup_get_xdg_popup( - popup: *mut gdk4_wayland::ffi::GdkWaylandPopup, - ) -> *mut wl_proxy; -} - -glib::wrapper! { - pub struct ConstraintSolver(Object); - - match fn { - type_ => || gtk_constraint_solver_get_type(), - } -} - -pub struct GtkNativeInterface { - pub g_iface: gobject_sys::GTypeInterface, - pub get_surface: - Option *mut gdk::ffi::GdkSurface>, - pub get_renderer: Option< - unsafe extern "C" fn(self_: *mut gtk4::ffi::GtkNative) -> *mut gsk::ffi::GskRenderer, - >, - pub get_surface_transform: - Option, - pub layout: - Option, -} - -pub struct GtkRootInterface { - pub g_iface: gobject_sys::GTypeInterface, - pub get_display: - Option *mut gdk::ffi::GdkDisplay>, - pub get_constraint_solver: - Option *mut GtkConstraintSolver>, - pub get_focus: - Option *mut gtk4::ffi::GtkWidget>, - pub set_focus: Option< - unsafe extern "C" fn(self_: *mut gtk4::ffi::GtkRoot, focus: *mut gtk4::ffi::GtkWidget), - >, -} - -unsafe extern "C" fn get_surface(native: *mut gtk4::ffi::GtkNative) -> *mut gdk::ffi::GdkSurface { - let instance = &*(native as *mut ::Instance); - let imp = instance.impl_(); - imp.surface.borrow().as_ref().map_or(ptr::null_mut(), |x| { - x.upcast_ref::().to_glib_none().0 - }) -} - -unsafe extern "C" fn get_renderer(native: *mut gtk4::ffi::GtkNative) -> *mut gsk::ffi::GskRenderer { - let instance = &*(native as *mut ::Instance); - let imp = instance.impl_(); - imp.renderer - .borrow() - .as_ref() - .map_or(ptr::null_mut(), |x| x.to_glib_none().0) -} - -unsafe extern "C" fn get_surface_transform( - _native: *mut gtk4::ffi::GtkNative, - x: *mut f64, - y: *mut f64, -) { - // TODO: add css logic like `GtkWindow` has - - *x = 0.; - *y = 0.; -} - -unsafe extern "C" fn layout(native: *mut gtk4::ffi::GtkNative, width: c_int, height: c_int) { - // TODO: `GtkWindow` has more here - gtk4::ffi::gtk_widget_allocate(native as *mut _, width, height, -1, ptr::null_mut()); -} - -unsafe extern "C" fn get_display(root: *mut gtk4::ffi::GtkRoot) -> *mut gdk::ffi::GdkDisplay { - let instance = &*(root as *mut ::Instance); - let imp = instance.impl_(); - imp.display.upcast_ref::().to_glib_none().0 -} - -unsafe extern "C" fn get_constraint_solver( - root: *mut gtk4::ffi::GtkRoot, -) -> *mut GtkConstraintSolver { - let instance = &*(root as *mut ::Instance); - let imp = instance.impl_(); - imp.constraint_solver.to_glib_none().0 -} - -unsafe extern "C" fn get_focus(root: *mut gtk4::ffi::GtkRoot) -> *mut gtk4::ffi::GtkWidget { - let instance = &*(root as *mut ::Instance); - let imp = instance.impl_(); - imp.focus_widget - .borrow() - .as_ref() - .map_or(ptr::null_mut(), |x| x.to_glib_none().0) -} - -unsafe extern "C" fn set_focus(root: *mut gtk4::ffi::GtkRoot, focus: *mut gtk4::ffi::GtkWidget) { - // TODO: `GtkWindow` does more here - let instance = &*(root as *mut ::Instance); - let imp = instance.impl_(); - *imp.focus_widget.borrow_mut() = if focus.is_null() { - None - } else { - Some(gtk4::Widget::from_glib_none(focus)) - }; -} diff --git a/src/wayland_custom_surface.rs b/src/wayland_custom_surface.rs deleted file mode 100644 index fceb4cb5..00000000 --- a/src/wayland_custom_surface.rs +++ /dev/null @@ -1,144 +0,0 @@ -use gdk4_wayland::{WaylandDisplay, WaylandPopup}; -use gtk4::{ - gdk, - glib::{self, translate::*}, -}; -use std::boxed::Box as Box_; -use std::fmt; - -mod ffi { - use gdk4_wayland::ffi::{GdkWaylandDisplay, GdkWaylandPopup}; - use gtk4::{ - gdk::ffi::GdkFrameClock, - glib::ffi::{gboolean, gpointer, GDestroyNotify, GType}, - }; - use std::os::raw::c_int; - - pub type GdkWaylandCustomSurfaceGetPopupFunc = Option< - unsafe extern "C" fn( - *mut GdkWaylandCustomSurface, - *mut GdkWaylandPopup, - gpointer, - ) -> gboolean, - >; - - #[repr(C)] - pub struct GdkWaylandCustomSurface { - _data: [u8; 0], - _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, - } - - impl ::std::fmt::Debug for GdkWaylandCustomSurface { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("GdkWaylandCustomSurface @ {:p}", self)) - .finish() - } - } - - extern "C" { - pub fn gdk_wayland_custom_surface_get_type() -> GType; - - pub fn gdk_wayland_custom_surface_new( - display: *mut GdkWaylandDisplay, - ) -> *mut GdkWaylandCustomSurface; - - pub fn gdk_wayland_custom_surface_present( - custom_surface: *mut GdkWaylandCustomSurface, - width: c_int, - height: c_int, - ); - - pub fn gdk_wayland_custom_surface_set_get_popup_func( - custom_surface: *mut GdkWaylandCustomSurface, - get_popup_func: GdkWaylandCustomSurfaceGetPopupFunc, - user_data: gpointer, - destroy: GDestroyNotify, - ); - - pub fn _gdk_frame_clock_idle_new() -> *mut GdkFrameClock; - } -} - -glib::wrapper! { - #[doc(alias = "GdkWaylandCustomSurface")] - pub struct WaylandCustomSurface(Object) @extends gdk4_wayland::WaylandSurface, gdk::Surface; - - match fn { - type_ => || ffi::gdk_wayland_custom_surface_get_type(), - } -} - -impl WaylandCustomSurface { - #[doc(alias = "gdk_wayland_custom_surface_new")] - pub fn new(display: &WaylandDisplay) -> WaylandCustomSurface { - unsafe { - from_glib_full(ffi::gdk_wayland_custom_surface_new( - display.to_glib_none().0, - )) - } - } - - #[doc(alias = "gdk_wayland_custom_surface_present")] - pub fn present(&self, width: i32, height: i32) { - unsafe { - ffi::gdk_wayland_custom_surface_present(self.to_glib_none().0, width, height); - } - } - - #[doc(alias = "gdk_wayland_custom_surface_set_get_popup_func")] - pub fn set_get_popup_func( - &self, - get_popup_func: Option< - Box_ bool + 'static>, - >, - ) { - let get_popup_func_data: Box_< - Option bool + 'static>>, - > = Box_::new(get_popup_func); - unsafe extern "C" fn get_popup_func_func( - custom_surface: *mut ffi::GdkWaylandCustomSurface, - popup: *mut gdk4_wayland::ffi::GdkWaylandPopup, - user_data: glib::ffi::gpointer, - ) -> glib::ffi::gboolean { - let custom_surface = from_glib_borrow(custom_surface); - let popup = from_glib_borrow(popup); - let callback: &Option< - Box_ bool + 'static>, - > = &*(user_data as *mut _); - let res = if let Some(ref callback) = *callback { - callback(&custom_surface, &popup) - } else { - panic!("cannot get closure...") - }; - res.into_glib() - } - let get_popup_func = if get_popup_func_data.is_some() { - Some(get_popup_func_func as _) - } else { - None - }; - unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) { - let _callback: Box_< - Option bool + 'static>>, - > = Box_::from_raw(data as *mut _); - } - let destroy_call3 = Some(destroy_func as _); - let super_callback0: Box_< - Option bool + 'static>>, - > = get_popup_func_data; - unsafe { - ffi::gdk_wayland_custom_surface_set_get_popup_func( - self.to_glib_none().0, - get_popup_func, - Box_::into_raw(super_callback0) as *mut _, - destroy_call3, - ); - } - } -} - -impl fmt::Display for WaylandCustomSurface { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("WaylandCustomSurface") - } -} diff --git a/src/window.rs b/src/window.rs index 770e5c3f..419c4ce2 100644 --- a/src/window.rs +++ b/src/window.rs @@ -1,13 +1,13 @@ use cascade::cascade; use glib::clone; use gtk4::{gdk, glib, pango, prelude::*, subclass::prelude::*}; +use libcosmic::x; use std::cell::Cell; use crate::application::PanelApp; use crate::deref_cell::DerefCell; use crate::status_area::StatusArea; use crate::time_button::TimeButton; -use crate::x; const BOTTOM: bool = false; @@ -26,7 +26,7 @@ pub fn create(app: &PanelApp, monitor: gdk::Monitor) { #[cfg(feature = "layer-shell")] fn wayland_create(app: &PanelApp, monitor: &gdk4_wayland::WaylandMonitor) { - use crate::wayland::{Anchor, Layer, LayerShellWindow}; + use libcosmic::wayland::{Anchor, Layer, LayerShellWindow}; let window = LayerShellWindow::new(Some(monitor), Layer::Top, ""); diff --git a/src/x.rs b/src/x.rs deleted file mode 100644 index aa732b99..00000000 --- a/src/x.rs +++ /dev/null @@ -1,188 +0,0 @@ -use cascade::cascade; -use gdk4_x11::x11::xlib; -use glib::translate::ToGlibPtr; -use gtk4::{glib, prelude::*}; -use std::{ - ffi::{CString, NulError}, - os::raw::c_long, - ptr, -}; - -pub use std::os::raw::{c_int, c_uchar, c_ulong, c_ushort}; - -pub fn get_window_x11>( - window: &T, -) -> Option<(gdk4_x11::X11Display, gdk4_x11::X11Surface)> { - let surface = window - .upcast_ref() - .surface()? - .downcast::() - .ok()?; - let display = surface.display()?.downcast::().ok()?; - Some((display, surface)) -} - -#[repr(transparent)] -pub struct Atom(xlib::Atom); - -impl Atom { - pub fn new(display: &gdk4_x11::X11Display, prop: &str) -> Result { - unsafe { - let prop = CString::new(prop)?; - Ok(Self(gdk4_x11::ffi::gdk_x11_get_xatom_by_name_for_display( - display.to_glib_none().0, - prop.as_ptr(), - ))) - } - } -} - -pub unsafe trait XElement { - const TYPE: xlib::Atom; - const SIZE: c_int; -} - -unsafe impl XElement for c_uchar { - const TYPE: xlib::Atom = xlib::XA_CARDINAL; - const SIZE: c_int = 8; -} - -unsafe impl XElement for c_ushort { - const TYPE: xlib::Atom = xlib::XA_CARDINAL; - const SIZE: c_int = 16; -} - -unsafe impl XElement for c_ulong { - const TYPE: xlib::Atom = xlib::XA_CARDINAL; - const SIZE: c_int = 32; -} - -unsafe impl XElement for Atom { - const TYPE: xlib::Atom = xlib::XA_ATOM; - const SIZE: c_int = 32; -} - -pub unsafe trait XProp { - const TYPE: xlib::Atom; - const SIZE: c_int; - - fn ptr(&self) -> *const u8; - - fn nelements(&self) -> c_int; -} - -unsafe impl XProp for &[T; LEN] { - const TYPE: xlib::Atom = T::TYPE; - const SIZE: c_int = T::SIZE; - - fn ptr(&self) -> *const u8 { - self.as_ptr() as _ - } - - fn nelements(&self) -> c_int { - LEN as c_int - } -} - -unsafe impl XProp for &[T] { - const TYPE: xlib::Atom = T::TYPE; - const SIZE: c_int = T::SIZE; - - fn ptr(&self) -> *const u8 { - self.as_ptr() as _ - } - - fn nelements(&self) -> c_int { - self.len() as c_int - } -} - -unsafe impl XProp for &str { - const TYPE: xlib::Atom = xlib::XA_STRING; - const SIZE: c_int = 8; - - fn ptr(&self) -> *const u8 { - self.as_ptr() - } - - fn nelements(&self) -> c_int { - self.len() as c_int - } -} - -#[allow(dead_code)] -pub enum PropMode { - Replace, - Prepend, - Append, -} - -pub unsafe fn change_property( - display: &gdk4_x11::X11Display, - surface: &gdk4_x11::X11Surface, - prop: &str, - mode: PropMode, - value: T, -) { - // TODO check error return value - let mode = match mode { - PropMode::Replace => xlib::PropModeReplace, - PropMode::Prepend => xlib::PropModePrepend, - PropMode::Append => xlib::PropModeAppend, - }; - xlib::XChangeProperty( - display.xdisplay(), - surface.xid(), - Atom::new(display, prop).unwrap().0, - T::TYPE, - T::SIZE, - mode, - value.ptr(), - value.nelements(), - ); -} - -pub unsafe fn set_position( - display: &gdk4_x11::X11Display, - surface: &gdk4_x11::X11Surface, - x: c_int, - y: c_int, -) { - // XXX check error return value - xlib::XMoveWindow(display.xdisplay(), surface.xid(), x, y); -} - -pub unsafe fn wm_state_add( - display: &gdk4_x11::X11Display, - surface: &gdk4_x11::X11Surface, - state: &str, -) { - const _NET_WM_STATE_ADD: c_long = 1; - // XXX check error return value - let mut event = xlib::XEvent { - client_message: xlib::XClientMessageEvent { - type_: xlib::ClientMessage, - serial: 0, - send_event: 0, - display: ptr::null_mut(), - window: surface.xid(), - message_type: Atom::new(display, "_NET_WM_STATE").unwrap().0, - format: 32, - data: cascade! { - xlib::ClientMessageData::new(); - ..set_long(0, _NET_WM_STATE_ADD); - ..set_long(1, Atom::new(display, state).unwrap().0 as _); - ..set_long(2, Atom::new(display, "").unwrap().0 as _); - ..set_long(3, 1); - ..set_long(3, 0); - }, - }, - }; - xlib::XSendEvent( - display.xdisplay(), - display.xrootwindow(), - 0, - xlib::SubstructureRedirectMask | xlib::SubstructureNotifyMask, - &mut event, - ); -}