[PATCH 1/3] user32: Reimplement SetMenuItemBitmaps on top of NtUserThunkedMenuItemInfo.
Jacek Caban
wine at gitlab.winehq.org
Fri Jun 24 07:31:50 CDT 2022
From: Jacek Caban <jacek at codeweavers.com>
---
dlls/user32/menu.c | 31 +++++++++++--------------------
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 76144706771..342ee08a89b 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -714,30 +714,21 @@ DWORD WINAPI GetMenuCheckMarkDimensions(void)
/**********************************************************************
* SetMenuItemBitmaps (USER32.@)
*/
-BOOL WINAPI SetMenuItemBitmaps( HMENU hMenu, UINT nPos, UINT wFlags,
- HBITMAP hNewUnCheck, HBITMAP hNewCheck)
+BOOL WINAPI SetMenuItemBitmaps( HMENU menu, UINT pos, UINT flags, HBITMAP uncheck, HBITMAP check )
{
- POPUPMENU *menu;
- MENUITEM *item;
- UINT pos;
+ MENUITEMINFOW info;
- if (!(menu = find_menu_item(hMenu, nPos, wFlags, &pos)))
+ info.cbSize = sizeof(info);
+ info.fMask = MIIM_STATE;
+ if (!NtUserThunkedMenuItemInfo( menu, pos, flags, NtUserGetMenuItemInfoW, &info, NULL ))
return FALSE;
- item = &menu->items[pos];
- if (!hNewCheck && !hNewUnCheck)
- {
- item->fState &= ~MF_USECHECKBITMAPS;
- }
- else /* Install new bitmaps */
- {
- item->hCheckBit = hNewCheck;
- item->hUnCheckBit = hNewUnCheck;
- item->fState |= MF_USECHECKBITMAPS;
- }
- release_menu_ptr(menu);
-
- return TRUE;
+ info.fMask = MIIM_STATE | MIIM_CHECKMARKS;
+ info.hbmpChecked = check;
+ info.hbmpUnchecked = uncheck;
+ if (check || uncheck) info.fState |= MF_USECHECKBITMAPS;
+ else info.fState &= ~MF_USECHECKBITMAPS;
+ return NtUserThunkedMenuItemInfo( menu, pos, flags, NtUserSetMenuItemInfo, &info, NULL );
}
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/311
More information about the wine-devel
mailing list