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

feat: add showsCursor configuration option #72

Merged
merged 1 commit into from
Jan 29, 2025
Merged
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
36 changes: 36 additions & 0 deletions src/stream/configuration/captured_elements.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use core_foundation::error::CFError;
use objc::{sel, sel_impl};

use crate::utils::objc::{get_property, set_property};

use super::internal::SCStreamConfiguration;

impl SCStreamConfiguration {
/// Sets the showsCursor of this [`SCStreamConfiguration`].
///
/// # Errors
///
/// This function will return an error if .
pub fn set_shows_cursor(mut self, shows_cursor: bool) -> Result<Self, CFError> {
set_property(&mut self, sel!(setShowsCursor:), shows_cursor)?;
Ok(self)
}

pub fn get_shows_cursor(&self) -> bool {
get_property(self, sel!(showsCursor))
}
}

#[cfg(test)]
mod sc_stream_configuration_test {
use crate::stream::configuration::SCStreamConfiguration;

#[test]
fn test_setters_and_getters() {
let config = SCStreamConfiguration::default();
let config = config
.set_shows_cursor(true)
.expect("Failed to set showsCursor");
assert!(config.get_shows_cursor());
}
}
5 changes: 3 additions & 2 deletions src/stream/configuration/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
mod internal;

pub mod audio;
pub mod dimensions;
pub mod captured_elements;
pub mod captured_frames;
pub mod colors;
pub mod dimensions;
pub mod pixel_format;
pub mod captured_frames;

#[allow(clippy::module_name_repetitions)]
pub use internal::SCStreamConfiguration;
Expand Down
Loading