summaryrefslogtreecommitdiff
path: root/src/display.rs
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2018-12-17 19:06:07 +0000
committerGitHub <noreply@github.com>2018-12-17 19:06:07 +0000
commitcf9d94eb1256881d48b1a3dc63db6caf32bfb841 (patch)
treedaae5794b13ba42cdfe57b431eedd76aa8a12b49 /src/display.rs
parent0c3e28617a95b4ca30ad9bdbb9114f1e4d41dce5 (diff)
downloadalacritty-cf9d94eb1256881d48b1a3dc63db6caf32bfb841.tar.gz
alacritty-cf9d94eb1256881d48b1a3dc63db6caf32bfb841.zip
Add color option to visual bell
This adds the option to specify the color of the visual bell using the `visual_bell.color` configuration setting. This is done by rendering a big quad over the entire screen, which also opens up options to draw other arbitrary rectangles on the screen in the future.
Diffstat (limited to 'src/display.rs')
-rw-r--r--src/display.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/display.rs b/src/display.rs
index 99889c67..120cd1dc 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -158,8 +158,8 @@ impl Display {
let dimensions = options.dimensions()
.unwrap_or_else(|| config.dimensions());
- let mut padding_x = (f64::from(config.padding().x) * dpr).floor();
- let mut padding_y = (f64::from(config.padding().y) * dpr).floor();
+ let mut padding_x = f64::from(config.padding().x) * dpr;
+ let mut padding_y = f64::from(config.padding().y) * dpr;
if dimensions.columns_u32() > 0
&& dimensions.lines_u32() > 0
@@ -168,6 +168,8 @@ impl Display {
// Calculate new size based on cols/lines specified in config
let width = cell_width as u32 * dimensions.columns_u32();
let height = cell_height as u32 * dimensions.lines_u32();
+ padding_x = padding_x.floor();
+ padding_y = padding_y.floor();
viewport_size = PhysicalSize::new(
f64::from(width) + 2. * padding_x,
@@ -211,7 +213,6 @@ impl Display {
renderer.with_api(
config,
&size_info,
- 0., /* visual bell intensity */
|api| {
api.clear(background_color);
},
@@ -325,8 +326,6 @@ impl Display {
self.update_glyph_cache(config);
}
- // Receive any resize events; only call gl::Viewport on last
- // available
if let Some(psize) = new_size.take() {
let width = psize.width as f32;
let height = psize.height as f32;
@@ -405,7 +404,7 @@ impl Display {
// handling and rendering.
drop(terminal);
- self.renderer.with_api(config, &size_info, visual_bell_intensity, |api| {
+ self.renderer.with_api(config, &size_info, |api| {
api.clear(background_color);
});
@@ -416,12 +415,15 @@ impl Display {
{
let _sampler = self.meter.sampler();
- self.renderer.with_api(config, &size_info, visual_bell_intensity, |mut api| {
+ self.renderer.with_api(config, &size_info, |mut api| {
// Draw the grid
api.render_cells(grid_cells.iter(), glyph_cache);
});
}
+ // Draw rectangles
+ self.renderer.draw_rects(config, &size_info, visual_bell_intensity);
+
// Draw render timer
if self.render_timer {
let timing = format!("{:.3} usec", self.meter.average());
@@ -430,7 +432,7 @@ impl Display {
g: 0x4e,
b: 0x53,
};
- self.renderer.with_api(config, &size_info, visual_bell_intensity, |mut api| {
+ self.renderer.with_api(config, &size_info, |mut api| {
api.render_string(&timing[..], size_info.lines() - 2, glyph_cache, color);
});
}
@@ -446,7 +448,7 @@ impl Display {
g: 0x00,
b: 0x00,
};
- self.renderer.with_api(config, &size_info, visual_bell_intensity, |mut api| {
+ self.renderer.with_api(config, &size_info, |mut api| {
api.render_string(&msg, size_info.lines() - 1, glyph_cache, color);
});
} else if self.logger_proxy.warnings() {
@@ -459,7 +461,7 @@ impl Display {
g: 0xff,
b: 0x00,
};
- self.renderer.with_api(config, &size_info, visual_bell_intensity, |mut api| {
+ self.renderer.with_api(config, &size_info, |mut api| {
api.render_string(&msg, size_info.lines() - 1, glyph_cache, color);
});
}