swap feature flag to just be a setting instead

macos-click-through
Keith Simmons 3 years ago committed by Keith Simmons
parent fe56ce7a0f
commit 1e1bd45d45

@ -14,7 +14,6 @@ members = ["neovide-derive"]
[features] [features]
default = [] default = []
embed-fonts = [] embed-fonts = []
debug-renderer = []
[dependencies] [dependencies]
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

@ -20,13 +20,13 @@ use crate::settings::*;
use cursor_renderer::CursorRenderer; use cursor_renderer::CursorRenderer;
#[derive(SettingGroup)] #[derive(SettingGroup)]
#[setting_prefix = "window"]
#[derive(Clone)] #[derive(Clone)]
pub struct RendererSettings { pub struct RendererSettings {
position_animation_length: f32, position_animation_length: f32,
scroll_animation_length: f32, scroll_animation_length: f32,
floating_opacity: f32, floating_opacity: f32,
floating_blur: bool, floating_blur: bool,
debug_renderer: bool,
} }
impl Default for RendererSettings { impl Default for RendererSettings {
@ -36,6 +36,7 @@ impl Default for RendererSettings {
scroll_animation_length: 0.3, scroll_animation_length: 0.3,
floating_opacity: 0.7, floating_opacity: 0.7,
floating_blur: true, floating_blur: true,
debug_renderer: false,
} }
} }
} }
@ -43,8 +44,7 @@ impl Default for RendererSettings {
pub struct Renderer { pub struct Renderer {
rendered_windows: HashMap<u64, RenderedWindow>, rendered_windows: HashMap<u64, RenderedWindow>,
cursor_renderer: CursorRenderer, cursor_renderer: CursorRenderer,
current_mode: EditorMode,
pub current_mode: EditorMode,
pub paint: Paint, pub paint: Paint,
pub shaper: CachingShaper, pub shaper: CachingShaper,
pub default_style: Arc<Style>, pub default_style: Arc<Style>,
@ -154,7 +154,7 @@ impl Renderer {
let region = self.compute_text_region(grid_pos, cell_width); let region = self.compute_text_region(grid_pos, cell_width);
let style = style.as_ref().unwrap_or(&self.default_style); let style = style.as_ref().unwrap_or(&self.default_style);
if cfg!(feature = "debug-renderer") { if SETTINGS.get_global::<RendererSettings>().debug_renderer {
let random_hsv: HSV = (rand::random::<f32>() * 360.0, 0.3, 0.3).into(); let random_hsv: HSV = (rand::random::<f32>() * 360.0, 0.3, 0.3).into();
let random_color = random_hsv.to_color(255); let random_color = random_hsv.to_color(255);
self.paint.set_color(random_color); self.paint.set_color(random_color);
@ -215,7 +215,7 @@ impl Renderer {
let y_adjustment = self.shaper.y_adjustment(); let y_adjustment = self.shaper.y_adjustment();
if cfg!(feature = "debug-renderer") { if SETTINGS.get_global::<RendererSettings>().debug_renderer {
let random_hsv: HSV = (rand::random::<f32>() * 360.0, 1.0, 1.0).into(); let random_hsv: HSV = (rand::random::<f32>() * 360.0, 1.0, 1.0).into();
let random_color = random_hsv.to_color(255); let random_color = random_hsv.to_color(255);
self.paint.set_color(random_color); self.paint.set_color(random_color);

Loading…
Cancel
Save