From 5494a8a584389d533c1a671b41b8e0266463c00a Mon Sep 17 00:00:00 2001 From: nashaofu Date: Tue, 4 Feb 2025 20:37:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20macos=20Monitor?= =?UTF-8?q?::from=5Fpoint=20=E6=9C=AA=E6=89=BE=E5=88=B0=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E6=97=B6=E4=BB=8D=E7=84=B6=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/macos/impl_monitor.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/macos/impl_monitor.rs b/src/macos/impl_monitor.rs index 9ca8404..323a6f8 100644 --- a/src/macos/impl_monitor.rs +++ b/src/macos/impl_monitor.rs @@ -144,10 +144,15 @@ impl ImplMonitor { ))); } + if display_count == 0 { + return Err(XCapError::new("Monitor not found")); + } + if let Some(&display_id) = display_ids.first() { if unsafe { !CGDisplayIsActive(display_id) } { return Err(XCapError::new("Monitor is not active")); } + println!("display_id: {}", display_id); ImplMonitor::new(display_id) } else { Err(XCapError::new("Monitor not found")) From 5ce1250c0837b6b177e2aa7169b74b3ba573a3f1 Mon Sep 17 00:00:00 2001 From: nashaofu Date: Tue, 4 Feb 2025 20:38:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7f512b0..63912bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xcap" -version = "0.3.0" +version = "0.3.1" edition = "2021" description = "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 (WIP)." license = "Apache-2.0"