Transparency working again

macos-click-through
LoipesMas 3 years ago committed by Keith Simmons
parent 401d1a88a2
commit 42f74a3bbb

@ -1,3 +1,4 @@
use crate::WindowSettings;
use std::sync::Arc;
use glutin::dpi::PhysicalSize;
@ -74,7 +75,8 @@ impl GridRenderer {
}
pub fn get_default_background(&self) -> Color {
self.default_style.colors.background.unwrap().to_color()
let transparency = {SETTINGS.get::<WindowSettings>().transparency};
self.default_style.colors.background.unwrap().to_color().with_a((255.0 * transparency) as u8)
}
pub fn draw_background(
@ -97,6 +99,9 @@ impl GridRenderer {
self.paint
.set_color(style.background(&self.default_style.colors).to_color());
}
let transparency = {SETTINGS.get::<WindowSettings>().transparency};
self.paint.set_alpha_f(transparency);
canvas.draw_rect(region, &self.paint);
}

@ -87,6 +87,9 @@ impl Renderer {
.collect();
let mut font_changed = false;
let default_background = self.grid_renderer.get_default_background();
root_canvas.clear(default_background);
for draw_command in draw_commands.into_iter() {
if let DrawCommand::FontChanged(_) = draw_command {
font_changed = true;
@ -94,10 +97,8 @@ impl Renderer {
self.handle_draw_command(root_canvas, draw_command);
}
let default_background = self.grid_renderer.get_default_background();
let font_dimensions = self.grid_renderer.font_dimensions;
root_canvas.clear(default_background);
root_canvas.save();
root_canvas.reset_matrix();

@ -51,6 +51,7 @@ pub struct GlutinWindowWrapper {
mouse_manager: MouseManager,
title: String,
fullscreen: bool,
transparency: f32,
saved_inner_size: PhysicalSize<u32>,
saved_grid_size: Option<Dimensions>,
ui_command_sender: LoggingTx<UiCommand>,
@ -76,6 +77,13 @@ impl GlutinWindowWrapper {
if self.fullscreen != fullscreen {
self.toggle_fullscreen();
}
let transparency = { SETTINGS.get::<WindowSettings>().transparency };
if self.transparency != transparency {
self.transparency = transparency;
self.toggle_fullscreen();
}
}
#[allow(clippy::needless_collect)]
@ -267,6 +275,7 @@ pub fn create_window(
.with_title("Neovide")
.with_window_icon(Some(icon))
.with_maximized(cmd_line_settings.maximized)
.with_transparent(true)
.with_decorations(!cmd_line_settings.frameless);
#[cfg(target_os = "linux")]
@ -309,6 +318,7 @@ pub fn create_window(
mouse_manager: MouseManager::new(ui_command_sender.clone()),
title: String::from("Neovide"),
fullscreen: false,
transparency: 1.0,
saved_inner_size,
saved_grid_size: None,
ui_command_sender,

Loading…
Cancel
Save