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
//! Configure your application.
use crate::{Size, WindowOpenOptions, WindowScalePolicy};
/// Any settings specific to `iced_baseview`.
pub struct IcedBaseviewSettings {
/// The [`Window`] settings.
pub window: WindowOpenOptions,
/// Ignore key inputs, except for modifier keys such as SHIFT and ALT
pub ignore_non_modifier_keys: bool,
/// Always redraw whenever the baseview window updates instead of only when iced wants to update
/// the window. This works around a current baseview limitation where it does not support
/// trigger a redraw on window visibility change (which may cause blank windows when opening or
/// reopening the editor) and an iced limitation where it's not possible to have animations
/// without using an asynchronous timer stream to send redraw messages to the application.
pub always_redraw: bool,
}
impl Default for IcedBaseviewSettings {
fn default() -> Self {
Self {
window: WindowOpenOptions {
title: String::from("iced_baseview"),
size: Size::new(500.0, 300.0),
scale: WindowScalePolicy::SystemScaleFactor,
#[cfg(feature = "rustanalyzer_opengl_workaround")]
gl_config: None,
},
ignore_non_modifier_keys: false,
always_redraw: false,
}
}
}
impl Clone for IcedBaseviewSettings {
fn clone(&self) -> Self {
Self {
window: WindowOpenOptions {
title: self.window.title.clone(),
size: self.window.size,
scale: self.window.scale,
#[cfg(feature = "rustanalyzer_opengl_workaround")]
gl_config: None,
},
ignore_non_modifier_keys: self.ignore_non_modifier_keys,
always_redraw: self.always_redraw,
}
}
}