Skip to content

Commit

Permalink
v0.6.1: cargo update
Browse files Browse the repository at this point in the history
  • Loading branch information
modelflat committed Sep 1, 2024
1 parent f040e0d commit 82e9a07
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 104 deletions.
193 changes: 102 additions & 91 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["zbl", "zbl_py"]
resolver = "2"

[workspace.package]
version = "0.6.0"
version = "0.6.1"

[profile.release]
strip = true
2 changes: 1 addition & 1 deletion zbl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ once_cell = "1"
log = "0.4"

[dependencies.windows]
version = "0.56"
version = "0.58"
features = [
"Foundation",
"Graphics_Capture",
Expand Down
4 changes: 2 additions & 2 deletions zbl/examples/simple.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::time::Instant;
use std::{os::raw::c_void, time::Instant};

use clap::Parser;
use opencv::{
Expand Down Expand Up @@ -29,7 +29,7 @@ fn main() {
window.print_info();
Box::new(window) as Box<dyn Capturable>
} else if let Some(window_handle) = args.window_handle {
let window = Window::new(HWND(window_handle));
let window = Window::new(HWND(window_handle as *mut c_void));
window.print_info();
Box::new(window) as Box<dyn Capturable>
} else if let Some(display_id) = args.display_id {
Expand Down
13 changes: 10 additions & 3 deletions zbl/src/capture/display.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{
collections::HashMap,
ptr::null_mut,
sync::{
mpsc::{sync_channel, Receiver, SyncSender},
RwLock,
Expand Down Expand Up @@ -47,7 +48,13 @@ extern "system" fn enum_monitor(monitor: HMONITOR, _: HDC, _: *mut RECT, state:
fn enumerate_displays() -> Result<Box<Vec<Result<Display>>>> {
let displays = Box::into_raw(Default::default());
unsafe {
EnumDisplayMonitors(HDC(0), None, Some(enum_monitor), LPARAM(displays as isize)).ok()?;
EnumDisplayMonitors(
HDC(null_mut()),
None,
Some(enum_monitor),
LPARAM(displays as isize),
)
.ok()?;
Ok(Box::from_raw(displays))
}
}
Expand Down Expand Up @@ -104,11 +111,11 @@ impl Capturable for Display {
OBJECT_DESTROYED_USER_DATA
.write()
.unwrap()
.insert(self.handle.0, (self.handle.0, sender));
.insert(self.handle.0 as isize, (self.handle.0 as isize, sender));
receiver
}

fn get_raw_handle(&self) -> isize {
self.handle.0
self.handle.0 as isize
}
}
8 changes: 4 additions & 4 deletions zbl/src/capture/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ extern "system" fn object_destroyed_cb(
) {
if id_object == 0 && id_child == 0 && handle != HWND::default() {
let has_been_closed = if let Ok(handles) = OBJECT_DESTROYED_USER_DATA.read() {
if let Some((window_handle, tx)) = handles.get(&this.0) {
if *window_handle == handle.0 {
if let Some((window_handle, tx)) = handles.get(&(this.0 as isize)) {
if *window_handle == handle.0 as isize {
tx.send(()).ok();
true
} else {
Expand Down Expand Up @@ -299,12 +299,12 @@ impl Capturable for Window {
)
};
if let Ok(mut handles) = OBJECT_DESTROYED_USER_DATA.write() {
handles.insert(hook_id.0, (self.handle.0, sender));
handles.insert(hook_id.0 as isize, (self.handle.0 as isize, sender));
}
receiver
}

fn get_raw_handle(&self) -> isize {
self.handle.0
self.handle.0 as isize
}
}
2 changes: 1 addition & 1 deletion zbl_py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "zbl"
description = "real-time window capture library based on D3D11 and Windows.Graphics.Capture"
version = "0.6.0"
version = "0.6.1"
readme = "../README.md"
requires-python = ">=3.8"
license = { file = "../LICENSE.txt" }
Expand Down
3 changes: 2 additions & 1 deletion zbl_py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ impl Capture {
)?)
} else if let Some(handle) = window_handle {
Ok(Self::from_capturable(
Box::new(::zbl::Window::new(HWND(handle as isize))) as Box<dyn ::zbl::Capturable>,
Box::new(::zbl::Window::new(HWND(handle as *mut c_void)))
as Box<dyn ::zbl::Capturable>,
is_cursor_capture_enabled,
is_border_required,
cpu_access,
Expand Down

0 comments on commit 82e9a07

Please sign in to comment.