Skip to content

Commit 3135ab9

Browse files
committed
rename Parent to ParentWindow and pass it by reference to Plugin::editor
1 parent 4518b92 commit 3135ab9

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

examples/gain/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl Plugin for Gain {
8686
}
8787
}
8888

89-
fn editor(&mut self, parent: Parent) -> Self::Editor {
89+
fn editor(&mut self, parent: &ParentWindow) -> Self::Editor {
9090
GainEditor::open(parent).unwrap()
9191
}
9292
}
@@ -138,7 +138,7 @@ pub struct GainEditor {
138138
}
139139

140140
impl GainEditor {
141-
fn open(parent: Parent) -> reflector_platform::Result<GainEditor> {
141+
fn open(parent: &ParentWindow) -> reflector_platform::Result<GainEditor> {
142142
let app = AppOptions::new().mode(AppMode::Guest).build()?;
143143

144144
let mut options = WindowOptions::new();

src/editor.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ pub enum RawParent {
99
X11(c_ulong),
1010
}
1111

12-
pub struct Parent {
12+
pub struct ParentWindow {
1313
parent: RawParent,
1414
}
1515

16-
impl Parent {
17-
pub unsafe fn from_raw(parent: RawParent) -> Parent {
18-
Parent { parent }
16+
impl ParentWindow {
17+
pub unsafe fn from_raw(parent: RawParent) -> ParentWindow {
18+
ParentWindow { parent }
1919
}
2020

2121
pub fn as_raw(&self) -> RawParent {

src/format/clap/gui.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clap_sys::ext::gui::*;
44
use clap_sys::plugin::*;
55

66
use super::instance::Instance;
7-
use crate::editor::{Editor, Parent, RawParent};
7+
use crate::editor::{Editor, ParentWindow, RawParent};
88
use crate::plugin::Plugin;
99

1010
impl<P: Plugin> Instance<P> {
@@ -151,7 +151,7 @@ impl<P: Plugin> Instance<P> {
151151
let instance = &*(plugin as *const Self);
152152
let main_thread_state = &mut *instance.main_thread_state.get();
153153

154-
let editor = main_thread_state.plugin.editor(Parent::from_raw(raw_parent));
154+
let editor = main_thread_state.plugin.editor(&ParentWindow::from_raw(raw_parent));
155155
main_thread_state.editor = Some(editor);
156156

157157
true

src/format/clap/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::ffi::{c_char, CStr};
22
use std::io::{self, Read, Write};
33

44
use crate::buffers::Buffers;
5-
use crate::editor::{Editor, Parent, Size};
5+
use crate::editor::{Editor, ParentWindow, Size};
66
use crate::events::Events;
77

88
use clap_sys::plugin_factory::{clap_plugin_factory, CLAP_PLUGIN_FACTORY_ID};
@@ -57,7 +57,7 @@ impl Plugin for TestPlugin {
5757
fn processor(&mut self, _config: Config) -> Self::Processor {
5858
TestProcessor
5959
}
60-
fn editor(&mut self, _parent: Parent) -> Self::Editor {
60+
fn editor(&mut self, _parent: &ParentWindow) -> Self::Editor {
6161
TestEditor
6262
}
6363

src/format/vst3/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::io::{self, Read, Write};
44
use std::{ptr, slice};
55

66
use crate::buffers::Buffers;
7-
use crate::editor::{Editor, Parent, Size};
7+
use crate::editor::{Editor, ParentWindow, Size};
88
use crate::events::Events;
99
use crate::host::Host;
1010
use crate::params::{ParamId, ParamValue};
@@ -64,7 +64,7 @@ impl Plugin for TestPlugin {
6464
fn processor(&mut self, _config: Config) -> Self::Processor {
6565
TestProcessor
6666
}
67-
fn editor(&mut self, _parent: Parent) -> Self::Editor {
67+
fn editor(&mut self, _parent: &ParentWindow) -> Self::Editor {
6868
TestEditor
6969
}
7070

src/format/vst3/view.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::sync::Arc;
55
use vst3::{Class, Steinberg::*};
66

77
use super::component::MainThreadState;
8-
use crate::editor::{Editor, Parent, RawParent};
8+
use crate::editor::{Editor, ParentWindow, RawParent};
99
use crate::plugin::Plugin;
1010

1111
pub struct View<P: Plugin> {
@@ -60,7 +60,7 @@ impl<P: Plugin> IPlugViewTrait for View<P> {
6060

6161
let main_thread_state = &mut *self.main_thread_state.get();
6262

63-
let editor = main_thread_state.plugin.editor(Parent::from_raw(raw_parent));
63+
let editor = main_thread_state.plugin.editor(&ParentWindow::from_raw(raw_parent));
6464
main_thread_state.editor = Some(editor);
6565

6666
kResultOk

src/plugin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::io::{self, Read, Write};
22

33
use crate::bus::{BusInfo, Layout};
4-
use crate::editor::{Editor, Parent};
4+
use crate::editor::{Editor, ParentWindow};
55
use crate::host::Host;
66
use crate::params::{ParamId, ParamInfo, ParamValue};
77
use crate::process::{Config, Processor};
@@ -46,7 +46,7 @@ pub trait Plugin: Send + Sized + 'static {
4646
fn save(&self, output: &mut impl Write) -> io::Result<()>;
4747
fn load(&mut self, input: &mut impl Read) -> io::Result<()>;
4848
fn processor(&mut self, config: Config) -> Self::Processor;
49-
fn editor(&mut self, parent: Parent) -> Self::Editor;
49+
fn editor(&mut self, parent: &ParentWindow) -> Self::Editor;
5050

5151
#[allow(unused_variables)]
5252
fn latency(&self, config: &Config) -> u64 {

0 commit comments

Comments
 (0)