1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Removed viewport_id and parent_viewport_id from eframe::Frame

This commit is contained in:
Konkitoman
2023-08-04 09:10:01 +03:00
parent d1b00b6fdc
commit e8027b3c3a
21 changed files with 39 additions and 62 deletions

View File

@@ -782,19 +782,6 @@ impl Frame {
/// If this is the main window will return true!
/// When is a single window mode will always return true!
pub fn is_main_window(&self) -> bool {
self.info.viewport_id == 0
}
/// Returns the current viewport id
pub fn viewport_id(&self) -> u64 {
self.info.viewport_id
}
/// Returns the current viewport parent id
pub fn parent_viewport_id(&self) -> u64 {
self.info.parent_viewport
}
/// A place where you can store custom data in a way that persists when you restart the app.
pub fn storage(&self) -> Option<&dyn Storage> {
@@ -1147,12 +1134,6 @@ pub struct IntegrationInfo {
/// The OS native pixels-per-point
pub native_pixels_per_point: Option<f32>,
/// This is the id of the current native window
/// If this is the same as `parent_viewport` that means that is the main window
pub viewport_id: u64,
/// This is the id of the current native window
pub parent_viewport: u64,
/// The position and size of the native window.
#[cfg(not(target_arch = "wasm32"))]
pub window_info: WindowInfo,

View File

@@ -279,10 +279,10 @@ pub fn run_simple_native(
frame: &mut Frame,
render_function: Option<&(dyn Fn(&egui::Context, u64, u64) + Send + Sync)>,
) {
if frame.is_main_window() {
if ctx.get_viewport_id() == 0 {
(self.update_fun)(ctx, frame);
} else if let Some(render_function) = render_function {
render_function(ctx, frame.viewport_id(), frame.parent_viewport_id())
render_function(ctx, ctx.get_viewport_id(), ctx.get_parent_viewport_id())
}
}
}

View File

@@ -369,8 +369,6 @@ impl EpiIntegration {
cpu_usage: None,
native_pixels_per_point: Some(native_pixels_per_point),
window_info: read_window_info(window, egui_ctx.pixels_per_point(), &window_state),
viewport_id: 0,
parent_viewport: 0,
},
output: epi::backend::AppOutput {
visible: Some(true),
@@ -511,8 +509,6 @@ impl EpiIntegration {
read_window_info(window, self.egui_ctx.pixels_per_point(), &self.window_state);
let mut raw_input = egui_winit.take_egui_input(window);
raw_input.time = Some(self.beagining.elapsed().as_secs_f64());
self.frame.info.viewport_id = viewport_id;
self.frame.info.parent_viewport = parent_id;
// Run user code:
let full_output = self