wezterm: fixup overall background color
When padding was set, it was being overwritten by black whitespace unconditionally. This fixes that. refs: #309
This commit is contained in:
1 parent
5b9c86d836
commit
3808cf3f58
3 files changed
+20
-15
No files matched your search
@@ -68,13 +68,14 @@ void main() {
|
||||
color = texture(atlas_linear_sampler, o_tex);
|
||||
// Apply window_background_image_opacity to the background image
|
||||
color.a = o_bg_color.a;
|
||||
} else if (o_has_color == 3.0) {
|
||||
color = o_bg_color;
|
||||
} else {
|
||||
// Nothing else should render on the background layer
|
||||
// color = vec4(0,0,0,0);
|
||||
discard;
|
||||
}
|
||||
} else if (bg_and_line_layer) {
|
||||
if (o_has_color == 2.0) {
|
||||
if (o_has_color >= 2.0) {
|
||||
// Don't render the background image on anything other than
|
||||
// the window_bg_layer.
|
||||
discard;
|
||||
@@ -104,7 +105,7 @@ void main() {
|
||||
color = o_cursor_color;
|
||||
}
|
||||
} else {
|
||||
if (o_has_color == 2.0) {
|
||||
if (o_has_color >= 2.0) {
|
||||
// Don't render the background image on anything other than
|
||||
// the window_bg_layer.
|
||||
discard;
|
||||
|
||||
@@ -35,12 +35,14 @@ pub struct Vertex {
|
||||
// bool or integer values to work:
|
||||
// "bool can't be an in in the vertex shader"
|
||||
//
|
||||
// has_color is effectively an enum with three
|
||||
// has_color is effectively an enum with these
|
||||
// possible values:
|
||||
// 0.0 -> a regular monochrome text glyph
|
||||
// 1.0 -> a color emoji glyph
|
||||
// 2.0 -> a full color texture attached as the
|
||||
// background image of the window
|
||||
// 3.0 -> like 2.0, except that instead of an
|
||||
// image, we use the solid bg color
|
||||
pub has_color: f32,
|
||||
}
|
||||
::window::glium::implement_vertex!(
|
||||
@@ -156,6 +158,12 @@ impl<'a> Quad<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_is_background(&mut self) {
|
||||
for v in self.vert.iter_mut() {
|
||||
v.has_color = 3.0;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_fg_color(&mut self, color: Color) {
|
||||
let color = color.to_tuple_rgba();
|
||||
for v in self.vert.iter_mut() {
|
||||
|
||||
@@ -737,7 +737,7 @@ impl WindowCallbacks for TermWindow {
|
||||
}
|
||||
|
||||
for pass in 0.. {
|
||||
match self.paint_opengl_pass(frame) {
|
||||
match self.paint_opengl_pass() {
|
||||
Ok(_) => break,
|
||||
Err(err) => {
|
||||
if let Some(&OutOfTextureSpace { size: Some(size) }) =
|
||||
@@ -2357,12 +2357,8 @@ impl TermWindow {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn paint_opengl_pass(&mut self, frame: &mut glium::Frame) -> anyhow::Result<()> {
|
||||
fn paint_opengl_pass(&mut self) -> anyhow::Result<()> {
|
||||
let panes = self.get_panes_to_render();
|
||||
if panes.is_empty() {
|
||||
frame.clear_color_srgb(0., 0., 0., 1.);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let Some(pane) = self.get_active_pane_or_overlay() {
|
||||
let splits = self.get_splits();
|
||||
@@ -2493,23 +2489,23 @@ impl TermWindow {
|
||||
let white_space = gl_state.util_sprites.white_space.texture_coords();
|
||||
quad.set_underline(white_space);
|
||||
quad.set_cursor(white_space);
|
||||
quad.set_has_color(false);
|
||||
|
||||
let background_image_alpha = (config.window_background_opacity * 255.0) as u8;
|
||||
let color = Color::rgba(0, 0, 0, background_image_alpha);
|
||||
quad.set_texture_adjust(0., 0., 0., 0.);
|
||||
let color = rgbcolor_alpha_to_window_color(palette.background, background_image_alpha);
|
||||
|
||||
quad.set_texture(white_space);
|
||||
if let Some(im) = self.window_background.as_ref() {
|
||||
let sprite = gl_state.glyph_cache.borrow_mut().cached_image(im, None)?;
|
||||
quad.set_texture(sprite.texture_coords());
|
||||
quad.set_is_background_image();
|
||||
} else {
|
||||
quad.set_texture(white_space);
|
||||
quad.set_is_background();
|
||||
}
|
||||
quad.set_texture_adjust(0., 0., 0., 0.);
|
||||
quad.set_hsv(config.window_background_image_hsb);
|
||||
quad.set_cursor_color(color);
|
||||
quad.set_fg_color(color);
|
||||
quad.set_bg_color(color);
|
||||
quad.set_cursor_color(color);
|
||||
}
|
||||
|
||||
let selrange = self.selection(pos.pane.pane_id()).range.clone();
|
||||
|
||||
Reference in new issue
Block a user