mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Merge branch 'master' of https://github.com/emilk/egui into multiples_viewports
This commit is contained in:
@@ -134,6 +134,9 @@ pub fn window_builder<E>(
|
||||
|
||||
window_builder = window_builder.with_drag_and_drop(*drag_and_drop_support);
|
||||
|
||||
// Always use the default window size / position on iOS. Trying to restore the previous position
|
||||
// causes the window to be shown too small.
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
let inner_size_points = if let Some(mut window_settings) = window_settings {
|
||||
// Restore pos/size from previous session
|
||||
|
||||
@@ -159,6 +162,7 @@ pub fn window_builder<E>(
|
||||
*initial_window_size
|
||||
};
|
||||
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
if *centered {
|
||||
if let Some(monitor) = event_loop.available_monitors().next() {
|
||||
let monitor_size = monitor.size().to_logical::<f64>(monitor.scale_factor());
|
||||
|
||||
@@ -138,6 +138,7 @@ fn with_event_loop<R>(
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
fn run_and_return(
|
||||
event_loop: &mut EventLoop<UserEvent>,
|
||||
mut winit_app: impl WinitApp,
|
||||
@@ -413,6 +414,17 @@ fn run_and_exit(event_loop: EventLoop<UserEvent>, mut winit_app: impl WinitApp +
|
||||
if time_until_next < std::time::Duration::from_secs(10_000) {
|
||||
log::trace!("WaitUntil {time_until_next:?}");
|
||||
}
|
||||
|
||||
// WaitUntil seems to not work on iOS
|
||||
#[cfg(target_os = "ios")]
|
||||
winit_app
|
||||
.get_window_winit_id(ViewportId::MAIN)
|
||||
.map(|window_id| {
|
||||
winit_app
|
||||
.window(window_id)
|
||||
.map(|window| window.read().request_redraw())
|
||||
});
|
||||
|
||||
control_flow.set_wait_until(next_repaint_time);
|
||||
};
|
||||
})
|
||||
@@ -1687,6 +1699,7 @@ mod glow_integration {
|
||||
mut native_options: epi::NativeOptions,
|
||||
app_creator: epi::AppCreator,
|
||||
) -> Result<()> {
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
if native_options.run_and_return {
|
||||
with_event_loop(native_options, |event_loop, native_options| {
|
||||
let glow_eframe =
|
||||
@@ -1698,6 +1711,13 @@ mod glow_integration {
|
||||
let glow_eframe = GlowWinitApp::new(&event_loop, app_name, native_options, app_creator);
|
||||
run_and_exit(event_loop, glow_eframe);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "ios")]
|
||||
{
|
||||
let event_loop = create_event_loop_builder(&mut native_options).build();
|
||||
let glow_eframe = GlowWinitApp::new(&event_loop, app_name, native_options, app_creator);
|
||||
run_and_exit(event_loop, glow_eframe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2493,6 +2513,7 @@ mod wgpu_integration {
|
||||
mut native_options: epi::NativeOptions,
|
||||
app_creator: epi::AppCreator,
|
||||
) -> Result<()> {
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
if native_options.run_and_return {
|
||||
with_event_loop(native_options, |event_loop, native_options| {
|
||||
let wgpu_eframe =
|
||||
@@ -2504,6 +2525,13 @@ mod wgpu_integration {
|
||||
let wgpu_eframe = WgpuWinitApp::new(&event_loop, app_name, native_options, app_creator);
|
||||
run_and_exit(event_loop, wgpu_eframe);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "ios")]
|
||||
{
|
||||
let event_loop = create_event_loop_builder(&mut native_options).build();
|
||||
let wgpu_eframe = WgpuWinitApp::new(&event_loop, app_name, native_options, app_creator);
|
||||
run_and_exit(event_loop, wgpu_eframe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user