Add vim setting for iso layout compatibility (#463)

macos-click-through
ref209 4 years ago committed by GitHub
parent 36548158ad
commit 008528d272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,16 +1,17 @@
mod qwerty; mod qwerty;
use crate::window::keyboard::Modifiers; use crate::{settings::SETTINGS, window::keyboard::Modifiers, WindowSettings};
use skulpin::sdl2::keyboard::Mod; use skulpin::sdl2::keyboard::Mod;
pub use qwerty::handle_qwerty_layout; pub use qwerty::handle_qwerty_layout;
impl From<Mod> for Modifiers { impl From<Mod> for Modifiers {
fn from(mods: Mod) -> Modifiers { fn from(mods: Mod) -> Modifiers {
let iso_layout = SETTINGS.get::<WindowSettings>().iso_layout;
Modifiers { Modifiers {
shift: mods.contains(Mod::LSHIFTMOD) || mods.contains(Mod::RSHIFTMOD), shift: mods.contains(Mod::LSHIFTMOD) || mods.contains(Mod::RSHIFTMOD),
control: mods.contains(Mod::LCTRLMOD) || mods.contains(Mod::RCTRLMOD), control: mods.contains(Mod::LCTRLMOD) || mods.contains(Mod::RCTRLMOD),
meta: mods.contains(Mod::LALTMOD) || mods.contains(Mod::RALTMOD), meta: mods.contains(Mod::LALTMOD) || (!iso_layout && mods.contains(Mod::RALTMOD)),
logo: mods.contains(Mod::LGUIMOD) || mods.contains(Mod::RGUIMOD), logo: mods.contains(Mod::LGUIMOD) || mods.contains(Mod::RGUIMOD),
} }
} }

@ -8,6 +8,7 @@ pub struct WindowSettings {
pub transparency: f32, pub transparency: f32,
pub no_idle: bool, pub no_idle: bool,
pub fullscreen: bool, pub fullscreen: bool,
pub iso_layout: bool
} }
impl Default for WindowSettings { impl Default for WindowSettings {
@ -19,6 +20,7 @@ impl Default for WindowSettings {
.neovim_arguments .neovim_arguments
.contains(&String::from("--noIdle")), .contains(&String::from("--noIdle")),
fullscreen: false, fullscreen: false,
iso_layout: false
} }
} }
} }

Loading…
Cancel
Save