[PATCH 2/5] user32: Add a helper to retrieve the height of the scroll arrows.

Huw Davies huw at codeweavers.com
Tue Mar 28 06:52:19 CDT 2017


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/user32/menu.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 7836c76ee3..6584a41f4b 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -404,6 +404,14 @@ static HBITMAP get_up_arrow_inactive_bitmap(void)
     return arrow_bitmap;
 }
 
+static inline UINT get_scroll_arrow_height(const POPUPMENU *menu)
+{
+    BITMAP bmp;
+
+    GetObjectW(get_up_arrow_bitmap(), sizeof(bmp), &bmp);
+    return bmp.bmHeight;
+}
+
 /***********************************************************************
  *           MENU_CopySysPopup
  *
@@ -699,13 +707,10 @@ MENU_AdjustMenuItemRect(const POPUPMENU *menu, LPRECT rect)
 {
     if (menu->bScrolling)
     {
-        UINT arrow_bitmap_height;
-        BITMAP bmp;
+        UINT arrow_height;
 
-        GetObjectW(get_up_arrow_bitmap(), sizeof(bmp), &bmp);
-        arrow_bitmap_height = bmp.bmHeight;
-        rect->top += arrow_bitmap_height - menu->nScrollPos;
-        rect->bottom += arrow_bitmap_height - menu->nScrollPos;
+        arrow_height = get_scroll_arrow_height( menu );
+        OffsetRect( rect, 0, arrow_height - menu->nScrollPos );
     }
 }
 
-- 
2.12.0




More information about the wine-patches mailing list