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

eframe: Set app icon on Mac and Windows (#2940)

* eframe: Set app icon on Mac and Windows

Also: correctly set window title on Mac when launching from
another process, e.g. python.

Co-authored-by: Wumpf <andreas@rerun.io>

* lint fixes

* Fix web build

* fix typo

* Try fix windows build

---------

Co-authored-by: Wumpf <andreas@rerun.io>
This commit is contained in:
Emil Ernerfeldt
2023-04-20 15:47:04 +02:00
committed by GitHub
parent 834e2e9f50
commit 7f2de426d2
10 changed files with 363 additions and 21 deletions

View File

@@ -329,6 +329,7 @@ pub struct EpiIntegration {
can_drag_window: bool,
window_state: WindowState,
follow_system_theme: bool,
app_icon_setter: super::app_icon::AppTitleIconSetter,
}
impl EpiIntegration {
@@ -338,7 +339,8 @@ impl EpiIntegration {
max_texture_side: usize,
window: &winit::window::Window,
system_theme: Option<Theme>,
follow_system_theme: bool,
app_name: &str,
native_options: &crate::NativeOptions,
storage: Option<Box<dyn epi::Storage>>,
#[cfg(feature = "glow")] gl: Option<std::sync::Arc<glow::Context>>,
#[cfg(feature = "wgpu")] wgpu_render_state: Option<egui_wgpu::RenderState>,
@@ -378,6 +380,11 @@ impl EpiIntegration {
egui_winit.set_max_texture_side(max_texture_side);
egui_winit.set_pixels_per_point(native_pixels_per_point);
let app_icon_setter = super::app_icon::AppTitleIconSetter::new(
app_name.to_owned(),
native_options.icon_data.clone(),
);
Self {
frame,
last_auto_save: std::time::Instant::now(),
@@ -387,7 +394,8 @@ impl EpiIntegration {
close: false,
can_drag_window: false,
window_state,
follow_system_theme,
follow_system_theme: native_options.follow_system_theme,
app_icon_setter,
}
}
@@ -474,6 +482,8 @@ impl EpiIntegration {
) -> egui::FullOutput {
let frame_start = std::time::Instant::now();
self.app_icon_setter.update();
self.frame.info.window_info =
read_window_info(window, self.egui_ctx.pixels_per_point(), &self.window_state);
let raw_input = self.egui_winit.take_egui_input(window);