diff --git a/Cargo.lock b/Cargo.lock index bf10f12..4103630 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -880,7 +880,7 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "glutin" version = "0.26.0" -source = "git+https://github.com/Kethku/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" +source = "git+https://github.com/neovide/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" dependencies = [ "android_glue", "cgl", @@ -900,13 +900,13 @@ dependencies = [ "wayland-client", "wayland-egl", "winapi", - "winit", + "winit 0.24.0 (git+https://github.com/Kethku/winit?branch=new-keyboard-all)", ] [[package]] name = "glutin_egl_sys" version = "0.1.5" -source = "git+https://github.com/Kethku/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" +source = "git+https://github.com/neovide/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" dependencies = [ "gl_generator", "winapi", @@ -915,12 +915,12 @@ dependencies = [ [[package]] name = "glutin_emscripten_sys" version = "0.1.1" -source = "git+https://github.com/Kethku/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" +source = "git+https://github.com/neovide/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" [[package]] name = "glutin_gles2_sys" version = "0.1.5" -source = "git+https://github.com/Kethku/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" +source = "git+https://github.com/neovide/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" dependencies = [ "gl_generator", "objc", @@ -929,7 +929,7 @@ dependencies = [ [[package]] name = "glutin_glx_sys" version = "0.1.7" -source = "git+https://github.com/Kethku/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" +source = "git+https://github.com/neovide/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" dependencies = [ "gl_generator", "x11-dl", @@ -938,7 +938,7 @@ dependencies = [ [[package]] name = "glutin_wgl_sys" version = "0.1.5" -source = "git+https://github.com/Kethku/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" +source = "git+https://github.com/neovide/glutin?branch=new-keyboard-all#cf509674b403e0f90f2db41a084e303cbd90fbf5" dependencies = [ "gl_generator", ] @@ -1351,7 +1351,7 @@ dependencies = [ "unicode-segmentation", "which", "winapi", - "winit", + "winit 0.24.0 (git+https://github.com/neovide/winit?branch=new-keyboard-all)", "winres", ] @@ -2597,6 +2597,34 @@ dependencies = [ "xkbcommon-dl", ] +[[package]] +name = "winit" +version = "0.24.0" +source = "git+https://github.com/neovide/winit?branch=new-keyboard-all#3b5462ec315aae8d95b9440ff6c52a5412c2cca4" +dependencies = [ + "bitflags", + "cocoa", + "core-foundation 0.9.1", + "core-graphics 0.22.2", + "core-video-sys", + "dispatch", + "instant", + "lazy_static", + "libc", + "log", + "nameof", + "ndk", + "ndk-glue", + "ndk-sys", + "objc", + "parking_lot 0.11.2", + "raw-window-handle", + "scopeguard", + "unicode-segmentation", + "winapi", + "xkbcommon-dl", +] + [[package]] name = "winres" version = "0.1.11" diff --git a/src/settings/window_geometry.rs b/src/settings/window_geometry.rs index cb5ed3e..6cddf67 100644 --- a/src/settings/window_geometry.rs +++ b/src/settings/window_geometry.rs @@ -8,6 +8,11 @@ const SETTINGS_PATH: &str = ".local/share/nvim/neovide-settings.json"; #[cfg(windows)] const SETTINGS_PATH: &str = "AppData/Local/nvim-data/neovide-settings.json"; +pub const DEFAULT_WINDOW_GEOMETRY: Dimensions = Dimensions { + width: 100, + height: 50, +}; + fn neovim_std_datapath() -> PathBuf { let mut settings_path = dirs::home_dir().unwrap(); settings_path.push(SETTINGS_PATH); @@ -18,14 +23,16 @@ pub fn try_to_load_last_window_size() -> Result { let settings_path = neovim_std_datapath(); let json = std::fs::read_to_string(&settings_path).map_err(|e| e.to_string())?; - let geometry: Dimensions = serde_json::from_str(&json).map_err(|e| e.to_string())?; - log::debug!("Loaded Window Size: {:?}", geometry); - Ok(geometry) + let loaded_geometry: Dimensions = serde_json::from_str(&json).map_err(|e| e.to_string())?; + log::debug!("Loaded Window Size: {:?}", loaded_geometry); + + if loaded_geometry.width == 0 || loaded_geometry.height == 0 { + log::warn!("Invalid Saved Window Size. Reverting to default"); + Ok(DEFAULT_WINDOW_GEOMETRY) + } else { + Ok(loaded_geometry) + } } -pub const DEFAULT_WINDOW_GEOMETRY: Dimensions = Dimensions { - width: 100, - height: 50, -}; pub fn maybe_save_window_size(grid_size: Option) { let settings = SETTINGS.get::(); diff --git a/src/window/window_wrapper/keyboard_manager.rs b/src/window/window_wrapper/keyboard_manager.rs index 01803f7..b2a9c6e 100644 --- a/src/window/window_wrapper/keyboard_manager.rs +++ b/src/window/window_wrapper/keyboard_manager.rs @@ -1,7 +1,7 @@ use glutin::event::{ElementState, Event, KeyEvent, WindowEvent}; use glutin::keyboard::Key; -use winit::platform::modifier_supplement::KeyEventExtModifierSupplement; +use glutin::platform::modifier_supplement::KeyEventExtModifierSupplement; use crate::bridge::{SerialCommand, UiCommand}; use crate::channel_utils::LoggingTx;