mirror of
git://source.winehq.org/git/wine.git
synced 2024-07-21 16:24:09 +00:00
win32u: Move NtUserSetMenuDefaultItem implementation from user32.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
99b94fcc74
commit
172ae86945
|
@ -894,7 +894,7 @@ static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild )
|
|||
NtUserEnableMenuItem(hSysPopup, SC_SIZE, MF_BYCOMMAND | MF_GRAYED);
|
||||
NtUserEnableMenuItem(hSysPopup, SC_MOVE, MF_BYCOMMAND | MF_GRAYED);
|
||||
NtUserEnableMenuItem(hSysPopup, SC_MAXIMIZE, MF_BYCOMMAND | MF_GRAYED);
|
||||
SetMenuDefaultItem(hSysPopup, SC_CLOSE, FALSE);
|
||||
NtUserSetMenuDefaultItem(hSysPopup, SC_CLOSE, FALSE);
|
||||
|
||||
/* redraw menu */
|
||||
DrawMenuBar(frame);
|
||||
|
|
|
@ -375,7 +375,7 @@ static HMENU MENU_CopySysPopup(BOOL mdi)
|
|||
SetMenuItemInfoW( hMenu, SC_MAXIMIZE, FALSE, &miteminfo);
|
||||
miteminfo.hbmpItem = HBMMENU_POPUP_MINIMIZE;
|
||||
SetMenuItemInfoW( hMenu, SC_MINIMIZE, FALSE, &miteminfo);
|
||||
SetMenuDefaultItem(hMenu, SC_CLOSE, FALSE);
|
||||
NtUserSetMenuDefaultItem( hMenu, SC_CLOSE, FALSE );
|
||||
}
|
||||
else
|
||||
ERR("Unable to load default system menu\n" );
|
||||
|
@ -4875,62 +4875,6 @@ BOOL WINAPI SetMenuItemInfoW(HMENU hmenu, UINT item, BOOL bypos,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static BOOL set_menu_default_item(POPUPMENU *menu, UINT uItem, UINT bypos)
|
||||
{
|
||||
unsigned int i;
|
||||
MENUITEM *item;
|
||||
|
||||
/* reset all default-item flags */
|
||||
item = menu->items;
|
||||
for (i = 0; i < menu->nItems; i++, item++)
|
||||
{
|
||||
item->fState &= ~MFS_DEFAULT;
|
||||
}
|
||||
|
||||
/* no default item */
|
||||
if (-1 == uItem)
|
||||
return TRUE;
|
||||
|
||||
item = menu->items;
|
||||
if ( bypos )
|
||||
{
|
||||
if ( uItem >= menu->nItems ) return FALSE;
|
||||
item[uItem].fState |= MFS_DEFAULT;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < menu->nItems; i++, item++)
|
||||
{
|
||||
if (item->wID == uItem)
|
||||
{
|
||||
item->fState |= MFS_DEFAULT;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* SetMenuDefaultItem (USER32.@)
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI SetMenuDefaultItem(HMENU hmenu, UINT uItem, UINT bypos)
|
||||
{
|
||||
POPUPMENU *menu;
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%p,%d,%d)\n", hmenu, uItem, bypos);
|
||||
|
||||
if (!(menu = grab_menu_ptr(hmenu))) return FALSE;
|
||||
ret = set_menu_default_item(menu, uItem, bypos);
|
||||
release_menu_ptr(menu);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* GetMenuDefaultItem (USER32.@)
|
||||
*/
|
||||
|
|
|
@ -680,7 +680,7 @@
|
|||
@ stdcall SetLogonNotifyWindow(long long)
|
||||
@ stdcall SetMenu(long long) NtUserSetMenu
|
||||
@ stdcall SetMenuContextHelpId(long long) NtUserSetMenuContextHelpId
|
||||
@ stdcall SetMenuDefaultItem(long long long)
|
||||
@ stdcall SetMenuDefaultItem(long long long) NtUserSetMenuDefaultItem
|
||||
@ stdcall SetMenuInfo(long ptr)
|
||||
@ stdcall SetMenuItemBitmaps(long long long long long)
|
||||
@ stdcall SetMenuItemInfoA(long long long ptr)
|
||||
|
|
|
@ -541,3 +541,51 @@ BOOL WINAPI NtUserSetMenuContextHelpId( HMENU handle, DWORD id )
|
|||
release_menu_ptr( menu );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* NtUserSetMenuDefaultItem (win32u.@)
|
||||
*/
|
||||
BOOL WINAPI NtUserSetMenuDefaultItem( HMENU handle, UINT item, UINT bypos )
|
||||
{
|
||||
MENUITEM *menu_item;
|
||||
POPUPMENU *menu;
|
||||
unsigned int i;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE( "(%p,%d,%d)\n", handle, item, bypos );
|
||||
|
||||
if (!(menu = grab_menu_ptr( handle ))) return FALSE;
|
||||
|
||||
/* reset all default-item flags */
|
||||
menu_item = menu->items;
|
||||
for (i = 0; i < menu->nItems; i++, menu_item++)
|
||||
{
|
||||
menu_item->fState &= ~MFS_DEFAULT;
|
||||
}
|
||||
|
||||
if (item != -1)
|
||||
{
|
||||
menu_item = menu->items;
|
||||
|
||||
if (bypos)
|
||||
{
|
||||
ret = item < menu->nItems;
|
||||
if (ret) menu->items[item].fState |= MFS_DEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < menu->nItems; i++)
|
||||
{
|
||||
if (menu->items[i].wID == item)
|
||||
{
|
||||
menu->items[i].fState |= MFS_DEFAULT;
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else ret = TRUE;
|
||||
|
||||
release_menu_ptr( menu );
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -157,6 +157,7 @@ static void * const syscalls[] =
|
|||
NtUserRemoveProp,
|
||||
NtUserSetKeyboardState,
|
||||
NtUserSetMenuContextHelpId,
|
||||
NtUserSetMenuDefaultItem,
|
||||
NtUserSetObjectInformation,
|
||||
NtUserSetProcessDpiAwarenessContext,
|
||||
NtUserSetProcessWindowStation,
|
||||
|
|
|
@ -1208,7 +1208,7 @@
|
|||
@ stub NtUserSetManipulationInputTarget
|
||||
@ stdcall NtUserSetMenu(long long)
|
||||
@ stdcall -syscall NtUserSetMenuContextHelpId(long long)
|
||||
@ stub NtUserSetMenuDefaultItem
|
||||
@ stdcall -syscall NtUserSetMenuDefaultItem(long long long)
|
||||
@ stub NtUserSetMenuFlagRtoL
|
||||
@ stub NtUserSetMirrorRendering
|
||||
@ stub NtUserSetMonitorWorkArea
|
||||
|
|
|
@ -144,6 +144,7 @@
|
|||
SYSCALL_ENTRY( NtUserRemoveProp ) \
|
||||
SYSCALL_ENTRY( NtUserSetKeyboardState ) \
|
||||
SYSCALL_ENTRY( NtUserSetMenuContextHelpId ) \
|
||||
SYSCALL_ENTRY( NtUserSetMenuDefaultItem ) \
|
||||
SYSCALL_ENTRY( NtUserSetObjectInformation ) \
|
||||
SYSCALL_ENTRY( NtUserSetProcessDpiAwarenessContext ) \
|
||||
SYSCALL_ENTRY( NtUserSetProcessWindowStation ) \
|
||||
|
|
|
@ -659,6 +659,15 @@ NTSTATUS WINAPI wow64_NtUserSetMenuContextHelpId( UINT *args )
|
|||
return NtUserSetMenuContextHelpId( menu, id );
|
||||
}
|
||||
|
||||
NTSTATUS WINAPI wow64_NtUserSetMenuDefaultItem( UINT *args )
|
||||
{
|
||||
HMENU handle = get_handle( &args );
|
||||
UINT item = get_ulong( &args );
|
||||
UINT bypos = get_ulong( &args );
|
||||
|
||||
return NtUserSetMenuDefaultItem( handle, item, bypos );
|
||||
}
|
||||
|
||||
NTSTATUS WINAPI wow64_NtUserThunkedMenuInfo( UINT *args )
|
||||
{
|
||||
HMENU menu = get_handle( &args );
|
||||
|
|
|
@ -556,6 +556,7 @@ BOOL WINAPI NtUserSetKeyboardState( BYTE *state );
|
|||
BOOL WINAPI NtUserSetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags );
|
||||
BOOL WINAPI NtUserSetMenu( HWND hwnd, HMENU menu );
|
||||
BOOL WINAPI NtUserSetMenuContextHelpId( HMENU handle, DWORD id );
|
||||
BOOL WINAPI NtUserSetMenuDefaultItem( HMENU handle, UINT item, UINT bypos );
|
||||
HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent );
|
||||
BOOL WINAPI NtUserSetProcessDpiAwarenessContext( ULONG awareness, ULONG unknown );
|
||||
BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle );
|
||||
|
|
Loading…
Reference in a new issue