Michael Kaufmann : user32: Popup menu position fixes.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jun 2 04:55:49 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 6a74137d70608b8c9677c9bcf626f40d04519117
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=6a74137d70608b8c9677c9bcf626f40d04519117

Author: Michael Kaufmann <hallo at michael-kaufmann.ch>
Date:   Fri Jun  2 00:07:37 2006 +0200

user32: Popup menu position fixes.

- Open large popup menus on the other side only if there's enough space
- Open popup menus such that the y position of the first item in the
  popup menu is the same as the y position of the focused menu item.

---

 dlls/user/menu.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/user/menu.c b/dlls/user/menu.c
index a9cd87e..4b10e7f 100644
--- a/dlls/user/menu.c
+++ b/dlls/user/menu.c
@@ -1796,8 +1796,9 @@ static BOOL MENU_ShowPopup( HWND hwndOwn
 
     if( x + width > GetSystemMetrics(SM_CXSCREEN ))
     {
-        if( xanchor )
+        if( xanchor && x >= width - xanchor )
             x -= width - xanchor;
+
         if( x + width > GetSystemMetrics(SM_CXSCREEN))
             x = GetSystemMetrics(SM_CXSCREEN) - width;
     }
@@ -1805,8 +1806,9 @@ static BOOL MENU_ShowPopup( HWND hwndOwn
 
     if( y + height > GetSystemMetrics(SM_CYSCREEN ))
     {
-        if( yanchor )
+        if( yanchor && y >= height + yanchor )
             y -= height + yanchor;
+
         if( y + height > GetSystemMetrics(SM_CYSCREEN ))
             y = GetSystemMetrics(SM_CYSCREEN) - height;
     }
@@ -2339,10 +2341,14 @@ static HMENU MENU_ShowSubPopup( HWND hwn
             RECT rc = item->rect;
 
             MENU_AdjustMenuItemRect(menu, &rc);
+
+	    /* The first item in the popup menu has to be at the
+	       same y position as the focused menu item */
 	    rect.left += rc.right - GetSystemMetrics(SM_CXBORDER);
-	    rect.top += rc.top;
+	    rect.top += rc.top - MENU_TOP_MARGIN;
 	    rect.right = rc.left - rc.right + GetSystemMetrics(SM_CXBORDER);
-	    rect.bottom = rc.top - rc.bottom;
+	    rect.bottom = rc.top - rc.bottom - MENU_TOP_MARGIN
+	                  - MENU_BOTTOM_MARGIN - GetSystemMetrics(SM_CYBORDER);
 	}
 	else
 	{




More information about the wine-cvs mailing list