1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
use crate::{host::*, plugin::*};
use std::ffi::c_void;
use std::os::raw::{c_char, c_ulong};
pub const CLAP_EXT_GUI: *const c_char = b"clap.gui\0".as_ptr() as *const c_char;
pub const CLAP_WINDOW_API_WIN32: *const c_char = b"win32\0".as_ptr() as *const c_char;
pub const CLAP_WINDOW_API_COCOA: *const c_char = b"cocoa\0".as_ptr() as *const c_char;
pub const CLAP_WINDOW_API_X11: *const c_char = b"x11\0".as_ptr() as *const c_char;
pub const CLAP_WINDOW_API_WAYLAND: *const c_char = b"wayland\0".as_ptr() as *const c_char;
pub type clap_hwnd = *mut c_void;
pub type clap_nsview = *mut c_void;
pub type clap_xwnd = c_ulong;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct clap_window {
pub api: *const c_char,
pub specific: clap_window_handle,
}
unsafe impl Send for clap_window {}
unsafe impl Sync for clap_window {}
#[repr(C)]
#[derive(Copy, Clone)]
pub union clap_window_handle {
pub cocoa: clap_nsview,
pub x11: clap_xwnd,
pub win32: clap_hwnd,
pub ptr: *mut c_void,
}
unsafe impl Send for clap_window_handle {}
unsafe impl Sync for clap_window_handle {}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct clap_gui_resize_hints {
pub can_resize_horizontally: bool,
pub can_resize_vertically: bool,
pub preseve_aspect_ratio: bool,
pub aspect_ratio_width: u32,
pub aspect_ratio_height: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct clap_plugin_gui {
pub is_api_supported: unsafe extern "C" fn(
plugin: *const clap_plugin,
api: *const c_char,
is_floating: bool,
) -> bool,
pub get_preferred_api: unsafe extern "C" fn(
plugin: *const clap_plugin,
api: *mut *const c_char,
is_floating: *mut bool,
) -> bool,
pub create: unsafe extern "C" fn(
plugin: *const clap_plugin,
api: *const c_char,
is_floating: bool,
) -> bool,
pub destroy: unsafe extern "C" fn(plugin: *const clap_plugin),
pub set_scale: unsafe extern "C" fn(plugin: *const clap_plugin, scale: f64) -> bool,
pub get_size:
unsafe extern "C" fn(plugin: *const clap_plugin, width: *mut u32, height: *mut u32) -> bool,
pub can_resize: unsafe extern "C" fn(plugin: *const clap_plugin) -> bool,
pub get_resize_hints:
unsafe extern "C" fn(plugin: *const clap_plugin, hints: *mut clap_gui_resize_hints) -> bool,
pub adjust_size:
unsafe extern "C" fn(plugin: *const clap_plugin, width: *mut u32, height: *mut u32) -> bool,
pub set_size: unsafe extern "C" fn(plugin: *const clap_plugin, width: u32, height: u32) -> bool,
pub set_parent:
unsafe extern "C" fn(plugin: *const clap_plugin, window: *const clap_window) -> bool,
pub set_transient:
unsafe extern "C" fn(plugin: *const clap_plugin, window: *const clap_window) -> bool,
pub suggest_title: unsafe extern "C" fn(plugin: *const clap_plugin, title: *const c_char),
pub show: unsafe extern "C" fn(plugin: *const clap_plugin) -> bool,
pub hide: unsafe extern "C" fn(plugin: *const clap_plugin) -> bool,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct clap_host_gui {
pub resize_hints_changed: unsafe extern "C" fn(host: *const clap_host),
pub request_resize:
unsafe extern "C" fn(host: *const clap_host, width: u32, height: u32) -> bool,
pub request_show: unsafe extern "C" fn(host: *const clap_host) -> bool,
pub request_hide: unsafe extern "C" fn(host: *const clap_host) -> bool,
pub closed: unsafe extern "C" fn(host: *const clap_host, was_destroyed: bool),
}