From a9ce6b166fc081b8b1e8748166ce02083c81e7cc Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Mon, 18 Mar 2024 19:16:53 -0700 Subject: [PATCH] cosmic-screencopy-v2 --- Cargo.lock | 353 ++++++++++-------- cosmic-applet-minimize/src/wayland_handler.rs | 113 ++++-- 2 files changed, 268 insertions(+), 198 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 622c3aaa..aaa2ad7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -125,9 +125,9 @@ dependencies = [ [[package]] name = "arc-swap" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3d0060af21e8d11a926981cc00c6c1541aa91dd64b9f881985c3da1094425f" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "arrayref" @@ -226,7 +226,7 @@ dependencies = [ "async-lock 3.3.0", "async-task", "concurrent-queue", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-lite 2.3.0", "slab", ] @@ -275,8 +275,8 @@ dependencies = [ "futures-io", "futures-lite 2.3.0", "parking", - "polling 3.5.0", - "rustix 0.38.31", + "polling 3.6.0", + "rustix 0.38.32", "slab", "tracing", "windows-sys 0.52.0", @@ -315,7 +315,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.31", + "rustix 0.38.32", "windows-sys 0.48.0", ] @@ -327,7 +327,7 @@ checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -342,7 +342,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.31", + "rustix 0.38.32", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -356,13 +356,13 @@ checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" [[package]] name = "async-trait" -version = "0.1.78" +version = "0.1.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" +checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -388,7 +388,7 @@ name = "atomicwrites" version = "0.4.2" source = "git+https://github.com/jackpot51/rust-atomicwrites#043ab4859d53ffd3d55334685303d8df39c9f768" dependencies = [ - "rustix 0.38.31", + "rustix 0.38.32", "tempfile", "windows-sys 0.48.0", ] @@ -449,9 +449,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -497,9 +497,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ "serde", ] @@ -528,7 +528,7 @@ dependencies = [ "async-channel", "async-lock 3.3.0", "async-task", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", "futures-lite 2.3.0", "piper", @@ -587,7 +587,7 @@ checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -598,9 +598,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cairo-sys-rs" @@ -618,10 +618,10 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "log", - "polling 3.5.0", - "rustix 0.38.31", + "polling 3.6.0", + "rustix 0.38.32", "slab", "thiserror", ] @@ -633,7 +633,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" dependencies = [ "calloop", - "rustix 0.38.31", + "rustix 0.38.32", "wayland-backend", "wayland-client", ] @@ -873,8 +873,8 @@ dependencies = [ name = "cosmic-app-list" version = "0.1.0" dependencies = [ - "cosmic-client-toolkit", - "cosmic-protocols", + "cosmic-client-toolkit 0.1.0 (git+https://github.com/pop-os/cosmic-protocols?rev=e65fa5e)", + "cosmic-protocols 0.1.0 (git+https://github.com/pop-os/cosmic-protocols?rev=e65fa5e)", "futures", "i18n-embed", "i18n-embed-fl", @@ -966,7 +966,7 @@ dependencies = [ "memmap2 0.9.4", "once_cell", "rust-embed", - "rustix 0.38.31", + "rustix 0.38.32", "tokio", "tracing", "tracing-log", @@ -1024,7 +1024,7 @@ dependencies = [ "logind-zbus", "once_cell", "rust-embed", - "rustix 0.38.31", + "rustix 0.38.32", "tracing", "tracing-log", "tracing-subscriber", @@ -1050,9 +1050,9 @@ name = "cosmic-applet-tiling" version = "0.1.0" dependencies = [ "anyhow", - "cosmic-client-toolkit", + "cosmic-client-toolkit 0.1.0 (git+https://github.com/pop-os/cosmic-protocols?rev=e65fa5e)", "cosmic-comp-config", - "cosmic-protocols", + "cosmic-protocols 0.1.0 (git+https://github.com/pop-os/cosmic-protocols?rev=e65fa5e)", "cosmic-time", "i18n-embed", "i18n-embed-fl", @@ -1086,8 +1086,8 @@ name = "cosmic-applet-workspaces" version = "0.1.1" dependencies = [ "anyhow", - "cosmic-client-toolkit", - "cosmic-protocols", + "cosmic-client-toolkit 0.1.0 (git+https://github.com/pop-os/cosmic-protocols?rev=e65fa5e)", + "cosmic-protocols 0.1.0 (git+https://github.com/pop-os/cosmic-protocols?rev=e65fa5e)", "futures", "i18n-embed", "i18n-embed-fl", @@ -1122,12 +1122,23 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "cosmic-client-toolkit" +version = "0.1.0" +source = "git+https://github.com/pop-os/cosmic-protocols?rev=1cc4a13#1cc4a1393d0f8be4d444666e260fdb811b400f49" +dependencies = [ + "cosmic-protocols 0.1.0 (git+https://github.com/pop-os/cosmic-protocols?rev=1cc4a13)", + "libc", + "smithay-client-toolkit 0.18.0", + "wayland-client", +] + [[package]] name = "cosmic-client-toolkit" version = "0.1.0" source = "git+https://github.com/pop-os/cosmic-protocols?rev=e65fa5e#e65fa5e2bb47e51656221657049bd3f88ae9dae5" dependencies = [ - "cosmic-protocols", + "cosmic-protocols 0.1.0 (git+https://github.com/pop-os/cosmic-protocols?rev=e65fa5e)", "smithay-client-toolkit 0.18.0", "wayland-client", ] @@ -1145,7 +1156,7 @@ dependencies = [ [[package]] name = "cosmic-config" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "atomicwrites", "cosmic-config-derive", @@ -1165,7 +1176,7 @@ dependencies = [ [[package]] name = "cosmic-config-derive" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "quote", "syn 1.0.109", @@ -1176,7 +1187,7 @@ name = "cosmic-dbus-networkmanager" version = "0.1.0" source = "git+https://github.com/pop-os/dbus-settings-bindings#8b9767f6cedede2def12941ce89e14bfcd913aeb" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "derive_builder", "procfs", "thiserror", @@ -1188,7 +1199,7 @@ dependencies = [ [[package]] name = "cosmic-notifications-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-notifications#63a1e46f54a0af3fdee35f49b9f3e0baf6baf186" +source = "git+https://github.com/pop-os/cosmic-notifications#4ea0564a062277a1e1a8bd82add40a00f20b5f3f" dependencies = [ "cosmic-config", "serde", @@ -1197,7 +1208,7 @@ dependencies = [ [[package]] name = "cosmic-notifications-util" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-notifications#63a1e46f54a0af3fdee35f49b9f3e0baf6baf186" +source = "git+https://github.com/pop-os/cosmic-notifications#4ea0564a062277a1e1a8bd82add40a00f20b5f3f" dependencies = [ "bytemuck", "fast_image_resize", @@ -1218,7 +1229,7 @@ dependencies = [ [[package]] name = "cosmic-panel-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-panel#3aad7907ee6b5506cf800c2a838176bacfcfa8ad" +source = "git+https://github.com/pop-os/cosmic-panel#6590999f80459726bf026a4529711be7af8eb316" dependencies = [ "anyhow", "cosmic-config", @@ -1230,12 +1241,25 @@ dependencies = [ "xdg-shell-wrapper-config", ] +[[package]] +name = "cosmic-protocols" +version = "0.1.0" +source = "git+https://github.com/pop-os/cosmic-protocols?rev=1cc4a13#1cc4a1393d0f8be4d444666e260fdb811b400f49" +dependencies = [ + "bitflags 2.5.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", + "wayland-server", +] + [[package]] name = "cosmic-protocols" version = "0.1.0" source = "git+https://github.com/pop-os/cosmic-protocols?rev=e65fa5e#e65fa5e2bb47e51656221657049bd3f88ae9dae5" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "wayland-backend", "wayland-client", "wayland-protocols", @@ -1254,9 +1278,9 @@ dependencies = [ [[package]] name = "cosmic-text" version = "0.11.2" -source = "git+https://github.com/pop-os/cosmic-text.git#b08676909f882f553ab574601b35b58276a52458" +source = "git+https://github.com/pop-os/cosmic-text.git#ff5501d9a36e51c50d908413caf7632d8f7533b7" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "fontdb", "libm", "log", @@ -1276,7 +1300,7 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "almost", "cosmic-config", @@ -1390,7 +1414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1418,7 +1442,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", "synstructure", ] @@ -1427,7 +1451,7 @@ name = "d3d12" version = "0.19.0" source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libloading 0.8.3", "winapi", ] @@ -1477,7 +1501,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1499,7 +1523,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core 0.20.8", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1614,7 +1638,7 @@ dependencies = [ "darling 0.20.8", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1682,7 +1706,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1715,11 +1739,11 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0f8a69e60d75ae7dab4ef26a59ca99f2a89d4c142089b537775ae0c198bdcde" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bytemuck", "drm-ffi", "drm-fourcc", - "rustix 0.38.31", + "rustix 0.38.32", ] [[package]] @@ -1729,7 +1753,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41334f8405792483e32ad05fbb9c5680ff4e84491883d2947a4757dc54cb2ac6" dependencies = [ "drm-sys", - "rustix 0.38.31", + "rustix 0.38.32", ] [[package]] @@ -1783,7 +1807,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1929,9 +1953,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fdeflate" @@ -2094,7 +2118,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -2227,7 +2251,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-core", "futures-io", "parking", @@ -2242,7 +2266,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -2471,7 +2495,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "gpu-alloc-types", ] @@ -2481,7 +2505,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", ] [[package]] @@ -2503,7 +2527,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "gpu-descriptor-types", "hashbrown", ] @@ -2514,7 +2538,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", ] [[package]] @@ -2577,7 +2601,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "com", "libc", "libloading 0.8.3", @@ -2592,6 +2616,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.3.9" @@ -2663,7 +2693,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.53", + "syn 2.0.55", "unic-langid", ] @@ -2677,7 +2707,7 @@ dependencies = [ "i18n-config", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -2706,7 +2736,7 @@ dependencies = [ [[package]] name = "iced" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "iced_accessibility", "iced_core", @@ -2722,7 +2752,7 @@ dependencies = [ [[package]] name = "iced_accessibility" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "accesskit", "accesskit_unix", @@ -2731,7 +2761,7 @@ dependencies = [ [[package]] name = "iced_core" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "bitflags 1.3.2", "iced_accessibility", @@ -2751,7 +2781,7 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "futures", "iced_core", @@ -2764,7 +2794,7 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -2788,7 +2818,7 @@ dependencies = [ [[package]] name = "iced_renderer" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -2800,7 +2830,7 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "iced_accessibility", "iced_core", @@ -2813,7 +2843,7 @@ dependencies = [ [[package]] name = "iced_sctk" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "enum-repr", "float-cmp", @@ -2839,7 +2869,7 @@ dependencies = [ [[package]] name = "iced_style" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "iced_core", "once_cell", @@ -2849,7 +2879,7 @@ dependencies = [ [[package]] name = "iced_tiny_skia" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "bytemuck", "cosmic-text", @@ -2866,7 +2896,7 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -2885,7 +2915,7 @@ dependencies = [ [[package]] name = "iced_widget" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "iced_renderer", "iced_runtime", @@ -2950,9 +2980,9 @@ checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", @@ -2984,7 +3014,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7911ce3db9c10c5ab4a35c49af778a5f9a827bd0f7371d9be56175d8dd2740d0" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "input-sys", "io-lifetimes 1.0.11", "libc", @@ -3161,12 +3191,12 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#01d7e46feadccf70825c3a822a566fb266d3add6" +source = "git+https://github.com/pop-os/libcosmic#8afd6490da67704abf9480692abfe33b0780c9c9" dependencies = [ "apply", "ashpd 0.7.0", "chrono", - "cosmic-client-toolkit", + "cosmic-client-toolkit 0.1.0 (git+https://github.com/pop-os/cosmic-protocols?rev=1cc4a13)", "cosmic-config", "cosmic-panel-config", "cosmic-settings-daemon", @@ -3270,7 +3300,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", "redox_syscall 0.4.1", ] @@ -3475,7 +3505,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "block", "core-graphics-types", "foreign-types", @@ -3545,7 +3575,7 @@ source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b802 dependencies = [ "arrayvec", "bit-set", - "bitflags 2.4.2", + "bitflags 2.5.0", "codespan-reporting", "hexf-parse", "indexmap", @@ -3576,7 +3606,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "libc", ] @@ -3587,7 +3617,7 @@ version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "crossbeam-channel", "filetime", "fsevent-sys", @@ -3669,7 +3699,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3821,11 +3851,11 @@ version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec4c6225c69b4ca778c0aea097321a64c421cf4577b331c61b229267edabb6f8" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3855,7 +3885,7 @@ checksum = "e8890702dbec0bad9116041ae586f84805b13eecd1d8b1df27c29998a9969d6d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3966,7 +3996,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4001,7 +4031,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4023,7 +4053,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" dependencies = [ "atomic-waker", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", ] @@ -4064,14 +4094,15 @@ dependencies = [ [[package]] name = "polling" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" +checksum = "e0c976a60b2d7e99d6f229e414670a9b85d13ac305cc6d1e9c134de58c5aaaf6" dependencies = [ "cfg-if", "concurrent-queue", + "hermit-abi", "pin-project-lite", - "rustix 0.38.31", + "rustix 0.38.32", "tracing", "windows-sys 0.52.0", ] @@ -4143,11 +4174,11 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "731e0d9356b0c25f16f33b5be79b1c57b562f141ebfcdb0ad8ac2c13a24293b4" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "hex", "lazy_static", "procfs-core", - "rustix 0.38.31", + "rustix 0.38.32", ] [[package]] @@ -4156,7 +4187,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3554923a69f4ce04c4a754260c338f505ce22642d3830e049a399fc2059a29" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "hex", ] @@ -4249,9 +4280,9 @@ checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" [[package]] name = "rayon" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -4313,9 +4344,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -4418,7 +4449,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ "base64", - "bitflags 2.4.2", + "bitflags 2.5.0", "serde", "serde_derive", ] @@ -4449,7 +4480,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.53", + "syn 2.0.55", "walkdir", ] @@ -4501,11 +4532,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys 0.4.13", @@ -4524,7 +4555,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0ae5692c5beaad6a9e22830deeed7874eae8a4e3ba4076fb48e12c56856222c" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bytemuck", "libm", "smallvec", @@ -4594,7 +4625,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4616,7 +4647,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4715,16 +4746,16 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smithay-client-toolkit" version = "0.18.0" source = "git+https://github.com/smithay/client-toolkit//?rev=e63ab5f#e63ab5f01964bc48766fc4c3bf79cc05dc59874c" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bytemuck", "calloop", "calloop-wayland-source", @@ -4733,7 +4764,7 @@ dependencies = [ "log", "memmap2 0.9.4", "pkg-config", - "rustix 0.38.31", + "rustix 0.38.32", "thiserror", "wayland-backend", "wayland-client", @@ -4752,14 +4783,14 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "calloop", "calloop-wayland-source", "cursor-icon", "libc", "log", "memmap2 0.9.4", - "rustix 0.38.31", + "rustix 0.38.32", "thiserror", "wayland-backend", "wayland-client", @@ -4821,7 +4852,7 @@ dependencies = [ "cocoa", "core-graphics", "drm", - "fastrand 2.0.1", + "fastrand 2.0.2", "foreign-types", "js-sys", "log", @@ -4829,7 +4860,7 @@ dependencies = [ "objc", "raw-window-handle 0.6.0", "redox_syscall 0.4.1", - "rustix 0.38.31", + "rustix 0.38.32", "tiny-xlib", "wasm-bindgen", "wayland-backend", @@ -4855,7 +4886,7 @@ version = "0.3.0+sdk-1.3.268.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", ] [[package]] @@ -4894,11 +4925,11 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4949,9 +4980,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.53" +version = "2.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" dependencies = [ "proc-macro2", "quote", @@ -4966,7 +4997,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4980,12 +5011,12 @@ dependencies = [ [[package]] name = "system-deps" -version = "6.2.1" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e9199467bcbc77c6a13cc6e32a6af21721ab8c96aa0261856c4fda5a4433f0" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" dependencies = [ "cfg-expr", - "heck", + "heck 0.5.0", "pkg-config", "toml 0.8.12", "version-compare", @@ -5010,9 +5041,9 @@ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "temp-dir" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd16aa9ffe15fe021c6ee3766772132c6e98dfa395a167e16864f61a9cfb71d6" +checksum = "1f227968ec00f0e5322f9b8173c7a0cbcff6181a0a5b28e9892491c286277231" [[package]] name = "tempfile" @@ -5021,8 +5052,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", - "fastrand 2.0.1", - "rustix 0.38.31", + "fastrand 2.0.2", + "rustix 0.38.32", "windows-sys 0.52.0", ] @@ -5052,7 +5083,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5205,7 +5236,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5237,7 +5268,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.8", + "toml_edit 0.22.9", ] [[package]] @@ -5262,9 +5293,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.8" +version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c12219811e0c1ba077867254e5ad62ee2c9c190b0d957110750ac0cda1ae96cd" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" dependencies = [ "indexmap", "serde", @@ -5292,7 +5323,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5568,9 +5599,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "version-compare" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "version_check" @@ -5621,7 +5652,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", "wasm-bindgen-shared", ] @@ -5655,7 +5686,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5689,7 +5720,7 @@ checksum = "9d50fa61ce90d76474c87f5fc002828d81b32677340112b4ef08079a9d459a40" dependencies = [ "cc", "downcast-rs", - "rustix 0.38.31", + "rustix 0.38.32", "scoped-tls", "smallvec", "wayland-sys", @@ -5701,8 +5732,8 @@ version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f" dependencies = [ - "bitflags 2.4.2", - "rustix 0.38.31", + "bitflags 2.5.0", + "rustix 0.38.32", "wayland-backend", "wayland-scanner", ] @@ -5713,7 +5744,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cursor-icon", "wayland-backend", ] @@ -5724,7 +5755,7 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71ce5fa868dd13d11a0d04c5e2e65726d0897be8de247c0c5a65886e283231ba" dependencies = [ - "rustix 0.38.31", + "rustix 0.38.32", "wayland-client", "xcursor", ] @@ -5735,7 +5766,7 @@ version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "wayland-backend", "wayland-client", "wayland-scanner", @@ -5748,7 +5779,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "wayland-backend", "wayland-client", "wayland-protocols", @@ -5773,10 +5804,10 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00e6e4d5c285bc24ba4ed2d5a4bd4febd5fd904451f465973225c8e99772fdb7" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "downcast-rs", "io-lifetimes 2.0.3", - "rustix 0.38.31", + "rustix 0.38.32", "wayland-backend", "wayland-scanner", ] @@ -5850,7 +5881,7 @@ source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b802 dependencies = [ "arrayvec", "bit-vec", - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg_aliases 0.1.1", "codespan-reporting", "indexmap", @@ -5877,7 +5908,7 @@ dependencies = [ "arrayvec", "ash", "bit-set", - "bitflags 2.4.2", + "bitflags 2.5.0", "block", "cfg_aliases 0.1.1", "core-graphics-types", @@ -5916,7 +5947,7 @@ name = "wgpu-types" version = "0.19.0" source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "js-sys", "web-sys", ] @@ -6152,7 +6183,7 @@ dependencies = [ "libc", "libloading 0.8.3", "once_cell", - "rustix 0.38.31", + "rustix 0.38.32", "x11rb-protocol", ] @@ -6210,7 +6241,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "dlib", "log", "once_cell", @@ -6340,7 +6371,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] diff --git a/cosmic-applet-minimize/src/wayland_handler.rs b/cosmic-applet-minimize/src/wayland_handler.rs index d17a6a3b..15636a77 100644 --- a/cosmic-applet-minimize/src/wayland_handler.rs +++ b/cosmic-applet-minimize/src/wayland_handler.rs @@ -24,14 +24,16 @@ use cosmic::{ self, cosmic_protocols::{ self, - screencopy::v1::client::{ - zcosmic_screencopy_manager_v1, zcosmic_screencopy_session_v1, + image_source::v1::client::zcosmic_toplevel_image_source_manager_v1::ZcosmicToplevelImageSourceManagerV1, + screencopy::v2::client::{ + zcosmic_screencopy_frame_v2, zcosmic_screencopy_manager_v2, + zcosmic_screencopy_session_v2, }, toplevel_info::v1::client::zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1, }, screencopy::{ - BufferInfo, ScreencopyHandler, ScreencopySessionData, ScreencopySessionDataExt, - ScreencopyState, + capture, Formats, Frame, ScreencopyFrameData, ScreencopyFrameDataExt, + ScreencopyHandler, ScreencopySessionData, ScreencopySessionDataExt, ScreencopyState, }, sctk::shm::{Shm, ShmHandler}, wayland_client::{ @@ -55,8 +57,8 @@ use wayland_client::{globals::registry_queue_init, Connection, QueueHandle}; #[derive(Default)] struct SessionInner { - buffer_infos: Option>, - res: Option>>, + formats: Option, + res: Option>>, } // TODO: dmabuf? need to handle modifier negotation @@ -72,9 +74,14 @@ struct SessionData { session_data: ScreencopySessionData, } +struct FrameData { + frame_data: ScreencopyFrameData, + session: zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, +} + impl Session { pub fn for_session( - session: &zcosmic_screencopy_session_v1::ZcosmicScreencopySessionV1, + session: &zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, ) -> Option<&Self> { Some(&session.data::()?.session) } @@ -96,6 +103,13 @@ impl ScreencopySessionDataExt for SessionData { &self.session_data } } + +impl ScreencopyFrameDataExt for FrameData { + fn screencopy_frame_data(&self) -> &ScreencopyFrameData { + &self.frame_data + } +} + struct AppData { exit: bool, tx: UnboundedSender, @@ -113,7 +127,8 @@ struct CaptureData { qh: QueueHandle, conn: Connection, wl_shm: WlShm, - screencopy_manager: zcosmic_screencopy_manager_v1::ZcosmicScreencopyManagerV1, + screencopy_manager: zcosmic_screencopy_manager_v2::ZcosmicScreencopyManagerV2, + toplevel_source_manager: ZcosmicToplevelImageSourceManagerV1, } impl CaptureData { @@ -131,9 +146,12 @@ impl CaptureData { let overlay_cursor = if overlay_cursor { 1 } else { 0 }; let session = Arc::new(Session::default()); - let screencopy_session = self.screencopy_manager.capture_toplevel( - &source, - zcosmic_screencopy_manager_v1::CursorMode::Hidden, // XXX take into account adventised capabilities + let image_source = self + .toplevel_source_manager + .create_source(&source, &self.qh, ()); + let screencopy_session = self.screencopy_manager.create_session( + &image_source, + zcosmic_screencopy_manager_v2::Options::empty(), &self.qh, SessionData { session: session.clone(), @@ -142,23 +160,24 @@ impl CaptureData { ); self.conn.flush().unwrap(); - let buffer_infos = session - .wait_while(|data| data.buffer_infos.is_none()) - .buffer_infos + let formats = session + .wait_while(|data| data.formats.is_none()) + .formats .take() .unwrap(); + let (width, height) = formats.buffer_size; // XXX - let Some(buffer_info) = buffer_infos.iter().find(|x| { - x.type_ == WEnum::Value(zcosmic_screencopy_session_v1::BufferType::WlShm) - && x.format == wl_shm::Format::Abgr8888.into() - }) else { + if !formats + .shm_formats + .contains(&wl_shm::Format::Abgr8888.into()) + { tracing::error!("No suitable buffer format found"); - tracing::warn!("Available formats: {:#?}", buffer_infos); + tracing::warn!("Available formats: {:#?}", formats); return None; }; - let buf_len = buffer_info.stride * buffer_info.height; + let buf_len = width * height * 4; if let Some(len) = len { if len != buf_len { return None; @@ -170,16 +189,24 @@ impl CaptureData { .create_pool(fd.as_fd(), buf_len as i32, &self.qh, ()); let buffer = pool.create_buffer( 0, - buffer_info.width as i32, - buffer_info.height as i32, - buffer_info.stride as i32, + width as i32, + height as i32, + width as i32 * 4, wl_shm::Format::Abgr8888, &self.qh, (), ); - screencopy_session.attach_buffer(&buffer, None, 0); // XXX age? - screencopy_session.commit(zcosmic_screencopy_session_v1::Options::empty()); + capture( + &screencopy_session, + &buffer, + &[], + &self.qh, + FrameData { + frame_data: Default::default(), + session: screencopy_session.clone(), + }, + ); self.conn.flush().unwrap(); // TODO: wait for server to release buffer? @@ -194,11 +221,7 @@ impl CaptureData { //std::thread::sleep(std::time::Duration::from_millis(16)); if res.is_ok() { - Some(ShmImage { - fd, - width: buffer_info.width, - height: buffer_info.height, - }) + Some(ShmImage { fd, width, height }) } else { None } @@ -277,6 +300,11 @@ impl AppData { conn: self.conn.clone(), wl_shm: self.shm_state.wl_shm().clone(), screencopy_manager: self.screencopy_state.screencopy_manager.clone(), + toplevel_source_manager: self + .screencopy_state + .toplevel_source_manager + .clone() + .unwrap(), }; std::thread::spawn(move || { use std::ffi::CStr; @@ -488,11 +516,11 @@ impl ScreencopyHandler for AppData { &mut self, _conn: &Connection, _qh: &QueueHandle, - session: &zcosmic_screencopy_session_v1::ZcosmicScreencopySessionV1, - buffer_infos: &[BufferInfo], + session: &zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, + formats: &Formats, ) { Session::for_session(session).unwrap().update(|data| { - data.buffer_infos = Some(buffer_infos.to_vec()); + data.formats = Some(formats.clone()); }); } @@ -500,8 +528,10 @@ impl ScreencopyHandler for AppData { &mut self, _conn: &Connection, _qh: &QueueHandle, - session: &zcosmic_screencopy_session_v1::ZcosmicScreencopySessionV1, + screencopy_frame: &zcosmic_screencopy_frame_v2::ZcosmicScreencopyFrameV2, + _frame: Frame, ) { + let session = &screencopy_frame.data::().unwrap().session; Session::for_session(session).unwrap().update(|data| { data.res = Some(Ok(())); }); @@ -512,15 +542,24 @@ impl ScreencopyHandler for AppData { &mut self, _conn: &Connection, _qh: &QueueHandle, - session: &zcosmic_screencopy_session_v1::ZcosmicScreencopySessionV1, - reason: WEnum, + screencopy_frame: &zcosmic_screencopy_frame_v2::ZcosmicScreencopyFrameV2, + reason: WEnum, ) { // TODO send message to thread + let session = &screencopy_frame.data::().unwrap().session; Session::for_session(session).unwrap().update(|data| { data.res = Some(Err(reason)); }); session.destroy(); } + + fn stopped( + &mut self, + _conn: &Connection, + _qh: &QueueHandle, + _session: &zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, + ) { + } } impl Dispatch for AppData { @@ -552,4 +591,4 @@ sctk::delegate_seat!(AppData); sctk::delegate_registry!(AppData); cctk::delegate_toplevel_info!(AppData); cctk::delegate_toplevel_manager!(AppData); -cctk::delegate_screencopy!(AppData, session: [SessionData]); +cctk::delegate_screencopy!(AppData, session: [SessionData], frame: [FrameData]);