Fix wrong detection of OS (#3238)
We had a bunch of `cfg!(windows)` and `cfg!(macos)` which should
have been `cfg!(target_os = "windows")`.
I wonder what the effects of this PR will be fore Windows 😬
This commit is contained in:
parent
98087029e0
commit
6633ecce64
|
|
@ -145,12 +145,12 @@ fn run_and_return(
|
||||||
// Platform-dependent event handlers to workaround a winit bug
|
// Platform-dependent event handlers to workaround a winit bug
|
||||||
// See: https://github.com/rust-windowing/winit/issues/987
|
// See: https://github.com/rust-windowing/winit/issues/987
|
||||||
// See: https://github.com/rust-windowing/winit/issues/1619
|
// See: https://github.com/rust-windowing/winit/issues/1619
|
||||||
#[cfg(windows)]
|
#[cfg(target_os = "windows")]
|
||||||
winit::event::Event::RedrawEventsCleared => {
|
winit::event::Event::RedrawEventsCleared => {
|
||||||
next_repaint_time = extremely_far_future();
|
next_repaint_time = extremely_far_future();
|
||||||
winit_app.run_ui_and_paint()
|
winit_app.run_ui_and_paint()
|
||||||
}
|
}
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
winit::event::Event::RedrawRequested(_) => {
|
winit::event::Event::RedrawRequested(_) => {
|
||||||
next_repaint_time = extremely_far_future();
|
next_repaint_time = extremely_far_future();
|
||||||
winit_app.run_ui_and_paint()
|
winit_app.run_ui_and_paint()
|
||||||
|
|
@ -196,7 +196,7 @@ fn run_and_return(
|
||||||
EventResult::Wait => {}
|
EventResult::Wait => {}
|
||||||
EventResult::RepaintNow => {
|
EventResult::RepaintNow => {
|
||||||
log::trace!("Repaint caused by winit::Event: {:?}", event);
|
log::trace!("Repaint caused by winit::Event: {:?}", event);
|
||||||
if cfg!(windows) {
|
if cfg!(target_os = "windows") {
|
||||||
// Fix flickering on Windows, see https://github.com/emilk/egui/pull/2280
|
// Fix flickering on Windows, see https://github.com/emilk/egui/pull/2280
|
||||||
next_repaint_time = extremely_far_future();
|
next_repaint_time = extremely_far_future();
|
||||||
winit_app.run_ui_and_paint();
|
winit_app.run_ui_and_paint();
|
||||||
|
|
@ -245,7 +245,7 @@ fn run_and_return(
|
||||||
//
|
//
|
||||||
// Note that this approach may cause issues on macOS (emilk/egui#2768); therefore,
|
// Note that this approach may cause issues on macOS (emilk/egui#2768); therefore,
|
||||||
// we only apply this approach on Windows to minimize the affect.
|
// we only apply this approach on Windows to minimize the affect.
|
||||||
#[cfg(windows)]
|
#[cfg(target_os = "windows")]
|
||||||
{
|
{
|
||||||
event_loop.run_return(|_, _, control_flow| {
|
event_loop.run_return(|_, _, control_flow| {
|
||||||
control_flow.set_exit();
|
control_flow.set_exit();
|
||||||
|
|
@ -270,11 +270,11 @@ fn run_and_exit(event_loop: EventLoop<UserEvent>, mut winit_app: impl WinitApp +
|
||||||
// Platform-dependent event handlers to workaround a winit bug
|
// Platform-dependent event handlers to workaround a winit bug
|
||||||
// See: https://github.com/rust-windowing/winit/issues/987
|
// See: https://github.com/rust-windowing/winit/issues/987
|
||||||
// See: https://github.com/rust-windowing/winit/issues/1619
|
// See: https://github.com/rust-windowing/winit/issues/1619
|
||||||
winit::event::Event::RedrawEventsCleared if cfg!(windows) => {
|
winit::event::Event::RedrawEventsCleared if cfg!(target_os = "windows") => {
|
||||||
next_repaint_time = extremely_far_future();
|
next_repaint_time = extremely_far_future();
|
||||||
winit_app.run_ui_and_paint()
|
winit_app.run_ui_and_paint()
|
||||||
}
|
}
|
||||||
winit::event::Event::RedrawRequested(_) if !cfg!(windows) => {
|
winit::event::Event::RedrawRequested(_) if !cfg!(target_os = "windows") => {
|
||||||
next_repaint_time = extremely_far_future();
|
next_repaint_time = extremely_far_future();
|
||||||
winit_app.run_ui_and_paint()
|
winit_app.run_ui_and_paint()
|
||||||
}
|
}
|
||||||
|
|
@ -302,7 +302,7 @@ fn run_and_exit(event_loop: EventLoop<UserEvent>, mut winit_app: impl WinitApp +
|
||||||
match event_result {
|
match event_result {
|
||||||
EventResult::Wait => {}
|
EventResult::Wait => {}
|
||||||
EventResult::RepaintNow => {
|
EventResult::RepaintNow => {
|
||||||
if cfg!(windows) {
|
if cfg!(target_os = "windows") {
|
||||||
// Fix flickering on Windows, see https://github.com/emilk/egui/pull/2280
|
// Fix flickering on Windows, see https://github.com/emilk/egui/pull/2280
|
||||||
next_repaint_time = extremely_far_future();
|
next_repaint_time = extremely_far_future();
|
||||||
winit_app.run_ui_and_paint();
|
winit_app.run_ui_and_paint();
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,8 @@ fn main() {
|
||||||
// Platform-dependent event handlers to workaround a winit bug
|
// Platform-dependent event handlers to workaround a winit bug
|
||||||
// See: https://github.com/rust-windowing/winit/issues/987
|
// See: https://github.com/rust-windowing/winit/issues/987
|
||||||
// See: https://github.com/rust-windowing/winit/issues/1619
|
// See: https://github.com/rust-windowing/winit/issues/1619
|
||||||
glutin::event::Event::RedrawEventsCleared if cfg!(windows) => redraw(),
|
glutin::event::Event::RedrawEventsCleared if cfg!(target_os = "windows") => redraw(),
|
||||||
glutin::event::Event::RedrawRequested(_) if !cfg!(windows) => redraw(),
|
glutin::event::Event::RedrawRequested(_) if !cfg!(target_os = "windows") => redraw(),
|
||||||
|
|
||||||
glutin::event::Event::WindowEvent { event, .. } => {
|
glutin::event::Event::WindowEvent { event, .. } => {
|
||||||
use glutin::event::WindowEvent;
|
use glutin::event::WindowEvent;
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@ fn main() {
|
||||||
// Platform-dependent event handlers to workaround a winit bug
|
// Platform-dependent event handlers to workaround a winit bug
|
||||||
// See: https://github.com/rust-windowing/winit/issues/987
|
// See: https://github.com/rust-windowing/winit/issues/987
|
||||||
// See: https://github.com/rust-windowing/winit/issues/1619
|
// See: https://github.com/rust-windowing/winit/issues/1619
|
||||||
glutin::event::Event::RedrawEventsCleared if cfg!(windows) => redraw(),
|
glutin::event::Event::RedrawEventsCleared if cfg!(target_os = "windows") => redraw(),
|
||||||
glutin::event::Event::RedrawRequested(_) if !cfg!(windows) => redraw(),
|
glutin::event::Event::RedrawRequested(_) if !cfg!(target_os = "windows") => redraw(),
|
||||||
|
|
||||||
glutin::event::Event::WindowEvent { event, .. } => {
|
glutin::event::Event::WindowEvent { event, .. } => {
|
||||||
use glutin::event::WindowEvent;
|
use glutin::event::WindowEvent;
|
||||||
|
|
|
||||||
|
|
@ -200,8 +200,8 @@ fn main() {
|
||||||
// Platform-dependent event handlers to workaround a winit bug
|
// Platform-dependent event handlers to workaround a winit bug
|
||||||
// See: https://github.com/rust-windowing/winit/issues/987
|
// See: https://github.com/rust-windowing/winit/issues/987
|
||||||
// See: https://github.com/rust-windowing/winit/issues/1619
|
// See: https://github.com/rust-windowing/winit/issues/1619
|
||||||
winit::event::Event::RedrawEventsCleared if cfg!(windows) => redraw(),
|
winit::event::Event::RedrawEventsCleared if cfg!(target_os = "windows") => redraw(),
|
||||||
winit::event::Event::RedrawRequested(_) if !cfg!(windows) => redraw(),
|
winit::event::Event::RedrawRequested(_) if !cfg!(target_os = "windows") => redraw(),
|
||||||
|
|
||||||
winit::event::Event::WindowEvent { event, .. } => {
|
winit::event::Event::WindowEvent { event, .. } => {
|
||||||
use winit::event::WindowEvent;
|
use winit::event::WindowEvent;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue