aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorJoe Wilm <jwilm@users.noreply.github.com>2017-07-20 10:50:50 -0700
committerGitHub <noreply@github.com>2017-07-20 10:50:50 -0700
commit8e7dd009a4335e6d6673c1aabb2b92d27f86155c (patch)
tree9e1dddb26693ea2085f700d43ae9bc2d800df52d /src/config.rs
parentc8e4f366e740b98377bf6faf157af358b3bc70d2 (diff)
downloadalacritty-8e7dd009a4335e6d6673c1aabb2b92d27f86155c.tar.gz
alacritty-8e7dd009a4335e6d6673c1aabb2b92d27f86155c.zip
Update to latest Glutin/winit (#671)
* Update to latest Glutin/winit This *finally* gets us off the fork of Glutin we've been on for so long and will unblock a number of other items. Functionality should be the same as before. The update forced our hand on a compiler update. It's no longer feasible to pin on an old version. From now on, we require latest stable.
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs324
1 files changed, 163 insertions, 161 deletions
diff --git a/src/config.rs b/src/config.rs
index e4f17ae7..59c675cd 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -21,6 +21,8 @@ use serde::de::Error as SerdeError;
use serde::de::{Visitor, MapVisitor, Unexpected};
use notify::{Watcher as WatcherApi, RecommendedWatcher as FileWatcher, op};
+use glutin::ModifiersState;
+
use input::{Action, Binding, MouseBinding, KeyBinding};
use index::{Line, Column};
@@ -297,10 +299,10 @@ impl Default for Config {
///
/// Our deserialize impl wouldn't be covered by a derive(Deserialize); see the
/// impl below.
-struct ModsWrapper(::glutin::Mods);
+struct ModsWrapper(ModifiersState);
impl ModsWrapper {
- fn into_inner(self) -> ::glutin::Mods {
+ fn into_inner(self) -> ModifiersState {
self.0
}
}
@@ -321,14 +323,13 @@ impl de::Deserialize for ModsWrapper {
fn visit_str<E>(self, value: &str) -> ::std::result::Result<ModsWrapper, E>
where E: de::Error,
{
- use ::glutin::{mods, Mods};
- let mut res = Mods::empty();
+ let mut res = ModifiersState::default();
for modifier in value.split('|') {
match modifier.trim() {
- "Command" | "Super" => res |= mods::SUPER,
- "Shift" => res |= mods::SHIFT,
- "Alt" | "Option" => res |= mods::ALT,
- "Control" => res |= mods::CONTROL,
+ "Command" | "Super" => res.logo = true,
+ "Shift" => res.shift = true,
+ "Alt" | "Option" => res.alt = true,
+ "Control" => res.ctrl = true,
_ => err_println!("unknown modifier {:?}", modifier),
}
}
@@ -482,7 +483,7 @@ impl de::Deserialize for MouseButton {
struct RawBinding {
key: Option<::glutin::VirtualKeyCode>,
mouse: Option<::glutin::MouseButton>,
- mods: ::glutin::Mods,
+ mods: ModifiersState,
mode: TermMode,
notmode: TermMode,
action: Action,
@@ -583,7 +584,7 @@ impl de::Deserialize for RawBinding {
) -> ::std::result::Result<RawBinding, V::Error>
where V: MapVisitor,
{
- let mut mods: Option<::glutin::Mods> = None;
+ let mut mods: Option<ModifiersState> = None;
let mut key: Option<::glutin::VirtualKeyCode> = None;
let mut chars: Option<String> = None;
let mut action: Option<::input::Action> = None;
@@ -670,7 +671,7 @@ impl de::Deserialize for RawBinding {
let mode = mode.unwrap_or_else(TermMode::empty);
let not_mode = not_mode.unwrap_or_else(TermMode::empty);
- let mods = mods.unwrap_or_else(::glutin::Mods::empty);
+ let mods = mods.unwrap_or_else(ModifiersState::default);
if mouse.is_none() && key.is_none() {
return Err(V::Error::custom("bindings require mouse button or key"));
@@ -1644,158 +1645,159 @@ enum Key {
impl Key {
fn to_glutin_key(&self) -> ::glutin::VirtualKeyCode {
+ use ::glutin::VirtualKeyCode::*;
// Thank you, vim macros!
match *self {
- Key::Key1 => ::glutin::VirtualKeyCode::Key1,
- Key::Key2 => ::glutin::VirtualKeyCode::Key2,
- Key::Key3 => ::glutin::VirtualKeyCode::Key3,
- Key::Key4 => ::glutin::VirtualKeyCode::Key4,
- Key::Key5 => ::glutin::VirtualKeyCode::Key5,
- Key::Key6 => ::glutin::VirtualKeyCode::Key6,
- Key::Key7 => ::glutin::VirtualKeyCode::Key7,
- Key::Key8 => ::glutin::VirtualKeyCode::Key8,
- Key::Key9 => ::glutin::VirtualKeyCode::Key9,
- Key::Key0 => ::glutin::VirtualKeyCode::Key0,
- Key::A => ::glutin::VirtualKeyCode::A,
- Key::B => ::glutin::VirtualKeyCode::B,
- Key::C => ::glutin::VirtualKeyCode::C,
- Key::D => ::glutin::VirtualKeyCode::D,
- Key::E => ::glutin::VirtualKeyCode::E,
- Key::F => ::glutin::VirtualKeyCode::F,
- Key::G => ::glutin::VirtualKeyCode::G,
- Key::H => ::glutin::VirtualKeyCode::H,
- Key::I => ::glutin::VirtualKeyCode::I,
- Key::J => ::glutin::VirtualKeyCode::J,
- Key::K => ::glutin::VirtualKeyCode::K,
- Key::L => ::glutin::VirtualKeyCode::L,
- Key::M => ::glutin::VirtualKeyCode::M,
- Key::N => ::glutin::VirtualKeyCode::N,
- Key::O => ::glutin::VirtualKeyCode::O,
- Key::P => ::glutin::VirtualKeyCode::P,
- Key::Q => ::glutin::VirtualKeyCode::Q,
- Key::R => ::glutin::VirtualKeyCode::R,
- Key::S => ::glutin::VirtualKeyCode::S,
- Key::T => ::glutin::VirtualKeyCode::T,
- Key::U => ::glutin::VirtualKeyCode::U,
- Key::V => ::glutin::VirtualKeyCode::V,
- Key::W => ::glutin::VirtualKeyCode::W,
- Key::X => ::glutin::VirtualKeyCode::X,
- Key::Y => ::glutin::VirtualKeyCode::Y,
- Key::Z => ::glutin::VirtualKeyCode::Z,
- Key::Escape => ::glutin::VirtualKeyCode::Escape,
- Key::F1 => ::glutin::VirtualKeyCode::F1,
- Key::F2 => ::glutin::VirtualKeyCode::F2,
- Key::F3 => ::glutin::VirtualKeyCode::F3,
- Key::F4 => ::glutin::VirtualKeyCode::F4,
- Key::F5 => ::glutin::VirtualKeyCode::F5,
- Key::F6 => ::glutin::VirtualKeyCode::F6,
- Key::F7 => ::glutin::VirtualKeyCode::F7,
- Key::F8 => ::glutin::VirtualKeyCode::F8,
- Key::F9 => ::glutin::VirtualKeyCode::F9,
- Key::F10 => ::glutin::VirtualKeyCode::F10,
- Key::F11 => ::glutin::VirtualKeyCode::F11,
- Key::F12 => ::glutin::VirtualKeyCode::F12,
- Key::F13 => ::glutin::VirtualKeyCode::F13,
- Key::F14 => ::glutin::VirtualKeyCode::F14,
- Key::F15 => ::glutin::VirtualKeyCode::F15,
- Key::Snapshot => ::glutin::VirtualKeyCode::Snapshot,
- Key::Scroll => ::glutin::VirtualKeyCode::Scroll,
- Key::Pause => ::glutin::VirtualKeyCode::Pause,
- Key::Insert => ::glutin::VirtualKeyCode::Insert,
- Key::Home => ::glutin::VirtualKeyCode::Home,
- Key::Delete => ::glutin::VirtualKeyCode::Delete,
- Key::End => ::glutin::VirtualKeyCode::End,
- Key::PageDown => ::glutin::VirtualKeyCode::PageDown,
- Key::PageUp => ::glutin::VirtualKeyCode::PageUp,
- Key::Left => ::glutin::VirtualKeyCode::Left,
- Key::Up => ::glutin::VirtualKeyCode::Up,
- Key::Right => ::glutin::VirtualKeyCode::Right,
- Key::Down => ::glutin::VirtualKeyCode::Down,
- Key::Back => ::glutin::VirtualKeyCode::Back,
- Key::Return => ::glutin::VirtualKeyCode::Return,
- Key::Space => ::glutin::VirtualKeyCode::Space,
- Key::Compose => ::glutin::VirtualKeyCode::Compose,
- Key::Numlock => ::glutin::VirtualKeyCode::Numlock,
- Key::Numpad0 => ::glutin::VirtualKeyCode::Numpad0,
- Key::Numpad1 => ::glutin::VirtualKeyCode::Numpad1,
- Key::Numpad2 => ::glutin::VirtualKeyCode::Numpad2,
- Key::Numpad3 => ::glutin::VirtualKeyCode::Numpad3,
- Key::Numpad4 => ::glutin::VirtualKeyCode::Numpad4,
- Key::Numpad5 => ::glutin::VirtualKeyCode::Numpad5,
- Key::Numpad6 => ::glutin::VirtualKeyCode::Numpad6,
- Key::Numpad7 => ::glutin::VirtualKeyCode::Numpad7,
- Key::Numpad8 => ::glutin::VirtualKeyCode::Numpad8,
- Key::Numpad9 => ::glutin::VirtualKeyCode::Numpad9,
- Key::AbntC1 => ::glutin::VirtualKeyCode::AbntC1,
- Key::AbntC2 => ::glutin::VirtualKeyCode::AbntC2,
- Key::Add => ::glutin::VirtualKeyCode::Add,
- Key::Apostrophe => ::glutin::VirtualKeyCode::Apostrophe,
- Key::Apps => ::glutin::VirtualKeyCode::Apps,
- Key::At => ::glutin::VirtualKeyCode::At,
- Key::Ax => ::glutin::VirtualKeyCode::Ax,
- Key::Backslash => ::glutin::VirtualKeyCode::Backslash,
- Key::Calculator => ::glutin::VirtualKeyCode::Calculator,
- Key::Capital => ::glutin::VirtualKeyCode::Capital,
- Key::Colon => ::glutin::VirtualKeyCode::Colon,
- Key::Comma => ::glutin::VirtualKeyCode::Comma,
- Key::Convert => ::glutin::VirtualKeyCode::Convert,
- Key::Decimal => ::glutin::VirtualKeyCode::Decimal,
- Key::Divide => ::glutin::VirtualKeyCode::Divide,
- Key::Equals => ::glutin::VirtualKeyCode::Equals,
- Key::Grave => ::glutin::VirtualKeyCode::Grave,
- Key::Kana => ::glutin::VirtualKeyCode::Kana,
- Key::Kanji => ::glutin::VirtualKeyCode::Kanji,
- Key::LAlt => ::glutin::VirtualKeyCode::LAlt,
- Key::LBracket => ::glutin::VirtualKeyCode::LBracket,
- Key::LControl => ::glutin::VirtualKeyCode::LControl,
- Key::LMenu => ::glutin::VirtualKeyCode::LMenu,
- Key::LShift => ::glutin::VirtualKeyCode::LShift,
- Key::LWin => ::glutin::VirtualKeyCode::LWin,
- Key::Mail => ::glutin::VirtualKeyCode::Mail,
- Key::MediaSelect => ::glutin::VirtualKeyCode::MediaSelect,
- Key::MediaStop => ::glutin::VirtualKeyCode::MediaStop,
- Key::Minus => ::glutin::VirtualKeyCode::Minus,
- Key::Multiply => ::glutin::VirtualKeyCode::Multiply,
- Key::Mute => ::glutin::VirtualKeyCode::Mute,
- Key::MyComputer => ::glutin::VirtualKeyCode::MyComputer,
- Key::NavigateForward => ::glutin::VirtualKeyCode::NavigateForward,
- Key::NavigateBackward => ::glutin::VirtualKeyCode::NavigateBackward,
- Key::NextTrack => ::glutin::VirtualKeyCode::NextTrack,
- Key::NoConvert => ::glutin::VirtualKeyCode::NoConvert,
- Key::NumpadComma => ::glutin::VirtualKeyCode::NumpadComma,
- Key::NumpadEnter => ::glutin::VirtualKeyCode::NumpadEnter,
- Key::NumpadEquals => ::glutin::VirtualKeyCode::NumpadEquals,
- Key::OEM102 => ::glutin::VirtualKeyCode::OEM102,
- Key::Period => ::glutin::VirtualKeyCode::Period,
- Key::PlayPause => ::glutin::VirtualKeyCode::PlayPause,
- Key::Power => ::glutin::VirtualKeyCode::Power,
- Key::PrevTrack => ::glutin::VirtualKeyCode::PrevTrack,
- Key::RAlt => ::glutin::VirtualKeyCode::RAlt,
- Key::RBracket => ::glutin::VirtualKeyCode::RBracket,
- Key::RControl => ::glutin::VirtualKeyCode::RControl,
- Key::RMenu => ::glutin::VirtualKeyCode::RMenu,
- Key::RShift => ::glutin::VirtualKeyCode::RShift,
- Key::RWin => ::glutin::VirtualKeyCode::RWin,
- Key::Semicolon => ::glutin::VirtualKeyCode::Semicolon,
- Key::Slash => ::glutin::VirtualKeyCode::Slash,
- Key::Sleep => ::glutin::VirtualKeyCode::Sleep,
- Key::Stop => ::glutin::VirtualKeyCode::Stop,
- Key::Subtract => ::glutin::VirtualKeyCode::Subtract,
- Key::Sysrq => ::glutin::VirtualKeyCode::Sysrq,
- Key::Tab => ::glutin::VirtualKeyCode::Tab,
- Key::Underline => ::glutin::VirtualKeyCode::Underline,
- Key::Unlabeled => ::glutin::VirtualKeyCode::Unlabeled,
- Key::VolumeDown => ::glutin::VirtualKeyCode::VolumeDown,
- Key::VolumeUp => ::glutin::VirtualKeyCode::VolumeUp,
- Key::Wake => ::glutin::VirtualKeyCode::Wake,
- Key::WebBack => ::glutin::VirtualKeyCode::WebBack,
- Key::WebFavorites => ::glutin::VirtualKeyCode::WebFavorites,
- Key::WebForward => ::glutin::VirtualKeyCode::WebForward,
- Key::WebHome => ::glutin::VirtualKeyCode::WebHome,
- Key::WebRefresh => ::glutin::VirtualKeyCode::WebRefresh,
- Key::WebSearch => ::glutin::VirtualKeyCode::WebSearch,
- Key::WebStop => ::glutin::VirtualKeyCode::WebStop,
- Key::Yen => ::glutin::VirtualKeyCode::Yen,
+ Key::Key1 => Key1,
+ Key::Key2 => Key2,
+ Key::Key3 => Key3,
+ Key::Key4 => Key4,
+ Key::Key5 => Key5,
+ Key::Key6 => Key6,
+ Key::Key7 => Key7,
+ Key::Key8 => Key8,
+ Key::Key9 => Key9,
+ Key::Key0 => Key0,
+ Key::A => A,
+ Key::B => B,
+ Key::C => C,
+ Key::D => D,
+ Key::E => E,
+ Key::F => F,
+ Key::G => G,
+ Key::H => H,
+ Key::I => I,
+ Key::J => J,
+ Key::K => K,
+ Key::L => L,
+ Key::M => M,
+ Key::N => N,
+ Key::O => O,
+ Key::P => P,
+ Key::Q => Q,
+ Key::R => R,
+ Key::S => S,
+ Key::T => T,
+ Key::U => U,
+ Key::V => V,
+ Key::W => W,
+ Key::X => X,
+ Key::Y => Y,
+ Key::Z => Z,
+ Key::Escape => Escape,
+ Key::F1 => F1,
+ Key::F2 => F2,
+ Key::F3 => F3,
+ Key::F4 => F4,
+ Key::F5 => F5,
+ Key::F6 => F6,
+ Key::F7 => F7,
+ Key::F8 => F8,
+ Key::F9 => F9,
+ Key::F10 => F10,
+ Key::F11 => F11,
+ Key::F12 => F12,
+ Key::F13 => F13,
+ Key::F14 => F14,
+ Key::F15 => F15,
+ Key::Snapshot => Snapshot,
+ Key::Scroll => Scroll,
+ Key::Pause => Pause,
+ Key::Insert => Insert,
+ Key::Home => Home,
+ Key::Delete => Delete,
+ Key::End => End,
+ Key::PageDown => PageDown,
+ Key::PageUp => PageUp,
+ Key::Left => Left,
+ Key::Up => Up,
+ Key::Right => Right,
+ Key::Down => Down,
+ Key::Back => Back,
+ Key::Return => Return,
+ Key::Space => Space,
+ Key::Compose => Compose,
+ Key::Numlock => Numlock,
+ Key::Numpad0 => Numpad0,
+ Key::Numpad1 => Numpad1,
+ Key::Numpad2 => Numpad2,
+ Key::Numpad3 => Numpad3,
+ Key::Numpad4 => Numpad4,
+ Key::Numpad5 => Numpad5,
+ Key::Numpad6 => Numpad6,
+ Key::Numpad7 => Numpad7,
+ Key::Numpad8 => Numpad8,
+ Key::Numpad9 => Numpad9,
+ Key::AbntC1 => AbntC1,
+ Key::AbntC2 => AbntC2,
+ Key::Add => Add,
+ Key::Apostrophe => Apostrophe,
+ Key::Apps => Apps,
+ Key::At => At,
+ Key::Ax => Ax,
+ Key::Backslash => Backslash,
+ Key::Calculator => Calculator,
+ Key::Capital => Capital,
+ Key::Colon => Colon,
+ Key::Comma => Comma,
+ Key::Convert => Convert,
+ Key::Decimal => Decimal,
+ Key::Divide => Divide,
+ Key::Equals => Equals,
+ Key::Grave => Grave,
+ Key::Kana => Kana,
+ Key::Kanji => Kanji,
+ Key::LAlt => LAlt,
+ Key::LBracket => LBracket,
+ Key::LControl => LControl,
+ Key::LMenu => LMenu,
+ Key::LShift => LShift,
+ Key::LWin => LWin,
+ Key::Mail => Mail,
+ Key::MediaSelect => MediaSelect,
+ Key::MediaStop => MediaStop,
+ Key::Minus => Minus,
+ Key::Multiply => Multiply,
+ Key::Mute => Mute,
+ Key::MyComputer => MyComputer,
+ Key::NavigateForward => NavigateForward,
+ Key::NavigateBackward => NavigateBackward,
+ Key::NextTrack => NextTrack,
+ Key::NoConvert => NoConvert,
+ Key::NumpadComma => NumpadComma,
+ Key::NumpadEnter => NumpadEnter,
+ Key::NumpadEquals => NumpadEquals,
+ Key::OEM102 => OEM102,
+ Key::Period => Period,
+ Key::PlayPause => PlayPause,
+ Key::Power => Power,
+ Key::PrevTrack => PrevTrack,
+ Key::RAlt => RAlt,
+ Key::RBracket => RBracket,
+ Key::RControl => RControl,
+ Key::RMenu => RMenu,
+ Key::RShift => RShift,
+ Key::RWin => RWin,
+ Key::Semicolon => Semicolon,
+ Key::Slash => Slash,
+ Key::Sleep => Sleep,
+ Key::Stop => Stop,
+ Key::Subtract => Subtract,
+ Key::Sysrq => Sysrq,
+ Key::Tab => Tab,
+ Key::Underline => Underline,
+ Key::Unlabeled => Unlabeled,
+ Key::VolumeDown => VolumeDown,
+ Key::VolumeUp => VolumeUp,
+ Key::Wake => Wake,
+ Key::WebBack => WebBack,
+ Key::WebFavorites => WebFavorites,
+ Key::WebForward => WebForward,
+ Key::WebHome => WebHome,
+ Key::WebRefresh => WebRefresh,
+ Key::WebSearch => WebSearch,
+ Key::WebStop => WebStop,
+ Key::Yen => Yen,
}
}
}