INNER CODE UNIT · Rust
deadline
ShadowBlip/OpenGamepadUI · extensions/core/src/gamescope.rs:192
let deadline = Instant::now() + DISPLAY_PROBE_TIMEOUT;
let mut gamescope_displays = Vec::new();
for (display, rx) in probes {
let remaining = deadline.saturating_duration_since(Instant::now());
match rx.recv_timeout(remaining) {
Ok(true) => gamescope_displays.push(display),
Ok(false) => (),
Err(_) => log::warn!("Display {display} did not respond in time; skipping it"),
}
}
Ok(gamescope_displays)
}
/// Connects to the given display and reports whether it is a Gamescope XWayland.
fn is_gamescope_display(display: &str) -> bool {
let mut xwayland = XWayland::new(display.to_string());
if let Err(e) = xwayland.connect() {