Nikolay Sivov : user32/menu: Replace macro checks for window style with a helper function.

Alexandre Julliard julliard at winehq.org
Tue Apr 17 14:53:58 CDT 2018


Module: wine
Branch: master
Commit: 6cae93a36e217cf45c8e09913442a805eb95e95f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6cae93a36e217cf45c8e09913442a805eb95e95f

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Apr 16 14:12:13 2018 +0300

user32/menu: Replace macro checks for window style with a helper function.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/menu.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 20a569c..537c2eb 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -165,8 +165,6 @@ typedef struct
 #define STATE_MASK (~TYPE_MASK)
 #define MENUITEMINFO_STATE_MASK (STATE_MASK & ~(MF_BYPOSITION | MF_MOUSESELECT))
 
-#define WIN_ALLOWED_MENU(style) ((style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
-
 static SIZE     menucharsize;
 static UINT     ODitemheight; /* default owner drawn item height */      
 
@@ -182,6 +180,11 @@ DWORD WINAPI DrawMenuBarTemp(HWND hwnd, HDC hDC, LPRECT lprect, HMENU hMenu, HFO
 
 static BOOL SetMenuItemInfo_common( MENUITEM *, const MENUITEMINFOW *, BOOL);
 
+static BOOL is_win_menu_disallowed(HWND hwnd)
+{
+    return (GetWindowLongW(hwnd, GWL_STYLE) & (WS_CHILD | WS_POPUP)) == WS_CHILD;
+}
+
 /*********************************************************************
  * menu class descriptor
  */
@@ -3442,7 +3445,7 @@ void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, WCHAR wChar)
 
     /* find window that has a menu */
 
-    while (!WIN_ALLOWED_MENU(GetWindowLongW( hwnd, GWL_STYLE )))
+    while (is_win_menu_disallowed(hwnd))
         if (!(hwnd = GetAncestor( hwnd, GA_PARENT ))) return;
 
     /* check if we have to track a system menu */
@@ -4375,7 +4378,7 @@ BOOL MENU_SetMenu( HWND hWnd, HMENU hMenu )
         WARN("hMenu %p is not a menu handle\n", hMenu);
         return FALSE;
     }
-    if (!WIN_ALLOWED_MENU(GetWindowLongW( hWnd, GWL_STYLE )))
+    if (is_win_menu_disallowed(hWnd))
         return FALSE;
 
     hWnd = WIN_GetFullHandle( hWnd );
@@ -4432,7 +4435,7 @@ BOOL WINAPI DrawMenuBar( HWND hWnd )
 
     if (!IsWindow( hWnd ))
         return FALSE;
-    if (!WIN_ALLOWED_MENU(GetWindowLongW( hWnd, GWL_STYLE )))
+    if (is_win_menu_disallowed(hWnd))
         return TRUE;
 
     if ((hMenu = GetMenu( hWnd )))




More information about the wine-cvs mailing list