From f7791dc361c795886de6bfbafa4e665855cec7b5 Mon Sep 17 00:00:00 2001 From: TimUntersberger Date: Wed, 11 Aug 2021 16:42:28 +0200 Subject: [PATCH 1/2] initial experimentation with using iced instead of winapi --- Cargo.lock | 2320 +++++++++++++++++++++++++++++++++++++++++++--- twm/Cargo.toml | 1 + twm/src/main.rs | 2 + twm/src/popup.rs | 62 ++ 4 files changed, 2233 insertions(+), 152 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3b37879e..9f74d538 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,22 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ab_glyph" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af0ac006645f86f20f6c6fa4dcaef920bf803df819123626f9440e35835e7d80" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser 0.12.1", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9fe5e32de01730eb1f6b7f5b51c17e03e2325bf40a74f754f04f130043affff" + [[package]] name = "addr2line" version = "0.14.1" @@ -17,6 +33,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" + [[package]] name = "aho-corasick" version = "0.7.18" @@ -26,6 +48,43 @@ dependencies = [ "memchr", ] +[[package]] +name = "andrew" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c4afb09dd642feec8408e33f92f3ffc4052946f6b20f32fb99c1f58cd4fa7cf" +dependencies = [ + "bitflags", + "rusttype", + "walkdir", + "xdg", + "xml-rs", +] + +[[package]] +name = "approx" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "072df7202e63b127ab55acfe16ce97013d5b97bf160489336d3f1840fd78e99e" +dependencies = [ + "num-traits", +] + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "ash" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06063a002a77d2734631db74e8f4ce7148b77fe522e6bca46f2ae7774fd48112" +dependencies = [ + "libloading 0.7.0", +] + [[package]] name = "atty" version = "0.2.14" @@ -64,12 +123,33 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "bit-set" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + [[package]] name = "bstr" version = "0.2.16" @@ -79,12 +159,44 @@ dependencies = [ "memchr", ] +[[package]] +name = "bumpalo" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad807f2fc2bf185eeb98ff3a901bd46dc5ad58163d0fa4577ba0d25674d71708" + [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" +[[package]] +name = "bytemuck" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72957246c41db82b8ef88a5486143830adeb8227ef9837740bdec67724cf2c5b" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e215f8c2f9f79cb53c8335e687ffd07d5bfcb6fe5fc80723762d0be46e7cc54" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + [[package]] name = "bytes" version = "0.5.6" @@ -97,11 +209,24 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +[[package]] +name = "calloop" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b036167e76041694579972c28cf4877b4f92da222560ddb49008937b6a6727c" +dependencies = [ + "log", + "nix 0.18.0", +] + [[package]] name = "cc" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" +dependencies = [ + "jobserver", +] [[package]] name = "cfg-if" @@ -115,6 +240,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "chrono" version = "0.4.19" @@ -129,278 +260,1081 @@ dependencies = [ ] [[package]] -name = "core-foundation" -version = "0.9.1" +name = "clipboard-win" +version = "4.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +checksum = "4e4ea1881992efc993e4dc50a324cdbd03216e41bdc8385720ff47efc9bd2ca8" dependencies = [ - "core-foundation-sys", - "libc", + "error-code", + "str-buf", + "winapi 0.3.9", ] [[package]] -name = "core-foundation-sys" -version = "0.8.2" +name = "clipboard_macos" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" +checksum = "145a7f9e9b89453bc0a5e32d166456405d389cea5b578f57f1274b1397588a95" +dependencies = [ + "objc", + "objc-foundation", + "objc_id", +] [[package]] -name = "crossbeam-channel" -version = "0.4.4" +name = "clipboard_wayland" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" +checksum = "6f6364a9f7a66f2ac1a1a098aa1c7f6b686f2496c6ac5e5c0d773445df912747" dependencies = [ - "crossbeam-utils", - "maybe-uninit", + "smithay-clipboard", ] [[package]] -name = "crossbeam-utils" -version = "0.7.2" +name = "clipboard_x11" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +checksum = "64240d63f1883d87e5637bfcaf9d77e5c8bd24e30fd440ea2dff5c48c0bf0b7a" dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", + "thiserror", + "x11rb", ] [[package]] -name = "ctrlc" -version = "3.1.9" +name = "cmake" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "232295399409a8b7ae41276757b5a1cc21032848d42bff2352261f958b3ca29a" +checksum = "eb6210b637171dfba4cda12e579ac6dc73f5165ad56133e5d72ef3131f320855" dependencies = [ - "nix", - "winapi 0.3.9", + "cc", ] [[package]] -name = "derivative" -version = "2.2.0" +name = "cocoa" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "6f63902e9223530efb4e26ccd0cf55ec30d592d3b42e21a28defc42a9586e832" dependencies = [ - "proc-macro2", - "quote", - "syn", + "bitflags", + "block", + "cocoa-foundation", + "core-foundation 0.9.1", + "core-graphics 0.22.2", + "foreign-types", + "libc", + "objc", ] [[package]] -name = "dirs" -version = "2.0.2" +name = "cocoa-foundation" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" dependencies = [ - "cfg-if 0.1.10", - "dirs-sys", + "bitflags", + "block", + "core-foundation 0.9.1", + "core-graphics-types", + "foreign-types", + "libc", + "objc", ] [[package]] -name = "dirs-sys" -version = "0.3.6" +name = "codespan-reporting" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "copyless" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" + +[[package]] +name = "core-foundation" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" dependencies = [ + "core-foundation-sys 0.7.0", "libc", - "redox_users", - "winapi 0.3.9", ] [[package]] -name = "either" -version = "1.6.1" +name = "core-foundation" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +dependencies = [ + "core-foundation-sys 0.8.2", + "libc", +] [[package]] -name = "encoding_rs" -version = "0.8.28" +name = "core-foundation-sys" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" + +[[package]] +name = "core-foundation-sys" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" + +[[package]] +name = "core-graphics" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" dependencies = [ - "cfg-if 1.0.0", + "bitflags", + "core-foundation 0.7.0", + "foreign-types", + "libc", ] [[package]] -name = "erased-serde" -version = "0.3.13" +name = "core-graphics" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0465971a8cc1fa2455c8465aaa377131e1f1cf4983280f474a13e68793aa770c" +checksum = "269f35f69b542b80e736a20a89a05215c0ce80c2c03c514abb2e318b78379d86" dependencies = [ - "serde", + "bitflags", + "core-foundation 0.9.1", + "core-graphics-types", + "foreign-types", + "libc", ] [[package]] -name = "filetime" -version = "0.2.14" +name = "core-graphics-types" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" +checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ - "cfg-if 1.0.0", + "bitflags", + "core-foundation 0.9.1", + "foreign-types", "libc", - "redox_syscall 0.2.8", - "winapi 0.3.9", ] [[package]] -name = "fixedbitset" -version = "0.2.0" +name = "core-text" +version = "19.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" +checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" +dependencies = [ + "core-foundation 0.9.1", + "core-graphics 0.22.2", + "foreign-types", + "libc", +] [[package]] -name = "flexi_logger" -version = "0.15.12" +name = "core-video-sys" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaab3caedb4149800f91e8e4899f29cd9ddf3b569b04c365ca9334f92f7542bf" +checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" dependencies = [ - "atty", - "chrono", - "glob", - "lazy_static", - "log", - "regex", - "thiserror", - "yansi", + "cfg-if 0.1.10", + "core-foundation-sys 0.7.0", + "core-graphics 0.19.2", + "libc", + "objc", ] [[package]] -name = "fnv" -version = "1.0.7" +name = "crossbeam" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-channel 0.5.1", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils 0.8.5", +] [[package]] -name = "foreign-types" -version = "0.3.2" +name = "crossbeam-channel" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" dependencies = [ - "foreign-types-shared", + "crossbeam-utils 0.7.2", + "maybe-uninit", ] [[package]] -name = "foreign-types-shared" -version = "0.1.1" +name = "crossbeam-channel" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils 0.8.5", +] [[package]] -name = "form_urlencoded" -version = "1.0.1" +name = "crossbeam-deque" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ - "matches", - "percent-encoding", + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils 0.8.5", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils 0.8.5", + "lazy_static", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b10ddc024425c88c2ad148c1b0fd53f4c6d38db9697c9f1588381212fa657c9" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils 0.8.5", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "lazy_static", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +dependencies = [ + "cfg-if 1.0.0", + "lazy_static", +] + +[[package]] +name = "ctrlc" +version = "3.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "232295399409a8b7ae41276757b5a1cc21032848d42bff2352261f958b3ca29a" +dependencies = [ + "nix 0.20.0", + "winapi 0.3.9", +] + +[[package]] +name = "d3d12" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "091ed1b25fe47c7ff129fc440c23650b6114f36aa00bc7212cc8041879294428" +dependencies = [ + "bitflags", + "libloading 0.7.0", + "winapi 0.3.9", +] + +[[package]] +name = "darling" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dirs" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +dependencies = [ + "cfg-if 0.1.10", + "dirs-sys", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if 1.0.0", + "dirs-sys-next", +] + +[[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 0.3.9", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi 0.3.9", +] + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dlib" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" +dependencies = [ + "libloading 0.6.7", +] + +[[package]] +name = "dlib" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" +dependencies = [ + "libloading 0.7.0", +] + +[[package]] +name = "dodrio" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7593dfc68e57dc1d058ada0f151ba07f4b05183c4da4c4df8ff651a81ef0fab" +dependencies = [ + "bumpalo 2.6.0", + "cfg-if 0.1.10", + "fxhash", + "js-sys", + "longest-increasing-subsequence", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + +[[package]] +name = "drm-fourcc" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebbf3a5ed4671aabffefce172ff43d69c1f27dd2c6aea28e5212a70f32ada0cf" +dependencies = [ + "serde", +] + +[[package]] +name = "dwrote" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" +dependencies = [ + "lazy_static", + "libc", + "winapi 0.3.9", + "wio", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "encoding_rs" +version = "0.8.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "erased-serde" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0465971a8cc1fa2455c8465aaa377131e1f1cf4983280f474a13e68793aa770c" +dependencies = [ + "serde", +] + +[[package]] +name = "error-code" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5115567ac25674e0043e472be13d14e537f37ea8aa4bdc4aef0c89add1db1ff" +dependencies = [ + "libc", + "str-buf", +] + +[[package]] +name = "euclid" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da96828553a086d7b18dcebfc579bd9628b016f86590d7453c115e490fa74b80" +dependencies = [ + "num-traits", +] + +[[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 = "external-memory" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4dfe8d292b014422776a8c516862d2bff8a81b223a4461dfdc45f3862dc9d39" +dependencies = [ + "bitflags", + "drm-fourcc", +] + +[[package]] +name = "filetime" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.8", + "winapi 0.3.9", +] + +[[package]] +name = "fixedbitset" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" + +[[package]] +name = "flexi_logger" +version = "0.15.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaab3caedb4149800f91e8e4899f29cd9ddf3b569b04c365ca9334f92f7542bf" +dependencies = [ + "atty", + "chrono", + "glob", + "lazy_static", + "log", + "regex", + "thiserror", + "yansi", +] + +[[package]] +name = "float-ord" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bad48618fdb549078c333a7a8528acb57af271d0433bdecd523eb620628364e" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "font-kit" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c9a156ec38864999bc9c4156e5f3b50224d4a5578028a64e5a3875caa9ee28" +dependencies = [ + "bitflags", + "byteorder", + "core-foundation 0.9.1", + "core-graphics 0.22.2", + "core-text", + "dirs-next", + "dwrote", + "float-ord", + "freetype", + "lazy_static", + "libc", + "log", + "pathfinder_geometry", + "pathfinder_simd", + "servo-fontconfig", + "walkdir", + "winapi 0.3.9", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "freetype" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee38378a9e3db1cc693b4f88d166ae375338a0ff75cb8263e1c601d51f35dc6" +dependencies = [ + "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 = "fsevent" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" +dependencies = [ + "bitflags", + "fsevent-sys", +] + +[[package]] +name = "fsevent-sys" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" +dependencies = [ + "libc", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futures" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d5813545e459ad3ca1bff9915e9ad7f1a47dc6a91b627ce321d5863b7dd253" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce79c6a52a299137a6013061e0cf0e688fce5d7f1bc60125f520912fdb29ec25" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "098cd1c6dda6ca01650f1a37a794245eb73181d0d4d4e955e2f3c37db7af1815" + +[[package]] +name = "futures-executor" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f6cb7042eda00f0049b1d2080aa4b93442997ee507eb3828e8bd7577f94c9d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-io" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "365a1a1fb30ea1c03a830fdb2158f5236833ac81fa0ad12fe35b29cddc35cb04" + +[[package]] +name = "futures-macro" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668c6733a182cd7deb4f1de7ba3bf2120823835b3bcfbeacf7d2c4a773c1bb8b" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5629433c555de3d82861a7a4e3794a4c40040390907cfbfd7143a92a426c23" + +[[package]] +name = "futures-task" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba7aa51095076f3ba6d9a1f702f74bd05ec65f555d70d2033d55ba8d69f581bc" + +[[package]] +name = "futures-util" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c144ad54d60f23927f0a6b6d816e4271278b64f005ad65e4e35291d2de9c025" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite 0.2.6", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "gethostname" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e692e296bfac1d2533ef168d0b60ff5897b8b70a4009276834014dd8924cc028" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi", +] + +[[package]] +name = "gfx-auxil" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1694991b11d642680e82075a75c7c2bd75556b805efa7660b705689f05b1ab1c" +dependencies = [ + "fxhash", + "gfx-hal", + "spirv_cross", +] + +[[package]] +name = "gfx-backend-dx11" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f9e453baf3aaef2b0c354ce0b3d63d76402e406a59b64b7182d123cfa6635ae" +dependencies = [ + "arrayvec", + "bitflags", + "gfx-auxil", + "gfx-hal", + "gfx-renderdoc", + "libloading 0.7.0", + "log", + "parking_lot", + "range-alloc", + "raw-window-handle", + "smallvec", + "spirv_cross", + "thunderdome", + "winapi 0.3.9", + "wio", +] + +[[package]] +name = "gfx-backend-dx12" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21506399f64a3c4d389182a89a30073856ae33eb712315456b4fd8f39ee7682a" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags", + "d3d12", + "gfx-auxil", + "gfx-hal", + "gfx-renderdoc", + "log", + "parking_lot", + "range-alloc", + "raw-window-handle", + "smallvec", + "spirv_cross", + "thunderdome", + "winapi 0.3.9", +] + +[[package]] +name = "gfx-backend-empty" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c8f813c47791918aa00dc9c9ddf961d23fa8c2a5d869e6cb8ea84f944820f4" +dependencies = [ + "gfx-hal", + "log", + "raw-window-handle", +] + +[[package]] +name = "gfx-backend-gl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bae057fc3a0ab23ecf97ae51d4017d27d5ddf0aab16ee6dcb58981af88c3152" +dependencies = [ + "arrayvec", + "bitflags", + "fxhash", + "gfx-hal", + "glow", + "js-sys", + "khronos-egl", + "libloading 0.7.0", + "log", + "naga", + "parking_lot", + "raw-window-handle", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gfx-backend-metal" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de85808e2a98994c6af925253f8a9593bc57180ef1ea137deab6d35cc949517" +dependencies = [ + "arrayvec", + "bitflags", + "block", + "cocoa-foundation", + "copyless", + "core-graphics-types", + "foreign-types", + "fxhash", + "gfx-hal", + "log", + "metal", + "naga", + "objc", + "parking_lot", + "profiling", + "range-alloc", + "raw-window-handle", + "storage-map", +] + +[[package]] +name = "gfx-backend-vulkan" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9861ec855acbbc65c0e4f966d761224886e811dc2c6d413a4776e9293d0e5c0" +dependencies = [ + "arrayvec", + "ash", + "byteorder", + "core-graphics-types", + "gfx-hal", + "gfx-renderdoc", + "inplace_it", + "log", + "naga", + "objc", + "parking_lot", + "raw-window-handle", + "smallvec", + "winapi 0.3.9", ] [[package]] -name = "fsevent" -version = "0.4.0" +name = "gfx-hal" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" +checksum = "7fbb575ea793dd0507b3082f4f2cde62dc9f3cebd98f5cd49ba2a4da97a976fd" dependencies = [ "bitflags", - "fsevent-sys", + "external-memory", + "naga", + "raw-window-handle", + "thiserror", ] [[package]] -name = "fsevent-sys" -version = "2.0.1" +name = "gfx-renderdoc" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" +checksum = "c8027995e247e2426d3a00d13f5191dd56c314bff02dc4b54cbf727f1ba9c40a" dependencies = [ - "libc", + "libloading 0.7.0", + "log", + "renderdoc-sys", ] [[package]] -name = "fuchsia-zircon" -version = "0.3.3" +name = "gimli" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" + +[[package]] +name = "glam" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579160312273c954cc51bd440f059dde741029ac8daf8c84fece76cb77f62c15" dependencies = [ - "bitflags", - "fuchsia-zircon-sys", + "version_check", ] [[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" +name = "glob" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] -name = "futures-channel" -version = "0.3.14" +name = "glow" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce79c6a52a299137a6013061e0cf0e688fce5d7f1bc60125f520912fdb29ec25" +checksum = "4b80b98efaa8a34fce11d60dd2ce2760d5d83c373cbcc73bb87c2a3a84a54108" dependencies = [ - "futures-core", + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "futures-core" -version = "0.3.14" +name = "glyph_brush" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "098cd1c6dda6ca01650f1a37a794245eb73181d0d4d4e955e2f3c37db7af1815" +checksum = "3e3f00b8574a76fb6c50890c48da03946ca50e4372a2778737922666a2238221" +dependencies = [ + "glyph_brush_draw_cache", + "glyph_brush_layout", + "log", + "ordered-float", + "rustc-hash", + "twox-hash", +] [[package]] -name = "futures-io" -version = "0.3.14" +name = "glyph_brush_draw_cache" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "365a1a1fb30ea1c03a830fdb2158f5236833ac81fa0ad12fe35b29cddc35cb04" +checksum = "ac2c82074cafb68b9e459c50c655f7eedcb92d6ee7166813802934bc6fc29fa3" +dependencies = [ + "ab_glyph", + "crossbeam-channel 0.5.1", + "crossbeam-deque", + "linked-hash-map", + "rayon", + "rustc-hash", +] [[package]] -name = "futures-sink" -version = "0.3.14" +name = "glyph_brush_layout" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5629433c555de3d82861a7a4e3794a4c40040390907cfbfd7143a92a426c23" +checksum = "cc32c2334f00ca5ac3695c5009ae35da21da8c62d255b5b96d56e2597a637a38" +dependencies = [ + "ab_glyph", + "approx", + "xi-unicode", +] [[package]] -name = "futures-task" -version = "0.3.14" +name = "gpu-alloc" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba7aa51095076f3ba6d9a1f702f74bd05ec65f555d70d2033d55ba8d69f581bc" +checksum = "cbc1b6ca374e81862526786d9cb42357ce03706ed1b8761730caafd02ab91f3a" +dependencies = [ + "bitflags", + "gpu-alloc-types", +] [[package]] -name = "futures-util" -version = "0.3.14" +name = "gpu-alloc-types" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c144ad54d60f23927f0a6b6d816e4271278b64f005ad65e4e35291d2de9c025" +checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" dependencies = [ - "futures-core", - "futures-io", - "futures-task", - "memchr", - "pin-project-lite 0.2.6", - "pin-utils", - "slab", + "bitflags", ] [[package]] -name = "getrandom" -version = "0.2.2" +name = "gpu-descriptor" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +checksum = "e8a70f1e87a3840ed6a3e99e02c2b861e4dbdf26f0d07e38f42ea5aff46cfce2" dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", + "bitflags", + "gpu-descriptor-types", + "hashbrown", ] [[package]] -name = "gimli" -version = "0.23.0" +name = "gpu-descriptor-types" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" +checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126" +dependencies = [ + "bitflags", +] [[package]] -name = "glob" -version = "0.3.0" +name = "guillotiere" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +checksum = "b62d5865c036cb1393e23c50693df631d3f5d7bcca4c04fe4cc0fd592e74a782" +dependencies = [ + "euclid", + "svg_fmt", +] [[package]] name = "h2" @@ -427,6 +1361,9 @@ name = "hashbrown" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +dependencies = [ + "ahash", +] [[package]] name = "heck" @@ -516,6 +1453,125 @@ dependencies = [ "tokio-tls", ] +[[package]] +name = "iced" +version = "0.3.0" +source = "git+https://github.com/hecrj/iced?rev=45778ed598c0d202f8e86c47a444fd671fb3abce#45778ed598c0d202f8e86c47a444fd671fb3abce" +dependencies = [ + "iced_core", + "iced_futures", + "iced_web", + "iced_wgpu", + "iced_winit", + "thiserror", +] + +[[package]] +name = "iced_core" +version = "0.4.0" +source = "git+https://github.com/hecrj/iced?rev=45778ed598c0d202f8e86c47a444fd671fb3abce#45778ed598c0d202f8e86c47a444fd671fb3abce" +dependencies = [ + "bitflags", +] + +[[package]] +name = "iced_futures" +version = "0.3.0" +source = "git+https://github.com/hecrj/iced?rev=45778ed598c0d202f8e86c47a444fd671fb3abce#45778ed598c0d202f8e86c47a444fd671fb3abce" +dependencies = [ + "futures", + "log", + "wasm-bindgen-futures", +] + +[[package]] +name = "iced_graphics" +version = "0.2.0" +source = "git+https://github.com/hecrj/iced?rev=45778ed598c0d202f8e86c47a444fd671fb3abce#45778ed598c0d202f8e86c47a444fd671fb3abce" +dependencies = [ + "bytemuck", + "font-kit", + "glam", + "iced_native", + "iced_style", + "raw-window-handle", + "thiserror", +] + +[[package]] +name = "iced_native" +version = "0.4.0" +source = "git+https://github.com/hecrj/iced?rev=45778ed598c0d202f8e86c47a444fd671fb3abce#45778ed598c0d202f8e86c47a444fd671fb3abce" +dependencies = [ + "iced_core", + "iced_futures", + "num-traits", + "twox-hash", + "unicode-segmentation", +] + +[[package]] +name = "iced_style" +version = "0.3.0" +source = "git+https://github.com/hecrj/iced?rev=45778ed598c0d202f8e86c47a444fd671fb3abce#45778ed598c0d202f8e86c47a444fd671fb3abce" +dependencies = [ + "iced_core", +] + +[[package]] +name = "iced_web" +version = "0.4.0" +source = "git+https://github.com/hecrj/iced?rev=45778ed598c0d202f8e86c47a444fd671fb3abce#45778ed598c0d202f8e86c47a444fd671fb3abce" +dependencies = [ + "dodrio", + "iced_core", + "iced_futures", + "iced_style", + "num-traits", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "iced_wgpu" +version = "0.4.0" +source = "git+https://github.com/hecrj/iced?rev=45778ed598c0d202f8e86c47a444fd671fb3abce#45778ed598c0d202f8e86c47a444fd671fb3abce" +dependencies = [ + "bytemuck", + "futures", + "glyph_brush", + "guillotiere", + "iced_graphics", + "iced_native", + "log", + "raw-window-handle", + "wgpu", + "wgpu_glyph", +] + +[[package]] +name = "iced_winit" +version = "0.3.0" +source = "git+https://github.com/hecrj/iced?rev=45778ed598c0d202f8e86c47a444fd671fb3abce#45778ed598c0d202f8e86c47a444fd671fb3abce" +dependencies = [ + "iced_futures", + "iced_graphics", + "iced_native", + "log", + "thiserror", + "winapi 0.3.9", + "window_clipboard", + "winit", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.2.3" @@ -557,6 +1613,12 @@ dependencies = [ "libc", ] +[[package]] +name = "inplace_it" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90953f308a79fe6d62a4643e51f848fbfddcd05975a38e69fdf4ab86a7baf7ca" + [[package]] name = "instant" version = "0.1.9" @@ -564,6 +1626,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" dependencies = [ "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] @@ -596,6 +1661,21 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5ca711fd837261e14ec9e674f092cbb931d3fa1482b017ae59328ddc6f3212b" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.50" @@ -615,6 +1695,16 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "khronos-egl" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" +dependencies = [ + "libc", + "libloading 0.7.0", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -633,6 +1723,32 @@ version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" +[[package]] +name = "libloading" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" +dependencies = [ + "cfg-if 1.0.0", + "winapi 0.3.9", +] + +[[package]] +name = "libloading" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" +dependencies = [ + "cfg-if 1.0.0", + "winapi 0.3.9", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" + [[package]] name = "lock_api" version = "0.4.4" @@ -651,6 +1767,12 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "longest-increasing-subsequence" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3bd0dd2cd90571056fdb71f6275fada10131182f84899f4b2a916e565d81d86" + [[package]] name = "lua-src" version = "543.0.0" @@ -669,6 +1791,15 @@ dependencies = [ "cc", ] +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + [[package]] name = "matches" version = "0.1.8" @@ -687,6 +1818,47 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +[[package]] +name = "memmap2" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b70ca2a6103ac8b665dc150b142ef0e4e89df640c9e6cf295d189c3caebe5a" +dependencies = [ + "libc", +] + +[[package]] +name = "memmap2" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "723e3ebdcdc5c023db1df315364573789f8857c11b631a2fdfad7c00f5c046b4" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +dependencies = [ + "autocfg", +] + +[[package]] +name = "metal" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79d7d769f1c104b8388294d6594d491d2e21240636f5f94d37f8a0f3d7904450" +dependencies = [ + "bitflags", + "block", + "core-graphics-types", + "foreign-types", + "log", + "objc", +] + [[package]] name = "mime" version = "0.3.16" @@ -726,10 +1898,23 @@ dependencies = [ "kernel32-sys", "libc", "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", + "miow 0.2.2", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" +dependencies = [ + "libc", + "log", + "miow 0.3.7", + "ntapi", + "winapi 0.3.9", ] [[package]] @@ -740,10 +1925,22 @@ checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" dependencies = [ "lazycell", "log", - "mio", + "mio 0.6.23", "slab", ] +[[package]] +name = "mio-misc" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ddf05411bb159cdb5801bb10002afb66cb4572be656044315e363460ce69dc2" +dependencies = [ + "crossbeam", + "crossbeam-queue", + "log", + "mio 0.7.13", +] + [[package]] name = "miow" version = "0.2.2" @@ -756,6 +1953,15 @@ dependencies = [ "ws2_32-sys", ] +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "mlua" version = "0.5.4" @@ -773,6 +1979,24 @@ dependencies = [ "serde", ] +[[package]] +name = "naga" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef670817eef03d356d5a509ea275e7dd3a78ea9e24261ea3cb2dfed1abb08f64" +dependencies = [ + "bit-set", + "bitflags", + "codespan-reporting", + "fxhash", + "log", + "num-traits", + "petgraph", + "rose_tree", + "spirv_headers", + "thiserror", +] + [[package]] name = "native-tls" version = "0.2.7" @@ -791,6 +2015,51 @@ dependencies = [ "tempfile", ] +[[package]] +name = "ndk" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8794322172319b972f528bf90c6b467be0079f1fa82780ffb431088e741a73ab" +dependencies = [ + "jni-sys", + "ndk-sys", + "num_enum", + "thiserror", +] + +[[package]] +name = "ndk-glue" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5caf0c24d51ac1c905c27d4eda4fa0635bbe0de596b8f79235e0b17a4d29385" +dependencies = [ + "lazy_static", + "libc", + "log", + "ndk", + "ndk-macro", + "ndk-sys", +] + +[[package]] +name = "ndk-macro" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" +dependencies = [ + "darling", + "proc-macro-crate 0.1.5", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ndk-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c44922cb3dbb1c70b5e5f443d63b64363a898564d739ba5198e3a9138442868d" + [[package]] name = "net2" version = "0.2.37" @@ -802,6 +2071,18 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "nix" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83450fe6a6142ddd95fb064b746083fc4ef1705fe81f64a64e1d4b39f54a1055" +dependencies = [ + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc", +] + [[package]] name = "nix" version = "0.20.0" @@ -814,6 +2095,16 @@ dependencies = [ "libc", ] +[[package]] +name = "nom" +version = "6.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2" +dependencies = [ + "memchr", + "version_check", +] + [[package]] name = "notify" version = "4.0.16" @@ -826,12 +2117,21 @@ dependencies = [ "fsevent-sys", "inotify", "libc", - "mio", + "mio 0.6.23", "mio-extras", "walkdir", "winapi 0.3.9", ] +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "num-derive" version = "0.3.3" @@ -872,6 +2172,67 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2c8fd66061a707503d515639b8af10fd3807a5b5ee6959f7ff1bd303634bd5" +dependencies = [ + "derivative", + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "474fd1d096da3ad17084694eebed40ba09c4a36c5255cd772bd8b98859cc562e" +dependencies = [ + "proc-macro-crate 1.0.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", + "objc_exception", +] + +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", +] + +[[package]] +name = "objc_exception" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +dependencies = [ + "cc", +] + +[[package]] +name = "objc_id" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +dependencies = [ + "objc", +] + [[package]] name = "object" version = "0.23.0" @@ -917,6 +2278,33 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-float" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "039f02eb0f69271f26abe3202189275d7aa2258b903cb0281b5de710a2570ff3" +dependencies = [ + "num-traits", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f923fb806c46266c02ab4a5b239735c144bdeda724a50ed058e5226f594cde3" +dependencies = [ + "ttf-parser 0.6.2", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60ac8dda2e5cc09bf6480e3b3feff9783db251710c922ae9369a429c51efdeb0" +dependencies = [ + "ttf-parser 0.12.3", +] + [[package]] name = "parking_lot" version = "0.11.1" @@ -945,12 +2333,40 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "pathfinder_geometry" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b7e7b4ea703700ce73ebf128e1450eb69c3a8329199ffbfb9b2a0418e5ad3" +dependencies = [ + "log", + "pathfinder_simd", +] + +[[package]] +name = "pathfinder_simd" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39fe46acc5503595e5949c17b818714d26fdf9b4920eacf3b2947f0199f4a6ff" +dependencies = [ + "rustc_version", +] + [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + [[package]] name = "petgraph" version = "0.5.1" @@ -1011,6 +2427,37 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro-crate" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fdbd1df62156fbc5945f4762632564d7d038153091c3fcf1067f6aef7cff92" +dependencies = [ + "thiserror", + "toml", +] + +[[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.26" @@ -1020,6 +2467,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "profiling" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87dfd5592a8eed7e74f56ad7b125f8234763b805c30f0c7c95c486920026a6ec" + [[package]] name = "quote" version = "1.0.9" @@ -1069,6 +2522,46 @@ dependencies = [ "rand_core", ] +[[package]] +name = "range-alloc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6" + +[[package]] +name = "raw-window-handle" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a441a7a6c80ad6473bd4b74ec1c9a4c951794285bf941c2126f607c72e48211" +dependencies = [ + "libc", +] + +[[package]] +name = "rayon" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +dependencies = [ + "crossbeam-channel 0.5.1", + "crossbeam-deque", + "crossbeam-utils 0.8.5", + "lazy_static", + "num_cpus", +] + [[package]] name = "redox_syscall" version = "0.1.57" @@ -1120,6 +2613,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "renderdoc-sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157" + [[package]] name = "reqwest" version = "0.10.10" @@ -1156,12 +2655,46 @@ dependencies = [ "winreg", ] +[[package]] +name = "rose_tree" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284de9dae38774e2813aaabd7e947b4a6fe9b8c58c2309f754a487cdd50de1c2" +dependencies = [ + "petgraph", +] + [[package]] name = "rustc-demangle" version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "410f7acf3cb3a44527c5d9546bad4bf4e6c460915d5f9f2fc524498bfe8f70ce" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver", +] + +[[package]] +name = "rusttype" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc7c727aded0be18c5b80c1640eae0ac8e396abf6fa8477d96cb37d18ee5ec59" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser 0.6.0", +] + [[package]] name = "ryu" version = "1.0.5" @@ -1187,6 +2720,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + [[package]] name = "scopeguard" version = "1.1.0" @@ -1200,8 +2739,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3670b1d2fdf6084d192bc71ead7aabe6c06aa2ea3fbd9cc3ac111fa5c2b1bd84" dependencies = [ "bitflags", - "core-foundation", - "core-foundation-sys", + "core-foundation 0.9.1", + "core-foundation-sys 0.8.2", "libc", "security-framework-sys", ] @@ -1212,15 +2751,47 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3676258fd3cfe2c9a0ec99ce3038798d847ce3e4bb17746373eb9f0f1ac16339" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.2", "libc", ] +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + [[package]] name = "serde" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "serde_json" @@ -1245,18 +2816,91 @@ dependencies = [ "serde", ] +[[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 = "slab" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" +[[package]] +name = "slotmap" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61b40583e0c1bd3100652ba8940939decc8808e7b2a07f4f4606c6a8a40035a" + [[package]] name = "smallvec" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +[[package]] +name = "smithay-client-toolkit" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4750c76fd5d3ac95fa3ed80fe667d6a3d8590a960e5b575b98eea93339a80b80" +dependencies = [ + "andrew", + "bitflags", + "calloop", + "dlib 0.4.2", + "lazy_static", + "log", + "memmap2 0.1.0", + "nix 0.18.0", + "wayland-client", + "wayland-cursor", + "wayland-protocols", +] + +[[package]] +name = "smithay-client-toolkit" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec783683499a2cfc85b6df3d04f83b1907b5cbd98a1aed44667dbdf1eac4e64c" +dependencies = [ + "bitflags", + "dlib 0.5.0", + "lazy_static", + "log", + "memmap2 0.2.3", + "nix 0.20.0", + "wayland-client", + "wayland-cursor", + "wayland-protocols", +] + +[[package]] +name = "smithay-clipboard" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "986c5b4a7bd4f50d4c51f81f844745535cb488360f9cf63293780b109b9295f3" +dependencies = [ + "smithay-client-toolkit 0.14.0", + "wayland-client", +] + [[package]] name = "socket2" version = "0.3.19" @@ -1268,6 +2912,54 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "spirv_cross" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60647fadbf83c4a72f0d7ea67a7ca3a81835cf442b8deae5c134c3e0055b2e14" +dependencies = [ + "cc", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "spirv_headers" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f5b132530b1ac069df335577e3581765995cba5a13995cdbbdbc8fb057c532c" +dependencies = [ + "bitflags", + "num-traits", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "storage-map" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418bb14643aa55a7841d5303f72cf512cfb323b8cc221d51580500a1ca75206c" +dependencies = [ + "lock_api", +] + +[[package]] +name = "str-buf" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d44a3643b4ff9caf57abcee9c2c621d6c03d9135e0d8b589bd9afb5992cb176a" + +[[package]] +name = "strsim" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" + [[package]] name = "strum" version = "0.18.0" @@ -1286,6 +2978,12 @@ dependencies = [ "syn", ] +[[package]] +name = "svg_fmt" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fb1df15f412ee2e9dfc1c504260fa695c1c3f10fe9f4a6ee2d2184d7d6450e2" + [[package]] name = "syn" version = "1.0.72" @@ -1311,6 +3009,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "termcolor" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.24" @@ -1342,6 +3049,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "thunderdome" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87b4947742c93ece24a0032141d9caa3d853752e694a57e35029dd2bd08673e0" + [[package]] name = "time" version = "0.1.43" @@ -1379,7 +3092,7 @@ dependencies = [ "iovec", "lazy_static", "memchr", - "mio", + "mio 0.6.23", "num_cpus", "pin-project-lite 0.1.12", "slab", @@ -1409,6 +3122,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + [[package]] name = "tower-service" version = "0.3.1" @@ -1452,17 +3174,30 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +[[package]] +name = "ttf-parser" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e5d7cd7ab3e47dda6e56542f4bbf3824c15234958c6e1bd6aaa347e93499fdc" + +[[package]] +name = "ttf-parser" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ae2f58a822f08abdaf668897e96a5656fe72f5a9ce66422423e8849384872e6" + [[package]] name = "twm" version = "0.13.0" dependencies = [ "bitflags", "chrono", - "crossbeam-channel", + "crossbeam-channel 0.4.4", "ctrlc", "derivative", "dirs", "flexi_logger", + "iced", "itertools", "lazy_static", "log", @@ -1483,6 +3218,23 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "twox-hash" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f559b464de2e2bdabcac6a210d12e9b5a5973c251e102c44c585c71d51bd78e" +dependencies = [ + "cfg-if 0.1.10", + "rand", + "static_assertions", +] + +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + [[package]] name = "unicase" version = "2.6.0" @@ -1516,6 +3268,12 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +[[package]] +name = "unicode-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + [[package]] name = "unicode-xid" version = "0.2.2" @@ -1591,7 +3349,7 @@ version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae70622411ca953215ca6d06d3ebeb1e915f0f6613e3b495122878d7ebec7dae" dependencies = [ - "bumpalo", + "bumpalo 3.6.1", "lazy_static", "log", "proc-macro2", @@ -1641,6 +3399,79 @@ version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9a543ae66aa233d14bb765ed9af4a33e81b8b58d1584cf1b47ff8cd0b9e4489" +[[package]] +name = "wayland-client" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ab332350e502f159382201394a78e3cc12d0f04db863429260164ea40e0355" +dependencies = [ + "bitflags", + "downcast-rs", + "libc", + "nix 0.20.0", + "scoped-tls", + "wayland-commons", + "wayland-scanner", + "wayland-sys", +] + +[[package]] +name = "wayland-commons" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21817947c7011bbd0a27e11b17b337bfd022e8544b071a2641232047966fbda" +dependencies = [ + "nix 0.20.0", + "once_cell", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-cursor" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be610084edd1586d45e7bdd275fe345c7c1873598caa464c4fb835dee70fa65a" +dependencies = [ + "nix 0.20.0", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "286620ea4d803bacf61fa087a4242ee316693099ee5a140796aaba02b29f861f" +dependencies = [ + "bitflags", + "wayland-client", + "wayland-commons", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce923eb2deb61de332d1f356ec7b6bf37094dc5573952e1c8936db03b54c03f1" +dependencies = [ + "proc-macro2", + "quote", + "xml-rs", +] + +[[package]] +name = "wayland-sys" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d841fca9aed7febf9bed2e9796c49bf58d4152ceda8ac949ebe00868d8f0feb8" +dependencies = [ + "dlib 0.5.0", + "lazy_static", + "pkg-config", +] + [[package]] name = "web-sys" version = "0.3.50" @@ -1651,6 +3482,77 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "wgpu" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd247f8b26fd3d42ef2f320d378025cd6e84d782ef749fab45cc3b981fbe3275" +dependencies = [ + "arrayvec", + "js-sys", + "log", + "naga", + "parking_lot", + "raw-window-handle", + "smallvec", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "958a8a5e418492723ab4e7933bf6dbdf06f5dc87274ba2ae0e4f9c891aac579c" +dependencies = [ + "arrayvec", + "bitflags", + "cfg_aliases", + "copyless", + "fxhash", + "gfx-backend-dx11", + "gfx-backend-dx12", + "gfx-backend-empty", + "gfx-backend-gl", + "gfx-backend-metal", + "gfx-backend-vulkan", + "gfx-hal", + "gpu-alloc", + "gpu-descriptor", + "log", + "naga", + "parking_lot", + "profiling", + "raw-window-handle", + "smallvec", + "thiserror", + "wgpu-types", +] + +[[package]] +name = "wgpu-types" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f5c9678cd533558e28b416d66947b099742df1939307478db54f867137f1b60" +dependencies = [ + "bitflags", +] + +[[package]] +name = "wgpu_glyph" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fee8c96eda18195a7ad9989737183e0a357f14b15e98838c76abbcf56a5f970" +dependencies = [ + "bytemuck", + "glyph_brush", + "log", + "wgpu", +] + [[package]] name = "winapi" version = "0.2.8" @@ -1688,12 +3590,66 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "winapi-wsapoll" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e" +dependencies = [ + "winapi 0.3.9", +] + [[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 = "window_clipboard" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33a4518b538a45ad39d138a8c3bea8f6b4452174aeb38143d1dd643a3a838ccc" +dependencies = [ + "clipboard-win", + "clipboard_macos", + "clipboard_wayland", + "clipboard_x11", + "raw-window-handle", +] + +[[package]] +name = "winit" +version = "0.25.0" +source = "git+https://github.com/iced-rs/winit?rev=844485272a7412cb35cdbfac3524decdf59475ca#844485272a7412cb35cdbfac3524decdf59475ca" +dependencies = [ + "bitflags", + "cocoa", + "core-foundation 0.9.1", + "core-graphics 0.22.2", + "core-video-sys", + "dispatch", + "instant", + "lazy_static", + "libc", + "log", + "mio 0.7.13", + "mio-misc", + "ndk", + "ndk-glue", + "ndk-sys", + "objc", + "parking_lot", + "percent-encoding", + "raw-window-handle", + "smithay-client-toolkit 0.12.3", + "wasm-bindgen", + "wayland-client", + "web-sys", + "winapi 0.3.9", + "x11-dl", +] + [[package]] name = "winreg" version = "0.7.0" @@ -1703,6 +3659,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "wio" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -1713,6 +3678,57 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "x11-dl" +version = "2.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf981e3a5b3301209754218f962052d4d9ee97e478f4d26d4a6eced34c1fef8" +dependencies = [ + "lazy_static", + "libc", + "maybe-uninit", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ffb080b3f2f616242a4eb8e7d325035312127901025b0052bc3154a282d0f19" +dependencies = [ + "gethostname", + "nix 0.20.0", + "winapi 0.3.9", + "winapi-wsapoll", +] + +[[package]] +name = "xcursor" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a9a231574ae78801646617cefd13bfe94be907c0e4fa979cfd8b770aa3c5d08" +dependencies = [ + "nom", +] + +[[package]] +name = "xdg" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" + +[[package]] +name = "xi-unicode" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a" + +[[package]] +name = "xml-rs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" + [[package]] name = "yansi" version = "0.5.0" diff --git a/twm/Cargo.toml b/twm/Cargo.toml index a5b84f66..e526a9a4 100644 --- a/twm/Cargo.toml +++ b/twm/Cargo.toml @@ -16,6 +16,7 @@ derivative = "2.1.1" log = "0.4" syn = "1.0.38" flexi_logger = "0.15" +iced = { git = "https://github.com/hecrj/iced", rev = "45778ed598c0d202f8e86c47a444fd671fb3abce" } reqwest = { version = "0.10", features = ["blocking", "json"] } winapi = { version = "0.3", features = ["winuser", "errhandlingapi", "impl-default", "shellapi", "windowsx", "shellscalingapi", "processthreadsapi", "psapi"] } serde = "1.0" diff --git a/twm/src/main.rs b/twm/src/main.rs index 23a3d4e0..8c7c1fb3 100644 --- a/twm/src/main.rs +++ b/twm/src/main.rs @@ -1097,6 +1097,8 @@ fn run(state_arc: Arc>) -> Result<(), Box config::hot_reloading::start(state_arc.clone()); } + popup::test(); + startup::set_launch_on_startup(state_arc.lock().config.launch_on_startup); os_specific_setup(state_arc.clone()); diff --git a/twm/src/popup.rs b/twm/src/popup.rs index 1809a1fd..66e7f78d 100644 --- a/twm/src/popup.rs +++ b/twm/src/popup.rs @@ -153,3 +153,65 @@ pub fn close() -> SystemResult { pub fn is_visible() -> bool { POPUP.lock().is_some() } + +use iced::{Application, Clipboard, Command, Element, Column, Text, Align, Settings, window}; + +#[derive(Clone, Debug)] +pub enum PopupMessage { +} + +pub struct IcedPopup(Vec); + +impl Application for IcedPopup { + type Executor = iced::executor::Default; + type Message = PopupMessage; + type Flags = Vec; + + fn new(flags: Self::Flags) -> (Self, Command) { + (Self(flags), Command::none()) + } + + fn title(&self) -> String { + String::from(NOG_POPUP_NAME) + } + + fn update(&mut self, message: Self::Message, _: &mut Clipboard) -> Command { + Command::none() + } + + fn view(&mut self) -> Element { + let mut col = Column::new() + .padding(10) + .align_items(Align::Center); + + for line in &self.0 { + col = col.push(Text::new(line.clone())); + } + + col.into() + } +} + +pub fn test() { + let lines = vec![ + "Hello World 1", + "Hello World 2", + "Hello World 3", + ].iter().map(|x| x.to_string()).collect::>(); + let font_size = 20; + let height = lines.len() * font_size; + + IcedPopup::run(Settings { + window: window::Settings { + position: window::Position::Centered, + size: (200, height as u32), + decorations: false, + resizable: false, + always_on_top: true, + ..Default::default() + }, + flags: lines, + default_text_size: font_size as u16, + ..Default::default() + }); +} From 9d828f9cc391a97bf7380ec6c8c0b948e36a01d8 Mon Sep 17 00:00:00 2001 From: TimUntersberger Date: Fri, 13 Aug 2021 12:34:06 +0200 Subject: [PATCH 2/2] wip --- twm/src/bar.rs | 7 +- twm/src/config/rule.rs | 18 +- twm/src/event.rs | 8 +- twm/src/event_handler/winevent.rs | 21 +- twm/src/event_handler/winevent/show.rs | 17 +- twm/src/keybindings.rs | 22 +- twm/src/keybindings/key.rs | 6 +- twm/src/keyboardhook.rs | 7 +- twm/src/logging.rs | 5 +- twm/src/lua/conversions.rs | 16 +- twm/src/lua/mod.rs | 354 +++++++----- twm/src/lua/runtime.rs | 10 +- twm/src/main.rs | 41 +- twm/src/pinned.rs | 578 ++++++++++---------- twm/src/popup.rs | 201 +++---- twm/src/tile_grid.rs | 13 +- twm/src/tile_grid/store.rs | 73 +-- twm/src/util.rs | 16 +- twm/src/win_event_handler/win_event_type.rs | 3 +- twm/src/window.rs | 16 +- 20 files changed, 761 insertions(+), 671 deletions(-) diff --git a/twm/src/bar.rs b/twm/src/bar.rs index d99dda7f..83c1e372 100644 --- a/twm/src/bar.rs +++ b/twm/src/bar.rs @@ -1,8 +1,8 @@ use std::sync::Arc; use crate::{system::DisplayId, window::Window, AppState}; +use crate::{SystemError, SystemResult}; use item::Item; -use crate::{SystemResult, SystemError}; use item_section::ItemSection; use parking_lot::Mutex; @@ -46,7 +46,7 @@ impl Bar { None } - + pub fn change_height(&self, height: i32) -> SystemResult { let nwin = self.window.get_native_window(); let mut rect = nwin.get_rect()?; @@ -57,7 +57,8 @@ impl Bar { rect.top = rect.bottom - height; } - nwin.set_window_pos(rect, None, None).map_err(|e| SystemError::Unknown(e)) + nwin.set_window_pos(rect, None, None) + .map_err(|e| SystemError::Unknown(e)) } } diff --git a/twm/src/config/rule.rs b/twm/src/config/rule.rs index a0543f80..91d260e3 100644 --- a/twm/src/config/rule.rs +++ b/twm/src/config/rule.rs @@ -14,12 +14,16 @@ pub enum Action { impl std::fmt::Display for Action { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { - write!(f, "{}", match self { - Self::Manage => "manage", - Self::Pin=> "pin", - Self::Validate => "validate", - Self::Ignore => "ignore", - }) + write!( + f, + "{}", + match self { + Self::Manage => "manage", + Self::Pin => "pin", + Self::Validate => "validate", + Self::Ignore => "ignore", + } + ) } } @@ -31,7 +35,7 @@ impl std::str::FromStr for Action { "pin" => Self::Pin, "validate" => Self::Validate, "ignore" => Self::Ignore, - x => return Err(format!("{} is not a valid action for a rule", x)) + x => return Err(format!("{} is not a valid action for a rule", x)), }) } } diff --git a/twm/src/event.rs b/twm/src/event.rs index ebc4587b..2f3f8e03 100644 --- a/twm/src/event.rs +++ b/twm/src/event.rs @@ -1,6 +1,6 @@ use crate::{ - keyboardhook::InputEvent, bar::item_section::ItemSection, keybindings::keybinding::Keybinding, popup::Popup, - system::DisplayId, win_event_handler::win_event::WinEvent, + bar::item_section::ItemSection, keybindings::keybinding::Keybinding, keyboardhook::InputEvent, + popup::Popup, system::DisplayId, win_event_handler::win_event::WinEvent, }; use crossbeam_channel::unbounded; use crossbeam_channel::Receiver; @@ -14,9 +14,7 @@ pub enum Event { NewPopup(Popup), UpdateKeybindings, LuaRuntimeError(LuaError), - CallCallback { - idx: usize - }, + CallCallback { idx: usize }, ToggleAppbar(DisplayId), UpdateBarSections(DisplayId, ItemSection, ItemSection, ItemSection), ChangeWorkspace(i32, bool), diff --git a/twm/src/event_handler/winevent.rs b/twm/src/event_handler/winevent.rs index d45c7039..3cadc665 100644 --- a/twm/src/event_handler/winevent.rs +++ b/twm/src/event_handler/winevent.rs @@ -24,16 +24,17 @@ pub fn handle(state: &mut AppState, ev: WinEvent) -> SystemResult { } // checking pinned of each grid - grids.iter() - .map(|g| g.id) - .collect::>() - .iter() - .for_each(|g_id| { + grids + .iter() + .map(|g| g.id) + .collect::>() + .iter() + .for_each(|g_id| { if let Some(window) = state.pinned.get(&ev.window.id.into(), Some(*g_id)) { title = Some(window.title.clone()); grid_id = Some(*g_id); } - }); + }); // checking global pinned if let Some(window) = state.pinned.get(&ev.window.id.into(), None) { @@ -41,7 +42,8 @@ pub fn handle(state: &mut AppState, ev: WinEvent) -> SystemResult { } // window is not already managed and the event isn't `Show` - if title.is_none() && ev.typ != WinEventType::Show(false) && ev.typ != WinEventType::Show(true) { + if title.is_none() && ev.typ != WinEventType::Show(false) && ev.typ != WinEventType::Show(true) + { return Ok(()); } @@ -70,9 +72,8 @@ pub fn handle(state: &mut AppState, ev: WinEvent) -> SystemResult { win.cleanup()?; state.get_current_display().refresh_grid(&state.config)?; } - }, - WinEventType::Hide - | WinEventType::Unminimize => {} + } + WinEventType::Hide | WinEventType::Unminimize => {} }; Ok(()) diff --git a/twm/src/event_handler/winevent/show.rs b/twm/src/event_handler/winevent/show.rs index 9bd0bdaf..5e69bc0a 100644 --- a/twm/src/event_handler/winevent/show.rs +++ b/twm/src/event_handler/winevent/show.rs @@ -1,5 +1,5 @@ -use crate::{system::NativeWindow, system::SystemResult, AppState}; use crate::config::rule::Action as RuleAction; +use crate::{system::NativeWindow, system::SystemResult, AppState}; use log::{debug, error}; pub fn handle(state: &mut AppState, mut window: NativeWindow, force: bool) -> SystemResult { @@ -33,15 +33,22 @@ pub fn handle(state: &mut AppState, mut window: NativeWindow, force: bool) -> Sy let parent = window.get_parent_window(); let rule = window.rule.clone().unwrap_or_default(); let is_window_pinned = state.pinned.is_pinned(&window.id.into()); - let should_manage = force || rule.action == RuleAction::Manage || rule.action == RuleAction::Pin || - (rule.action == RuleAction::Validate && !too_small - && parent.is_err() && window.should_manage() && grid_allows_managing); + let should_manage = force + || rule.action == RuleAction::Manage + || rule.action == RuleAction::Pin + || (rule.action == RuleAction::Validate + && !too_small + && parent.is_err() + && window.should_manage() + && grid_allows_managing); if should_manage && !is_window_pinned { if rule.action == RuleAction::Pin { if state.pinned.can_pin(&window) { let additional_rules = state.additonal_rules.clone(); - state.pinned.pin_window(window, None, &config, &additional_rules)?; + state + .pinned + .pin_window(window, None, &config, &additional_rules)?; state.pinned.store(None); } } else { diff --git a/twm/src/keybindings.rs b/twm/src/keybindings.rs index 73e1b290..55ec0b49 100644 --- a/twm/src/keybindings.rs +++ b/twm/src/keybindings.rs @@ -1,11 +1,19 @@ -use crate::{keyboardhook::{self, InputEvent}, config::Config, event::Event, popup::Popup, system, system::api, AppState}; +use crate::{ + config::Config, + event::Event, + keyboardhook::{self, InputEvent}, + popup::Popup, + system, + system::api, + AppState, +}; use key::Key; use keybinding::Keybinding; use log::{debug, error, info}; use modifier::Modifier; -use std::collections::HashMap; use num_traits::FromPrimitive; use parking_lot::Mutex; +use std::collections::HashMap; use std::{ fmt::Debug, sync::atomic::{AtomicBool, Ordering}, @@ -50,7 +58,15 @@ pub fn listen(state_arc: Arc>) -> Sender { } } - if let InputEvent::KeyDown { key_code, shift, ctrl, win, lalt, ralt } = ev { + if let InputEvent::KeyDown { + key_code, + shift, + ctrl, + win, + lalt, + ralt, + } = ev + { let mut modifiers = Modifier::empty(); if ctrl { diff --git a/twm/src/keybindings/key.rs b/twm/src/keybindings/key.rs index ebc13a7c..4cd8ab0b 100644 --- a/twm/src/keybindings/key.rs +++ b/twm/src/keybindings/key.rs @@ -1,7 +1,9 @@ -use strum_macros::{EnumString, Display, AsRefStr}; +use strum_macros::{AsRefStr, Display, EnumString}; use winapi::um::winuser::*; -#[derive(Clone, Copy, FromPrimitive, ToPrimitive, PartialEq, EnumString, AsRefStr, Display, Debug)] +#[derive( + Clone, Copy, FromPrimitive, ToPrimitive, PartialEq, EnumString, AsRefStr, Display, Debug, +)] #[allow(dead_code)] pub enum Key { Enter = 0x0D, diff --git a/twm/src/keyboardhook.rs b/twm/src/keyboardhook.rs index 231791f0..daac82b2 100644 --- a/twm/src/keyboardhook.rs +++ b/twm/src/keyboardhook.rs @@ -1,9 +1,9 @@ use winapi::shared::minwindef::LRESULT; use winapi::shared::windef::HHOOK; use winapi::um::winuser::{ - CallNextHookEx, DispatchMessageW, PeekMessageW, UnhookWindowsHookEx, SetWindowsHookExW, TranslateMessage, - KBDLLHOOKSTRUCT, MSG, PM_REMOVE, WH_KEYBOARD_LL, WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, - WM_SYSKEYUP, + CallNextHookEx, DispatchMessageW, PeekMessageW, SetWindowsHookExW, TranslateMessage, + UnhookWindowsHookEx, KBDLLHOOKSTRUCT, MSG, PM_REMOVE, WH_KEYBOARD_LL, WM_KEYDOWN, WM_KEYUP, + WM_SYSKEYDOWN, WM_SYSKEYUP, }; use std::sync::mpsc::{channel, Receiver, RecvError, Sender}; @@ -193,7 +193,6 @@ unsafe extern "system" fn hook_cb(ncode: i32, wparam: usize, lparam: isize) -> L } } } - } CallNextHookEx(std::ptr::null_mut(), ncode, wparam, lparam) } diff --git a/twm/src/logging.rs b/twm/src/logging.rs index 08adc681..c27fdc63 100644 --- a/twm/src/logging.rs +++ b/twm/src/logging.rs @@ -34,9 +34,8 @@ pub fn setup() -> Result<(), Box> { { logger = logger.log_to_file(); } - - logger.start() - .expect("Failed to initialize logger"); + + logger.start().expect("Failed to initialize logger"); Ok(()) } diff --git a/twm/src/lua/conversions.rs b/twm/src/lua/conversions.rs index 9399a776..b7e2137a 100644 --- a/twm/src/lua/conversions.rs +++ b/twm/src/lua/conversions.rs @@ -2,8 +2,9 @@ use mlua::{Error as LuaError, FromLua, Table, ToLua, Value}; use crate::{ bar::component::Component, config::rule::Action as RuleAction, - keybindings::keybinding::Keybinding, split_direction::SplitDirection, -keybindings::keybinding::KeybindingKind}; + keybindings::keybinding::Keybinding, keybindings::keybinding::KeybindingKind, + split_direction::SplitDirection, +}; use crate::{bar::component::ComponentText, direction::Direction, system::SystemError}; use std::str::FromStr; @@ -19,7 +20,9 @@ impl FromLua<'_> for Direction { fn from_lua(lua_value: mlua::Value<'_>, lua: &'_ mlua::Lua) -> mlua::Result { let mut raw_direction = String::from_lua(lua_value, lua)?.to_lowercase(); - raw_direction.get_mut(0..1).map(|s| s.make_ascii_uppercase()); + raw_direction + .get_mut(0..1) + .map(|s| s.make_ascii_uppercase()); Ok(Direction::from_str(&raw_direction).unwrap_or(Direction::Right)) } @@ -39,7 +42,9 @@ impl FromLua<'_> for SplitDirection { fn from_lua(lua_value: mlua::Value<'_>, lua: &'_ mlua::Lua) -> mlua::Result { let mut raw_direction = String::from_lua(lua_value, lua)?.to_lowercase(); - raw_direction.get_mut(0..1).map(|s| s.make_ascii_uppercase()); + raw_direction + .get_mut(0..1) + .map(|s| s.make_ascii_uppercase()); Ok(SplitDirection::from_str(&raw_direction).unwrap_or(SplitDirection::Horizontal)) } @@ -60,7 +65,8 @@ impl ToLua<'_> for Keybinding { impl FromLua<'_> for Keybinding { fn from_lua(lua_value: Value<'_>, lua: &'_ mlua::Lua) -> mlua::Result { let tbl = Table::from_lua(lua_value, lua)?; - let mut kb = Keybinding::from_str(&tbl.get::<_, String>("key")?).map_err(|e| LuaError::RuntimeError(e.to_string()))?; + let mut kb = Keybinding::from_str(&tbl.get::<_, String>("key")?) + .map_err(|e| LuaError::RuntimeError(e.to_string()))?; kb.callback_id = tbl.get::<_, usize>("callback_id")?; diff --git a/twm/src/lua/mod.rs b/twm/src/lua/mod.rs index e3a9b1ad..fb8d0080 100644 --- a/twm/src/lua/mod.rs +++ b/twm/src/lua/mod.rs @@ -1,7 +1,7 @@ use std::{str::FromStr, sync::Arc}; use chrono::Local; -use mlua::{Error as LuaError, FromLua, Function, Lua, Table, Value, Result as RuntimeResult}; +use mlua::{Error as LuaError, FromLua, Function, Lua, Result as RuntimeResult, Table, Value}; use parking_lot::Mutex; use regex::Regex; @@ -10,10 +10,10 @@ use log::{info, warn}; use crate::{ bar::component::Component, config::bar_config::BarComponentsConfig, config::rule::Rule, config::workspace_setting::WorkspaceSetting, config::Config, direction::Direction, - event::Event, get_config_path, keybindings::keybinding::Keybinding, - keybindings::keybinding::KeybindingKind, split_direction::SplitDirection, system, + event::Event, get_config_path, get_runtime_path, keybindings::keybinding::Keybinding, + keybindings::keybinding::KeybindingKind, popup::Popup, split_direction::SplitDirection, system, system::DisplayId, system::WindowId, AppState, -get_runtime_path, popup::Popup}; +}; mod conversions; mod runtime; @@ -334,7 +334,7 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { prefix, key, value, - is_setup + is_setup, ): ( Value, Value, @@ -360,7 +360,7 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { /// set_prop!(bar, "height", i32) /// /// When given a function as third/fourth argument and not in setup it calls the - /// function like this: + /// function like this: /// /// f(old, new, state_arc) /// @@ -399,30 +399,38 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { } match parts.as_slice() { ["nog", "config"] => match key.as_str() { - "launch_on_startup" => set_prop!(launch_on_startup, bool, |old, new, _| -> RuntimeResult<()> { - if old != new { - crate::startup::set_launch_on_startup(new); - } + "launch_on_startup" => set_prop!( + launch_on_startup, + bool, + |old, new, _| -> RuntimeResult<()> { + if old != new { + crate::startup::set_launch_on_startup(new); + } - Ok(()) - }), + Ok(()) + } + ), "enable_hot_reloading" => set_prop!(enable_hot_reloading, bool), "min_height" => set_prop!(min_height, i32), "min_width" => set_prop!(min_width, i32), - "use_border" => set_prop!(use_border, bool, |old, new, _| -> RuntimeResult<()> { - if old != new && state.work_mode { - state.each_window(|w| { - if new { - w.add_border() - } else { - w.remove_border() - } - }).unwrap(); - - state.redraw()?; - } - Ok(()) - }), + "use_border" => { + set_prop!(use_border, bool, |old, new, _| -> RuntimeResult<()> { + if old != new && state.work_mode { + state + .each_window(|w| { + if new { + w.add_border() + } else { + w.remove_border() + } + }) + .unwrap(); + + state.redraw()?; + } + Ok(()) + }) + } "outer_gap" => set_prop!(outer_gap, i32, |old, new, _| -> RuntimeResult<()> { if old != new && state.work_mode { state.redraw()?; @@ -435,76 +443,90 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { } Ok(()) }), - "remove_title_bar" => set_prop!(remove_title_bar, bool, |old, new, _| -> RuntimeResult<()> { - if old != new && state.work_mode { - state.each_window(|w| { - if new { - w.remove_title_bar() - } else { - w.add_title_bar() - } - }).unwrap(); - - state.redraw()?; - } - Ok(()) - }), + "remove_title_bar" => { + set_prop!(remove_title_bar, bool, |old, new, _| -> RuntimeResult<()> { + if old != new && state.work_mode { + state + .each_window(|w| { + if new { + w.remove_title_bar() + } else { + w.add_title_bar() + } + }) + .unwrap(); + + state.redraw()?; + } + Ok(()) + }) + } "work_mode" => set_prop!(work_mode, bool), "light_theme" => set_prop!(light_theme, bool), - "multi_monitor" => set_prop!(multi_monitor, bool, |old, new: bool, state_arc: Arc>| -> RuntimeResult<()> { - if old != new && state.work_mode { - let display_app_bar = state.config.display_app_bar; - let remove_task_bar = state.config.remove_task_bar; - - if !new { - for mut d in std::mem::replace(&mut state.displays, vec![]) { - if !d.is_primary() { - d.cleanup(remove_task_bar)?; - } else { - state.displays.push(d); + "multi_monitor" => set_prop!( + multi_monitor, + bool, + |old, new: bool, state_arc: Arc>| -> RuntimeResult<()> { + if old != new && state.work_mode { + let display_app_bar = state.config.display_app_bar; + let remove_task_bar = state.config.remove_task_bar; + + if !new { + for mut d in std::mem::replace(&mut state.displays, vec![]) { + if !d.is_primary() { + d.cleanup(remove_task_bar)?; + } else { + state.displays.push(d); + } } } - } - if new { - for d in crate::display::init(&state.config) { - if !d.is_primary() { - state.displays.push(d); + if new { + for d in crate::display::init(&state.config) { + if !d.is_primary() { + state.displays.push(d); + } + } + if remove_task_bar { + state.show_taskbars(); + } + drop(state); + if display_app_bar { + AppState::close_app_bars(state_arc.clone()); + AppState::create_app_bars(state_arc.clone()); } - } - if remove_task_bar { - state.show_taskbars(); - } - drop(state); - if display_app_bar { - AppState::close_app_bars(state_arc.clone()); - AppState::create_app_bars(state_arc.clone()); } } + Ok(()) } - Ok(()) - }), - "remove_task_bar" => set_prop!(remove_task_bar, bool, |old, new, _| -> RuntimeResult<()> { - if state.work_mode { - match (old, new) { - (false, true) => state.hide_taskbars(), - (true, false) => state.show_taskbars(), - _ => {} + ), + "remove_task_bar" => { + set_prop!(remove_task_bar, bool, |old, new, _| -> RuntimeResult<()> { + if state.work_mode { + match (old, new) { + (false, true) => state.hide_taskbars(), + (true, false) => state.show_taskbars(), + _ => {} + } } - } - Ok(()) - }), - "display_app_bar" => set_prop!(display_app_bar, bool, move |old, new, state_arc| -> RuntimeResult<()> { - if state.work_mode { - drop(state); - match (old, new) { - (false, true) => AppState::create_app_bars(state_arc), - (true, false) => AppState::close_app_bars(state_arc), - _ => {} + Ok(()) + }) + } + "display_app_bar" => set_prop!( + display_app_bar, + bool, + move |old, new, state_arc| -> RuntimeResult<()> { + if state.work_mode { + drop(state); + match (old, new) { + (false, true) => AppState::create_app_bars(state_arc), + (true, false) => AppState::close_app_bars(state_arc), + _ => {} + } } + Ok(()) } - Ok(()) - }), + ), "ignore_fullscreen_actions" => set_prop!(ignore_fullscreen_actions, bool), "allow_right_alt" => set_prop!(allow_right_alt, bool), "workspaces" => { @@ -532,7 +554,7 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { x => { warn!("Unknown config key {}", x); Ok(()) - }, + } }, ["nog", "config", "bar"] => match key.as_str() { "color" => set_prop!(bar, color, i32), @@ -557,11 +579,11 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { x => { warn!("Unknown config key {}", x); Ok(()) - }, + } }, x => { unreachable!("Unsupported {:?}", x); - }, + } } }); @@ -590,15 +612,17 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { for res in settings.pairs::() { if let Ok((key, value)) = res { popup = match key.as_str() { - "text" => popup.with_text(validate!(lua, value : Vec, "text", "string[]")?), - "padding" => popup.with_padding(validate!(lua, value : i32)?), - _ => popup + "text" => { + popup.with_text(validate!(lua, value: Vec, "text", "string[]")?) + } + "padding" => popup.with_padding(validate!(lua, value: i32)?), + _ => popup, } } } popup - .create(state.clone()) + .create(&state.lock().config) .map_err(|e| LuaError::RuntimeError(e.to_string()))?; Ok(()) @@ -625,21 +649,21 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { move |lua, display_id: Value| { validate!(lua, { display_id: i32 }); let state_g = state.lock(); - let display = state_g.get_display_by_id(DisplayId(display_id)) - .unwrap(); - - let display_grid_ids = display.grids - .iter() - .map(|g| g.id) - .collect::>(); - let mut grids = display.get_active_grids() - .iter() - .map(|g| g.id) - .collect::>(); - grids.extend(state_g.pinned - .get_active_workspaces() - .iter() - .filter(|id| display_grid_ids.contains(id))); + let display = state_g.get_display_by_id(DisplayId(display_id)).unwrap(); + + let display_grid_ids = display.grids.iter().map(|g| g.id).collect::>(); + let mut grids = display + .get_active_grids() + .iter() + .map(|g| g.id) + .collect::>(); + grids.extend( + state_g + .pinned + .get_active_workspaces() + .iter() + .filter(|id| display_grid_ids.contains(id)), + ); grids.sort(); grids.dedup(); @@ -666,10 +690,11 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { let state = state_arc.clone(); def_fn!(lua, nog_tbl, "toggle_view_pinned", move |_, (): ()| { - state.lock() - .pinned - .toggle_view_pinned(None) - .map_err(|e| LuaError::RuntimeError(e.to_string())) + state + .lock() + .pinned + .toggle_view_pinned(None) + .map_err(|e| LuaError::RuntimeError(e.to_string())) }); let state = state_arc.clone(); @@ -724,7 +749,7 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { factor: f64 }); - Ok(crate::util::scale_color(color, factor)) + Ok(crate::util::scale_hex_color(color, factor)) }); let state = state_arc.clone(); @@ -741,18 +766,21 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { let state = state_arc.clone(); def_fn!(lua, nog_tbl, "get_focused_win", move |_, (): ()| { - let win_id = state - .lock() - .get_focused_win(); + let win_id = state.lock().get_focused_win(); Ok(win_id) }); let state = state_arc.clone(); - def_fn!(lua, nog_tbl, "get_focused_win_of_display", move |lua, display_id: Value| { - validate!(lua, { display_id: i32 }); - Ok(state.lock().get_focused_win_of_display(display_id)) - }); + def_fn!( + lua, + nog_tbl, + "get_focused_win_of_display", + move |lua, display_id: Value| { + validate!(lua, { display_id: i32 }); + Ok(state.lock().get_focused_win_of_display(display_id)) + } + ); let state = state_arc.clone(); def_fn!(lua, nog_tbl, "get_current_ws", move |_, (): ()| { @@ -837,7 +865,7 @@ fn setup_nog_global(state_arc: Arc>, rt: &LuaRuntime) { let state = state_arc.clone(); def_fn!(lua, nog_tbl, "__bind", move |lua, - (mode, key, id): ( + (mode, key, id): ( Value, Value, Value @@ -891,7 +919,10 @@ fn load_window_functions(state_arc: Arc>, rt: &LuaRuntime) -> ml l_def_ffi_fn!("move_to_ws", move_window_to_workspace, ws_id: i32); let state = state_arc.clone(); - def_fn!(lua, nog_tbl, "win_hide_title_bar", + def_fn!( + lua, + nog_tbl, + "win_hide_title_bar", move |lua, win_id: Value| { validate!(lua, { win_id: i32 }); @@ -901,7 +932,10 @@ fn load_window_functions(state_arc: Arc>, rt: &LuaRuntime) -> ml ); let state = state_arc.clone(); - def_fn!(lua, nog_tbl, "win_show_title_bar", + def_fn!( + lua, + nog_tbl, + "win_show_title_bar", move |lua, win_id: Value| { validate!(lua, { win_id: i32 }); @@ -911,7 +945,10 @@ fn load_window_functions(state_arc: Arc>, rt: &LuaRuntime) -> ml ); let state = state_arc.clone(); - def_fn!(lua, nog_tbl, "win_hide_border", + def_fn!( + lua, + nog_tbl, + "win_hide_border", move |lua, win_id: Value| { validate!(lua, { win_id: i32 }); @@ -921,7 +958,10 @@ fn load_window_functions(state_arc: Arc>, rt: &LuaRuntime) -> ml ); let state = state_arc.clone(); - def_fn!(lua, nog_tbl, "win_show_border", + def_fn!( + lua, + nog_tbl, + "win_show_border", move |lua, win_id: Value| { validate!(lua, { win_id: i32 }); @@ -931,20 +971,24 @@ fn load_window_functions(state_arc: Arc>, rt: &LuaRuntime) -> ml ); let state = state_arc.clone(); - def_fn!(lua, nog_tbl, "win_toggle_pin", - move |lua, win_id: Value| { - validate!(lua, { win_id: i32 }); + def_fn!(lua, nog_tbl, "win_toggle_pin", move |lua, win_id: Value| { + validate!(lua, { win_id: i32 }); - let config = state.lock().config.clone(); - let additional_rules = state.lock().additonal_rules.clone(); + let config = state.lock().config.clone(); + let additional_rules = state.lock().additonal_rules.clone(); - state.lock().pinned.toggle_pin(win_id, None, &config, &additional_rules)?; - Ok(()) - } - ); + state + .lock() + .pinned + .toggle_pin(win_id, None, &config, &additional_rules)?; + Ok(()) + }); let state = state_arc.clone(); - def_fn!(lua, nog_tbl, "win_toggle_ws_pin", + def_fn!( + lua, + nog_tbl, + "win_toggle_ws_pin", move |lua, win_id: Value| { validate!(lua, { win_id: i32 }); @@ -956,21 +1000,20 @@ fn load_window_functions(state_arc: Arc>, rt: &LuaRuntime) -> ml .get_focused_grid() .map(|ws| ws.id); - state.lock() - .pinned - .toggle_pin(win_id, ws_id, &config, &additional_rules)?; + state + .lock() + .pinned + .toggle_pin(win_id, ws_id, &config, &additional_rules)?; Ok(()) } ); let state = state_arc.clone(); - def_fn!(lua, nog_tbl, "win_is_pinned", - move |lua, win_id: Value| { - validate!(lua, { win_id: i32 }); - Ok(state.lock().pinned.is_pinned(&win_id)) - } - ); + def_fn!(lua, nog_tbl, "win_is_pinned", move |lua, win_id: Value| { + validate!(lua, { win_id: i32 }); + Ok(state.lock().pinned.is_pinned(&win_id)) + }); Ok(()) }) @@ -1034,25 +1077,27 @@ fn load_workspace_functions(state_arc: Arc>, rt: &LuaRuntime) -> ); let state = state_arc.clone(); - def_fn!(lua, nog_tbl, "ws_toggle_view_pinned", + def_fn!( + lua, + nog_tbl, + "ws_toggle_view_pinned", move |lua, workspace_id: Value| { validate!(lua, { workspace_id: i32 }); - state.lock() - .pinned - .toggle_view_pinned(Some(workspace_id))?; + state.lock().pinned.toggle_view_pinned(Some(workspace_id))?; Ok(()) } ); let state = state_arc.clone(); - def_fn!(lua, nog_tbl, "ws_has_pinned", + def_fn!( + lua, + nog_tbl, + "ws_has_pinned", move |lua, workspace_id: Value| { validate!(lua, { workspace_id: i32 }); - Ok(!state.lock() - .pinned - .is_empty(Some(workspace_id))) + Ok(!state.lock().pinned.is_empty(Some(workspace_id))) } ); @@ -1075,7 +1120,11 @@ pub fn setup_lua_rt(state_arc: Arc>) { path = format!("{}\\lua\\?.lua;{}", plug_path, path); } - path = format!("{}\\config\\?.lua;{}", get_config_path().to_str().unwrap(), path); + path = format!( + "{}\\config\\?.lua;{}", + get_config_path().to_str().unwrap(), + path + ); #[cfg(debug_assertions)] let dll_path = { @@ -1103,7 +1152,8 @@ pub fn setup_lua_rt(state_arc: Arc>) { package_tbl.set("cpath", cpath)?; Ok(()) - }).unwrap(); + }) + .unwrap(); let mut path = get_runtime_path(); path.push("lua"); diff --git a/twm/src/lua/runtime.rs b/twm/src/lua/runtime.rs index a615999a..ef6b5cdc 100644 --- a/twm/src/lua/runtime.rs +++ b/twm/src/lua/runtime.rs @@ -100,14 +100,16 @@ impl LuaRuntime { let path_str: String = path.display().to_string(); debug!("Executing {}", &path_str); match std::fs::read_to_string(&path) { - Ok(content) => { + Ok(content) => { #[cfg(not(debug_assertions))] { debug!("\n{}", content); } - self.run_str(&path_str, &content); - }, - Err(e) => { error!("{}", e); } + self.run_str(&path_str, &content); + } + Err(e) => { + error!("{}", e); + } }; debug!("Finished execution"); } diff --git a/twm/src/main.rs b/twm/src/main.rs index 8c7c1fb3..df2481ae 100644 --- a/twm/src/main.rs +++ b/twm/src/main.rs @@ -5,19 +5,20 @@ extern crate num_derive; #[macro_use] extern crate strum_macros; -use config::{rule::Rule, workspace_setting::WorkspaceSetting, Config}; use crate::config::rule::Action as RuleAction; +use config::{rule::Rule, workspace_setting::WorkspaceSetting, Config}; use crossbeam_channel::select; use direction::Direction; use display::Display; use event::Event; use event::EventChannel; use itertools::Itertools; -use keybindings::{keybinding::Keybinding, KeybindingsMessage, keybinding::KeybindingKind}; +use keybindings::{keybinding::Keybinding, keybinding::KeybindingKind, KeybindingsMessage}; use log::debug; use log::{error, info}; use lua::{setup_lua_rt, LuaRuntime}; use parking_lot::{deadlock, Mutex}; +use pinned::Pinned; use split_direction::SplitDirection; use std::path::PathBuf; use std::process::Command; @@ -25,12 +26,11 @@ use std::{fmt::Debug, fs::ReadDir}; use std::{mem, thread, time::Duration}; use std::{process, sync::Arc}; use system::NativeWindow; -use system::{DisplayId, SystemResult, SystemError, WinEventListener, WindowId}; +use system::{DisplayId, SystemError, SystemResult, WinEventListener, WindowId}; use task_bar::Taskbar; use tile_grid::{store::Store, TileGrid}; use win_event_handler::{win_event::WinEvent, win_event_type::WinEventType}; use window::Window; -use pinned::Pinned; pub const NOG_BAR_NAME: &'static str = "nog_bar"; pub const NOG_POPUP_NAME: &'static str = "nog_popup"; @@ -122,6 +122,7 @@ mod keyboardhook; mod logging; mod lua; mod message_loop; +mod pinned; mod popup; mod renderer; mod split_direction; @@ -130,7 +131,6 @@ mod system; mod task_bar; mod tile; mod tile_grid; -mod pinned; mod tray; mod update; mod util; @@ -162,7 +162,7 @@ impl Default for AppState { window_event_listener: WinEventListener::default(), workspace_id: 1, config, - pinned: Pinned::new() + pinned: Pinned::new(), } } } @@ -347,7 +347,6 @@ impl AppState { self.refresh_pinned()?; } - Ok(()) } @@ -701,7 +700,10 @@ impl AppState { Ok(()) } - pub fn each_window(&mut self, cb: impl Fn(&mut NativeWindow) -> SystemResult + Copy) -> SystemResult { + pub fn each_window( + &mut self, + cb: impl Fn(&mut NativeWindow) -> SystemResult + Copy, + ) -> SystemResult { for d in &mut self.displays { for g in &mut d.grids { g.modify_windows(cb)?; @@ -831,11 +833,12 @@ impl AppState { } pub fn get_focused_workspaces(&self) -> Vec { - self.displays.iter() - .map(|d| d.focused_grid_id) - .filter(|g_id| g_id.is_some()) - .map(|g_id| g_id.unwrap()) - .collect() + self.displays + .iter() + .map(|d| d.focused_grid_id) + .filter(|g_id| g_id.is_some()) + .map(|g_id| g_id.unwrap()) + .collect() } fn refresh_pinned(&mut self) -> SystemResult { @@ -868,15 +871,17 @@ impl AppState { pub fn get_focused_win(&self) -> i32 { NativeWindow::get_foreground_window() .expect("Failed to get foreground window") - .id.into() + .id + .into() } pub fn get_window_mut(&mut self, window_id: &i32) -> Option<&mut NativeWindow> { if self.pinned.is_pinned(window_id) { if let Some(window) = self.pinned.get_mut(window_id) { return Some(window); - } - } else if let Some(grid) = self.find_grid_containing_window_mut(WindowId::from(*window_id)) { + } + } else if let Some(grid) = self.find_grid_containing_window_mut(WindowId::from(*window_id)) + { return grid.get_window_mut(WindowId::from(*window_id)); } @@ -1097,7 +1102,7 @@ fn run(state_arc: Arc>) -> Result<(), Box config::hot_reloading::start(state_arc.clone()); } - popup::test(); + popup::Popup::new_error(vec!["Hello World".into(), "Hello World".into()]).create(&state_arc.lock().config); startup::set_launch_on_startup(state_arc.lock().config.launch_on_startup); @@ -1116,7 +1121,7 @@ fn run(state_arc: Arc>) -> Result<(), Box let msg = maybe_msg.unwrap(); let _ = match msg { Event::NewPopup(mut p) => { - p.create(state_arc.clone())?; + p.create(&state_arc.lock().config)?; Ok(()) }, Event::ToggleAppbar(display_id) => { diff --git a/twm/src/pinned.rs b/twm/src/pinned.rs index 3856306d..8ec860fb 100644 --- a/twm/src/pinned.rs +++ b/twm/src/pinned.rs @@ -1,281 +1,297 @@ -use std::collections::HashMap; -use crate::{ - tile_grid::store::Store, - config::{Config, rule::Rule}, - AppState, - system::{NativeWindow, SystemResult, SystemError, WindowId, } -}; -use log::debug; - -static NUMBER_OF_WORKSPACES: usize = 10; -static GLOBAL_INDEX: i32 = 0; // index of the container storing globally pinned windows - -#[derive(Clone, Debug)] -pub struct Pinned { - // index 0 is global, 1-10 are workspaces - containers: Vec, -} - -#[derive(Clone, Debug)] -struct PinnedContainer { - is_visible: bool, - windows: HashMap -} - -impl PinnedContainer { - pub fn new() -> Self { - PinnedContainer { - is_visible: true, - windows: HashMap::new(), - } - } - - pub fn cleanup(&mut self) -> SystemResult { - for window in self.windows.values_mut() { - if window.is_hidden() { - window.show(); - } - - window.remove_topmost()?; - window.cleanup()?; - } - - self.windows.clear(); - self.is_visible = false; - - Ok(()) - } - - pub fn insert(&mut self, window_id: i32, window: NativeWindow) { - self.windows.insert(window_id, window); - self.is_visible = true; - } - - pub fn contains(&self, window_id: &i32) -> bool { - self.windows.contains_key(window_id.into()) - } - - pub fn remove(&mut self, window_id: &i32) -> Option { - let window = self.windows.remove(window_id.into()); - if self.windows.len() == 0 { - self.is_visible = false; - } - window - } -} - -impl Pinned { - pub fn new() -> Self { - Pinned { - containers: vec!(PinnedContainer::new(); NUMBER_OF_WORKSPACES + 1), - } - } - - pub fn load(pinned_windows: Vec::<(bool, Vec::)>, state: &AppState) -> Result { - let mut pinned = Pinned::new(); - let pinned_windows = pinned_windows.into_iter().enumerate(); - for (index, (is_visible, pinned_ids)) in pinned_windows { - let index = index as i32; - for pinned_id in pinned_ids { - let window_id: WindowId = pinned_id.into(); - let window: NativeWindow = NativeWindow::from(window_id); - if pinned.can_pin(&window) { - pinned.pin_window(window, Some(index), &state.config, &state.additonal_rules)?; - } - - } - - if !is_visible { - pinned.toggle_view_pinned(Some(index))?; - } else { - pinned.store(Some(index)); - } - } - - Ok(pinned) - } - - pub fn cleanup(&mut self) -> SystemResult { - for container in self.containers.iter_mut() { - container.cleanup()?; - } - - Ok(()) - } - - pub fn can_pin(&self, window: &NativeWindow) -> bool { - !self.is_pinned(&window.id.into()) && window.is_window() - } - - pub fn is_pinned(&self, window_id: &i32) -> bool { - self.containers.iter() - .any(|c| c.contains(window_id.into())) - } - - pub fn contains(&self, window_id: &i32, ws_id: Option) -> bool { - let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; - self.containers[container_index] - .contains(window_id) - } - - pub fn is_empty(&self, ws_id: Option) -> bool { - let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; - self.containers[container_index].windows.is_empty() - } - - pub fn pin_window( - &mut self, - mut window: NativeWindow, - ws_id: Option, - config: &Config, - additional_rules: &Vec - ) -> SystemResult { - let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; - let rules = config - .rules - .iter() - .chain(additional_rules.iter()) - .collect(); - - window.set_matching_rule(rules); - window.init(false, config.use_border)?; - - if !window.is_visible() { - window.show(); - } - - window.to_foreground(true)?; - - self.containers[container_index].insert(window.id.into(), window); - - Ok(()) - } - - pub fn toggle_pin(&mut self, win_id: i32, ws_id: Option, config: &Config, additional_rules: &Vec) -> SystemResult { - let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; - let win_id: WindowId = win_id.into(); - let window: NativeWindow = NativeWindow::from(win_id); - - if self.containers[container_index].contains(&window.id.into()) { - let mut window = self.containers[container_index].remove(&window.id.into()).unwrap(); - window.remove_topmost()?; - window.cleanup()?; - } else if self.can_pin(&window) { - self.pin_window(window, ws_id, config, additional_rules)?; - } - - self.store(ws_id); - - Ok(()) - } - - pub fn toggle_view_pinned(&mut self, ws_id: Option) -> SystemResult { - let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; - if self.containers[container_index].is_visible { - self.containers[container_index] - .windows.values_mut() - .for_each(|w| w.hide()); - self.containers[container_index].is_visible = false; - } else { - for window in self.containers[container_index].windows.values_mut() { - window.show(); - window.focus()?; - } - self.containers[container_index].is_visible = true; - } - - self.store(ws_id); - - Ok(()) - } - - pub fn store(&self, ws_id: Option) { - let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; - let window_ids = self.containers[container_index] - .windows - .keys() - .collect::>(); - let pinned_visible = self.containers[container_index].is_visible; - - Store::save_pinned(container_index, window_ids, pinned_visible); - } - - pub fn each_pinned_window(&mut self, callback: impl Fn(&mut NativeWindow) -> SystemResult + Copy) -> SystemResult { - for container in self.containers.iter_mut() { - for window in container.windows.values_mut() { - callback(window)?; - } - } - - Ok(()) - } - - pub fn get(&self, window_id: &i32, ws_id: Option) -> Option<&NativeWindow> { - let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; - self.containers[container_index].windows.get(window_id) - } - - pub fn get_mut(&mut self, window_id: &i32) -> Option<&mut NativeWindow> { - for container in self.containers.iter_mut() { - if container.contains(window_id) { - return container.windows.get_mut(window_id); - } - } - - None - } - - pub fn get_active_workspaces(&self) -> Vec { - self.containers - .iter() - .enumerate() - .filter(|(i, c)| *i != GLOBAL_INDEX as usize && !c.windows.is_empty()) - .map(|(i, _)| i as i32) - .collect() - } - - pub fn show(&mut self, workspace_ids: Vec) -> SystemResult { - let (show_containers, hide_containers): (Vec<(usize, &mut PinnedContainer)>, Vec<(usize, &mut PinnedContainer)>) - = self.containers - .iter_mut() - .enumerate() - .filter(|(i, _)| *i != GLOBAL_INDEX as usize) - .partition(|(i, container)| { - workspace_ids.contains(&(*i as i32)) && container.is_visible - }); - - for (i, container) in show_containers { - debug!("Showing {}", i); - for window in container.windows.values_mut() { - if window.is_hidden() { - window.show(); - } - } - } - - for (i, container) in hide_containers { - debug!("Hiding {}", i); - for window in container.windows.values_mut() { - if window.is_visible() { - window.hide(); - } - } - } - - Ok(()) - } - - pub fn remove(&mut self, window_id: &i32) -> Option { - for (container_id, container) in self.containers.iter_mut().enumerate() { - if container.contains(window_id) { - let window = container.remove(window_id); - - self.store(Some(container_id as i32)); - - return window; - } - } - - None - } -} +use crate::{ + config::{rule::Rule, Config}, + system::{NativeWindow, SystemError, SystemResult, WindowId}, + tile_grid::store::Store, + AppState, +}; +use log::debug; +use std::collections::HashMap; + +static NUMBER_OF_WORKSPACES: usize = 10; +static GLOBAL_INDEX: i32 = 0; // index of the container storing globally pinned windows + +#[derive(Clone, Debug)] +pub struct Pinned { + // index 0 is global, 1-10 are workspaces + containers: Vec, +} + +#[derive(Clone, Debug)] +struct PinnedContainer { + is_visible: bool, + windows: HashMap, +} + +impl PinnedContainer { + pub fn new() -> Self { + PinnedContainer { + is_visible: true, + windows: HashMap::new(), + } + } + + pub fn cleanup(&mut self) -> SystemResult { + for window in self.windows.values_mut() { + if window.is_hidden() { + window.show(); + } + + window.remove_topmost()?; + window.cleanup()?; + } + + self.windows.clear(); + self.is_visible = false; + + Ok(()) + } + + pub fn insert(&mut self, window_id: i32, window: NativeWindow) { + self.windows.insert(window_id, window); + self.is_visible = true; + } + + pub fn contains(&self, window_id: &i32) -> bool { + self.windows.contains_key(window_id.into()) + } + + pub fn remove(&mut self, window_id: &i32) -> Option { + let window = self.windows.remove(window_id.into()); + if self.windows.len() == 0 { + self.is_visible = false; + } + window + } +} + +impl Pinned { + pub fn new() -> Self { + Pinned { + containers: vec![PinnedContainer::new(); NUMBER_OF_WORKSPACES + 1], + } + } + + pub fn load( + pinned_windows: Vec<(bool, Vec)>, + state: &AppState, + ) -> Result { + let mut pinned = Pinned::new(); + let pinned_windows = pinned_windows.into_iter().enumerate(); + for (index, (is_visible, pinned_ids)) in pinned_windows { + let index = index as i32; + for pinned_id in pinned_ids { + let window_id: WindowId = pinned_id.into(); + let window: NativeWindow = NativeWindow::from(window_id); + if pinned.can_pin(&window) { + pinned.pin_window( + window, + Some(index), + &state.config, + &state.additonal_rules, + )?; + } + } + + if !is_visible { + pinned.toggle_view_pinned(Some(index))?; + } else { + pinned.store(Some(index)); + } + } + + Ok(pinned) + } + + pub fn cleanup(&mut self) -> SystemResult { + for container in self.containers.iter_mut() { + container.cleanup()?; + } + + Ok(()) + } + + pub fn can_pin(&self, window: &NativeWindow) -> bool { + !self.is_pinned(&window.id.into()) && window.is_window() + } + + pub fn is_pinned(&self, window_id: &i32) -> bool { + self.containers.iter().any(|c| c.contains(window_id.into())) + } + + pub fn contains(&self, window_id: &i32, ws_id: Option) -> bool { + let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; + self.containers[container_index].contains(window_id) + } + + pub fn is_empty(&self, ws_id: Option) -> bool { + let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; + self.containers[container_index].windows.is_empty() + } + + pub fn pin_window( + &mut self, + mut window: NativeWindow, + ws_id: Option, + config: &Config, + additional_rules: &Vec, + ) -> SystemResult { + let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; + let rules = config.rules.iter().chain(additional_rules.iter()).collect(); + + window.set_matching_rule(rules); + window.init(false, config.use_border)?; + + if !window.is_visible() { + window.show(); + } + + window.to_foreground(true)?; + + self.containers[container_index].insert(window.id.into(), window); + + Ok(()) + } + + pub fn toggle_pin( + &mut self, + win_id: i32, + ws_id: Option, + config: &Config, + additional_rules: &Vec, + ) -> SystemResult { + let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; + let win_id: WindowId = win_id.into(); + let window: NativeWindow = NativeWindow::from(win_id); + + if self.containers[container_index].contains(&window.id.into()) { + let mut window = self.containers[container_index] + .remove(&window.id.into()) + .unwrap(); + window.remove_topmost()?; + window.cleanup()?; + } else if self.can_pin(&window) { + self.pin_window(window, ws_id, config, additional_rules)?; + } + + self.store(ws_id); + + Ok(()) + } + + pub fn toggle_view_pinned(&mut self, ws_id: Option) -> SystemResult { + let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; + if self.containers[container_index].is_visible { + self.containers[container_index] + .windows + .values_mut() + .for_each(|w| w.hide()); + self.containers[container_index].is_visible = false; + } else { + for window in self.containers[container_index].windows.values_mut() { + window.show(); + window.focus()?; + } + self.containers[container_index].is_visible = true; + } + + self.store(ws_id); + + Ok(()) + } + + pub fn store(&self, ws_id: Option) { + let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; + let window_ids = self.containers[container_index] + .windows + .keys() + .collect::>(); + let pinned_visible = self.containers[container_index].is_visible; + + Store::save_pinned(container_index, window_ids, pinned_visible); + } + + pub fn each_pinned_window( + &mut self, + callback: impl Fn(&mut NativeWindow) -> SystemResult + Copy, + ) -> SystemResult { + for container in self.containers.iter_mut() { + for window in container.windows.values_mut() { + callback(window)?; + } + } + + Ok(()) + } + + pub fn get(&self, window_id: &i32, ws_id: Option) -> Option<&NativeWindow> { + let container_index = ws_id.unwrap_or(GLOBAL_INDEX) as usize; + self.containers[container_index].windows.get(window_id) + } + + pub fn get_mut(&mut self, window_id: &i32) -> Option<&mut NativeWindow> { + for container in self.containers.iter_mut() { + if container.contains(window_id) { + return container.windows.get_mut(window_id); + } + } + + None + } + + pub fn get_active_workspaces(&self) -> Vec { + self.containers + .iter() + .enumerate() + .filter(|(i, c)| *i != GLOBAL_INDEX as usize && !c.windows.is_empty()) + .map(|(i, _)| i as i32) + .collect() + } + + pub fn show(&mut self, workspace_ids: Vec) -> SystemResult { + let (show_containers, hide_containers): ( + Vec<(usize, &mut PinnedContainer)>, + Vec<(usize, &mut PinnedContainer)>, + ) = self + .containers + .iter_mut() + .enumerate() + .filter(|(i, _)| *i != GLOBAL_INDEX as usize) + .partition(|(i, container)| { + workspace_ids.contains(&(*i as i32)) && container.is_visible + }); + + for (i, container) in show_containers { + debug!("Showing {}", i); + for window in container.windows.values_mut() { + if window.is_hidden() { + window.show(); + } + } + } + + for (i, container) in hide_containers { + debug!("Hiding {}", i); + for window in container.windows.values_mut() { + if window.is_visible() { + window.hide(); + } + } + } + + Ok(()) + } + + pub fn remove(&mut self, window_id: &i32) -> Option { + for (container_id, container) in self.containers.iter_mut().enumerate() { + if container.contains(window_id) { + let window = container.remove(window_id); + + self.store(Some(container_id as i32)); + + return window; + } + } + + None + } +} diff --git a/twm/src/popup.rs b/twm/src/popup.rs index 66e7f78d..8cdc7f1b 100644 --- a/twm/src/popup.rs +++ b/twm/src/popup.rs @@ -1,7 +1,4 @@ -use crate::{ - system::Rectangle, system::SystemResult, window::Window, window::WindowEvent, AppState, - NOG_POPUP_NAME, -}; +use crate::{config::Config, system::SystemResult, util, window::Window, NOG_POPUP_NAME}; use parking_lot::Mutex; use std::{fmt::Debug, sync::Arc, thread, thread::JoinHandle}; @@ -47,8 +44,8 @@ impl Popup { ) } - pub fn error(msg: Vec, state_arc: Arc>) { - thread::spawn(move || Popup::new_error(msg).create(state_arc).unwrap()); + pub fn error(msg: Vec, config: &Config) { + Popup::new_error(msg).create(config).unwrap(); } pub fn with_text>(mut self, text: Vec) -> Self { @@ -64,72 +61,43 @@ impl Popup { /// Creates the window for the popup with the configured parameters. /// /// This function closes a popup that is currently visible. - pub fn create(&mut self, state_arc: Arc>) -> SystemResult> { + pub fn create(&mut self, config: &Config) -> SystemResult> { if is_visible() { close()?; } - let state = state_arc.lock(); - - let text = self.text.join("\n"); - let padding = self.padding; - - let mut window = Window::new() - .with_title(NOG_POPUP_NAME) - .with_font(&state.config.bar.font) - .with_size(10, 10) - .with_font_size(state.config.bar.font_size) - .with_is_popup(true) - .with_background_color(state.config.bar.color); - - drop(state); - - let t = window.create(state_arc, true, move |event| { - match event { - WindowEvent::Draw { - api, - display_id, - state_arc, - .. - } => { - let (display_width, display_height) = { - let state = state_arc.lock(); - let display = state.get_display_by_id(*display_id).unwrap(); - - (display.width(), display.height()) - }; - let rect = api.calculate_text_rect(&text); - - let height = rect.height(); - let width = rect.width(); - - let x = display_width / 2 - width / 2 - padding; - let y = display_height / 2 - height / 2 - padding; - - api.window - .set_window_pos( - Rectangle { - left: x, - right: x + width + padding * 2, - top: y, - bottom: y + height + padding * 2, - }, - None, - None, - ) - .expect("Failed to move popup to its location"); - - api.set_text_color(0xffffff); - api.write_text(&text, padding, padding, false, false); - } - _ => {} - } - Ok(()) + let base_color = util::hex_to_rgb(config.bar.color); + let background_color = (base_color.0 as u8, base_color.1 as u8, base_color.2 as u8); + let text = self.text.clone(); + let text_color = if config.light_theme { + (0, 0, 0) + } else { + (255, 255, 255) + }; + let font_size = config.bar.font_size as usize; + let height = self.text.len() * font_size; + + let t = EventLoopExtWindows::new_any_thread(move || { + IcedPopup::run(Settings { + window: window::Settings { + position: window::Position::Centered, + size: (200, height as u32), + decorations: false, + resizable: false, + always_on_top: true, + ..Default::default() + }, + flags: PopupSettings { + content: text, + text_color, + background_color, + }, + default_text_size: font_size as u16, + ..Default::default() + }) + .unwrap(); }); - self.window = Some(window); - *POPUP.lock() = Some(self.clone()); - Ok(t) } } @@ -154,64 +122,71 @@ pub fn is_visible() -> bool { POPUP.lock().is_some() } -use iced::{Application, Clipboard, Command, Element, Column, Text, Align, Settings, window}; +use iced::{window, Align, Application, Clipboard, Column, Command, Element, Settings, Text}; #[derive(Clone, Debug)] -pub enum PopupMessage { +enum PopupMessage {} + +struct IcedPopup { + content: Vec, + text_color: iced::Color, + background_color: iced::Color, } -pub struct IcedPopup(Vec); +#[derive(Debug, Default, Clone)] +struct PopupSettings { + content: Vec, + text_color: (u8, u8, u8), + background_color: (u8, u8, u8), +} impl Application for IcedPopup { - type Executor = iced::executor::Default; - type Message = PopupMessage; - type Flags = Vec; - - fn new(flags: Self::Flags) -> (Self, Command) { - (Self(flags), Command::none()) - } + type Executor = iced::executor::Default; + type Message = PopupMessage; + type Flags = PopupSettings; + + fn new(flags: Self::Flags) -> (Self, Command) { + ( + Self { + content: flags.content, + text_color: iced::Color::from_rgb8( + flags.text_color.0, + flags.text_color.1, + flags.text_color.2, + ), + background_color: iced::Color::from_rgb8( + flags.background_color.0, + flags.background_color.1, + flags.background_color.2, + ), + }, + Command::none(), + ) + } - fn title(&self) -> String { - String::from(NOG_POPUP_NAME) - } + fn title(&self) -> String { + String::from(NOG_POPUP_NAME) + } - fn update(&mut self, message: Self::Message, _: &mut Clipboard) -> Command { - Command::none() - } + fn update(&mut self, message: Self::Message, _: &mut Clipboard) -> Command { + Command::none() + } - fn view(&mut self) -> Element { - let mut col = Column::new() - .padding(10) - .align_items(Align::Center); + fn background_color(&self) -> iced::Color { + self.background_color + } - for line in &self.0 { - col = col.push(Text::new(line.clone())); + fn should_exit(&self) -> bool { + false } - col.into() - } -} + fn view(&mut self) -> Element { + let mut col = Column::new().padding(10).align_items(Align::Center); -pub fn test() { - let lines = vec![ - "Hello World 1", - "Hello World 2", - "Hello World 3", - ].iter().map(|x| x.to_string()).collect::>(); - let font_size = 20; - let height = lines.len() * font_size; - - IcedPopup::run(Settings { - window: window::Settings { - position: window::Position::Centered, - size: (200, height as u32), - decorations: false, - resizable: false, - always_on_top: true, - ..Default::default() - }, - flags: lines, - default_text_size: font_size as u16, - ..Default::default() - }); + for line in &self.content { + col = col.push(Text::new(line.clone()).color(self.text_color)); + } + + col.into() + } } diff --git a/twm/src/tile_grid.rs b/twm/src/tile_grid.rs index 31f62794..6fcb4973 100644 --- a/twm/src/tile_grid.rs +++ b/twm/src/tile_grid.rs @@ -401,14 +401,13 @@ impl TileGrid { } /// Returns the window that matches by ID if it exists pub fn get_window_mut(&mut self, id: WindowId) -> Option<&mut NativeWindow> { - let node = self.graph.nodes() - .find(|n| { - let node = self.graph.node(*n); - node.is_tile() && node.get_window().id == id - }); + let node = self.graph.nodes().find(|n| { + let node = self.graph.node(*n); + node.is_tile() && node.get_window().id == id + }); match node { Some(n) => Some(self.graph.node_mut(n).get_window_mut()), - _ => None + _ => None, } } /// Runs the passed in function on the currently focused tile's window in the current tile grid. @@ -663,7 +662,7 @@ impl TileGrid { self.fullscreen_id = None; } } - } + } window } diff --git a/twm/src/tile_grid/store.rs b/twm/src/tile_grid/store.rs index 7d5da3e7..d71da8f7 100644 --- a/twm/src/tile_grid/store.rs +++ b/twm/src/tile_grid/store.rs @@ -8,8 +8,8 @@ const PINNED_INVISIBLE: &'static str = "n"; pub struct Store {} pub struct StoredData { - pub grids: Vec::, - pub pinned_windows: Vec::<(bool, Vec::)> // (isVisible, Vec of windowIDs) + pub grids: Vec, + pub pinned_windows: Vec<(bool, Vec)>, // (isVisible, Vec of windowIDs) } impl Store { @@ -37,51 +37,56 @@ impl Store { /// | | -- 2nd pinned window /// | -- 1st pinned window /// -- indicates whether pinned windows are visible (v) or not (n) - pub fn save_pinned(index: usize, pinned: Vec::<&i32>, is_visible: bool) { - let visible = if is_visible { PINNED_VISIBLE } else { PINNED_INVISIBLE }; - let pinned = pinned.iter() - .map(|x| x.to_string()) - .collect::>() - .join("|"); + pub fn save_pinned(index: usize, pinned: Vec<&i32>, is_visible: bool) { + let visible = if is_visible { + PINNED_VISIBLE + } else { + PINNED_INVISIBLE + }; + let pinned = pinned + .iter() + .map(|x| x.to_string()) + .collect::>() + .join("|"); let pinned = format!("{}|{}", visible, pinned); info!("Saving Pinned IDs {}", pinned); Store::write_to_file(index + PINNED_OFFSET, pinned); } pub fn load() -> StoredData { let data = match fs::read_to_string(Store::get_path()) { - Ok(f) => f, - Err(_) => TEMPLATE.into(), - } - .split("\n") - .map(|x| x.to_string()) - .collect::>(); + Ok(f) => f, + Err(_) => TEMPLATE.into(), + } + .split("\n") + .map(|x| x.to_string()) + .collect::>(); let (grids, other_data) = data.split_at(10); - let mut pinned_windows: Vec::<(bool, Vec::)> = Vec::new(); + let mut pinned_windows: Vec<(bool, Vec)> = Vec::new(); // at this point, other_data should contain 11 rows left if it's a valid format - // these last 11 rows each represent a set of pinned windows. + // these last 11 rows each represent a set of pinned windows. // 0 is global, 1-10 are for each workspace if other_data.len() > 11 { let (saved_pinned, _) = other_data.split_at(11); - saved_pinned.iter() - .for_each(|x|{ - let split_pinned = x.split("|").collect::>(); - let (visibility, pinned_ids) = split_pinned.split_at(1); - let visibility = visibility.get(0).unwrap_or(&PINNED_INVISIBLE); - let windows = pinned_ids.into_iter() - .map(|x| x.parse::()) - .filter(|x| x.is_ok()) - .map(|x| x.unwrap()) - .collect(); - pinned_windows.push((*visibility == PINNED_VISIBLE, windows)); - }); + saved_pinned.iter().for_each(|x| { + let split_pinned = x.split("|").collect::>(); + let (visibility, pinned_ids) = split_pinned.split_at(1); + let visibility = visibility.get(0).unwrap_or(&PINNED_INVISIBLE); + let windows = pinned_ids + .into_iter() + .map(|x| x.parse::()) + .filter(|x| x.is_ok()) + .map(|x| x.unwrap()) + .collect(); + pinned_windows.push((*visibility == PINNED_VISIBLE, windows)); + }); } StoredData { grids: Vec::from(grids), - pinned_windows + pinned_windows, } } fn write_to_file(index: usize, new_value: String) { @@ -89,16 +94,16 @@ impl Store { Ok(f) => f, Err(_) => TEMPLATE.into(), }; - let file = file.split("\n").collect::>(); + let file = file.split("\n").collect::>(); let file: String = TEMPLATE // start with template so we always have the right # of rows .split("\n") .into_iter() .enumerate() .map(|(i, empty_string)| { - if i == index { - &new_value - } else { - // if we don't already have a value on this row + if i == index { + &new_value + } else { + // if we don't already have a value on this row // then populate it with an empty // string from the template if let Some(old_value) = file.get(i) { diff --git a/twm/src/util.rs b/twm/src/util.rs index f0cf5336..a1396845 100644 --- a/twm/src/util.rs +++ b/twm/src/util.rs @@ -20,12 +20,16 @@ pub fn hex_to_rgb(hex: i32) -> RGB { ((hex >> 16) & 0xFF, (hex >> 8) & 0xFF, hex & 0xFF) } -pub fn scale_color(color: i32, factor: f64) -> i32 { - let (mut red, mut green, mut blue) = hex_to_rgb(color); +pub fn scale_hex_color(color: i32, factor: f64) -> i32 { + rgb_to_hex(scale_rgb_color(hex_to_rgb(color), factor)) +} - red = (red as f64 * factor).round() as i32; - green = (green as f64 * factor).round() as i32; - blue = (blue as f64 * factor).round() as i32; +pub fn scale_rgb_color(color: RGB, factor: f64) -> RGB { + let (red, green, blue) = color; - rgb_to_hex((red, green, blue)) + ( + (red as f64 * factor).round() as i32, + (green as f64 * factor).round() as i32, + (blue as f64 * factor).round() as i32, + ) } diff --git a/twm/src/win_event_handler/win_event_type.rs b/twm/src/win_event_handler/win_event_type.rs index dd854e9d..bae371eb 100644 --- a/twm/src/win_event_handler/win_event_type.rs +++ b/twm/src/win_event_handler/win_event_type.rs @@ -11,7 +11,8 @@ pub enum WinEventType { #[cfg(target_os = "windows")] use winapi::um::winuser::{ - EVENT_OBJECT_DESTROY, EVENT_OBJECT_HIDE, EVENT_OBJECT_SHOW, EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_MINIMIZESTART, EVENT_SYSTEM_MINIMIZEEND + EVENT_OBJECT_DESTROY, EVENT_OBJECT_HIDE, EVENT_OBJECT_SHOW, EVENT_SYSTEM_FOREGROUND, + EVENT_SYSTEM_MINIMIZEEND, EVENT_SYSTEM_MINIMIZESTART, }; #[cfg(target_os = "windows")] impl WinEventType { diff --git a/twm/src/window.rs b/twm/src/window.rs index 6a08351c..27b1ba1a 100644 --- a/twm/src/window.rs +++ b/twm/src/window.rs @@ -1,4 +1,5 @@ use log::error; +use mlua::Result as RuntimeResult; use parking_lot::Mutex; use std::{ ffi::c_void, ffi::CString, sync::atomic::AtomicBool, sync::atomic::Ordering, @@ -26,7 +27,6 @@ use winapi::{ um::winuser::WS_BORDER, um::winuser::WS_EX_NOACTIVATE, um::winuser::WS_EX_TOPMOST, um::winuser::WS_OVERLAPPEDWINDOW, um::winuser::WS_POPUPWINDOW, }; -use mlua::Result as RuntimeResult; use crate::{ display::Display, @@ -102,17 +102,17 @@ impl Api { SetTextColor(self.hdc as HDC, convert_color_to_winapi(color as u32)); } } - pub fn with_font(&self, name: &str, size: i32, cb: impl Fn() -> RuntimeResult) -> RuntimeResult { + pub fn with_font( + &self, + name: &str, + size: i32, + cb: impl Fn() -> RuntimeResult, + ) -> RuntimeResult { unsafe { let mut logfont = LOGFONTA::default(); let mut font_name: [i8; 32] = [0; 32]; - for (i, byte) in CString::new(name) - .unwrap() - .as_bytes() - .iter() - .enumerate() - { + for (i, byte) in CString::new(name).unwrap().as_bytes().iter().enumerate() { font_name[i] = *byte as i8; }