Vincent Povirk : user32: Implement TPM_*ALIGN flags.

Alexandre Julliard julliard at winehq.org
Wed Aug 20 08:13:57 CDT 2008


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Mon Aug 18 12:16:48 2008 -0500

user32: Implement TPM_*ALIGN flags.

---

 dlls/user32/menu.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index b4c1955..058cf0f 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -1767,7 +1767,7 @@ UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd,
  *
  * Display a popup menu.
  */
-static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id,
+static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, UINT flags,
                               INT x, INT y, INT xanchor, INT yanchor )
 {
     POPUPMENU *menu;
@@ -1803,6 +1803,13 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id,
     monitor = MonitorFromPoint( pt, MONITOR_DEFAULTTONEAREST );
     info.cbSize = sizeof(info);
     GetMonitorInfoW( monitor, &info );
+
+    if( flags & TPM_RIGHTALIGN ) x -= width;
+    if( flags & TPM_CENTERALIGN ) x -= width / 2;
+
+    if( flags & TPM_BOTTOMALIGN ) y -= height;
+    if( flags & TPM_VCENTERALIGN ) y -= height / 2;
+
     if( x + width > info.rcWork.right)
     {
         if( xanchor && x >= width - xanchor )
@@ -2390,7 +2397,7 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
 	}
     }
 
-    MENU_ShowPopup( hwndOwner, item->hSubMenu, menu->FocusedItem,
+    MENU_ShowPopup( hwndOwner, item->hSubMenu, menu->FocusedItem, 0,
 		    rect.left, rect.top, rect.right, rect.bottom );
     if (selectFirst)
         MENU_MoveSelection( hwndOwner, item->hSubMenu, ITEM_NEXT );
@@ -3410,7 +3417,7 @@ BOOL WINAPI TrackPopupMenu( HMENU hMenu, UINT wFlags, INT x, INT y,
     if (!(wFlags & TPM_NONOTIFY))
         SendMessageW( hWnd, WM_INITMENUPOPUP, (WPARAM)hMenu, 0);
 
-    if (MENU_ShowPopup( hWnd, hMenu, 0, x, y, 0, 0 ))
+    if (MENU_ShowPopup( hWnd, hMenu, 0, wFlags, x, y, 0, 0 ))
         ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd, lpRect );
     MENU_ExitTracking(hWnd);
 




More information about the wine-cvs mailing list