Use a patched {egui-,}baseview for X11 GL contexts
This commit is contained in:
parent
5549fd4185
commit
02115d5004
39
Cargo.lock
generated
39
Cargo.lock
generated
|
@ -62,14 +62,14 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
|||
[[package]]
|
||||
name = "baseview"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/RustAudio/baseview.git#a8010016fb92a4b9307da3fbe5d4d97c873feb0e"
|
||||
source = "git+https://github.com/robbert-vdh/baseview.git?branch=feature/merge-raw-gl-context#2f7f177be8c039352ce9aa351cb55aa7ed624e1e"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"core-foundation",
|
||||
"keyboard-types",
|
||||
"nix",
|
||||
"objc",
|
||||
"raw-window-handle 0.3.4",
|
||||
"raw-window-handle",
|
||||
"uuid",
|
||||
"winapi",
|
||||
"x11",
|
||||
|
@ -158,9 +158,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.2"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3"
|
||||
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
|
@ -300,15 +300,14 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "egui-baseview"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/robbert-vdh/egui-baseview.git?branch=fix/update-dependencies#9234744bc4ddfa5252fd220f2d5f24bb9d9fa66d"
|
||||
source = "git+https://github.com/robbert-vdh/egui-baseview.git?branch=fix/update-dependencies#240be386214a0d9f0e6bbd1c721c4b381ddf3628"
|
||||
dependencies = [
|
||||
"baseview",
|
||||
"copypasta",
|
||||
"egui",
|
||||
"gl",
|
||||
"keyboard-types",
|
||||
"raw-gl-context",
|
||||
"raw-window-handle 0.3.4",
|
||||
"raw-window-handle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -510,7 +509,7 @@ dependencies = [
|
|||
"lazy_static",
|
||||
"nih_plug_derive",
|
||||
"parking_lot",
|
||||
"raw-window-handle 0.3.4",
|
||||
"raw-window-handle",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"vst3-sys",
|
||||
|
@ -668,30 +667,6 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-gl-context"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4590d88b5f7f4a7b140a2bbb90085c2c3c9ac80832e53521a47c6a4ac1adbc3"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"core-foundation",
|
||||
"objc",
|
||||
"raw-window-handle 0.3.4",
|
||||
"winapi",
|
||||
"x11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"raw-window-handle 0.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.4.2"
|
||||
|
|
|
@ -28,8 +28,7 @@ cfg-if = "1.0"
|
|||
crossbeam = "0.8"
|
||||
lazy_static = "1.4"
|
||||
parking_lot = "0.12"
|
||||
# 0.4.x doesn't work with baseview
|
||||
raw-window-handle = "0.3"
|
||||
raw-window-handle = "0.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
vst3-sys = { git = "https://github.com/robbert-vdh/vst3-sys.git", branch = "fix/atomic-reference-count" }
|
||||
|
|
|
@ -10,7 +10,7 @@ description = "An adapter to use egui GUIs with NIH-plug"
|
|||
[dependencies]
|
||||
nih_plug = { path = ".." }
|
||||
|
||||
baseview = { git = "https://github.com/RustAudio/baseview.git" }
|
||||
baseview = { git = "https://github.com/robbert-vdh/baseview.git", branch = "feature/merge-raw-gl-context" }
|
||||
crossbeam = "0.8"
|
||||
egui = "0.16"
|
||||
# Upstream doesn't work with the current baseview and egui versions
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
//!
|
||||
//! TODO: Proper usage example
|
||||
|
||||
use baseview::gl::GlConfig;
|
||||
use baseview::{Size, WindowHandle, WindowOpenOptions, WindowScalePolicy};
|
||||
use egui::CtxRef;
|
||||
use egui_baseview::{EguiWindow, RenderSettings, Settings};
|
||||
use egui_baseview::EguiWindow;
|
||||
use nih_plug::{Editor, ParamSetter, ParentWindowHandle};
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
|
@ -77,22 +78,18 @@ where
|
|||
let (width, height) = self.size.load();
|
||||
let window = EguiWindow::open_parented(
|
||||
&parent,
|
||||
Settings {
|
||||
window: WindowOpenOptions {
|
||||
WindowOpenOptions {
|
||||
title: String::from("egui window"),
|
||||
size: Size::new(width as f64, height as f64),
|
||||
// TODO: What happens when we use the system scale factor here? I'd assume this
|
||||
// would work everywhere, even if the window may be tiny in some cases.
|
||||
scale: WindowScalePolicy::ScaleFactor(1.0),
|
||||
},
|
||||
render_settings: RenderSettings {
|
||||
gl_config: Some(GlConfig {
|
||||
version: (3, 2),
|
||||
red_bits: 8,
|
||||
blue_bits: 8,
|
||||
green_bits: 8,
|
||||
// If the window was not created with the correct visual, then specifying 8 bits
|
||||
// here will cause creating the context to fail
|
||||
alpha_bits: 0,
|
||||
alpha_bits: 8,
|
||||
depth_bits: 24,
|
||||
stencil_bits: 8,
|
||||
samples: None,
|
||||
|
@ -100,7 +97,7 @@ where
|
|||
double_buffer: true,
|
||||
vsync: true,
|
||||
..Default::default()
|
||||
},
|
||||
}),
|
||||
},
|
||||
state,
|
||||
|_, _, _| {},
|
||||
|
@ -115,7 +112,8 @@ where
|
|||
queue.request_repaint();
|
||||
(update)(egui_ctx, &setter, &mut state.write());
|
||||
},
|
||||
);
|
||||
)
|
||||
.expect("We provided an OpenGL config, did we not?");
|
||||
|
||||
Box::new(EguiEditorHandle { window })
|
||||
}
|
||||
|
|
|
@ -102,21 +102,21 @@ impl<P: Plugin> IPlugView for WrapperView<P> {
|
|||
let handle = match type_.to_str() {
|
||||
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
|
||||
Ok(type_) if type_ == VST3_PLATFORM_X11_WINDOW => {
|
||||
let mut handle = raw_window_handle::unix::XcbHandle::empty();
|
||||
let mut handle = raw_window_handle::XcbHandle::empty();
|
||||
handle.window = parent as usize as u32;
|
||||
RawWindowHandle::Xcb(handle)
|
||||
}
|
||||
#[cfg(all(target_os = "macos"))]
|
||||
Ok(type_) if type_ == VST3_PLATFORM_NSVIEW => {
|
||||
let mut handle = raw_window_handle::macos::MacOSHandle::empty();
|
||||
let mut handle = raw_window_handle::AppKitHandle::empty();
|
||||
handle.ns_view = parent;
|
||||
RawWindowHandle::MacOS(handle)
|
||||
RawWindowHandle::AppKit(handle)
|
||||
}
|
||||
#[cfg(all(target_os = "windows"))]
|
||||
Ok(type_) if type_ == VST3_PLATFORM_HWND => {
|
||||
let mut handle = raw_window_handle::windows::WindowsHandle::empty();
|
||||
let mut handle = raw_window_handle::Win32Handle::empty();
|
||||
handle.hwnd = parent;
|
||||
RawWindowHandle::Windows(handle)
|
||||
RawWindowHandle::Win32(handle)
|
||||
}
|
||||
_ => {
|
||||
nih_debug_assert_failure!("Unknown window handle type: {:?}", type_);
|
||||
|
|
Loading…
Reference in a new issue