XCap is a cross-platform screen capture library written in Rust. It supports Linux (X11, Wayland), MacOS, and Windows. XCap supports screenshot and video recording (to be implemented).
To duplicate the problem: Start this test, then once it is going plug in an external monitor. You might have to try it several times before the error happens.
#[test]
fn test_xcap_monitor_all() {
for _ in 0..1000 {
match Monitor::all() {
Ok(_) => (),
Err(e) => core::panic!("Error occurred: {:?}", e),
}
// Sleep for a short duration to not overwhelm the system
sleep(Duration::from_millis(100));
}
}
Here is the error:
Error occurred: Error("Get display mode failed")
thread 'interface::screen_detector::tests::test_xcap_monitor_all' panicked at src/interface/screen_detector.rs:390:27:
Error occurred: Error("Get display mode failed")
stack backtrace:
0: rust_begin_unwind
at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/std/src/panicking.rs:647:5
1: core::panicking::panic_fmt
at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/panicking.rs:72:14
2: ea_client_lib::interface::screen_detector::tests::test_xcap_monitor_all
at ./src/interface/screen_detector.rs:390:27
3: ea_client_lib::interface::screen_detector::tests::test_xcap_monitor_all::{{closure}}
at ./src/interface/screen_detector.rs:386:31
4: core::ops::function::FnOnce::call_once
at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/ops/function.rs:250:5
5: core::ops::function::FnOnce::call_once
at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
To duplicate the problem: Start this test, then once it is going plug in an external monitor. You might have to try it several times before the error happens.
Here is the error: