diff --git a/CHANGELOG.md b/CHANGELOG.md index 9166511187..d6cbcae67c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -252,6 +252,7 @@ values and their textual representations. ([#1377]) - All Image formats are now optional, reducing compile time and binary size by default ([#1340] by [@JAicewizard]) - The `Cursor` API has changed to a stateful one ([#1433] by [@jneem]) - Part of the `SAVE_FILE` command is now `SAVE_FILE_AS` ([#1463] by [@jneem]) +- Windows: Use custom application icon, if present ([#2274] by [@tay64]) ### Deprecated - Parse widget (replaced with `Formatter` trait) ([#1377] by [@cmyr]) @@ -864,7 +865,9 @@ Last release without a changelog :( [#2203]: https://github.com/linebender/druid/pull/2203 [#2235]: https://github.com/linebender/druid/pull/2235 [#2247]: https://github.com/linebender/druid/pull/2247 +[#2274]: https://github.com/linebender/druid/pull/2274 [#2284]: https://github.com/linebender/druid/pull/2284 + [Unreleased]: https://github.com/linebender/druid/compare/v0.7.0...master [0.7.0]: https://github.com/linebender/druid/compare/v0.6.0...v0.7.0 [0.6.0]: https://github.com/linebender/druid/compare/v0.5.0...v0.6.0 diff --git a/druid-shell/src/backend/windows/application.rs b/druid-shell/src/backend/windows/application.rs index 084757b5f6..d911154bad 100644 --- a/druid-shell/src/backend/windows/application.rs +++ b/druid-shell/src/backend/windows/application.rs @@ -26,13 +26,14 @@ use winapi::shared::ntdef::LPCWSTR; use winapi::shared::windef::{DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2, HCURSOR, HWND}; use winapi::shared::winerror::HRESULT_FROM_WIN32; use winapi::um::errhandlingapi::GetLastError; +use winapi::um::libloaderapi::GetModuleHandleW; use winapi::um::shellscalingapi::PROCESS_PER_MONITOR_DPI_AWARE; use winapi::um::winnls::GetUserDefaultLocaleName; use winapi::um::winnt::LOCALE_NAME_MAX_LENGTH; use winapi::um::winuser::{ DispatchMessageW, GetAncestor, GetMessageW, LoadIconW, PeekMessageW, PostMessageW, PostQuitMessage, RegisterClassW, TranslateAcceleratorW, TranslateMessage, GA_ROOT, - IDI_APPLICATION, MSG, PM_NOREMOVE, WM_TIMER, WNDCLASSW, + MAKEINTRESOURCEW, MSG, PM_NOREMOVE, WM_TIMER, WNDCLASSW, }; use piet_common::D2DLoadedFonts; @@ -90,7 +91,7 @@ impl Application { .is_ok() { let class_name = CLASS_NAME.to_wide(); - let icon = unsafe { LoadIconW(0 as HINSTANCE, IDI_APPLICATION) }; + let icon = unsafe { LoadIconW(GetModuleHandleW(0 as LPCWSTR), MAKEINTRESOURCEW(1)) }; let wnd = WNDCLASSW { style: 0, lpfnWndProc: Some(window::win_proc_dispatch),