From c8f34aa81bec4baa9c5a44d33b8d6b3d1d34acc0 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 4 Nov 2019 08:09:52 -0800 Subject: [PATCH] windows: use application icon in window title bar --- assets/windows/resource.rc | 1 + window/src/os/windows/window.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/windows/resource.rc b/assets/windows/resource.rc index 85f0b24c7..8e5a1f4eb 100644 --- a/assets/windows/resource.rc +++ b/assets/windows/resource.rc @@ -1,3 +1,4 @@ +// This ID is coupled with code in window/src/os/windows/window.rs #define IDI_ICON 0x101 IDI_ICON ICON "terminal.ico" #define RT_MANIFEST 24 diff --git a/window/src/os/windows/window.rs b/window/src/os/windows/window.rs index 3069ed78d..9db27dfde 100644 --- a/window/src/os/windows/window.rs +++ b/window/src/os/windows/window.rs @@ -115,13 +115,17 @@ impl Window { } let class_name = wide_string(class_name); + let h_inst = unsafe { GetModuleHandleW(null()) }; let class = WNDCLASSW { style: CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS, lpfnWndProc: Some(wnd_proc), cbClsExtra: 0, cbWndExtra: 0, - hInstance: unsafe { GetModuleHandleW(null()) }, - hIcon: null_mut(), + hInstance: h_inst, + // FIXME: this resource is specific to the wezterm build and this should + // really be made generic for other sorts of windows. + // The ID is defined in assets/windows/resource.rc + hIcon: unsafe { LoadIconW(h_inst, MAKEINTRESOURCEW(0x101)) }, hCursor: null_mut(), hbrBackground: null_mut(), lpszMenuName: null(),