mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
* Now: is_desktop can only be set at the creation with egui::Context::new insted of default!
* Removed: egui::Context::is_desktop, egui::Context::set_desktop * Added: egui::Context::force_embedding, egui::Context::set_force_embedding
This commit is contained in:
@@ -333,10 +333,11 @@ impl EpiIntegration {
|
||||
app_name: &str,
|
||||
native_options: &crate::NativeOptions,
|
||||
storage: Option<Box<dyn epi::Storage>>,
|
||||
desktop: bool,
|
||||
#[cfg(feature = "glow")] gl: Option<std::sync::Arc<glow::Context>>,
|
||||
#[cfg(feature = "wgpu")] wgpu_render_state: Option<egui_wgpu::RenderState>,
|
||||
) -> Self {
|
||||
let egui_ctx = egui::Context::default();
|
||||
let egui_ctx = egui::Context::new(desktop);
|
||||
|
||||
let memory = load_egui_memory(storage.as_deref()).unwrap_or_default();
|
||||
egui_ctx.memory_mut(|mem| *mem = memory);
|
||||
|
||||
@@ -19,6 +19,16 @@ use super::epi_integration::{self, EpiIntegration};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
pub const IS_DESKTOP: bool = cfg!(any(
|
||||
target_os = "windows",
|
||||
target_os = "linux",
|
||||
target_os = "macos",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd"
|
||||
));
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum UserEvent {
|
||||
RequestRepaint {
|
||||
@@ -891,6 +901,7 @@ mod glow_integration {
|
||||
&self.app_name,
|
||||
&self.native_options,
|
||||
storage,
|
||||
IS_DESKTOP,
|
||||
Some(gl.clone()),
|
||||
#[cfg(feature = "wgpu")]
|
||||
None,
|
||||
@@ -908,12 +919,6 @@ mod glow_integration {
|
||||
let theme = system_theme.unwrap_or(self.native_options.default_theme);
|
||||
integration.egui_ctx.set_visuals(theme.egui_visuals());
|
||||
|
||||
// !!! WARNING This is needed to be improved !!!
|
||||
// I don't really know not to detect if is on desktop or web/mobile
|
||||
// This allows to have multiples windows
|
||||
|
||||
integration.egui_ctx.set_desktop(true);
|
||||
|
||||
gl_window
|
||||
.window(ViewportId::MAIN)
|
||||
.read()
|
||||
@@ -1885,6 +1890,7 @@ mod wgpu_integration {
|
||||
&self.app_name,
|
||||
&self.native_options,
|
||||
storage,
|
||||
IS_DESKTOP,
|
||||
#[cfg(feature = "glow")]
|
||||
None,
|
||||
wgpu_render_state.clone(),
|
||||
|
||||
Reference in New Issue
Block a user