1
0
Fork 0

Compare commits

...

2 commits

Author SHA1 Message Date
Alex Janka a03f406bd5 raw-window-handle 0.6.0 2024-08-10 14:31:51 +10:00
Robbert van der Helm ffe9b61fcb Bump dependencies
The `time` package no longer compiled with the latest nightly compiler.
2024-06-09 15:49:29 +02:00
4 changed files with 94 additions and 37 deletions

43
Cargo.lock generated
View file

@ -660,6 +660,23 @@ dependencies = [
"x11rb 0.13.0",
]
[[package]]
name = "baseview"
version = "0.1.0"
source = "git+https://github.com/RustAudio/baseview.git#579130ecb4f9f315ae52190af42f0ea46aeaa4a2"
dependencies = [
"cocoa",
"core-foundation",
"keyboard-types",
"nix 0.22.3",
"objc",
"raw-window-handle 0.5.2",
"uuid",
"winapi",
"x11",
"x11rb 0.13.0",
]
[[package]]
name = "bindgen"
version = "0.69.1"
@ -3002,7 +3019,7 @@ dependencies = [
"atomic_float",
"atomic_refcell",
"backtrace",
"baseview 0.1.0 (git+https://github.com/RustAudio/baseview.git?rev=2c1b1a7b0fef1a29a5150a6a8f6fef6a0cbab8c4)",
"baseview 0.1.0 (git+https://github.com/RustAudio/baseview.git)",
"bitflags 1.3.2",
"cfg-if",
"clap",
@ -3020,7 +3037,7 @@ dependencies = [
"nih_plug_derive",
"objc",
"parking_lot 0.12.1",
"raw-window-handle 0.5.2",
"raw-window-handle 0.6.0",
"rtrb",
"serde",
"serde_json",
@ -3159,6 +3176,12 @@ dependencies = [
"num-traits",
]
[[package]]
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "num-derive"
version = "0.3.3"
@ -3889,6 +3912,12 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9"
[[package]]
name = "raw-window-handle"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544"
[[package]]
name = "rayon"
version = "1.8.0"
@ -4541,13 +4570,14 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.31"
version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e"
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [
"deranged",
"itoa",
"libc",
"num-conv",
"num_threads",
"powerfmt",
"serde",
@ -4563,10 +4593,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]]
name = "time-macros"
version = "0.2.16"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f"
checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [
"num-conv",
"time-core",
]

View file

@ -54,7 +54,14 @@ assert_process_allocs = ["dep:assert_no_alloc"]
# Enables an export target for standalone binaries through the
# `nih_export_standalone()` function. Disabled by default as this requires
# building additional dependencies for audio and MIDI handling.
standalone = ["dep:baseview", "dep:clap", "dep:cpal", "dep:jack", "dep:midir", "dep:rtrb"]
standalone = [
"dep:baseview",
"dep:clap",
"dep:cpal",
"dep:jack",
"dep:midir",
"dep:rtrb",
]
# Enables the `nih_export_vst3!()` macro. Enabled by default. This feature
# exists mostly for GPL-compliance reasons, since even if you don't use the VST3
# wrapper you might otherwise still include a couple (unused) symbols from the
@ -83,27 +90,35 @@ backtrace = "0.3.65"
bitflags = "1.3"
cfg-if = "1.0"
# This supports CLAP 1.1.8
clap-sys = { git = "https://github.com/robbert-vdh/clap-sys.git", branch = "feature/cstr-macro" }
clap-sys = { git = "https://github.com/robbert-vdh/clap-sys.git", branch = "feature/cstr-macro" }
crossbeam = "0.8"
lazy_static = "1.4"
log = { version = "0.4", features = ["std", "release_max_level_info"] }
midi-consts = "0.1"
nih_log = "0.3.1"
parking_lot = "0.12"
raw-window-handle = "0.5"
raw-window-handle = "0.6"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
widestring = "1.0.0-beta.1"
# Used for the `assert_process_allocs` feature
assert_no_alloc = { git = "https://github.com/robbert-vdh/rust-assert-no-alloc.git", branch = "feature/nested-permit-forbid", features = ["backtrace", "log"], optional = true }
assert_no_alloc = { git = "https://github.com/robbert-vdh/rust-assert-no-alloc.git", branch = "feature/nested-permit-forbid", features = [
"backtrace",
"log",
], optional = true }
# Used for the `standalone` feature
# NOTE: OpenGL support is not needed here, but rust-analyzer gets confused when
# some crates do use it and others don't
baseview = { git = "https://github.com/RustAudio/baseview.git", rev = "2c1b1a7b0fef1a29a5150a6a8f6fef6a0cbab8c4", features = ["opengl"], optional = true }
baseview = { git = "https://github.com/RustAudio/baseview.git", features = [
"opengl",
], optional = true }
# All the claps!
clap = { version = "4.1.8", features = ["derive", "wrap_help"], optional = true }
clap = { version = "4.1.8", features = [
"derive",
"wrap_help",
], optional = true }
cpal = { version = "0.15", optional = true }
jack = { version = "0.11.4", optional = true }
midir = { version = "0.9.1", optional = true }

View file

@ -1,6 +1,6 @@
//! Traits for working with plugin editors.
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
use raw_window_handle::{HasWindowHandle, RawWindowHandle, WindowHandle};
use std::any::Any;
use std::ffi::c_void;
use std::sync::Arc;
@ -90,24 +90,33 @@ pub enum ParentWindowHandle {
Win32Hwnd(*mut c_void),
}
unsafe impl HasRawWindowHandle for ParentWindowHandle {
fn raw_window_handle(&self) -> RawWindowHandle {
match *self {
ParentWindowHandle::X11Window(window) => {
let mut handle = raw_window_handle::XcbWindowHandle::empty();
handle.window = window;
RawWindowHandle::Xcb(handle)
}
ParentWindowHandle::AppKitNsView(ns_view) => {
let mut handle = raw_window_handle::AppKitWindowHandle::empty();
handle.ns_view = ns_view;
RawWindowHandle::AppKit(handle)
}
ParentWindowHandle::Win32Hwnd(hwnd) => {
let mut handle = raw_window_handle::Win32WindowHandle::empty();
handle.hwnd = hwnd;
RawWindowHandle::Win32(handle)
}
}
impl HasWindowHandle for ParentWindowHandle {
fn window_handle(
&self,
) -> Result<raw_window_handle::WindowHandle<'_>, raw_window_handle::HandleError> {
Ok(unsafe {
WindowHandle::borrow_raw(match *self {
ParentWindowHandle::X11Window(window) => {
RawWindowHandle::Xcb(raw_window_handle::XcbWindowHandle::new(
window
.try_into()
.map_err(|_| raw_window_handle::HandleError::Unavailable)?,
))
}
ParentWindowHandle::AppKitNsView(ns_view) => {
RawWindowHandle::AppKit(raw_window_handle::AppKitWindowHandle::new(
std::ptr::NonNull::new(ns_view)
.ok_or(raw_window_handle::HandleError::Unavailable)?,
))
}
ParentWindowHandle::Win32Hwnd(hwnd) => {
RawWindowHandle::Win32(raw_window_handle::Win32WindowHandle::new(
(hwnd as isize)
.try_into()
.map_err(|_| raw_window_handle::HandleError::Unavailable)?,
))
}
})
})
}
}

View file

@ -3,7 +3,7 @@ use baseview::{EventStatus, Window, WindowHandler, WindowOpenOptions};
use crossbeam::channel::{self, Sender};
use crossbeam::queue::ArrayQueue;
use parking_lot::Mutex;
use raw_window_handle::HasRawWindowHandle;
use raw_window_handle::HasWindowHandle;
use std::any::Any;
use std::collections::{HashMap, HashSet};
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
@ -345,18 +345,20 @@ impl<P: Plugin, B: Backend<P>> Wrapper<P, B> {
gl_config: None,
},
move |window| {
let parent_handle = match window.raw_window_handle() {
let parent_handle = match window.window_handle().unwrap().as_raw() {
raw_window_handle::RawWindowHandle::Xlib(handle) => {
ParentWindowHandle::X11Window(handle.window as u32)
}
raw_window_handle::RawWindowHandle::Xcb(handle) => {
ParentWindowHandle::X11Window(handle.window)
ParentWindowHandle::X11Window(handle.window.into())
}
raw_window_handle::RawWindowHandle::AppKit(handle) => {
ParentWindowHandle::AppKitNsView(handle.ns_view)
ParentWindowHandle::AppKitNsView(handle.ns_view.as_ptr())
}
raw_window_handle::RawWindowHandle::Win32(handle) => {
ParentWindowHandle::Win32Hwnd(handle.hwnd)
ParentWindowHandle::Win32Hwnd(
handle.hwnd.get() as *mut core::ffi::c_void
)
}
handle => unimplemented!("Unsupported window handle: {handle:?}"),
};