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