Adding a setting to change the refresh rate

macos-click-through
Jon Valdés 5 years ago
parent 8c19cdd275
commit f31f96e0bc

@ -183,6 +183,7 @@ impl Settings {
settings.insert("no_idle".to_string(), Setting::new_bool(no_idle));
settings.insert("extra_buffer_frames".to_string(), Setting::new_u16(buffer_frames));
settings.insert("refresh_rate".to_string(), Setting::new_u16(60));
Settings { neovim_arguments, settings: Mutex::new(settings) }
}

@ -215,7 +215,8 @@ pub fn ui_loop() {
}
let elapsed = frame_start.elapsed();
let frame_length = Duration::from_secs_f32(1.0 / 60.0);
let refresh_rate = SETTINGS.get("refresh_rate").read_u16() as f32;
let frame_length = Duration::from_secs_f32(1.0 / refresh_rate);
if elapsed < frame_length {
sleep(frame_length - elapsed);
}

Loading…
Cancel
Save