1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 23:00:04 -04:00

Reduce indentation and simplify code

This commit is contained in:
Emil Ernerfeldt
2023-11-13 19:22:33 +01:00
parent 337da61c22
commit 719f2f1c63

View File

@@ -517,9 +517,9 @@ mod glow_integration {
)
};
{
// This will only happen if the viewport is sync
// That means that the viewport cannot be rendered by itself and needs his parent to be rendered
{
let glutin = glutin.borrow();
let viewport = &glutin.viewports[&viewport_id];
if viewport.viewport_ui_cb.is_none() && viewport_id != ViewportId::ROOT {
@@ -532,16 +532,6 @@ mod glow_integration {
}
}
let egui::FullOutput {
platform_output,
textures_delta,
shapes,
viewports: viewports_out,
viewport_commands,
};
let control_flow;
{
let (raw_input, viewport_ui_cb) = {
let mut glutin = glutin.borrow_mut();
let viewport = glutin.viewports.get_mut(&viewport_id).unwrap();
@@ -562,7 +552,9 @@ mod glow_integration {
let full_output =
integration.update(app.as_mut(), viewport_ui_cb.as_deref(), raw_input);
egui::FullOutput {
// ------------------------------------------------------------
let egui::FullOutput {
platform_output,
textures_delta,
shapes,
@@ -570,8 +562,6 @@ mod glow_integration {
viewport_commands,
} = full_output;
// ------------------------------------------------------------
let mut glutin = glutin.borrow_mut();
let GlutinWindowContext {
viewports,
@@ -676,12 +666,6 @@ mod glow_integration {
}
}
control_flow = if integration.should_close() {
EventResult::Exit
} else {
EventResult::Wait
};
integration.maybe_autosave(app.as_mut(), Some(window));
if window.is_minimized() == Some(true) {
@@ -690,12 +674,11 @@ mod glow_integration {
crate::profile_scope!("minimized_sleep");
std::thread::sleep(std::time::Duration::from_millis(10));
}
}
glutin.borrow_mut().process_viewport_builders(viewports_out);
glutin.process_viewport_builders(viewports_out);
for (viewport_id, command) in viewport_commands {
if let Some(viewport) = glutin.borrow().viewports.get(&viewport_id) {
if let Some(viewport) = glutin.viewports.get(&viewport_id) {
if let Some(window) = &viewport.window {
let is_viewport_focused = focused_viewport == Some(viewport_id);
egui_winit::process_viewport_commands(
@@ -707,7 +690,11 @@ mod glow_integration {
}
}
control_flow
if integration.should_close() {
EventResult::Exit
} else {
EventResult::Wait
}
}
}