slowly figuring it out

This commit is contained in:
🪞👃🪞 2024-07-24 16:42:24 +03:00
parent b1d8fc62a9
commit ef619c595a
2 changed files with 17 additions and 10 deletions

View file

@ -5,7 +5,13 @@ pub mod bound;
pub struct Host(*mut self::bound::SuilHost); pub struct Host(*mut self::bound::SuilHost);
pub struct Instance(*mut self::bound::SuilInstance); impl Drop for Host {
fn drop (&mut self) -> () {
unsafe {
bound::suil_host_free(self.0)
}
}
}
impl Host { impl Host {
pub fn new () -> Self { pub fn new () -> Self {
@ -87,13 +93,7 @@ unsafe extern "C" fn index (
//0 //0
//} //}
impl Drop for Host { pub struct Instance(*mut self::bound::SuilInstance);
fn drop (&mut self) -> () {
unsafe {
bound::suil_host_free(self.0)
}
}
}
impl Drop for Instance { impl Drop for Instance {
fn drop (&mut self) -> () { fn drop (&mut self) -> () {
@ -106,3 +106,9 @@ impl Drop for Instance {
unsafe impl Send for Instance {} unsafe impl Send for Instance {}
unsafe impl Sync for Instance {} unsafe impl Sync for Instance {}
impl Instance {
fn get_widget (&self) -> *mut c_void {
unsafe { bound::suil_instance_get_widget(self.0) }
}
}

View file

@ -13,14 +13,15 @@ fn test_lv2_ui () {
std::mem::forget(features); std::mem::forget(features);
let instance = Arc::new(host.instance( let instance = Arc::new(host.instance(
&mut plugin.instance.raw(), &mut plugin.instance.raw(),
"http://lv2plug.in/ns/extensions/ui#X11UI", "http://lv2plug.in/ns/extensions/ui#Gtk3UI",
"https://thewavewarden.com/odin2", "https://thewavewarden.com/odin2",
"https://thewavewarden.com/odin2#ParentUI", "https://thewavewarden.com/odin2#ParentUI",
"/home/user/.lv2/Odin2.lv2", "http://lv2plug.in/ns/extensions/ui#X11UI",
"/home/user/.lv2/Odin2.lv2/Odin2.so", "/home/user/.lv2/Odin2.lv2/Odin2.so",
"/home/user/.lv2/Odin2.lv2/Odin2.so", "/home/user/.lv2/Odin2.lv2/Odin2.so",
&features, &features,
).unwrap()); ).unwrap());
println!("{:?}", instance.get_widget());
self::ui::UI::run(&instance).join(); self::ui::UI::run(&instance).join();
} }