Commit 72d53fda authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move CreatePopupMenu implementation from user32.

parent 6ea417b2
......@@ -4158,13 +4158,7 @@ BOOL WINAPI ModifyMenuA( HMENU hMenu, UINT pos, UINT flags,
*/
HMENU WINAPI CreatePopupMenu(void)
{
HMENU hmenu;
POPUPMENU *menu;
if (!(hmenu = CreateMenu())) return 0;
menu = MENU_GetMenu( hmenu );
menu->wFlags |= MF_POPUP;
return hmenu;
return NtUserCreateMenu( TRUE );
}
......@@ -4213,7 +4207,7 @@ BOOL WINAPI SetMenuItemBitmaps( HMENU hMenu, UINT nPos, UINT wFlags,
*/
HMENU WINAPI CreateMenu(void)
{
return NtUserCreateMenu();
return NtUserCreateMenu( FALSE );
}
......
......@@ -116,8 +116,8 @@ HMENU get_menu( HWND hwnd )
return UlongToHandle( get_window_long( hwnd, GWLP_ID ));
}
/* see CreateMenu */
HMENU create_menu(void)
/* see CreateMenu and CreatePopupMenu */
HMENU create_menu( BOOL is_popup )
{
POPUPMENU *menu;
HMENU handle;
......@@ -125,6 +125,7 @@ HMENU create_menu(void)
if (!(menu = calloc( 1, sizeof(*menu) ))) return 0;
menu->FocusedItem = NO_SELECTED_ITEM;
menu->refcount = 1;
if (is_popup) menu->wFlags |= MF_POPUP;
if (!(handle = alloc_user_handle( &menu->obj, NTUSER_OBJ_MENU ))) free( menu );
......
......@@ -4632,9 +4632,6 @@ ULONG_PTR WINAPI NtUserCallNoParam( ULONG code )
{
switch(code)
{
case NtUserCallNoParam_CreateMenu:
return HandleToUlong( create_menu() );
case NtUserCallNoParam_GetDesktopWindow:
return HandleToUlong( get_desktop_window() );
......@@ -4679,6 +4676,9 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
case NtUserCallOneParam_CreateCursorIcon:
return HandleToUlong( alloc_cursoricon_handle( arg ));
case NtUserCallOneParam_CreateMenu:
return HandleToUlong( create_menu( arg ) );
case NtUserCallOneParam_DispatchMessageA:
return dispatch_message( (const MSG *)arg, TRUE );
......
......@@ -353,7 +353,7 @@ extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) DECL
extern BOOL set_foreground_window( HWND hwnd, BOOL mouse ) DECLSPEC_HIDDEN;
/* menu.c */
extern HMENU create_menu(void) DECLSPEC_HIDDEN;
extern HMENU create_menu( BOOL is_popup ) DECLSPEC_HIDDEN;
extern HMENU get_menu( HWND hwnd ) DECLSPEC_HIDDEN;
/* message.c */
......
......@@ -577,7 +577,6 @@ HWND WINAPI NtUserWindowFromPoint( LONG x, LONG y );
/* NtUserCallNoParam codes, not compatible with Windows */
enum
{
NtUserCallNoParam_CreateMenu,
NtUserCallNoParam_GetDesktopWindow,
NtUserCallNoParam_GetInputState,
NtUserCallNoParam_GetMessagePos,
......@@ -588,11 +587,6 @@ enum
NtUserUpdateClipboard,
};
static inline HMENU NtUserCreateMenu(void)
{
return UlongToHandle( NtUserCallNoParam( NtUserCallNoParam_CreateMenu ));
}
static inline HWND NtUserGetDesktopWindow(void)
{
return UlongToHandle( NtUserCallNoParam( NtUserCallNoParam_GetDesktopWindow ));
......@@ -618,6 +612,7 @@ enum
{
NtUserCallOneParam_BeginDeferWindowPos,
NtUserCallOneParam_CreateCursorIcon,
NtUserCallOneParam_CreateMenu,
NtUserCallOneParam_DispatchMessageA,
NtUserCallOneParam_EnableDC,
NtUserCallOneParam_EnableThunkLock,
......@@ -651,6 +646,11 @@ static inline HICON NtUserCreateCursorIcon( BOOL is_icon )
return UlongToHandle( NtUserCallOneParam( is_icon, NtUserCallOneParam_CreateCursorIcon ));
}
static inline HMENU NtUserCreateMenu( BOOL is_popup )
{
return UlongToHandle( NtUserCallOneParam( is_popup, NtUserCallOneParam_CreateMenu ));
}
static inline LRESULT NtUserDispatchMessageA( const MSG *msg )
{
return NtUserCallOneParam( (UINT_PTR)msg, NtUserCallOneParam_DispatchMessageA );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment