Skip to content

Commit 728425b

Browse files
task bar icon
1 parent 3f532e4 commit 728425b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

desktop/src/window/win.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
use winit::dpi::PhysicalSize;
12
use winit::event_loop::ActiveEventLoop;
23
use winit::icon::Icon;
3-
use winit::platform::windows::WinIcon;
4+
use winit::platform::windows::{WinIcon, WindowAttributesWindows};
45
use winit::window::{Window, WindowAttributes};
56

67
use crate::event::AppEventScheduler;
@@ -11,12 +12,10 @@ pub(super) struct NativeWindowImpl {
1112

1213
impl super::NativeWindow for NativeWindowImpl {
1314
fn configure(attributes: WindowAttributes, _event_loop: &dyn ActiveEventLoop) -> WindowAttributes {
14-
if let Ok(win_icon) = WinIcon::from_resource(1, None) {
15-
let icon = Icon(std::sync::Arc::new(win_icon));
16-
attributes.with_window_icon(Some(icon))
17-
} else {
18-
attributes
19-
}
15+
let icon = WinIcon::from_resource(1, Some(PhysicalSize::new(256, 256))).ok().map(|icon| Icon(std::sync::Arc::new(icon)));
16+
let win_window = WindowAttributesWindows::default().with_taskbar_icon(icon);
17+
let icon = WinIcon::from_resource(1, None).ok().map(|icon| Icon(std::sync::Arc::new(icon)));
18+
attributes.with_window_icon(icon).with_platform_attributes(Box::new(win_window))
2019
}
2120

2221
fn new(window: &dyn Window, _app_event_scheduler: AppEventScheduler) -> Self {

0 commit comments

Comments
 (0)