mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 15:13:12 -04:00
Minor cleanup
This commit is contained in:
@@ -216,6 +216,8 @@ pub fn handle_app_output(
|
||||
app_output: epi::backend::AppOutput,
|
||||
window_state: &mut WindowState,
|
||||
) {
|
||||
crate::profile_function!();
|
||||
|
||||
let epi::backend::AppOutput {
|
||||
close: _,
|
||||
window_size,
|
||||
@@ -478,6 +480,8 @@ impl EpiIntegration {
|
||||
egui_winit.on_event(&self.egui_ctx, event)
|
||||
}
|
||||
|
||||
/// If `viewport_ui_cb` is None, we are in the root viewport
|
||||
/// and will cal [`App::update`].
|
||||
pub fn update(
|
||||
&mut self,
|
||||
app: &mut dyn epi::App,
|
||||
@@ -497,12 +501,15 @@ impl EpiIntegration {
|
||||
|
||||
// Run user code:
|
||||
let full_output = self.egui_ctx.run(raw_input, |egui_ctx| {
|
||||
crate::profile_scope!("App::update");
|
||||
if let Some(viewport_ui_cb) = viewport_ui_cb {
|
||||
// Child viewport
|
||||
crate::profile_scope!("callback");
|
||||
debug_assert!(id_pair.this != ViewportId::ROOT);
|
||||
viewport_ui_cb(egui_ctx);
|
||||
} else {
|
||||
// Root viewport
|
||||
crate::profile_scope!("App::update");
|
||||
debug_assert_eq!(id_pair, ViewportIdPair::ROOT);
|
||||
app.update(egui_ctx, &mut self.frame);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -726,6 +726,8 @@ impl State {
|
||||
egui_ctx: &egui::Context,
|
||||
platform_output: egui::PlatformOutput,
|
||||
) {
|
||||
crate::profile_function!();
|
||||
|
||||
let egui::PlatformOutput {
|
||||
cursor_icon,
|
||||
open_url,
|
||||
|
||||
@@ -161,6 +161,19 @@ impl ViewportInfo {
|
||||
pub fn take(&mut self) -> Self {
|
||||
core::mem::take(self)
|
||||
}
|
||||
|
||||
pub fn ui(&self, ui: &mut crate::Ui) {
|
||||
let Self {
|
||||
id_pair,
|
||||
inner_rect,
|
||||
outer_rect,
|
||||
close_requested,
|
||||
} = self;
|
||||
ui.label(format!("id_pair: {id_pair:?}"));
|
||||
ui.label(format!("inner_rect: {inner_rect:?}"));
|
||||
ui.label(format!("outer_rect: {outer_rect:?}"));
|
||||
ui.label(format!("close_requested: {close_requested:?}"));
|
||||
}
|
||||
}
|
||||
|
||||
/// A file about to be dropped into egui.
|
||||
@@ -1000,14 +1013,6 @@ impl RawInput {
|
||||
}
|
||||
}
|
||||
|
||||
impl ViewportInfo {
|
||||
pub fn ui(&self, ui: &mut crate::Ui) {
|
||||
ui.label(format!("id_pair: {:?}", self.id_pair));
|
||||
ui.label(format!("inner_rect: {:?}", self.inner_rect));
|
||||
ui.label(format!("outer_rect: {:?}", self.outer_rect));
|
||||
}
|
||||
}
|
||||
|
||||
/// this is a `u64` as values of this kind can always be obtained by hashing
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
|
||||
Reference in New Issue
Block a user