mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30:03 -04:00
Let app logic see the window state, and test it
`Context::run_logic` now takes the new `RawInput`, and copies only `RawInput::viewports` into the `InputState`, so that `App::logic` can tell that the window is minimized/occluded. The ui input (events, time) is left for the next pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -331,17 +331,17 @@ impl EpiIntegration {
|
||||
|
||||
let close_requested = raw_input.viewport().close_requested();
|
||||
|
||||
// No pass will consume the input, so save it for the next one:
|
||||
let logic_output = self.egui_ctx.run_logic(&raw_input, |ctx| {
|
||||
profiling::scope!("App::logic");
|
||||
app.logic(ctx, &mut self.frame);
|
||||
});
|
||||
|
||||
// No pass consumed the input, so save it for the next one:
|
||||
match &mut self.pending_raw_input {
|
||||
Some(pending) => pending.append(raw_input),
|
||||
None => self.pending_raw_input = Some(raw_input),
|
||||
}
|
||||
|
||||
let logic_output = self.egui_ctx.run_logic(|ctx| {
|
||||
profiling::scope!("App::logic");
|
||||
app.logic(ctx, &mut self.frame);
|
||||
});
|
||||
|
||||
if close_requested {
|
||||
let canceled = logic_output
|
||||
.viewport_commands
|
||||
|
||||
@@ -285,16 +285,16 @@ impl AppRunner {
|
||||
// That way all ui state is left untouched, and is still there
|
||||
// when the tab is shown again.
|
||||
|
||||
// No pass will consume the input, so save it for the next one:
|
||||
self.input.raw.append(raw_input);
|
||||
|
||||
let egui::LogicOutput {
|
||||
platform_output,
|
||||
viewport_commands,
|
||||
} = self.egui_ctx.run_logic(|ctx| {
|
||||
} = self.egui_ctx.run_logic(&raw_input, |ctx| {
|
||||
self.app.logic(ctx, &mut self.frame);
|
||||
});
|
||||
|
||||
// No pass consumed the input, so save it for the next one:
|
||||
self.input.raw.append(raw_input);
|
||||
|
||||
self.handle_viewport_commands(viewport_commands.into_values().flatten());
|
||||
self.handle_platform_output(platform_output);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user