diff --git a/src/controls.c b/src/controls.c index b1301d3c..854356eb 100644 --- a/src/controls.c +++ b/src/controls.c @@ -643,15 +643,13 @@ VOID _app_restoreinterfacestate (_In_ HWND hwnd, _In_ BOOLEAN is_enabled) _r_status_settext (hwnd, IDC_STATUSBAR, 0, _app_getinterfacestatelocale (install_type)); } -VOID _app_setinterfacestate (_In_ HWND hwnd) +VOID _app_setinterfacestate (_In_ HWND hwnd, _In_ LONG dpi_value) { ENUM_INSTALL_TYPE install_type; HICON hico_sm; HICON hico_big; - LONG dpi_value; - LONG icon_small_x; LONG icon_small_y; @@ -666,8 +664,6 @@ VOID _app_setinterfacestate (_In_ HWND hwnd) install_type = _wfp_isfiltersinstalled (); is_filtersinstalled = (install_type != INSTALL_DISABLED); - dpi_value = _r_dc_getsystemdpi (); - icon_small_x = _r_dc_getsystemmetrics (SM_CXSMICON, dpi_value); icon_small_y = _r_dc_getsystemmetrics (SM_CYSMICON, dpi_value); @@ -689,6 +685,13 @@ VOID _app_setinterfacestate (_In_ HWND hwnd) _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_TRAY_START, _r_locale_getstring (string_id), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, is_filtersinstalled ? 1 : 0); + // fix tray icon size + dpi_value = _r_dc_gettaskbardpi (); + + icon_small_x = _r_dc_getsystemmetrics (SM_CXSMICON, dpi_value); + + hico_sm = _r_sys_loadsharedicon (_r_sys_getimagebase (), MAKEINTRESOURCE (icon_id), icon_small_x, icon_small_y); + _r_tray_setinfo (hwnd, &GUID_TrayIcon, hico_sm, _r_app_getname ()); } diff --git a/src/controls.h b/src/controls.h index e0052b3b..20db34c0 100644 --- a/src/controls.h +++ b/src/controls.h @@ -34,7 +34,7 @@ VOID _app_settab_id (_In_ HWND hwnd, _In_ INT page_id); LPCWSTR _app_getinterfacestatelocale (_In_ ENUM_INSTALL_TYPE install_type); BOOLEAN _app_initinterfacestate (_In_ HWND hwnd, _In_ BOOLEAN is_forced); VOID _app_restoreinterfacestate (_In_ HWND hwnd, _In_ BOOLEAN is_enabled); -VOID _app_setinterfacestate (_In_ HWND hwnd); +VOID _app_setinterfacestate (_In_ HWND hwnd, _In_ LONG dpi_value); VOID _app_imagelist_init (_In_opt_ HWND hwnd, _In_ LONG dpi_value); diff --git a/src/main.c b/src/main.c index 521a8c2c..27846ad7 100644 --- a/src/main.c +++ b/src/main.c @@ -1910,7 +1910,7 @@ INT_PTR CALLBACK DlgProc (_In_ HWND hwnd, _In_ UINT msg, _In_ WPARAM wparam, _In UINT icon_id; - dpi_value = _r_dc_getsystemdpi (); + dpi_value = _r_dc_gettaskbardpi (); icon_small_x = _r_dc_getsystemmetrics (SM_CXSMICON, dpi_value); icon_small_y = _r_dc_getsystemmetrics (SM_CYSMICON, dpi_value); diff --git a/src/messages.c b/src/messages.c index 7ccf3b7d..ddb876bc 100644 --- a/src/messages.c +++ b/src/messages.c @@ -412,7 +412,7 @@ VOID _app_message_dpichanged (_In_ HWND hwnd, _In_ LONG dpi_value) _app_imagelist_init (hwnd, dpi_value); // reset toolbar information - _app_setinterfacestate (hwnd); + _app_setinterfacestate (hwnd, dpi_value); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_REFRESH, _r_locale_getstring (IDS_REFRESH), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_SETTINGS, _r_locale_getstring (IDS_SETTINGS), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); @@ -1240,7 +1240,7 @@ VOID _app_message_initialize (_In_ HWND hwnd) UINT icon_id; - dpi_value = _r_dc_getsystemdpi (); + dpi_value = _r_dc_gettaskbardpi (); icon_small_x = _r_dc_getsystemmetrics (SM_CXSMICON, dpi_value); icon_small_y = _r_dc_getsystemmetrics (SM_CYSMICON, dpi_value); @@ -1341,6 +1341,8 @@ VOID _app_message_localize (_In_ HWND hwnd) hmenu = GetMenu (hwnd); + dpi_value = _r_dc_getwindowdpi (hwnd); + if (hmenu) { recommended_string = _r_locale_getstring (IDS_RECOMMENDED); @@ -1446,7 +1448,7 @@ VOID _app_message_localize (_In_ HWND hwnd) PR_STRING localized_string = NULL; // localize toolbar - _app_setinterfacestate (hwnd); + _app_setinterfacestate (hwnd, dpi_value); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_REFRESH, _r_locale_getstring (IDS_REFRESH), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); _r_toolbar_setbutton (config.hrebar, IDC_TOOLBAR, IDM_SETTINGS, _r_locale_getstring (IDS_SETTINGS), BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, 0, I_IMAGENONE); @@ -1472,8 +1474,6 @@ VOID _app_message_localize (_In_ HWND hwnd) _r_edit_setcuebanner (config.hrebar, IDC_SEARCH, localized_string->buffer); // set rebar size - dpi_value = _r_dc_getwindowdpi (hwnd); - _app_toolbar_resize (hwnd, dpi_value); // localize tabs