From 8c5b5e4a76a525e2bc6180f45aa08b7f4cbee944 Mon Sep 17 00:00:00 2001 From: rolv Date: Sun, 2 Jun 2024 21:42:21 +0100 Subject: [PATCH 1/7] chore: bump dependencies --- Cargo.lock | 431 ++++++++++++++++++++++++++++++---------------- cli/Cargo.toml | 4 +- daemon/Cargo.toml | 10 +- ipc/Cargo.toml | 2 +- 4 files changed, 293 insertions(+), 154 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8aa6e07..728f97b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,18 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aligned-vec" version = "0.5.0" @@ -40,47 +52,48 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -88,9 +101,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arbitrary" @@ -117,9 +130,23 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "av-data" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75b98a3525d00f920df9a2d44cc99b9cc5b7dc70d7fbb612cd755270dbe6552" +dependencies = [ + "byte-slice-cast", + "bytes", + "num-derive", + "num-rational", + "num-traits", + "thiserror", +] [[package]] name = "av1-grain" @@ -177,17 +204,26 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +[[package]] +name = "bitreader" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd859c9d97f7c468252795b35aeccc412bdbb1e90ee6969c4fa6328272eaeff" +dependencies = [ + "cfg-if", +] + [[package]] name = "bitstream-io" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c9989a51171e2e81038ab168b6ae22886fe9ded214430dbb4f41c28cf176da" +checksum = "7c12d1856e42f0d817a835fe55853957c85c8c8a470114029143d3f12671446e" [[package]] name = "built" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41bfbdb21256b87a8b5e80fab81a8eed158178e812fd7ba451907518b2742f16" +checksum = "c6a6c0b39c38fd754ac338b00a88066436389c0f029da5d37d1e01091d9b7c17" [[package]] name = "bumpalo" @@ -195,11 +231,17 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + [[package]] name = "bytemuck" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" +checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" [[package]] name = "byteorder" @@ -207,6 +249,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" + [[package]] name = "calloop" version = "0.12.4" @@ -235,12 +289,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.94" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" dependencies = [ "jobserver", "libc", + "once_cell", ] [[package]] @@ -358,15 +413,15 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "concurrent-queue" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" dependencies = [ "crossbeam-utils", ] @@ -379,18 +434,18 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ "crossbeam-utils", ] @@ -416,9 +471,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crunchy" @@ -432,6 +487,38 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" +[[package]] +name = "dav1d" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d4b54a40baf633a71c6f0fb49494a7e4ee7bc26f3e727212b6cb915aa1ea1e1" +dependencies = [ + "av-data", + "bitflags 2.5.0", + "dav1d-sys", + "static_assertions", +] + +[[package]] +name = "dav1d-sys" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ecb1c5e8f4dc438eedc1b534a54672fb0e0a56035dae6b50162787bd2c50e95" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "dcv-color-primitives" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ad62edfed069700a5b33af6babd29c498d7e33eb01d96ffa8841ee1841634c" +dependencies = [ + "paste", + "wasm-bindgen", +] + [[package]] name = "dirs" version = "5.0.1" @@ -470,9 +557,9 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "either" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "equivalent" @@ -482,9 +569,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -516,6 +603,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "fallible_collections" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a88c69768c0a15262df21899142bc6df9b9b823546d4b4b9a7bc2d6c448ec6fd" +dependencies = [ + "hashbrown 0.13.2", +] + [[package]] name = "fdeflate" version = "0.3.4" @@ -542,15 +638,15 @@ checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.4.1", "windows-sys 0.52.0", ] [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", @@ -558,9 +654,9 @@ dependencies = [ [[package]] name = "flexi_logger" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f248c29a6d4bc5d065c9e9068d858761a0dcd796759f7801cc14db35db23abd8" +checksum = "419c99d8fc346ea0eaeaac2cc3945024d8fe82aa435aefc2fb9fcda1065f8774" dependencies = [ "chrono", "glob", @@ -590,9 +686,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -644,9 +740,18 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "heck" @@ -719,9 +824,12 @@ dependencies = [ "bytemuck", "byteorder", "color_quant", + "dav1d", + "dcv-color-primitives", "exr", "gif", "image-webp", + "mp4parse", "num-traits", "png", "qoi", @@ -735,11 +843,11 @@ dependencies = [ [[package]] name = "image-webp" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a84a25dcae3ac487bc24ef280f9e20c79c9b1a3e5e32cbed3041d1c514aa87c" +checksum = "d730b085583c4d789dfd07fdcf185be59501666a90c97c40162b37e4fdad272d" dependencies = [ - "byteorder", + "byteorder-lite", "thiserror", ] @@ -762,7 +870,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -807,6 +915,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itertools" version = "0.12.1" @@ -824,9 +938,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685a7d121ee3f65ae4fddd72b25a04bb36b6af81bc0828f7d5434c0fe60fa3a2" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] @@ -890,9 +1004,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libfuzzer-sys" @@ -927,15 +1041,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -995,9 +1109,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" dependencies = [ "adler", "simd-adler32", @@ -1015,6 +1129,20 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mp4parse" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63a35203d3c6ce92d5251c77520acb2e57108c88728695aa883f70023624c570" +dependencies = [ + "bitreader", + "byteorder", + "fallible_collections", + "log", + "num-traits", + "static_assertions", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -1093,20 +1221,19 @@ dependencies = [ [[package]] name = "nu-ansi-term" -version = "0.49.0" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c073d3c1930d0751774acf49e66653acecb416c3a54c6ec095a9b11caddb5a68" +checksum = "dd2800e1520bdc966782168a627aa5d1ad92e33b984bf7c7615d31280c83ff14" dependencies = [ "windows-sys 0.48.0", ] [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -1133,11 +1260,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -1145,9 +1271,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -1181,9 +1307,9 @@ checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -1191,22 +1317,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.1", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pin-project-lite" @@ -1235,9 +1361,9 @@ dependencies = [ [[package]] name = "polling" -version = "3.6.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c976a60b2d7e99d6f229e414670a9b85d13ac305cc6d1e9c134de58c5aaaf6" +checksum = "5e6a007746f34ed64099e88783b0ae369eaa3da6392868ba262e2af9b8fbaea1" dependencies = [ "cfg-if", "concurrent-queue", @@ -1256,9 +1382,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" dependencies = [ "unicode-ident", ] @@ -1424,6 +1550,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +dependencies = [ + "bitflags 2.5.0", +] + [[package]] name = "redox_users" version = "0.4.5" @@ -1452,15 +1587,15 @@ checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316" [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" -version = "0.38.32" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.5.0", "errno", @@ -1471,9 +1606,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "same-file" @@ -1498,18 +1633,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", @@ -1518,9 +1653,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -1529,9 +1664,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" dependencies = [ "serde", ] @@ -1600,6 +1735,12 @@ dependencies = [ "lock_api", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.11.1" @@ -1608,9 +1749,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.60" +version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ "proc-macro2", "quote", @@ -1648,18 +1789,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", @@ -1679,9 +1820,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.12" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" dependencies = [ "serde", "serde_spanned", @@ -1691,18 +1832,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.9" +version = "0.22.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" +checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" dependencies = [ "indexmap", "serde", @@ -1843,9 +1984,9 @@ checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wayland-backend" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d50fa61ce90d76474c87f5fc002828d81b32677340112b4ef08079a9d459a40" +checksum = "34e9e6b6d4a2bb4e7e69433e0b35c7923b95d4dc8503a84d25ec917a4bbfdf07" dependencies = [ "cc", "downcast-rs", @@ -1857,9 +1998,9 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.31.2" +version = "0.31.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f" +checksum = "1e63801c85358a431f986cffa74ba9599ff571fc5774ac113ed3b490c19a1133" dependencies = [ "bitflags 2.5.0", "rustix", @@ -1880,9 +2021,9 @@ dependencies = [ [[package]] name = "wayland-cursor" -version = "0.31.1" +version = "0.31.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71ce5fa868dd13d11a0d04c5e2e65726d0897be8de247c0c5a65886e283231ba" +checksum = "a206e8b2b53b1d3fcb9428fec72bc278ce539e2fa81fe2bfc1ab27703d5187b9" dependencies = [ "rustix", "wayland-client", @@ -1891,9 +2032,9 @@ dependencies = [ [[package]] name = "wayland-egl" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355f652e5a24ae02d2ad536c8fc2d3dcc6c2bd635027cd6103a193e7d75eeda2" +checksum = "18cede1c33845ccd8fcebf7f107595170abf0ad0a28d47c50b444e06019b16e8" dependencies = [ "wayland-backend", "wayland-sys", @@ -1926,9 +2067,9 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.31.1" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63b3a62929287001986fb58c789dce9b67604a397c15c611ad9f747300b6c283" +checksum = "67da50b9f80159dec0ea4c11c13e24ef9e7574bd6ce24b01860a175010cea565" dependencies = [ "proc-macro2", "quick-xml", @@ -1937,9 +2078,9 @@ dependencies = [ [[package]] name = "wayland-sys" -version = "0.31.1" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" +checksum = "105b1842da6554f91526c14a2a2172897b7f745a805d62af4ce698706be79c12" dependencies = [ "dlib", "log", @@ -1952,37 +2093,15 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-core" version = "0.52.0" @@ -2133,9 +2252,9 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" -version = "0.6.6" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352" +checksum = "86c949fede1d13936a99f14fafd3e76fd642b556dd2ce96287fbe2e0151bfac6" dependencies = [ "memchr", ] @@ -2213,6 +2332,26 @@ version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "zune-core" version = "0.4.12" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 90d990f..9b95625 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -15,8 +15,8 @@ categories = ["command-line-utilities", "multimedia"] [dependencies] wpaperd-ipc = { path = "../ipc", version = "1.0.0" } clap = { version = "4.5.4", features = ["derive", "wrap_help"] } -serde = { version = "1.0.198", features = ["derive"] } -serde_json = "1.0.116" +serde = { version = "1.0.203", features = ["derive"] } +serde_json = "1.0.117" [build-dependencies] clap = { version = "4.5.4", features = ["derive", "cargo"] } diff --git a/daemon/Cargo.toml b/daemon/Cargo.toml index a076c9a..cd4ac66 100644 --- a/daemon/Cargo.toml +++ b/daemon/Cargo.toml @@ -18,7 +18,7 @@ rust-version = "1.61.0" wpaperd-ipc = { path = "../ipc", version = "1.0.0" } clap = { version = "4.5.4", features = ["derive", "wrap_help"] } color-eyre = { version = "0.6.3", default-features = false } -flexi_logger = { version = "0.28.0", default-features = false, features = ["colors"] } +flexi_logger = { version = "0.28.1", default-features = false, features = ["colors"] } image = "0.25.1" hotwatch = "0.5.0" humantime-serde = "1.1.1" @@ -26,14 +26,14 @@ log = "0.4.21" new_mime_guess = "4.0.1" nix = { version = "0.28.0", features = ["process"] } rand = "0.8.5" -serde = { version = "1.0.198", features = ["derive", "rc"] } +serde = { version = "1.0.203", features = ["derive", "rc"] } smithay-client-toolkit = { version = "0.18.1", default-features = false, features = [ "calloop" ] } -toml = "0.8.12" +toml = "0.8.13" xdg = "2.5.2" walkdir = "2.5.0" dirs = "5.0.1" -serde_json = "1.0.116" -wayland-egl = "0.32.0" +serde_json = "1.0.117" +wayland-egl = "0.32.1" khronos-egl = { version = "6.0.0", features = [ "static" ] } [build-dependencies] diff --git a/ipc/Cargo.toml b/ipc/Cargo.toml index d4dc42b..0024ac1 100644 --- a/ipc/Cargo.toml +++ b/ipc/Cargo.toml @@ -13,5 +13,5 @@ categories = ["command-line-utilities", "multimedia"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -serde = { version = "1.0.198", features = ["derive"] } +serde = { version = "1.0.203", features = ["derive"] } xdg = "2.5.2" From 562436c040ae29875fe3f2a9ad4b59e69893a098 Mon Sep 17 00:00:00 2001 From: rolv Date: Sun, 2 Jun 2024 21:49:07 +0100 Subject: [PATCH 2/7] fix: minor spelling mistake --- daemon/src/image_picker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/src/image_picker.rs b/daemon/src/image_picker.rs index c89ab13..1dfec13 100644 --- a/daemon/src/image_picker.rs +++ b/daemon/src/image_picker.rs @@ -178,7 +178,7 @@ impl ImagePicker { } // Otherwise pick a new random image that has not been drawn before - // Try 5 times, then get a random image. We do this because it might appen + // Try 5 times, then get a random image. We do this because it might happen // that the queue is bigger than the amount of available wallpapers let mut tries = 5; loop { From d7313d700a0b664095ce44b1851459673eddea13 Mon Sep 17 00:00:00 2001 From: rolv Date: Sun, 2 Jun 2024 21:53:39 +0100 Subject: [PATCH 3/7] fix: formatting --- daemon/src/config.rs | 6 +++--- daemon/src/surface.rs | 3 +-- daemon/src/wallpaper_info.rs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/daemon/src/config.rs b/daemon/src/config.rs index 62cddaf..4966613 100644 --- a/daemon/src/config.rs +++ b/daemon/src/config.rs @@ -38,8 +38,8 @@ pub struct SerializedWallpaperInfo { pub mode: Option, pub queue_size: Option, pub transition_time: Option, - - /// Determines if we should show the transition between black and first + + /// Determines if we should show the transition between black and first /// wallpaper. `Some(false)` means we instantly cut to the first wallpaper, /// `Some(true)` means we fade from black to the first wallpaper. /// @@ -146,7 +146,7 @@ impl SerializedWallpaperInfo { mode, drawn_images_queue_size, transition_time, - initial_transition + initial_transition, }) } } diff --git a/daemon/src/surface.rs b/daemon/src/surface.rs index 135837d..dbc6c19 100644 --- a/daemon/src/surface.rs +++ b/daemon/src/surface.rs @@ -74,8 +74,7 @@ impl Surface { let info = Rc::new(RefCell::new(info)); let renderer = unsafe { - Renderer::new(image.into(), info.clone(), 0) - .expect("unable to create the renderer") + Renderer::new(image.into(), info.clone(), 0).expect("unable to create the renderer") }; let first_transition = !wallpaper_info.initial_transition; diff --git a/daemon/src/wallpaper_info.rs b/daemon/src/wallpaper_info.rs index 240ce4c..5b79d4f 100644 --- a/daemon/src/wallpaper_info.rs +++ b/daemon/src/wallpaper_info.rs @@ -14,7 +14,7 @@ pub struct WallpaperInfo { pub drawn_images_queue_size: usize, pub transition_time: u32, - /// Determines if we should show the transition between black and first + /// Determines if we should show the transition between black and first /// wallpaper. `false` means we instantly cut to the first wallpaper, /// `true` means we fade from black to the first wallpaper. pub initial_transition: bool, From 5fa3e50f6d5f89c36524004b62af6103428c81dd Mon Sep 17 00:00:00 2001 From: rolv Date: Sun, 2 Jun 2024 21:55:39 +0100 Subject: [PATCH 4/7] feat: pause/resume auto wallpaper sequence --- cli/src/main.rs | 2 ++ cli/src/opts.rs | 4 ++++ daemon/src/ipc_server.rs | 15 +++++++++++++++ daemon/src/surface.rs | 30 +++++++++++++++++++++++++++++- ipc/src/lib.rs | 2 ++ 5 files changed, 52 insertions(+), 1 deletion(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index 045f3f6..db78132 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -27,6 +27,8 @@ fn main() { SubCmd::NextWallpaper { monitors } => IpcMessage::NextWallpaper { monitors }, SubCmd::PreviousWallpaper { monitors } => IpcMessage::PreviousWallpaper { monitors }, SubCmd::ReloadWallpaper { monitors } => IpcMessage::ReloadWallpaper { monitors }, + SubCmd::PauseWallpaper { monitors } => IpcMessage::PauseWallpaper { monitors }, + SubCmd::ResumeWallpaper { monitors } => IpcMessage::ResumeWallpaper { monitors }, }; conn.write_all(&serde_json::to_vec(&msg).unwrap()).unwrap(); let mut buf = String::new(); diff --git a/cli/src/opts.rs b/cli/src/opts.rs index da688fa..31ca6ab 100644 --- a/cli/src/opts.rs +++ b/cli/src/opts.rs @@ -22,4 +22,8 @@ pub enum SubCmd { PreviousWallpaper { monitors: Vec }, #[clap(visible_alias = "reload")] ReloadWallpaper { monitors: Vec }, + #[clap(visible_alias = "pause")] + PauseWallpaper { monitors: Vec }, + #[clap(visible_alias = "resume")] + ResumeWallpaper { monitors: Vec }, } diff --git a/daemon/src/ipc_server.rs b/daemon/src/ipc_server.rs index ffdadfe..064ce17 100644 --- a/daemon/src/ipc_server.rs +++ b/daemon/src/ipc_server.rs @@ -123,6 +123,7 @@ pub fn handle_message( IpcResponse::Ok }), + IpcMessage::ReloadWallpaper { monitors } => check_monitors(wpaperd, &monitors).map(|_| { for surface in collect_surfaces(wpaperd, monitors) { surface.image_picker.reload(); @@ -131,6 +132,20 @@ pub fn handle_message( IpcResponse::Ok }), + + IpcMessage::PauseWallpaper { monitors } => check_monitors(wpaperd, &monitors).map(|_| { + for surface in collect_surfaces(wpaperd, monitors) { + surface.pause(); + } + IpcResponse::Ok + }), + + IpcMessage::ResumeWallpaper { monitors } => check_monitors(wpaperd, &monitors).map(|_| { + for surface in collect_surfaces(wpaperd, monitors) { + surface.resume(); + } + IpcResponse::Ok + }), }; let mut stream = BufWriter::new(ustream); diff --git a/daemon/src/surface.rs b/daemon/src/surface.rs index dbc6c19..9048ae8 100644 --- a/daemon/src/surface.rs +++ b/daemon/src/surface.rs @@ -46,6 +46,10 @@ pub struct Surface { /// /// See [crate::wallpaper_info::WallpaperInfo]'s `initial_transition` field skip_next_transition: bool, + /// Pause state of the automatic wallpaper sequence. + /// Setting this to true will mean only an explicit next/previous wallpaper command will change + /// the wallpaper. + paused: bool, } impl Surface { @@ -89,6 +93,7 @@ impl Surface { event_source: None, wallpaper_info, drawn: false, + paused: false, image_loader, loading_image: None, loading_image_tries: 0, @@ -179,7 +184,11 @@ impl Surface { self.renderer .load_wallpaper(data.into(), self.wallpaper_info.mode)?; - let transition_time = if self.skip_next_transition { 0 } else { self.wallpaper_info.transition_time }; + let transition_time = if self.skip_next_transition { + 0 + } else { + self.wallpaper_info.transition_time + }; self.skip_next_transition = false; self.renderer.start_transition(time, transition_time); @@ -397,7 +406,13 @@ impl Surface { return TimeoutAction::Drop; } }; + if let Some(duration) = surface.wallpaper_info.duration { + // Reset the timer if automatic sequence is (still) paused + if surface.is_paused() { + return TimeoutAction::ToDuration(duration); + }; + // Check that the timer has expired // if the daemon received a next or previous image command // the timer will be reset and we need to account that here @@ -435,6 +450,19 @@ impl Surface { self.surface.frame(qh, self.surface.clone()); self.surface.commit(); } + + #[inline] + pub fn pause(&mut self) { + self.paused = true; + } + #[inline] + pub fn resume(&mut self) { + self.paused = false; + } + #[inline] + pub fn is_paused(&self) -> bool { + self.paused + } } fn black_image() -> RgbaImage { diff --git a/ipc/src/lib.rs b/ipc/src/lib.rs index 9315d56..6b1d0e8 100644 --- a/ipc/src/lib.rs +++ b/ipc/src/lib.rs @@ -8,6 +8,8 @@ pub enum IpcMessage { CurrentWallpaper { monitor: String }, NextWallpaper { monitors: Vec }, PreviousWallpaper { monitors: Vec }, + PauseWallpaper { monitors: Vec }, + ResumeWallpaper { monitors: Vec }, AllWallpapers, ReloadWallpaper { monitors: Vec }, } From 489b2161a0dc8184ecea29c9e34cf3eb96c4e1ef Mon Sep 17 00:00:00 2001 From: rolv Date: Tue, 4 Jun 2024 18:44:50 +0100 Subject: [PATCH 5/7] fix: documentation warnings generated by `cargo doc` --- daemon/src/ipc_server.rs | 2 +- daemon/src/socket.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/src/ipc_server.rs b/daemon/src/ipc_server.rs index 064ce17..34eef73 100644 --- a/daemon/src/ipc_server.rs +++ b/daemon/src/ipc_server.rs @@ -1,5 +1,5 @@ //! IPC socket server. -//! Based on https://github.com/catacombing/catacomb/blob/master/src/ipc_server.rs +//! Based on use std::collections::HashSet; use std::fs; diff --git a/daemon/src/socket.rs b/daemon/src/socket.rs index d04ce40..213b5c1 100644 --- a/daemon/src/socket.rs +++ b/daemon/src/socket.rs @@ -1,7 +1,7 @@ //! Calloop socket event source. //! //! This module provides a Calloop event source for Unix domain sockets. -//! https://github.com/catacombing/catacomb/blob/master/src/socket.rs +//! use std::io::{self, ErrorKind}; use std::os::unix::net::{UnixListener, UnixStream}; From 53ba5afd82688d97fef31741af46926c49f91518 Mon Sep 17 00:00:00 2001 From: rolv Date: Tue, 4 Jun 2024 19:41:43 +0100 Subject: [PATCH 6/7] refactor: remove timer entirely when pausing auto wallpaper sequence --- daemon/src/main.rs | 13 +- daemon/src/surface.rs | 280 +++++++++++++++++++++++------------------- 2 files changed, 167 insertions(+), 126 deletions(-) diff --git a/daemon/src/main.rs b/daemon/src/main.rs index 4577d18..2a0c06d 100644 --- a/daemon/src/main.rs +++ b/daemon/src/main.rs @@ -172,12 +172,21 @@ fn run(opts: Opts, xdg_dirs: BaseDirectories) -> Result<()> { // We cannot use WlSurface::frame() because it only works for windows that are // already visible, hence we need to draw for the first time and then commit. wpaperd.surfaces.iter_mut().for_each(|surface| { - if surface.is_configured() && !surface.drawn() { + if !surface.is_configured() { + return; + }; + + if !surface.drawn() { surface.add_timer(None, &event_loop.handle(), qh.clone()); if let Err(err) = surface.draw(&qh, 0) { error!("{err:?}"); - } + }; } + // If the surface has already been drawn for the first time, then handle pausing/resuming + // the automatic wallpaper sequence. + else { + surface.handle_pause_state(&event_loop.handle(), qh.clone()) + }; }); event_loop diff --git a/daemon/src/surface.rs b/daemon/src/surface.rs index 9048ae8..56c77e3 100644 --- a/daemon/src/surface.rs +++ b/daemon/src/surface.rs @@ -27,6 +27,14 @@ use crate::{ }; use crate::{image_loader::ImageLoader, image_picker::ImagePicker}; +#[derive(Debug)] +pub enum EventSource { + NotSet, + Running(RegistrationToken), + // The contained value is the duration that was left on the previous timer, used for starting the next timer. + Paused(Duration), +} + pub struct Surface { pub surface: wl_surface::WlSurface, pub output: WlOutput, @@ -34,7 +42,7 @@ pub struct Surface { egl_context: EglContext, renderer: Renderer, pub image_picker: ImagePicker, - pub event_source: Option, + pub event_source: EventSource, wallpaper_info: WallpaperInfo, info: Rc>, image_loader: Rc>, @@ -49,7 +57,7 @@ pub struct Surface { /// Pause state of the automatic wallpaper sequence. /// Setting this to true will mean only an explicit next/previous wallpaper command will change /// the wallpaper. - paused: bool, + should_pause: bool, } impl Surface { @@ -90,10 +98,10 @@ impl Surface { egl_context, renderer, image_picker, - event_source: None, + event_source: EventSource::NotSet, wallpaper_info, drawn: false, - paused: false, + should_pause: false, image_loader, loading_image: None, loading_image_tries: 0, @@ -299,82 +307,81 @@ impl Surface { qh: &QueueHandle, mut wallpaper_info: WallpaperInfo, ) { - if self.wallpaper_info != wallpaper_info { - // Put the new value in place - std::mem::swap(&mut self.wallpaper_info, &mut wallpaper_info); - let path_changed = self.wallpaper_info.path != wallpaper_info.path; - self.image_picker.update_sorting( - self.wallpaper_info.sorting, - path_changed, - wallpaper_info.drawn_images_queue_size, - ); - if path_changed { - // ask the image_picker to pick a new a image - self.image_picker.next_image(); - self.queue_draw(qh); - } - if self.wallpaper_info.duration != wallpaper_info.duration { - match (self.wallpaper_info.duration, wallpaper_info.duration) { - (None, None) => { - unreachable!() - } - // There was a duration before but now it has been removed - (None, Some(_)) => { - if let Some(registration_token) = self.event_source.take() { - handle.remove(registration_token); - } - } - // There wasn't a duration before but now it has been added or it has changed - (Some(new_duration), None) | (Some(new_duration), Some(_)) => { - if let Some(registration_token) = self.event_source.take() { - handle.remove(registration_token); - } - - // if the path has not changed or the duration has changed - // and the remaining time is great than 0 - let timer = if let (false, Some(remaining_time)) = ( - path_changed, - remaining_duration( - new_duration, - self.image_picker.image_changed_instant, - ), - ) { - Some(Timer::from_duration(remaining_time)) - } else { - // otherwise draw the image immediately, the next timer - // will be set to the new duration - Some(Timer::immediate()) - }; + if self.wallpaper_info == wallpaper_info { + return; + } - self.add_timer(timer, handle, qh.clone()); - } + // Put the new value in place + std::mem::swap(&mut self.wallpaper_info, &mut wallpaper_info); + let path_changed = self.wallpaper_info.path != wallpaper_info.path; + self.image_picker.update_sorting( + self.wallpaper_info.sorting, + path_changed, + wallpaper_info.drawn_images_queue_size, + ); + if path_changed { + // ask the image_picker to pick a new a image + self.image_picker.next_image(); + self.queue_draw(qh); + } + if self.wallpaper_info.duration != wallpaper_info.duration { + match (self.wallpaper_info.duration, wallpaper_info.duration) { + (None, None) => { + unreachable!() } - } - if self.wallpaper_info.mode != wallpaper_info.mode { - if let Err(err) = self - .egl_context - .make_current() - .and_then(|_| self.renderer.set_mode(self.wallpaper_info.mode, false)) - { - error!("{err:?}"); + // There was a duration before but now it has been removed + (None, Some(_)) => { + if let EventSource::Running(registration_token) = self.event_source { + handle.remove(registration_token); + } } - if !path_changed { - // We should draw immediately - if let Err(err) = self.draw(qh, 0) { - warn!("{err:?}"); + // There wasn't a duration before but now it has been added or it has changed + (Some(new_duration), None) | (Some(new_duration), Some(_)) => { + if let EventSource::Running(registration_token) = self.event_source { + handle.remove(registration_token); } + + // if the path has not changed or the duration has changed + // and the remaining time is great than 0 + let timer = if let (false, Some(remaining_time)) = ( + path_changed, + remaining_duration(new_duration, self.image_picker.image_changed_instant), + ) { + Some(Timer::from_duration(remaining_time)) + } else { + // otherwise draw the image immediately, the next timer + // will be set to the new duration + Some(Timer::immediate()) + }; + + self.add_timer(timer, handle, qh.clone()); } } - if self.wallpaper_info.drawn_images_queue_size != wallpaper_info.drawn_images_queue_size + } + + if self.wallpaper_info.mode != wallpaper_info.mode { + if let Err(err) = self + .egl_context + .make_current() + .and_then(|_| self.renderer.set_mode(self.wallpaper_info.mode, false)) { - self.image_picker - .update_queue_size(self.wallpaper_info.drawn_images_queue_size); + error!("{err:?}"); } - if self.wallpaper_info.transition_time != wallpaper_info.transition_time { - self.renderer - .update_transition_time(self.wallpaper_info.transition_time); + if !path_changed { + // We should draw immediately + if let Err(err) = self.draw(qh, 0) { + warn!("{err:?}"); + } } } + if self.wallpaper_info.drawn_images_queue_size != wallpaper_info.drawn_images_queue_size { + self.image_picker + .update_queue_size(self.wallpaper_info.drawn_images_queue_size); + } + if self.wallpaper_info.transition_time != wallpaper_info.transition_time { + self.renderer + .update_transition_time(self.wallpaper_info.transition_time); + } } /// Add a new timer in the event_loop for the current duration @@ -385,59 +392,76 @@ impl Surface { handle: &LoopHandle, qh: QueueHandle, ) { - if let Some(duration) = self.wallpaper_info.duration { - let timer = timer.unwrap_or(Timer::from_duration(duration)); - if self.event_source.is_some() { - return; - } + if matches!(self.event_source, EventSource::Running(_)) { + return; + } + let Some(duration) = self.wallpaper_info.duration else { + return; + }; - let name = self.name().clone(); - let registration_token = handle - .insert_source( - timer, - move |_deadline, _: &mut (), wpaperd: &mut Wpaperd| { - let surface = match wpaperd - .surface_from_name(&name) - .with_context(|| format!("expecting surface {name} to be available")) + let timer = timer.unwrap_or(Timer::from_duration(duration)); + + let name = self.name().clone(); + let registration_token = handle + .insert_source( + timer, + move |_deadline, _: &mut (), wpaperd: &mut Wpaperd| { + let surface = match wpaperd + .surface_from_name(&name) + .with_context(|| format!("expecting surface {name} to be available")) + { + Ok(surface) => surface, + Err(err) => { + error!("{err:?}"); + return TimeoutAction::Drop; + } + }; + + if let Some(duration) = surface.wallpaper_info.duration { + // Check that the timer has expired + // if the daemon received a next or previous image command + // the timer will be reset and we need to account that here + // i.e. there is a timer of 1 minute. The user changes the image + // with a previous wallpaper command at 50 seconds. + // The timer will be reset to 1 minute and the image will be changed + if let Some(remaining_time) = + remaining_duration(duration, surface.image_picker.image_changed_instant) { - Ok(surface) => surface, - Err(err) => { - error!("{err:?}"); - return TimeoutAction::Drop; - } - }; - - if let Some(duration) = surface.wallpaper_info.duration { - // Reset the timer if automatic sequence is (still) paused - if surface.is_paused() { - return TimeoutAction::ToDuration(duration); - }; - - // Check that the timer has expired - // if the daemon received a next or previous image command - // the timer will be reset and we need to account that here - // i.e. there is a timer of 1 minute. The user changes the image - // with a previous wallpaper command at 50 seconds. - // The timer will be reset to 1 minute and the image will be changed - if let Some(remaining_time) = remaining_duration( - duration, - surface.image_picker.image_changed_instant, - ) { - TimeoutAction::ToDuration(remaining_time) - } else { - // Change the drawn image - surface.image_picker.next_image(); - surface.queue_draw(&qh); - TimeoutAction::ToDuration(duration) - } + TimeoutAction::ToDuration(remaining_time) } else { - TimeoutAction::Drop + // Change the drawn image + surface.image_picker.next_image(); + surface.queue_draw(&qh); + TimeoutAction::ToDuration(duration) } - }, - ) - .expect("Failed to insert event source!"); + } else { + TimeoutAction::Drop + } + }, + ) + .expect("Failed to insert event source!"); + + self.event_source = EventSource::Running(registration_token); + } - self.event_source = Some(registration_token); + /// Handle updating the timer based on the pause state of the automatic wallpaper sequence. + /// Remove the timer if pausing, and add a new timer with the remaining duration of the old + /// timer when resuming. + pub fn handle_pause_state(&mut self, handle: &LoopHandle, qh: QueueHandle) { + match (self.should_pause, &self.event_source) { + // Should pause, but timer is still currently running + (true, EventSource::Running(registration_token)) => { + let remaining_duration = self.get_remaining_duration().unwrap_or_default(); + + handle.remove(*registration_token); + self.event_source = EventSource::Paused(remaining_duration); + } + // Should resume, but timer is not currently running + (false, EventSource::Paused(duration)) => { + self.add_timer(Some(Timer::from_duration(*duration)), handle, qh.clone()); + } + // Otherwise no update is necessary + (_, _) => {} } } @@ -452,16 +476,24 @@ impl Surface { } #[inline] - pub fn pause(&mut self) { - self.paused = true; + fn get_remaining_duration(&self) -> Option { + let duration = self.wallpaper_info.duration?; + remaining_duration(duration, self.image_picker.image_changed_instant) } + + /// Indicate to the main event loop that the automatic wallpaper sequence for this [`Surface`] + /// should be paused. + /// The actual pausing/resuming is handled in [`Surface::handle_pause_state`] #[inline] - pub fn resume(&mut self) { - self.paused = false; + pub fn pause(&mut self) { + self.should_pause = true; } + /// Indicate to the main event loop that the automatic wallpaper sequence for this [`Surface`] + /// should be resumed. + /// The actual pausing/resuming is handled in [`Surface::handle_pause_state`] #[inline] - pub fn is_paused(&self) -> bool { - self.paused + pub fn resume(&mut self) { + self.should_pause = false; } } From 3cb1079cb9d7c4c1b59ae8a5c7589d5474c84999 Mon Sep 17 00:00:00 2001 From: rolv Date: Tue, 4 Jun 2024 19:51:16 +0100 Subject: [PATCH 7/7] fix: reloading config --- daemon/src/surface.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/daemon/src/surface.rs b/daemon/src/surface.rs index 56c77e3..6548dd8 100644 --- a/daemon/src/surface.rs +++ b/daemon/src/surface.rs @@ -354,6 +354,7 @@ impl Surface { Some(Timer::immediate()) }; + self.event_source = EventSource::NotSet; self.add_timer(timer, handle, qh.clone()); } }