aboutsummaryrefslogtreecommitdiff
path: root/src/term
diff options
context:
space:
mode:
authorMatt Keeler <mkeeler@users.noreply.github.com>2018-11-10 11:08:48 -0500
committerChristian Duerr <chrisduerr@users.noreply.github.com>2018-11-10 16:08:48 +0000
commit2434547fce7bf47a848f088f2600e8ba7027a62b (patch)
tree551a50b1071e6208c76c9e26b38b40f60605f2c7 /src/term
parent81617983bb4b3b17f18dab938bb572757aa54920 (diff)
downloadalacritty-2434547fce7bf47a848f088f2600e8ba7027a62b.tar.gz
alacritty-2434547fce7bf47a848f088f2600e8ba7027a62b.zip
Upgrade Glutin to v0.19.0
Some changes include: • Use the with_hardware_acceleration function on the ContextBuilder to not require the discrete GPU • Remove the LMenu and RMenu virtual key codes (winit 0.16.0 removed these because Windows now generates LAlt and RAlt instead • Replace set_cursor_state with hide_cursor (winit 0.16.0 removed the set_cursor_state function) • Replace GlWindow::hidpi_factor with GlWindow::get_hidpi_factor and change to expecting an f64 • Use the glutin/winit dpi size and position types where possible Glutin's dpi change event has been implemented. All size events now return logical sizes. As a result of that, the logical sizes are translated in the `display::handle_rezize` method so DPI scaling works correctly. When the DPI is changed, the glyph cache is updated to make use of the correct font size again. Moving a window to a different screen which is a different DPI caused a racing condition where the logical size of the event was sent to the `handle_resize` method in `src/display.rs`, however if there was a DPI change event before `handle_resize` is able to process this message, it would incorrectly use the new DPI to scale the resize event. To solve this issue instead of sending the logical size to the `handle_resize` method and then converting it to a physical size in there, the `LogicalSize` of the resize event is transformed into a `PhysicalSize` as soon as it's received. This fixes potential racing conditions since all events are processed in order. The padding has been changed so it's also scaled by DPR. The `scale_with_dpi` config option has been removed. If it's not present a warning will be emitted. The `winit` dependency on Windows has been removed. All interactions with winit in Alacritty are handled through glutin.
Diffstat (limited to 'src/term')
-rw-r--r--src/term/mod.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 971755af..39213ee2 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -832,6 +832,10 @@ pub struct SizeInfo {
/// Horizontal window padding
pub padding_y: f32,
+
+ /// DPI factor of the current window
+ #[serde(default)]
+ pub dpr: f64,
}
impl SizeInfo {
@@ -2065,6 +2069,7 @@ mod tests {
cell_height: 3.0,
padding_x: 0.0,
padding_y: 0.0,
+ dpr: 1.0,
};
let mut term = Term::new(&Default::default(), size);
let mut grid: Grid<Cell> = Grid::new(Line(3), Column(5), 0, Cell::default());
@@ -2108,6 +2113,7 @@ mod tests {
cell_height: 3.0,
padding_x: 0.0,
padding_y: 0.0,
+ dpr: 1.0,
};
let mut term = Term::new(&Default::default(), size);
let mut grid: Grid<Cell> = Grid::new(Line(1), Column(5), 0, Cell::default());
@@ -2133,6 +2139,7 @@ mod tests {
cell_height: 3.0,
padding_x: 0.0,
padding_y: 0.0,
+ dpr: 1.0,
};
let mut term = Term::new(&Default::default(), size);
let mut grid: Grid<Cell> = Grid::new(Line(3), Column(3), 0, Cell::default());
@@ -2177,6 +2184,7 @@ mod tests {
cell_height: 3.0,
padding_x: 0.0,
padding_y: 0.0,
+ dpr: 1.0,
};
let mut term = Term::new(&Default::default(), size);
let cursor = Point::new(Line(0), Column(0));
@@ -2195,6 +2203,7 @@ mod tests {
cell_height: 3.0,
padding_x: 0.0,
padding_y: 0.0,
+ dpr: 1.0,
};
let config: Config = Default::default();
let mut term: Term = Term::new(&config, size);
@@ -2223,6 +2232,7 @@ mod tests {
cell_height: 3.0,
padding_x: 0.0,
padding_y: 0.0,
+ dpr: 1.0,
};
let config: Config = Default::default();
let mut term: Term = Term::new(&config, size);
@@ -2242,6 +2252,7 @@ mod tests {
cell_height: 3.0,
padding_x: 0.0,
padding_y: 0.0,
+ dpr: 1.0,
};
let config: Config = Default::default();
let mut term: Term = Term::new(&config, size);
@@ -2262,6 +2273,7 @@ mod tests {
cell_height: 3.0,
padding_x: 0.0,
padding_y: 0.0,
+ dpr: 1.0
};
let config: Config = Default::default();
let mut term: Term = Term::new(&config, size);
@@ -2288,6 +2300,7 @@ mod tests {
cell_height: 3.0,
padding_x: 0.0,
padding_y: 0.0,
+ dpr: 1.0,
};
let mut term = Term::new(&Default::default(), size);
let mut grid: Grid<Cell> = Grid::new(Line(1), Column(15), 0, Cell::default());
@@ -2323,6 +2336,7 @@ mod tests {
cell_height: 3.0,
padding_x: 0.0,
padding_y: 0.0,
+ dpr: 1.0,
};
let mut term = Term::new(&Default::default(), size);
let mut grid: Grid<Cell> = Grid::new(Line(1), Column(15), 0, Cell::default());
@@ -2357,6 +2371,7 @@ mod tests {
cell_height: 3.0,
padding_x: 0.0,
padding_y: 0.0,
+ dpr: 1.0,
};
let mut term = Term::new(&Default::default(), size);
let mut grid: Grid<Cell> = Grid::new(Line(1), Column(15), 0, Cell::default());