Merge pull request #231 from exoticusd/master

fixes #226, and temporarly #221 based on j4qfrost's suggestion
macos-click-through
j4qfrost 5 years ago committed by GitHub
commit 92d7f472e6

@ -1,3 +1,4 @@
use std::sync::atomic::Ordering;
use std::thread::sleep; use std::thread::sleep;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
@ -293,6 +294,10 @@ impl WindowWrapper {
} }
pub fn draw_frame(&mut self) -> bool { pub fn draw_frame(&mut self) -> bool {
if !BRIDGE.running.load(Ordering::Relaxed) {
return false;
}
if let Ok(new_size) = LogicalSize::new(&self.window) { if let Ok(new_size) = LogicalSize::new(&self.window) {
if self.previous_size != new_size { if self.previous_size != new_size {
handle_new_grid_size(new_size, &self.renderer); handle_new_grid_size(new_size, &self.renderer);
@ -420,8 +425,11 @@ pub fn ui_loop() {
let elapsed = frame_start.elapsed(); let elapsed = frame_start.elapsed();
let refresh_rate = { SETTINGS.get::<WindowSettings>().refresh_rate as f32 }; let refresh_rate = { SETTINGS.get::<WindowSettings>().refresh_rate as f32 };
let frame_length = Duration::from_secs_f32(1.0 / refresh_rate); let frame_length = Duration::from_secs_f32(1.0 / refresh_rate);
if elapsed < frame_length { if elapsed < frame_length {
sleep(frame_length - elapsed); sleep(frame_length - elapsed);
} }
} }
std::process::exit(0);
} }

Loading…
Cancel
Save