[PATCH 3/5] win32u: Move MENU_DrawMenuBar implementation from user32.
Jacek Caban
wine at gitlab.winehq.org
Mon Jun 13 19:10:52 CDT 2022
From: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
---
dlls/user32/controls.h | 1 -
dlls/user32/menu.c | 20 --------------------
dlls/user32/user_main.c | 1 -
dlls/win32u/defwnd.c | 7 +++++--
dlls/win32u/menu.c | 2 +-
dlls/win32u/ntuser_private.h | 1 -
dlls/win32u/win32u_private.h | 1 +
7 files changed, 7 insertions(+), 26 deletions(-)
diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h
index 2b6c4912709..c09ab1233d0 100644
--- a/dlls/user32/controls.h
+++ b/dlls/user32/controls.h
@@ -116,7 +116,6 @@ extern BOOL update_wallpaper( const WCHAR *wallpaper, const WCHAR *pattern ) DEC
extern HWND MENU_IsMenuActive(void) DECLSPEC_HIDDEN;
extern void MENU_TrackMouseMenuBar( HWND hwnd, INT ht, POINT pt ) DECLSPEC_HIDDEN;
extern void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, WCHAR wChar ) DECLSPEC_HIDDEN;
-extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd ) DECLSPEC_HIDDEN;
extern void MENU_EndMenu(HWND) DECLSPEC_HIDDEN;
extern HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu ) DECLSPEC_HIDDEN;
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 1372baca6cc..2d01e01872c 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -1693,26 +1693,6 @@ static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu )
}
}
-/***********************************************************************
- * MENU_DrawMenuBar
- *
- * Paint a menu bar. Returns the height of the menu bar.
- * called from [windows/nonclient.c]
- */
-UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd )
-{
- LPPOPUPMENU lppop;
- HMENU hMenu = GetMenu(hwnd);
-
- lppop = MENU_GetMenu( hMenu );
- if (lppop == NULL || lprect == NULL)
- {
- return GetSystemMetrics(SM_CYMENU);
- }
-
- return NtUserDrawMenuBarTemp( hwnd, hDC, lprect, hMenu, NULL );
-}
-
/***********************************************************************
* MENU_InitPopup
diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c
index 5344dafd359..bca56fc4141 100644
--- a/dlls/user32/user_main.c
+++ b/dlls/user32/user_main.c
@@ -145,7 +145,6 @@ static const struct user_callbacks user_funcs =
ImmProcessKey,
ImmTranslateMessage,
NtWaitForMultipleObjects,
- MENU_DrawMenuBar,
SCROLL_DrawNCScrollBar,
free_win_ptr,
MENU_GetSysMenu,
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c
index 9a51b9a463a..f9a23bcee3f 100644
--- a/dlls/win32u/defwnd.c
+++ b/dlls/win32u/defwnd.c
@@ -1487,12 +1487,15 @@ static void nc_paint( HWND hwnd, HRGN clip )
if (has_menu( hwnd, style ))
{
RECT r = rect;
+ HMENU menu;
+
r.bottom = rect.top + get_system_metrics( SM_CYMENU );
TRACE( "drawing menu with rect %s\n", wine_dbgstr_rect( &r ));
- if (user_callbacks)
- rect.top += user_callbacks->draw_menu( hdc, &r, hwnd ) + 1;
+ menu = get_menu( hwnd );
+ if (!is_menu( menu )) rect.top += get_system_metrics( SM_CYMENU );
+ else rect.top += NtUserDrawMenuBarTemp( hwnd, hdc, &r, menu, NULL );
}
TRACE( "rect after menu %s\n", wine_dbgstr_rect( &rect ));
diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c
index 182dbb6cf58..b794b9a162a 100644
--- a/dlls/win32u/menu.c
+++ b/dlls/win32u/menu.c
@@ -241,7 +241,7 @@ static POPUPMENU *unsafe_menu_ptr( HMENU handle )
}
/* see IsMenu */
-static BOOL is_menu( HMENU handle )
+BOOL is_menu( HMENU handle )
{
POPUPMENU *menu;
BOOL is_menu;
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index 6fc1c1423bd..69fb831c03f 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -36,7 +36,6 @@ struct user_callbacks
BOOL (WINAPI *pImmProcessKey)(HWND, HKL, UINT, LPARAM, DWORD);
BOOL (WINAPI *pImmTranslateMessage)(HWND, UINT, WPARAM, LPARAM);
NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
- UINT (CDECL *draw_menu)( HDC hDC, LPRECT lprect, HWND hwnd );
void (CDECL *draw_nc_scrollbar)( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical );
void (CDECL *free_win_ptr)( struct tagWND *win );
HMENU (CDECL *get_sys_menu)( HWND hwnd, HMENU popup );
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index 5f5563ec9f9..cf3e5c75b16 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -401,6 +401,7 @@ extern UINT get_menu_bar_height( HWND hwnd, UINT width, INT org_x, INT org_y ) D
extern BOOL get_menu_info( HMENU handle, MENUINFO *info ) DECLSPEC_HIDDEN;
extern INT get_menu_item_count( HMENU handle ) DECLSPEC_HIDDEN;
extern UINT get_menu_state( HMENU handle, UINT item_id, UINT flags ) DECLSPEC_HIDDEN;
+extern BOOL is_menu( HMENU handle ) DECLSPEC_HIDDEN;
extern BOOL set_window_menu( HWND hwnd, HMENU handle ) DECLSPEC_HIDDEN;
/* message.c */
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/240
More information about the wine-devel
mailing list