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
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 Fábio Henrique de Lima Silva (fhl.bsb@gmail.com) All rights reserved.
// SAFETY: FFI call, host pointer transmute, or raw graphics context access with verified lifetimes.
//! Implementation of the main graphical user interface window.
/// egui rendering function and UI components.
/// Main window and event/draw manager with baseview + egui.
/// Default width of the plugin window.
pub const GUI_WIDTH: u32 = 600;
/// Default height of the plugin window.
pub const GUI_HEIGHT: u32 = 275;
/// Extends the lifetime of a `HostSharedHandle` to `'static`.
///
/// # Safety
///
/// The caller must ensure that the CLAP host referenced by the handle remains
/// valid and is not unloaded while the returned handle with `'static` lifetime
/// is in use. In the plugin context, the GUI window that uses the `'static`
/// handle is guaranteed to be destroyed/closed before the plugin is destroyed,
/// ensuring that the host's real lifetime encompasses all use of the handle.
// SAFETY: HostSharedHandle is repr(transparent) over a raw pointer wrapper
// (the underlying type is a NonNull<clap_host>). transmuting the lifetime from
// 'a to 'static is sound because the caller guarantees the host outlives the
// plugin — the GUI window is destroyed/closed before the plugin factory is
// deactivated, ensuring the real host lifetime encompasses the extended lifetime.
pub unsafe