Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added window visibility to mac scap #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ fn main() {
}

// // Get recording targets
// let targets = scap::get_all_targets();

let targets = scap::get_all_targets();
println!("Targets from get_all_targets: {:?}", targets);

// Create Options
let options = Options {
fps: 60,
Expand Down
4 changes: 4 additions & 0 deletions src/targets/mac/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ pub fn get_all_targets() -> Vec<Target> {
let id = window.window_id;
let title = window.title.expect("Window title not found");
let raw_handle: CGWindowID = id;
let is_visible = window.is_on_screen;

// println!("Window: '{}' - Visible: {}", title, is_visible);

let target = Target::Window(super::Window {
id,
title,
is_visible,
raw_handle,
});
targets.push(target);
Expand Down
1 change: 1 addition & 0 deletions src/targets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod linux;
pub struct Window {
pub id: u32,
pub title: String,
pub is_visible: bool,

#[cfg(target_os = "windows")]
pub raw_handle: windows::Win32::Foundation::HWND,
Expand Down
3 changes: 2 additions & 1 deletion src/targets/win/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub fn get_all_targets() -> Vec<Target> {
id,
title,
raw_handle: HWND(window.as_raw_hwnd()),
is_visible: window.is_visible().unwrap_or(false),
});
targets.push(target);
}
Expand Down Expand Up @@ -102,4 +103,4 @@ pub fn get_target_dimensions(target: &Target) -> (u64, u64) {
)
}
}
}
}