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