Huw Davies : user32: Add a helper to retrieve the height of the scroll arrows.

Alexandre Julliard julliard at winehq.org
Tue Mar 28 15:38:42 CDT 2017


Module: wine
Branch: master
Commit: c72a7219fd1ba530cc522c9c8bf2dbe45e735143
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c72a7219fd1ba530cc522c9c8bf2dbe45e735143

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Mar 28 12:52:19 2017 +0100

user32: Add a helper to retrieve the height of the scroll arrows.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 7836c76..6584a41 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 );
     }
 }
 




More information about the wine-cvs mailing list