mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Fix: fall back to default egui icon if non is set (#3610)
It broke in one of the recent multi-viewport prs
This commit is contained in:
@@ -13,7 +13,13 @@ pub struct AppTitleIconSetter {
|
||||
}
|
||||
|
||||
impl AppTitleIconSetter {
|
||||
pub fn new(title: String, icon_data: Option<Arc<IconData>>) -> Self {
|
||||
pub fn new(title: String, mut icon_data: Option<Arc<IconData>>) -> Self {
|
||||
if let Some(icon) = &icon_data {
|
||||
if **icon == IconData::default() {
|
||||
icon_data = None;
|
||||
}
|
||||
}
|
||||
|
||||
Self {
|
||||
title,
|
||||
icon_data,
|
||||
|
||||
@@ -169,13 +169,19 @@ impl EpiIntegration {
|
||||
raw_window_handle: window.raw_window_handle(),
|
||||
};
|
||||
|
||||
let icon = native_options
|
||||
.viewport
|
||||
.icon
|
||||
.clone()
|
||||
.unwrap_or_else(|| std::sync::Arc::new(load_default_egui_icon()));
|
||||
|
||||
let app_icon_setter = super::app_icon::AppTitleIconSetter::new(
|
||||
native_options
|
||||
.viewport
|
||||
.title
|
||||
.clone()
|
||||
.unwrap_or_else(|| app_name.to_owned()),
|
||||
native_options.viewport.icon.clone(),
|
||||
Some(icon),
|
||||
);
|
||||
|
||||
Self {
|
||||
@@ -356,6 +362,11 @@ impl EpiIntegration {
|
||||
}
|
||||
}
|
||||
|
||||
fn load_default_egui_icon() -> egui::IconData {
|
||||
crate::profile_function!();
|
||||
crate::icon_data::from_png_bytes(&include_bytes!("../../data/icon.png")[..]).unwrap()
|
||||
}
|
||||
|
||||
#[cfg(feature = "persistence")]
|
||||
const STORAGE_EGUI_MEMORY_KEY: &str = "egui";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user