Upgrade `zbus` and `async-io`
Browse files at this commit0113292cf6a77aea55739c7e779a891786aa35bdParent: 4741ab212 changed files +236 -66
- Cargo.lock +186 -20
- Cargo.toml +2 -2
- src/dbus/freedesktop_screensaver.rs +5 -4
- src/dbus/gnome_shell_introspect.rs +5 -4
- src/dbus/gnome_shell_screenshot.rs +2 -2
- src/dbus/mod.rs +1 -1
- src/dbus/mutter_display_config.rs +5 -4
- src/dbus/mutter_screen_cast.rs +16 -15
- src/dbus/mutter_service_channel.rs +6 -7
- src/niri.rs +4 -4
- src/pw_utils.rs +2 -2
- src/utils/spawning.rs +2 -1
Cargo.lockmodified+186 -20
| @@ -183,6 +183,18 @@ dependencies = [ | ||
| 183 | 183 | "futures-core", |
| 184 | 184 | ] |
| 185 | 185 | |
| 186 | +[[package]] | |
| 187 | +name = "async-broadcast" | |
| 188 | +version = "0.7.1" | |
| 189 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 190 | +checksum = "20cd0e2e25ea8e5f7e9df04578dc6cf5c83577fd09b1a46aaf5c85e1c33f2a7e" | |
| 191 | +dependencies = [ | |
| 192 | + "event-listener 5.3.1", | |
| 193 | + "event-listener-strategy", | |
| 194 | + "futures-core", | |
| 195 | + "pin-project-lite", | |
| 196 | +] | |
| 197 | + | |
| 186 | 198 | [[package]] |
| 187 | 199 | name = "async-channel" |
| 188 | 200 | version = "2.3.1" |
| @@ -220,6 +232,17 @@ dependencies = [ | ||
| 220 | 232 | "futures-lite 1.13.0", |
| 221 | 233 | ] |
| 222 | 234 | |
| 235 | +[[package]] | |
| 236 | +name = "async-fs" | |
| 237 | +version = "2.1.2" | |
| 238 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 239 | +checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a" | |
| 240 | +dependencies = [ | |
| 241 | + "async-lock 3.4.0", | |
| 242 | + "blocking", | |
| 243 | + "futures-lite 2.3.0", | |
| 244 | +] | |
| 245 | + | |
| 223 | 246 | [[package]] |
| 224 | 247 | name = "async-io" |
| 225 | 248 | version = "1.13.0" |
| @@ -242,9 +265,9 @@ dependencies = [ | ||
| 242 | 265 | |
| 243 | 266 | [[package]] |
| 244 | 267 | name = "async-io" |
| 245 | -version = "2.3.4" | |
| 268 | +version = "2.4.0" | |
| 246 | 269 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 247 | -checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" | |
| 270 | +checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" | |
| 248 | 271 | dependencies = [ |
| 249 | 272 | "async-lock 3.4.0", |
| 250 | 273 | "cfg-if", |
| @@ -296,6 +319,25 @@ dependencies = [ | ||
| 296 | 319 | "windows-sys 0.48.0", |
| 297 | 320 | ] |
| 298 | 321 | |
| 322 | +[[package]] | |
| 323 | +name = "async-process" | |
| 324 | +version = "2.3.0" | |
| 325 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 326 | +checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" | |
| 327 | +dependencies = [ | |
| 328 | + "async-channel", | |
| 329 | + "async-io 2.4.0", | |
| 330 | + "async-lock 3.4.0", | |
| 331 | + "async-signal", | |
| 332 | + "async-task", | |
| 333 | + "blocking", | |
| 334 | + "cfg-if", | |
| 335 | + "event-listener 5.3.1", | |
| 336 | + "futures-lite 2.3.0", | |
| 337 | + "rustix 0.38.38", | |
| 338 | + "tracing", | |
| 339 | +] | |
| 340 | + | |
| 299 | 341 | [[package]] |
| 300 | 342 | name = "async-recursion" |
| 301 | 343 | version = "1.1.1" |
| @@ -313,7 +355,7 @@ version = "0.2.10" | ||
| 313 | 355 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 314 | 356 | checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" |
| 315 | 357 | dependencies = [ |
| 316 | - "async-io 2.3.4", | |
| 358 | + "async-io 2.4.0", | |
| 317 | 359 | "async-lock 3.4.0", |
| 318 | 360 | "atomic-waker", |
| 319 | 361 | "cfg-if", |
| @@ -817,9 +859,9 @@ dependencies = [ | ||
| 817 | 859 | |
| 818 | 860 | [[package]] |
| 819 | 861 | name = "cpufeatures" |
| 820 | -version = "0.2.14" | |
| 862 | +version = "0.2.16" | |
| 821 | 863 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 822 | -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" | |
| 864 | +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" | |
| 823 | 865 | dependencies = [ |
| 824 | 866 | "libc", |
| 825 | 867 | ] |
| @@ -1057,6 +1099,12 @@ version = "1.0.0" | ||
| 1057 | 1099 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1058 | 1100 | checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" |
| 1059 | 1101 | |
| 1102 | +[[package]] | |
| 1103 | +name = "endi" | |
| 1104 | +version = "1.1.0" | |
| 1105 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 1106 | +checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" | |
| 1107 | + | |
| 1060 | 1108 | [[package]] |
| 1061 | 1109 | name = "enumflags2" |
| 1062 | 1110 | version = "0.7.10" |
| @@ -2436,7 +2484,7 @@ dependencies = [ | ||
| 2436 | 2484 | "approx 0.5.1", |
| 2437 | 2485 | "arrayvec", |
| 2438 | 2486 | "async-channel", |
| 2439 | - "async-io 1.13.0", | |
| 2487 | + "async-io 2.4.0", | |
| 2440 | 2488 | "atomic", |
| 2441 | 2489 | "bitflags 2.6.0", |
| 2442 | 2490 | "bytemuck", |
| @@ -2482,7 +2530,7 @@ dependencies = [ | ||
| 2482 | 2530 | "wayland-scanner", |
| 2483 | 2531 | "xcursor", |
| 2484 | 2532 | "xshell", |
| 2485 | - "zbus", | |
| 2533 | + "zbus 5.2.0", | |
| 2486 | 2534 | ] |
| 2487 | 2535 | |
| 2488 | 2536 | [[package]] |
| @@ -2549,6 +2597,19 @@ dependencies = [ | ||
| 2549 | 2597 | "libc", |
| 2550 | 2598 | ] |
| 2551 | 2599 | |
| 2600 | +[[package]] | |
| 2601 | +name = "nix" | |
| 2602 | +version = "0.29.0" | |
| 2603 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 2604 | +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" | |
| 2605 | +dependencies = [ | |
| 2606 | + "bitflags 2.6.0", | |
| 2607 | + "cfg-if", | |
| 2608 | + "cfg_aliases", | |
| 2609 | + "libc", | |
| 2610 | + "memoffset 0.9.1", | |
| 2611 | +] | |
| 2612 | + | |
| 2552 | 2613 | [[package]] |
| 2553 | 2614 | name = "nom" |
| 2554 | 2615 | version = "7.1.3" |
| @@ -2569,7 +2630,7 @@ dependencies = [ | ||
| 2569 | 2630 | "mac-notification-sys", |
| 2570 | 2631 | "serde", |
| 2571 | 2632 | "tauri-winrt-notification", |
| 2572 | - "zbus", | |
| 2633 | + "zbus 3.15.2", | |
| 2573 | 2634 | ] |
| 2574 | 2635 | |
| 2575 | 2636 | [[package]] |
| @@ -4011,9 +4072,9 @@ dependencies = [ | ||
| 4011 | 4072 | |
| 4012 | 4073 | [[package]] |
| 4013 | 4074 | name = "time" |
| 4014 | -version = "0.3.36" | |
| 4075 | +version = "0.3.37" | |
| 4015 | 4076 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 4016 | -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" | |
| 4077 | +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" | |
| 4017 | 4078 | dependencies = [ |
| 4018 | 4079 | "deranged", |
| 4019 | 4080 | "num-conv", |
| @@ -5092,12 +5153,12 @@ version = "3.15.2" | ||
| 5092 | 5153 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5093 | 5154 | checksum = "675d170b632a6ad49804c8cf2105d7c31eddd3312555cffd4b740e08e97c25e6" |
| 5094 | 5155 | dependencies = [ |
| 5095 | - "async-broadcast", | |
| 5156 | + "async-broadcast 0.5.1", | |
| 5096 | 5157 | "async-executor", |
| 5097 | - "async-fs", | |
| 5158 | + "async-fs 1.6.0", | |
| 5098 | 5159 | "async-io 1.13.0", |
| 5099 | 5160 | "async-lock 2.8.0", |
| 5100 | - "async-process", | |
| 5161 | + "async-process 1.8.1", | |
| 5101 | 5162 | "async-recursion", |
| 5102 | 5163 | "async-task", |
| 5103 | 5164 | "async-trait", |
| @@ -5122,9 +5183,45 @@ dependencies = [ | ||
| 5122 | 5183 | "uds_windows", |
| 5123 | 5184 | "winapi", |
| 5124 | 5185 | "xdg-home", |
| 5125 | - "zbus_macros", | |
| 5126 | - "zbus_names", | |
| 5127 | - "zvariant", | |
| 5186 | + "zbus_macros 3.15.2", | |
| 5187 | + "zbus_names 2.6.1", | |
| 5188 | + "zvariant 3.15.2", | |
| 5189 | +] | |
| 5190 | + | |
| 5191 | +[[package]] | |
| 5192 | +name = "zbus" | |
| 5193 | +version = "5.2.0" | |
| 5194 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 5195 | +checksum = "fb67eadba43784b6fb14857eba0d8fc518686d3ee537066eb6086dc318e2c8a1" | |
| 5196 | +dependencies = [ | |
| 5197 | + "async-broadcast 0.7.1", | |
| 5198 | + "async-executor", | |
| 5199 | + "async-fs 2.1.2", | |
| 5200 | + "async-io 2.4.0", | |
| 5201 | + "async-lock 3.4.0", | |
| 5202 | + "async-process 2.3.0", | |
| 5203 | + "async-recursion", | |
| 5204 | + "async-task", | |
| 5205 | + "async-trait", | |
| 5206 | + "blocking", | |
| 5207 | + "enumflags2", | |
| 5208 | + "event-listener 5.3.1", | |
| 5209 | + "futures-core", | |
| 5210 | + "futures-util", | |
| 5211 | + "hex", | |
| 5212 | + "nix 0.29.0", | |
| 5213 | + "ordered-stream", | |
| 5214 | + "serde", | |
| 5215 | + "serde_repr", | |
| 5216 | + "static_assertions", | |
| 5217 | + "tracing", | |
| 5218 | + "uds_windows", | |
| 5219 | + "windows-sys 0.59.0", | |
| 5220 | + "winnow 0.6.20", | |
| 5221 | + "xdg-home", | |
| 5222 | + "zbus_macros 5.2.0", | |
| 5223 | + "zbus_names 4.1.0", | |
| 5224 | + "zvariant 5.1.0", | |
| 5128 | 5225 | ] |
| 5129 | 5226 | |
| 5130 | 5227 | [[package]] |
| @@ -5138,7 +5235,22 @@ dependencies = [ | ||
| 5138 | 5235 | "quote", |
| 5139 | 5236 | "regex", |
| 5140 | 5237 | "syn 1.0.109", |
| 5141 | - "zvariant_utils", | |
| 5238 | + "zvariant_utils 1.0.1", | |
| 5239 | +] | |
| 5240 | + | |
| 5241 | +[[package]] | |
| 5242 | +name = "zbus_macros" | |
| 5243 | +version = "5.2.0" | |
| 5244 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 5245 | +checksum = "2c9d49ebc960ceb660f2abe40a5904da975de6986f2af0d7884b39eec6528c57" | |
| 5246 | +dependencies = [ | |
| 5247 | + "proc-macro-crate 3.2.0", | |
| 5248 | + "proc-macro2", | |
| 5249 | + "quote", | |
| 5250 | + "syn 2.0.86", | |
| 5251 | + "zbus_names 4.1.0", | |
| 5252 | + "zvariant 5.1.0", | |
| 5253 | + "zvariant_utils 3.0.2", | |
| 5142 | 5254 | ] |
| 5143 | 5255 | |
| 5144 | 5256 | [[package]] |
| @@ -5149,7 +5261,19 @@ checksum = "437d738d3750bed6ca9b8d423ccc7a8eb284f6b1d6d4e225a0e4e6258d864c8d" | ||
| 5149 | 5261 | dependencies = [ |
| 5150 | 5262 | "serde", |
| 5151 | 5263 | "static_assertions", |
| 5152 | - "zvariant", | |
| 5264 | + "zvariant 3.15.2", | |
| 5265 | +] | |
| 5266 | + | |
| 5267 | +[[package]] | |
| 5268 | +name = "zbus_names" | |
| 5269 | +version = "4.1.0" | |
| 5270 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 5271 | +checksum = "856b7a38811f71846fd47856ceee8bccaec8399ff53fb370247e66081ace647b" | |
| 5272 | +dependencies = [ | |
| 5273 | + "serde", | |
| 5274 | + "static_assertions", | |
| 5275 | + "winnow 0.6.20", | |
| 5276 | + "zvariant 5.1.0", | |
| 5153 | 5277 | ] |
| 5154 | 5278 | |
| 5155 | 5279 | [[package]] |
| @@ -5227,7 +5351,22 @@ dependencies = [ | ||
| 5227 | 5351 | "libc", |
| 5228 | 5352 | "serde", |
| 5229 | 5353 | "static_assertions", |
| 5230 | - "zvariant_derive", | |
| 5354 | + "zvariant_derive 3.15.2", | |
| 5355 | +] | |
| 5356 | + | |
| 5357 | +[[package]] | |
| 5358 | +name = "zvariant" | |
| 5359 | +version = "5.1.0" | |
| 5360 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 5361 | +checksum = "a1200ee6ac32f1e5a312e455a949a4794855515d34f9909f4a3e082d14e1a56f" | |
| 5362 | +dependencies = [ | |
| 5363 | + "endi", | |
| 5364 | + "enumflags2", | |
| 5365 | + "serde", | |
| 5366 | + "static_assertions", | |
| 5367 | + "winnow 0.6.20", | |
| 5368 | + "zvariant_derive 5.1.0", | |
| 5369 | + "zvariant_utils 3.0.2", | |
| 5231 | 5370 | ] |
| 5232 | 5371 | |
| 5233 | 5372 | [[package]] |
| @@ -5240,7 +5379,20 @@ dependencies = [ | ||
| 5240 | 5379 | "proc-macro2", |
| 5241 | 5380 | "quote", |
| 5242 | 5381 | "syn 1.0.109", |
| 5243 | - "zvariant_utils", | |
| 5382 | + "zvariant_utils 1.0.1", | |
| 5383 | +] | |
| 5384 | + | |
| 5385 | +[[package]] | |
| 5386 | +name = "zvariant_derive" | |
| 5387 | +version = "5.1.0" | |
| 5388 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 5389 | +checksum = "687e3b97fae6c9104fbbd36c73d27d149abf04fb874e2efbd84838763daa8916" | |
| 5390 | +dependencies = [ | |
| 5391 | + "proc-macro-crate 3.2.0", | |
| 5392 | + "proc-macro2", | |
| 5393 | + "quote", | |
| 5394 | + "syn 2.0.86", | |
| 5395 | + "zvariant_utils 3.0.2", | |
| 5244 | 5396 | ] |
| 5245 | 5397 | |
| 5246 | 5398 | [[package]] |
| @@ -5253,3 +5405,17 @@ dependencies = [ | ||
| 5253 | 5405 | "quote", |
| 5254 | 5406 | "syn 1.0.109", |
| 5255 | 5407 | ] |
| 5408 | + | |
| 5409 | +[[package]] | |
| 5410 | +name = "zvariant_utils" | |
| 5411 | +version = "3.0.2" | |
| 5412 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 5413 | +checksum = "20d1d011a38f12360e5fcccceeff5e2c42a8eb7f27f0dcba97a0862ede05c9c6" | |
| 5414 | +dependencies = [ | |
| 5415 | + "proc-macro2", | |
| 5416 | + "quote", | |
| 5417 | + "serde", | |
| 5418 | + "static_assertions", | |
| 5419 | + "syn 2.0.86", | |
| 5420 | + "winnow 0.6.20", | |
| 5421 | +] |
Cargo.tomlmodified+2 -2
| @@ -48,7 +48,7 @@ keywords = ["wayland", "compositor", "tiling", "smithay", "wm"] | ||
| 48 | 48 | anyhow.workspace = true |
| 49 | 49 | arrayvec = "0.7.6" |
| 50 | 50 | async-channel = "2.3.1" |
| 51 | -async-io = { version = "1.13.0", optional = true } | |
| 51 | +async-io = { version = "2.4.0", optional = true } | |
| 52 | 52 | atomic = "0.6.0" |
| 53 | 53 | bitflags.workspace = true |
| 54 | 54 | bytemuck = { version = "1.19.0", features = ["derive"] } |
| @@ -86,7 +86,7 @@ url = { version = "2.5.3", optional = true } | ||
| 86 | 86 | wayland-backend = "0.3.7" |
| 87 | 87 | wayland-scanner = "0.31.5" |
| 88 | 88 | xcursor = "0.3.8" |
| 89 | -zbus = { version = "~3.15.2", optional = true } | |
| 89 | +zbus = { version = "5.2.0", optional = true } | |
| 90 | 90 | |
| 91 | 91 | [dependencies.smithay] |
| 92 | 92 | workspace = true |
src/dbus/freedesktop_screensaver.rsmodified+5 -4
| @@ -6,9 +6,10 @@ use std::sync::{Arc, Mutex, OnceLock}; | ||
| 6 | 6 | use anyhow::Context; |
| 7 | 7 | use futures_util::StreamExt; |
| 8 | 8 | use zbus::fdo::{self, RequestNameFlags}; |
| 9 | +use zbus::message::Header; | |
| 9 | 10 | use zbus::names::{OwnedUniqueName, UniqueName}; |
| 10 | 11 | use zbus::zvariant::NoneValue; |
| 11 | -use zbus::{dbus_interface, MessageHeader, Task}; | |
| 12 | +use zbus::{interface, Task}; | |
| 12 | 13 | |
| 13 | 14 | use super::Start; |
| 14 | 15 | |
| @@ -20,11 +21,11 @@ pub struct ScreenSaver { | ||
| 20 | 21 | monitor_task: Arc<OnceLock<Task<()>>>, |
| 21 | 22 | } |
| 22 | 23 | |
| 23 | -#[dbus_interface(name = "org.freedesktop.ScreenSaver")] | |
| 24 | +#[interface(name = "org.freedesktop.ScreenSaver")] | |
| 24 | 25 | impl ScreenSaver { |
| 25 | 26 | async fn inhibit( |
| 26 | 27 | &mut self, |
| 27 | - #[zbus(header)] hdr: MessageHeader<'_>, | |
| 28 | + #[zbus(header)] hdr: Header<'_>, | |
| 28 | 29 | application_name: &str, |
| 29 | 30 | reason_for_inhibit: &str, |
| 30 | 31 | ) -> fdo::Result<u32> { |
| @@ -33,7 +34,7 @@ impl ScreenSaver { | ||
| 33 | 34 | hdr.sender() |
| 34 | 35 | ); |
| 35 | 36 | |
| 36 | - let Ok(Some(name)) = hdr.sender() else { | |
| 37 | + let Some(name) = hdr.sender() else { | |
| 37 | 38 | return Err(fdo::Error::Failed(String::from("no sender"))); |
| 38 | 39 | }; |
| 39 | 40 | let name = OwnedUniqueName::from(name.to_owned()); |
src/dbus/gnome_shell_introspect.rsmodified+5 -4
| @@ -1,8 +1,9 @@ | ||
| 1 | 1 | use std::collections::HashMap; |
| 2 | 2 | |
| 3 | 3 | use zbus::fdo::{self, RequestNameFlags}; |
| 4 | +use zbus::interface; | |
| 5 | +use zbus::object_server::SignalEmitter; | |
| 4 | 6 | use zbus::zvariant::{SerializeDict, Type, Value}; |
| 5 | -use zbus::{dbus_interface, SignalContext}; | |
| 6 | 7 | |
| 7 | 8 | use super::Start; |
| 8 | 9 | |
| @@ -33,7 +34,7 @@ pub struct WindowProperties { | ||
| 33 | 34 | pub app_id: String, |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | -#[dbus_interface(name = "org.gnome.Shell.Introspect")] | |
| 37 | +#[interface(name = "org.gnome.Shell.Introspect")] | |
| 37 | 38 | impl Introspect { |
| 38 | 39 | async fn get_windows(&self) -> fdo::Result<HashMap<u64, WindowProperties>> { |
| 39 | 40 | if let Err(err) = self.to_niri.send(IntrospectToNiri::GetWindows) { |
| @@ -52,8 +53,8 @@ impl Introspect { | ||
| 52 | 53 | |
| 53 | 54 | // FIXME: call this upon window changes, once more of the infrastructure is there (will be |
| 54 | 55 | // needed for the event stream IPC anyway). |
| 55 | - #[dbus_interface(signal)] | |
| 56 | - pub async fn windows_changed(ctxt: &SignalContext<'_>) -> zbus::Result<()>; | |
| 56 | + #[zbus(signal)] | |
| 57 | + pub async fn windows_changed(ctxt: &SignalEmitter<'_>) -> zbus::Result<()>; | |
| 57 | 58 | } |
| 58 | 59 | |
| 59 | 60 | impl Introspect { |
src/dbus/gnome_shell_screenshot.rsmodified+2 -2
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | use std::path::PathBuf; |
| 2 | 2 | |
| 3 | -use zbus::dbus_interface; | |
| 4 | 3 | use zbus::fdo::{self, RequestNameFlags}; |
| 4 | +use zbus::interface; | |
| 5 | 5 | |
| 6 | 6 | use super::Start; |
| 7 | 7 | |
| @@ -18,7 +18,7 @@ pub enum NiriToScreenshot { | ||
| 18 | 18 | ScreenshotResult(Option<PathBuf>), |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | -#[dbus_interface(name = "org.gnome.Shell.Screenshot")] | |
| 21 | +#[interface(name = "org.gnome.Shell.Screenshot")] | |
| 22 | 22 | impl Screenshot { |
| 23 | 23 | async fn screenshot( |
| 24 | 24 | &self, |
src/dbus/mod.rsmodified+1 -1
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | use zbus::blocking::Connection; |
| 2 | -use zbus::Interface; | |
| 2 | +use zbus::object_server::Interface; | |
| 3 | 3 | |
| 4 | 4 | use crate::niri::State; |
| 5 | 5 |
src/dbus/mutter_display_config.rsmodified+5 -4
| @@ -3,8 +3,9 @@ use std::sync::{Arc, Mutex}; | ||
| 3 | 3 | |
| 4 | 4 | use serde::Serialize; |
| 5 | 5 | use zbus::fdo::RequestNameFlags; |
| 6 | +use zbus::object_server::SignalEmitter; | |
| 6 | 7 | use zbus::zvariant::{self, OwnedValue, Type}; |
| 7 | -use zbus::{dbus_interface, fdo, SignalContext}; | |
| 8 | +use zbus::{fdo, interface}; | |
| 8 | 9 | |
| 9 | 10 | use super::Start; |
| 10 | 11 | use crate::backend::IpcOutputMap; |
| @@ -43,7 +44,7 @@ pub struct LogicalMonitor { | ||
| 43 | 44 | properties: HashMap<String, OwnedValue>, |
| 44 | 45 | } |
| 45 | 46 | |
| 46 | -#[dbus_interface(name = "org.gnome.Mutter.DisplayConfig")] | |
| 47 | +#[interface(name = "org.gnome.Mutter.DisplayConfig")] | |
| 47 | 48 | impl DisplayConfig { |
| 48 | 49 | async fn get_current_state( |
| 49 | 50 | &self, |
| @@ -156,8 +157,8 @@ impl DisplayConfig { | ||
| 156 | 157 | Ok((0, monitors, logical_monitors, properties)) |
| 157 | 158 | } |
| 158 | 159 | |
| 159 | - #[dbus_interface(signal)] | |
| 160 | - pub async fn monitors_changed(ctxt: &SignalContext<'_>) -> zbus::Result<()>; | |
| 160 | + #[zbus(signal)] | |
| 161 | + pub async fn monitors_changed(ctxt: &SignalEmitter<'_>) -> zbus::Result<()>; | |
| 161 | 162 | } |
| 162 | 163 | |
| 163 | 164 | impl DisplayConfig { |
src/dbus/mutter_screen_cast.rsmodified+16 -15
| @@ -5,8 +5,9 @@ use std::sync::{Arc, Mutex}; | ||
| 5 | 5 | |
| 6 | 6 | use serde::Deserialize; |
| 7 | 7 | use zbus::fdo::RequestNameFlags; |
| 8 | +use zbus::object_server::{InterfaceRef, SignalEmitter}; | |
| 8 | 9 | use zbus::zvariant::{DeserializeDict, OwnedObjectPath, SerializeDict, Type, Value}; |
| 9 | -use zbus::{dbus_interface, fdo, InterfaceRef, ObjectServer, SignalContext}; | |
| 10 | +use zbus::{fdo, interface, ObjectServer}; | |
| 10 | 11 | |
| 11 | 12 | use super::Start; |
| 12 | 13 | use crate::backend::IpcOutputMap; |
| @@ -94,14 +95,14 @@ pub enum ScreenCastToNiri { | ||
| 94 | 95 | session_id: usize, |
| 95 | 96 | target: StreamTargetId, |
| 96 | 97 | cursor_mode: CursorMode, |
| 97 | - signal_ctx: SignalContext<'static>, | |
| 98 | + signal_ctx: SignalEmitter<'static>, | |
| 98 | 99 | }, |
| 99 | 100 | StopCast { |
| 100 | 101 | session_id: usize, |
| 101 | 102 | }, |
| 102 | 103 | } |
| 103 | 104 | |
| 104 | -#[dbus_interface(name = "org.gnome.Mutter.ScreenCast")] | |
| 105 | +#[interface(name = "org.gnome.Mutter.ScreenCast")] | |
| 105 | 106 | impl ScreenCast { |
| 106 | 107 | async fn create_session( |
| 107 | 108 | &self, |
| @@ -136,26 +137,26 @@ impl ScreenCast { | ||
| 136 | 137 | Ok(path) |
| 137 | 138 | } |
| 138 | 139 | |
| 139 | - #[dbus_interface(property)] | |
| 140 | + #[zbus(property)] | |
| 140 | 141 | async fn version(&self) -> i32 { |
| 141 | 142 | 4 |
| 142 | 143 | } |
| 143 | 144 | } |
| 144 | 145 | |
| 145 | -#[dbus_interface(name = "org.gnome.Mutter.ScreenCast.Session")] | |
| 146 | +#[interface(name = "org.gnome.Mutter.ScreenCast.Session")] | |
| 146 | 147 | impl Session { |
| 147 | 148 | async fn start(&self) { |
| 148 | 149 | debug!("start"); |
| 149 | 150 | |
| 150 | 151 | for (stream, iface) in &*self.streams.lock().unwrap() { |
| 151 | - stream.start(self.id, iface.signal_context().clone()); | |
| 152 | + stream.start(self.id, iface.signal_emitter().clone()); | |
| 152 | 153 | } |
| 153 | 154 | } |
| 154 | 155 | |
| 155 | 156 | pub async fn stop( |
| 156 | 157 | &self, |
| 157 | 158 | #[zbus(object_server)] server: &ObjectServer, |
| 158 | - #[zbus(signal_context)] ctxt: SignalContext<'_>, | |
| 159 | + #[zbus(signal_context)] ctxt: SignalEmitter<'_>, | |
| 159 | 160 | ) { |
| 160 | 161 | debug!("stop"); |
| 161 | 162 | |
| @@ -175,7 +176,7 @@ impl Session { | ||
| 175 | 176 | let streams = mem::take(&mut *self.streams.lock().unwrap()); |
| 176 | 177 | for (_, iface) in streams.iter() { |
| 177 | 178 | server |
| 178 | - .remove::<Stream, _>(iface.signal_context().path()) | |
| 179 | + .remove::<Stream, _>(iface.signal_emitter().path()) | |
| 179 | 180 | .await |
| 180 | 181 | .unwrap(); |
| 181 | 182 | } |
| @@ -264,17 +265,17 @@ impl Session { | ||
| 264 | 265 | Ok(path) |
| 265 | 266 | } |
| 266 | 267 | |
| 267 | - #[dbus_interface(signal)] | |
| 268 | - async fn closed(ctxt: &SignalContext<'_>) -> zbus::Result<()>; | |
| 268 | + #[zbus(signal)] | |
| 269 | + async fn closed(ctxt: &SignalEmitter<'_>) -> zbus::Result<()>; | |
| 269 | 270 | } |
| 270 | 271 | |
| 271 | -#[dbus_interface(name = "org.gnome.Mutter.ScreenCast.Stream")] | |
| 272 | +#[interface(name = "org.gnome.Mutter.ScreenCast.Stream")] | |
| 272 | 273 | impl Stream { |
| 273 | - #[dbus_interface(signal)] | |
| 274 | - pub async fn pipe_wire_stream_added(ctxt: &SignalContext<'_>, node_id: u32) | |
| 274 | + #[zbus(signal)] | |
| 275 | + pub async fn pipe_wire_stream_added(ctxt: &SignalEmitter<'_>, node_id: u32) | |
| 275 | 276 | -> zbus::Result<()>; |
| 276 | 277 | |
| 277 | - #[dbus_interface(property)] | |
| 278 | + #[zbus(property)] | |
| 278 | 279 | async fn parameters(&self) -> StreamParameters { |
| 279 | 280 | match &self.target { |
| 280 | 281 | StreamTarget::Output(output) => { |
| @@ -361,7 +362,7 @@ impl Stream { | ||
| 361 | 362 | } |
| 362 | 363 | } |
| 363 | 364 | |
| 364 | - fn start(&self, session_id: usize, ctxt: SignalContext<'static>) { | |
| 365 | + fn start(&self, session_id: usize, ctxt: SignalEmitter<'static>) { | |
| 365 | 366 | if self.was_started.load(Ordering::SeqCst) { |
| 366 | 367 | return; |
| 367 | 368 | } |
src/dbus/mutter_service_channel.rsmodified+6 -7
| @@ -1,9 +1,8 @@ | ||
| 1 | -use std::os::fd::{FromRawFd, IntoRawFd}; | |
| 2 | 1 | use std::os::unix::net::UnixStream; |
| 3 | 2 | use std::sync::Arc; |
| 4 | 3 | |
| 5 | 4 | use smithay::reexports::wayland_server::DisplayHandle; |
| 6 | -use zbus::dbus_interface; | |
| 5 | +use zbus::{fdo, interface, zvariant}; | |
| 7 | 6 | |
| 8 | 7 | use super::Start; |
| 9 | 8 | use crate::niri::ClientState; |
| @@ -12,14 +11,14 @@ pub struct ServiceChannel { | ||
| 12 | 11 | display: DisplayHandle, |
| 13 | 12 | } |
| 14 | 13 | |
| 15 | -#[dbus_interface(name = "org.gnome.Mutter.ServiceChannel")] | |
| 14 | +#[interface(name = "org.gnome.Mutter.ServiceChannel")] | |
| 16 | 15 | impl ServiceChannel { |
| 17 | 16 | async fn open_wayland_service_connection( |
| 18 | 17 | &mut self, |
| 19 | 18 | service_client_type: u32, |
| 20 | - ) -> zbus::fdo::Result<zbus::zvariant::OwnedFd> { | |
| 19 | + ) -> fdo::Result<zvariant::OwnedFd> { | |
| 21 | 20 | if service_client_type != 1 { |
| 22 | - return Err(zbus::fdo::Error::InvalidArgs( | |
| 21 | + return Err(fdo::Error::InvalidArgs( | |
| 23 | 22 | "Invalid service client type".to_owned(), |
| 24 | 23 | )); |
| 25 | 24 | } |
| @@ -34,7 +33,7 @@ impl ServiceChannel { | ||
| 34 | 33 | credentials_unknown: true, |
| 35 | 34 | }); |
| 36 | 35 | self.display.insert_client(sock2, data).unwrap(); |
| 37 | - Ok(unsafe { zbus::zvariant::OwnedFd::from_raw_fd(sock1.into_raw_fd()) }) | |
| 36 | + Ok(zvariant::OwnedFd::from(std::os::fd::OwnedFd::from(sock1))) | |
| 38 | 37 | } |
| 39 | 38 | } |
| 40 | 39 | |
| @@ -46,7 +45,7 @@ impl ServiceChannel { | ||
| 46 | 45 | |
| 47 | 46 | impl Start for ServiceChannel { |
| 48 | 47 | fn start(self) -> anyhow::Result<zbus::blocking::Connection> { |
| 49 | - let conn = zbus::blocking::ConnectionBuilder::session()? | |
| 48 | + let conn = zbus::blocking::connection::Builder::session()? | |
| 50 | 49 | .name("org.gnome.Mutter.ServiceChannel")? |
| 51 | 50 | .serve_at("/org/gnome/Mutter/ServiceChannel", self)? |
| 52 | 51 | .build()?; |
src/niri.rsmodified+4 -4
| @@ -2067,7 +2067,7 @@ impl Niri { | ||
| 2067 | 2067 | |
| 2068 | 2068 | use smithay::reexports::rustix::io::{fcntl_setfd, FdFlags}; |
| 2069 | 2069 | |
| 2070 | - let conn = zbus::blocking::ConnectionBuilder::system()?.build()?; | |
| 2070 | + let conn = zbus::blocking::Connection::system()?; | |
| 2071 | 2071 | |
| 2072 | 2072 | let message = conn.call_method( |
| 2073 | 2073 | Some("org.freedesktop.login1"), |
| @@ -2077,7 +2077,7 @@ impl Niri { | ||
| 2077 | 2077 | &("handle-power-key", "niri", "Power key handling", "block"), |
| 2078 | 2078 | )?; |
| 2079 | 2079 | |
| 2080 | - let fd: zbus::zvariant::OwnedFd = message.body()?; | |
| 2080 | + let fd: zbus::zvariant::OwnedFd = message.body().deserialize()?; | |
| 2081 | 2081 | |
| 2082 | 2082 | // Don't leak the fd to child processes. |
| 2083 | 2083 | let borrowed = unsafe { BorrowedFd::borrow_raw(fd.as_raw_fd()) }; |
| @@ -4294,7 +4294,7 @@ impl Niri { | ||
| 4294 | 4294 | async_io::block_on(async move { |
| 4295 | 4295 | iface |
| 4296 | 4296 | .get() |
| 4297 | - .stop(&server, iface.signal_context().clone()) | |
| 4297 | + .stop(server.inner(), iface.signal_emitter().clone()) | |
| 4298 | 4298 | .await |
| 4299 | 4299 | }); |
| 4300 | 4300 | } |
| @@ -4774,7 +4774,7 @@ impl Niri { | ||
| 4774 | 4774 | }; |
| 4775 | 4775 | |
| 4776 | 4776 | async_io::block_on(async move { |
| 4777 | - if let Err(err) = DisplayConfig::monitors_changed(iface.signal_context()).await | |
| 4777 | + if let Err(err) = DisplayConfig::monitors_changed(iface.signal_emitter()).await | |
| 4778 | 4778 | { |
| 4779 | 4779 | warn!("error emitting MonitorsChanged: {err:?}"); |
| 4780 | 4780 | } |
src/pw_utils.rsmodified+2 -2
| @@ -41,7 +41,7 @@ use smithay::reexports::calloop::generic::Generic; | ||
| 41 | 41 | use smithay::reexports::calloop::{Interest, LoopHandle, Mode, PostAction}; |
| 42 | 42 | use smithay::reexports::gbm::Modifier; |
| 43 | 43 | use smithay::utils::{Physical, Scale, Size, Transform}; |
| 44 | -use zbus::SignalContext; | |
| 44 | +use zbus::object_server::SignalEmitter; | |
| 45 | 45 | |
| 46 | 46 | use crate::dbus::mutter_screen_cast::{self, CursorMode}; |
| 47 | 47 | use crate::niri::State; |
| @@ -188,7 +188,7 @@ impl PipeWire { | ||
| 188 | 188 | refresh: u32, |
| 189 | 189 | alpha: bool, |
| 190 | 190 | cursor_mode: CursorMode, |
| 191 | - signal_ctx: SignalContext<'static>, | |
| 191 | + signal_ctx: SignalEmitter<'static>, | |
| 192 | 192 | ) -> anyhow::Result<Cast> { |
| 193 | 193 | let _span = tracy_client::span!("PipeWire::start_cast"); |
| 194 | 194 |
src/utils/spawning.rsmodified+2 -1
| @@ -424,8 +424,9 @@ mod systemd { | ||
| 424 | 424 | |
| 425 | 425 | trace!("waiting for JobRemoved"); |
| 426 | 426 | for message in signals { |
| 427 | + let body = message.body(); | |
| 427 | 428 | let body: (u32, OwnedObjectPath, &str, &str) = |
| 428 | - message.body().context("error parsing signal")?; | |
| 429 | + body.deserialize().context("error parsing signal")?; | |
| 429 | 430 | |
| 430 | 431 | if body.1 == job { |
| 431 | 432 | // Our transient unit had started, we're good to exit the intermediate child. |