aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
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/config.rs
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/config.rs')
-rw-r--r--src/config.rs57
1 files changed, 42 insertions, 15 deletions
diff --git a/src/config.rs b/src/config.rs
index 85859cfe..b638ea43 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1869,8 +1869,26 @@ pub struct Font {
#[serde(default="true_bool", deserialize_with = "default_true_bool")]
use_thin_strokes: bool,
- #[serde(default="true_bool", deserialize_with = "default_true_bool")]
- scale_with_dpi: bool,
+ // TODO: Deprecated
+ #[serde(default, deserialize_with = "deserialize_scale_with_dpi")]
+ scale_with_dpi: Option<()>,
+}
+
+fn deserialize_scale_with_dpi<'a, D>(deserializer: D) -> ::std::result::Result<Option<()>, D::Error>
+where
+ D: de::Deserializer<'a>,
+{
+ use ::util::fmt;
+ // This is necessary in order to get serde to complete deserialization of the configuration
+ let _ignored = bool::deserialize(deserializer);
+ eprintln!(
+ "{}",
+ fmt::Yellow(
+ "The `scale_with_dpi` setting has been removed, \
+ on X11 the WINIT_HIDPI_FACTOR environment variable can be used instead."
+ )
+ );
+ Ok(None)
}
fn default_bold_desc() -> FontDescription {
@@ -1923,11 +1941,6 @@ impl Font {
.. self
}
}
-
- /// Check whether dpi should be applied
- pub fn scale_with_dpi(&self) -> bool {
- self.scale_with_dpi
- }
}
#[cfg(target_os = "macos")]
@@ -1939,7 +1952,7 @@ impl Default for Font {
italic: FontDescription::new_with_family("Menlo"),
size: Size::new(11.0),
use_thin_strokes: true,
- scale_with_dpi: true,
+ scale_with_dpi: None,
glyph_offset: Default::default(),
offset: Default::default(),
}
@@ -1955,7 +1968,7 @@ impl Default for Font {
italic: FontDescription::new_with_family("monospace"),
size: Size::new(11.0),
use_thin_strokes: false,
- scale_with_dpi: true,
+ scale_with_dpi: None,
glyph_offset: Default::default(),
offset: Default::default(),
}
@@ -1971,9 +1984,9 @@ impl Default for Font {
italic: FontDescription::new_with_family("Consolas"),
size: Size::new(11.0),
use_thin_strokes: false,
- offset: Default::default(),
+ scale_with_dpi: None,
glyph_offset: Default::default(),
- scale_with_dpi: false,
+ offset: Default::default(),
}
}
}
@@ -2156,6 +2169,15 @@ pub enum Key {
F13,
F14,
F15,
+ F16,
+ F17,
+ F18,
+ F19,
+ F20,
+ F21,
+ F22,
+ F23,
+ F24,
Snapshot,
Scroll,
Pause,
@@ -2206,7 +2228,6 @@ pub enum Key {
LAlt,
LBracket,
LControl,
- LMenu,
LShift,
LWin,
Mail,
@@ -2231,7 +2252,6 @@ pub enum Key {
RAlt,
RBracket,
RControl,
- RMenu,
RShift,
RWin,
Semicolon,
@@ -2317,6 +2337,15 @@ impl Key {
F13 => Key::F13,
F14 => Key::F14,
F15 => Key::F15,
+ F16 => Key::F16,
+ F17 => Key::F17,
+ F18 => Key::F18,
+ F19 => Key::F19,
+ F20 => Key::F20,
+ F21 => Key::F21,
+ F22 => Key::F22,
+ F23 => Key::F23,
+ F24 => Key::F24,
Snapshot => Key::Snapshot,
Scroll => Key::Scroll,
Pause => Key::Pause,
@@ -2367,7 +2396,6 @@ impl Key {
LAlt => Key::LAlt,
LBracket => Key::LBracket,
LControl => Key::LControl,
- LMenu => Key::LMenu,
LShift => Key::LShift,
LWin => Key::LWin,
Mail => Key::Mail,
@@ -2392,7 +2420,6 @@ impl Key {
RAlt => Key::RAlt,
RBracket => Key::RBracket,
RControl => Key::RControl,
- RMenu => Key::RMenu,
RShift => Key::RShift,
RWin => Key::RWin,
Semicolon => Key::Semicolon,