Skip to content

Commit

Permalink
Update Dependencies ⭐
Browse files Browse the repository at this point in the history
  • Loading branch information
NiiightmareXD committed Jul 11, 2024
1 parent 243a5cf commit e025aed
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 21 deletions.
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Add this library to your `Cargo.toml`:

```toml
[dependencies]
windows-capture = "1.2.0"
windows-capture = "1.2.1"
```
or run this command

Expand Down
2 changes: 1 addition & 1 deletion src/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl<T: GraphicsCaptureApiHandler + Send + 'static, E> CaptureControl<T, E> {

if let Some(thread_handle) = self.thread_handle.take() {
let handle = thread_handle.as_raw_handle();
let handle = HANDLE(handle as isize);
let handle = HANDLE(handle);
let therad_id = unsafe { GetThreadId(handle) };

loop {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//!
//! ```toml
//! [dependencies]
//! windows-capture = "1.2.0"
//! windows-capture = "1.2.1"
//! ```
//! or run this command
//!
Expand Down
6 changes: 4 additions & 2 deletions src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ pub struct Monitor {
monitor: HMONITOR,
}

unsafe impl Send for Monitor {}

impl Monitor {
/// Returns the primary monitor.
///
Expand Down Expand Up @@ -424,15 +426,15 @@ impl Monitor {
///
/// * `hmonitor` - The raw HMONITOR.
#[must_use]
pub const fn from_raw_hmonitor(monitor: isize) -> Self {
pub const fn from_raw_hmonitor(monitor: *mut std::ffi::c_void) -> Self {
Self {
monitor: HMONITOR(monitor),
}
}

/// Returns the raw HMONITOR of the monitor.
#[must_use]
pub const fn as_raw_hmonitor(&self) -> isize {
pub const fn as_raw_hmonitor(&self) -> *mut std::ffi::c_void {
self.monitor.0
}

Expand Down
12 changes: 7 additions & 5 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ pub struct Window {
window: HWND,
}

unsafe impl Send for Window {}

impl Window {
/// Returns the foreground window.
///
Expand All @@ -58,7 +60,7 @@ impl Window {
pub fn foreground() -> Result<Self, Error> {
let window = unsafe { GetForegroundWindow() };

if window.0 == 0 {
if window.is_invalid() {
return Err(Error::NoActiveWindow);
}

Expand All @@ -76,9 +78,9 @@ impl Window {
/// Returns an `Error::NotFound` if the window is not found.
pub fn from_name(title: &str) -> Result<Self, Error> {
let hstring_title = HSTRING::from(title);
let window = unsafe { FindWindowW(None, &hstring_title) };
let window = unsafe { FindWindowW(None, &hstring_title)? };

if window.0 == 0 {
if window.is_invalid() {
return Err(Error::NotFound(String::from(title)));
}

Expand Down Expand Up @@ -214,13 +216,13 @@ impl Window {
///
/// * `hwnd` - The raw HWND.
#[must_use]
pub const fn from_raw_hwnd(hwnd: isize) -> Self {
pub const fn from_raw_hwnd(hwnd: *mut std::ffi::c_void) -> Self {
Self { window: HWND(hwnd) }
}

/// Returns the raw HWND of the window.
#[must_use]
pub const fn as_raw_hwnd(&self) -> isize {
pub const fn as_raw_hwnd(&self) -> *mut std::ffi::c_void {
self.window.0
}

Expand Down
2 changes: 1 addition & 1 deletion windows-capture-python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "windows-capture-python"
version = "1.2.0"
version = "1.2.1"
authors = ["NiiightmareXD"]
edition = "2021"
description = "Fastest Windows Screen Capture Library For Python 🔥"
Expand Down
2 changes: 1 addition & 1 deletion windows-capture-python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "windows-capture"
version = "1.2.0"
version = "1.2.1"
description = "Fastest Windows Screen Capture Library For Python 🔥"
readme = "README.md"
requires-python = ">=3.9"
Expand Down
1 change: 1 addition & 0 deletions windows-capture-python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ pub struct NativeWindowsCapture {
#[pymethods]
impl NativeWindowsCapture {
#[new]
#[pyo3(signature = (on_frame_arrived_callback, on_closed, cursor_capture=None, draw_border=None, monitor_index=None, window_name=None))]
pub fn new(
on_frame_arrived_callback: PyObject,
on_closed: PyObject,
Expand Down

0 comments on commit e025aed

Please sign in to comment.