Popup Menu Position

Michael Kaufmann hallo at michael-kaufmann.ch
Thu Jun 1 16:58:04 CDT 2006


These changes have been tested against Windows 2000.

Changelog:
  - 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
-------------- next part --------------
Index: menu.c
===================================================================
RCS file: /home/wine/wine/dlls/user/menu.c,v
retrieving revision 1.62
diff -u -r1.62 menu.c
--- menu.c	23 May 2006 12:48:46 -0000	1.62
+++ menu.c	1 Jun 2006 21:45:48 -0000
@@ -1796,8 +1796,9 @@
 
     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 @@
 
     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 @@
             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-patches mailing list