Added 32x32 icons for TTI_INFO_LARGE, TTI_WARNING_LARGE and TTI_ERROR_LARGE. User-defined icons passed through TTM_SETTITLE message are still drawn as 16x16 icons.
-- v3: comctl32: changed tooltip icon indices to match the native library
From: Sergei Chernyadyev serg.cherniadjev@gmail.com
Added 32x32 icons for TTI_INFO_LARGE, TTI_WARNING_LARGE and TTI_ERROR_LARGE. User-defined icons passed through TTM_SETTITLE message are still drawn as 16x16 icons. --- dlls/comctl32/comctl32.h | 3 +++ dlls/comctl32/comctl32.rc | 9 +++++++ dlls/comctl32/idi_tt_error_md.ico | Bin 0 -> 766 bytes dlls/comctl32/idi_tt_info_md.ico | Bin 0 -> 766 bytes dlls/comctl32/idi_tt_warn_md.ico | Bin 0 -> 766 bytes dlls/comctl32/tooltips.c | 41 +++++++++++++++++++++++------- 6 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 dlls/comctl32/idi_tt_error_md.ico create mode 100644 dlls/comctl32/idi_tt_info_md.ico create mode 100644 dlls/comctl32/idi_tt_warn_md.ico
diff --git a/dlls/comctl32/comctl32.h b/dlls/comctl32/comctl32.h index 51f4337add2..ffd5a3f2ea2 100644 --- a/dlls/comctl32/comctl32.h +++ b/dlls/comctl32/comctl32.h @@ -101,6 +101,9 @@ extern HBRUSH COMCTL32_hPattern55AABrush; #define IDI_TT_INFO_SM 22 #define IDI_TT_WARN_SM 25 #define IDI_TT_ERROR_SM 28 +#define IDI_TT_INFO_MD 35 +#define IDI_TT_WARN_MD 38 +#define IDI_TT_ERROR_MD 41
/* Taskdialog strings */ #define IDS_BUTTON_YES 3000 diff --git a/dlls/comctl32/comctl32.rc b/dlls/comctl32/comctl32.rc index c9aa1ba6253..e89ab0ee4d1 100644 --- a/dlls/comctl32/comctl32.rc +++ b/dlls/comctl32/comctl32.rc @@ -170,3 +170,12 @@ IDI_TT_WARN_SM ICON idi_tt_warn_sm.ico
/* @makedep: idi_tt_error_sm.ico */ IDI_TT_ERROR_SM ICON idi_tt_error_sm.ico + +/* @makedep: idi_tt_info_md.ico */ +IDI_TT_INFO_MD ICON idi_tt_info_md.ico + +/* @makedep: idi_tt_warn_md.ico */ +IDI_TT_WARN_MD ICON idi_tt_warn_md.ico + +/* @makedep: idi_tt_error_md.ico */ +IDI_TT_ERROR_MD ICON idi_tt_error_md.ico diff --git a/dlls/comctl32/idi_tt_error_md.ico b/dlls/comctl32/idi_tt_error_md.ico new file mode 100644 index 0000000000000000000000000000000000000000..1c5a347f31c956e7dfb4313c69616cd149fa4695 GIT binary patch literal 766 zcmZ{iF>b;@5Jmq6OEgG$6%k5ImqQ?+aG4uW<s1~4f&(DR6dWQFiL#B0ls*JyO3D<# z<j*W7jv^L~ci+yR?_s@w<1fonJ`;T10S^Ek85v{B(EZz^U`j9=3C3eVQ50CM1nae6 zvk`2!g40QGJ_|(TpG_4<p65@OB`1=Odgn7|S;CErVhZnlids-QA_q52pjjPhVh*Jr zMjoanaJ`)|Cl!=#7M^v36O`{mcq8^hcumR9&w~nPAuL%yW@hJmA-wy@Ca^TQjHMsZ zBsErnR<otZbkOQ6`<D>b4W>C?@tdEKt;tx=^4eefv)1M&NR+KLYUp6hYQEb9N%i;t z@q|k^x7H|FLeJ0jtu@c7que+@#j3iVZ^w`h+A7aKA}iwesgX0kU#EeMr5xKLB^FX( z!rL)81KlIg{svkHUcLP#N?O!WaD5{jHFdQ1^kH=AGoasuz6<(`6fKd%fY(vv2ToE8 A*Z=?k
literal 0 HcmV?d00001
diff --git a/dlls/comctl32/idi_tt_info_md.ico b/dlls/comctl32/idi_tt_info_md.ico new file mode 100644 index 0000000000000000000000000000000000000000..566b81190820b11f0b5242c986df1b187d74b82e GIT binary patch literal 766 zcmbu7JyOFk5QSf4W>Oj&T7+mQg>?Y98NLBm$_==JOUjffGFiTr?ZgI#0-ondeygX| z>POn}#duA7rH>%pN_vD5zCe%v24k@Adzty)ACbPyqmBiF);cyT9aL62HcOqNO38_? zBB&`~+@DD73gpR9M?IkAe&o{)AmD2R`dQ~FJ-9Q~VGJ>>w4&QD<N2Ge_VfHQPXDj& z?x%W6sOz6~PGdc_C>rV+3z!02x$Ew-pSs^!XFm`ObH2d-MTSX_=cP0y>+130NOg_* z_<c$O^uX+$XY*!uYR!)D0QXROJ;8%?2irXyr0tI9*e^(mAJG$q)w`n~xJYtrJ=als KHf_v?);<A_(q^mx
literal 0 HcmV?d00001
diff --git a/dlls/comctl32/idi_tt_warn_md.ico b/dlls/comctl32/idi_tt_warn_md.ico new file mode 100644 index 0000000000000000000000000000000000000000..3f88bedd79dd6bea908e0df53c7f0bb056fa84da GIT binary patch literal 766 zcmaKqu};G<5QhIIR247)66%^v6;DCo4Pfb9ft1%s_6}v{6_5}+3|aaLfLQ2+U?M`5 znxWMEcX3=>mAL4)^Pm0sPKkjIpENz>xP#9K=mR*RQtFJ7{J+sZ=H>*^`6;5y3*hP+ zC~{yj0q*aBr$<Dy8RF*`;Pnmo`T!O`fH6Q8#+DBXM;RF}x)}~UTMfpIUmoR>u0~@i z!j~pZyzzFu%VqBX!2>^{Rp1xzJVkN!HKz26E3m+jMHE+GVqdB&F2D_T9qzov1(5Y> zV7Irv#R<r|t*#x3cQ_BA-{ABQ*mKndSR(guV14`T;nIPRtKU@DiUH1!0-QTs^Rk-} z;=ow5+e68esEvZxt!xx??#-!+4Ot~MkgR~ARlb(b>C`c%h#Qrh%bqcFUJy|wN{p%b Kr&gleNc;f@wCn=_
literal 0 HcmV?d00001
diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 2353d4018ac..f48bf12e9f9 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -105,7 +105,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(tooltips);
-static HICON hTooltipIcons[TTI_ERROR+1]; +static HICON hTooltipIcons[TTI_ERROR_LARGE+1];
typedef struct { @@ -146,6 +146,8 @@ typedef struct BOOL bToolBelow; LPWSTR pszTitle; HICON hTitleIcon; + int iconWidth; + int iconHeight;
TTTOOL_INFO *tools; } TOOLTIPS_INFO; @@ -169,8 +171,6 @@ typedef struct
#define BALLOON_ICON_TITLE_SPACING 8 /* horizontal spacing between icon and title */ #define BALLOON_TITLE_TEXT_SPACING 8 /* vertical spacing between icon/title and main text */ -#define ICON_HEIGHT 16 -#define ICON_WIDTH 16
#define MAX_TEXT_SIZE_A 80 /* maximum retrieving text size by ANSI message */
@@ -312,11 +312,11 @@ TOOLTIPS_Refresh (const TOOLTIPS_INFO *infoPtr, HDC hdc) /* draw icon */ icon_present = infoPtr->hTitleIcon && DrawIconEx(hdc, rc.left, rc.top, infoPtr->hTitleIcon, - ICON_WIDTH, ICON_HEIGHT, 0, NULL, DI_NORMAL); + infoPtr->iconWidth, infoPtr->iconHeight, 0, NULL, DI_NORMAL); if (icon_present) - rcTitle.left += ICON_WIDTH + BALLOON_ICON_TITLE_SPACING; + rcTitle.left += infoPtr->iconWidth + BALLOON_ICON_TITLE_SPACING;
- rcTitle.bottom = rc.top + ICON_HEIGHT; + rcTitle.bottom = rc.top + infoPtr->iconHeight;
/* draw title text */ prevFont = SelectObject (hdc, infoPtr->hTitleFont); @@ -537,8 +537,8 @@ TOOLTIPS_CalcTipSize (const TOOLTIPS_INFO *infoPtr, LPSIZE lpSize) TRACE("title %s\n", debugstr_w(infoPtr->pszTitle)); if (infoPtr->hTitleIcon) { - title.cx = ICON_WIDTH; - title.cy = ICON_HEIGHT; + title.cx = infoPtr->iconWidth; + title.cy = infoPtr->iconHeight; } if (title.cx != 0) title.cx += BALLOON_ICON_TITLE_SPACING; hOldFont = SelectObject (hdc, infoPtr->hTitleFont); @@ -1660,10 +1660,26 @@ TOOLTIPS_SetTitleT (TOOLTIPS_INFO *infoPtr, UINT_PTR uTitleIcon, LPCWSTR pszTitl else infoPtr->pszTitle = NULL;
- if (uTitleIcon <= TTI_ERROR) + if (uTitleIcon <= TTI_ERROR_LARGE) + { + if (uTitleIcon > TTI_ERROR) + { + infoPtr->iconHeight = GetSystemMetrics(SM_CYICON); + infoPtr->iconWidth = GetSystemMetrics(SM_CXICON); + } + else + { + infoPtr->iconHeight = GetSystemMetrics(SM_CYSMICON); + infoPtr->iconWidth = GetSystemMetrics(SM_CXSMICON); + } infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon]; + } else + { + infoPtr->iconHeight = GetSystemMetrics(SM_CYSMICON); + infoPtr->iconWidth = GetSystemMetrics(SM_CXSMICON); infoPtr->hTitleIcon = CopyIcon((HICON)uTitleIcon); + }
TRACE("icon = %p\n", infoPtr->hTitleIcon);
@@ -2302,6 +2318,13 @@ TOOLTIPS_Register (void) (LPCWSTR)MAKEINTRESOURCE(IDI_TT_WARN_SM), IMAGE_ICON, 0, 0, 0); hTooltipIcons[TTI_ERROR] = LoadImageW(COMCTL32_hModule, (LPCWSTR)MAKEINTRESOURCE(IDI_TT_ERROR_SM), IMAGE_ICON, 0, 0, 0); + hTooltipIcons[TTI_INFO_LARGE] = LoadImageW(COMCTL32_hModule, + (LPCWSTR)MAKEINTRESOURCE(IDI_TT_INFO_MD), IMAGE_ICON, 0, 0, 0); + hTooltipIcons[TTI_WARNING_LARGE] = LoadImageW(COMCTL32_hModule, + (LPCWSTR)MAKEINTRESOURCE(IDI_TT_WARN_MD), IMAGE_ICON, 0, 0, 0); + hTooltipIcons[TTI_ERROR_LARGE] = LoadImageW(COMCTL32_hModule, + (LPCWSTR)MAKEINTRESOURCE(IDI_TT_ERROR_MD), IMAGE_ICON, 0, 0, 0); + }
From: Sergei Chernyadyev serg.cherniadjev@gmail.com
Icon-related NIIF_ flags are now handled properly when used alongside with other flags such as NIIF_LARGE_ICON and others. --- programs/explorer/systray.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index 275c683e3ff..50f0ca49fa0 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -241,7 +241,12 @@ static void balloon_create_timer( struct icon *icon ) if ((icon->info_flags & NIIF_ICONMASK) == NIIF_USER) SendMessageW( balloon_window, TTM_SETTITLEW, (WPARAM)icon->info_icon, (LPARAM)icon->info_title ); else - SendMessageW( balloon_window, TTM_SETTITLEW, icon->info_flags, (LPARAM)icon->info_title ); + { + UINT info_flags_wparam = icon->info_flags & NIIF_ERROR; + if (icon->info_flags & NIIF_LARGEICON) + info_flags_wparam += TTI_ERROR; + SendMessageW( balloon_window, TTM_SETTITLEW, info_flags_wparam, (LPARAM)icon->info_title ); + } balloon_icon = icon; balloon_pos.x = balloon_pos.y = MAXLONG; update_systray_balloon_position();
From: Sergei Chernyadyev serg.cherniadjev@gmail.com
--- dlls/comctl32/comctl32.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/comctl32.h b/dlls/comctl32/comctl32.h index ffd5a3f2ea2..9d4ee9067c3 100644 --- a/dlls/comctl32/comctl32.h +++ b/dlls/comctl32/comctl32.h @@ -98,9 +98,9 @@ extern HBRUSH COMCTL32_hPattern55AABrush; #define HKY_NONE 2048
/* Tooltip icons */ -#define IDI_TT_INFO_SM 22 -#define IDI_TT_WARN_SM 25 -#define IDI_TT_ERROR_SM 28 +#define IDI_TT_INFO_SM 37 +#define IDI_TT_WARN_SM 40 +#define IDI_TT_ERROR_SM 43 #define IDI_TT_INFO_MD 35 #define IDI_TT_WARN_MD 38 #define IDI_TT_ERROR_MD 41
I used my real name in the commits, I just didn't specify it in my profile here.
Our policy is that sign-offs are required when submitting someone else's work, and this is done automatically as I understand, so you'll either need to change your gitlab name to match the patch author name, or explicitly approve every patch you send.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/comctl32.h:
#define HKY_NONE 2048
/* Tooltip icons */ -#define IDI_TT_INFO_SM 22 -#define IDI_TT_WARN_SM 25 -#define IDI_TT_ERROR_SM 28 +#define IDI_TT_INFO_SM 37 +#define IDI_TT_WARN_SM 40 +#define IDI_TT_ERROR_SM 43
Let's drop this patch. It looks like the indices are not stable across comctl32 v5 and v6 and different system versions.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/comctl32.h:
#define IDI_TT_INFO_SM 22 #define IDI_TT_WARN_SM 25
Let's rename the commit subject to "comctl32/tooltip: Support large standard title icons."
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/tooltips.c:
(LPCWSTR)MAKEINTRESOURCE(IDI_TT_WARN_SM), IMAGE_ICON, 0, 0, 0); hTooltipIcons[TTI_ERROR] = LoadImageW(COMCTL32_hModule, (LPCWSTR)MAKEINTRESOURCE(IDI_TT_ERROR_SM), IMAGE_ICON, 0, 0, 0);
- hTooltipIcons[TTI_INFO_LARGE] = LoadImageW(COMCTL32_hModule,
(LPCWSTR)MAKEINTRESOURCE(IDI_TT_INFO_MD), IMAGE_ICON, 0, 0, 0);
- hTooltipIcons[TTI_WARNING_LARGE] = LoadImageW(COMCTL32_hModule,
(LPCWSTR)MAKEINTRESOURCE(IDI_TT_WARN_MD), IMAGE_ICON, 0, 0, 0);
- hTooltipIcons[TTI_ERROR_LARGE] = LoadImageW(COMCTL32_hModule,
(LPCWSTR)MAKEINTRESOURCE(IDI_TT_ERROR_MD), IMAGE_ICON, 0, 0, 0);
Delete this empty line.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/tooltips.c:
else infoPtr->pszTitle = NULL;
- if (uTitleIcon <= TTI_ERROR)
- if (uTitleIcon <= TTI_ERROR_LARGE)
Let's write it like ``` if (uTitleIcon >= TTI_INFO_LARGE && uTitleIcon <= TTI_ERROR_LARGE) { infoPtr->iconWidth = GetSystemMetrics(SM_CXICON); infoPtr->iconHeight = GetSystemMetrics(SM_CYICON); } else { infoPtr->iconWidth = GetSystemMetrics(SM_CXSMICON); infoPtr->iconHeight = GetSystemMetrics(SM_CYSMICON); }
if (uTitleIcon <= TTI_ERROR_LARGE) infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon]; else infoPtr->hTitleIcon = CopyIcon((HICON)uTitleIcon); ```
Zhiyi Zhang (@zhiyi) commented about programs/explorer/systray.c:
if ((icon->info_flags & NIIF_ICONMASK) == NIIF_USER) SendMessageW( balloon_window, TTM_SETTITLEW, (WPARAM)icon->info_icon, (LPARAM)icon->info_title );
A style nitpick. Let's add curly braces when the if condition is TRUE.
Zhiyi Zhang (@zhiyi) commented about programs/explorer/systray.c:
if ((icon->info_flags & NIIF_ICONMASK) == NIIF_USER) SendMessageW( balloon_window, TTM_SETTITLEW, (WPARAM)icon->info_icon, (LPARAM)icon->info_title ); else
SendMessageW( balloon_window, TTM_SETTITLEW, icon->info_flags, (LPARAM)icon->info_title );
- {
UINT info_flags_wparam = icon->info_flags & NIIF_ERROR;
Let's add a newline after the variable declaration.