Dmitry Timoshkov : user32: Check only for -1 and -2 as special values returned by MENU_ExecFocusedItem .

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 2 15:42:30 CST 2006


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

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Thu Nov  2 19:19:39 2006 +0800

user32: Check only for -1 and -2 as special values returned by MENU_ExecFocusedItem.

---

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

diff --git a/dlls/user/menu.c b/dlls/user/menu.c
index 43bb11e..59c8386 100644
--- a/dlls/user/menu.c
+++ b/dlls/user/menu.c
@@ -2444,7 +2444,7 @@ static INT MENU_ExecFocusedItem( MTRACKE
 
     item = &menu->items[menu->FocusedItem];
 
-    TRACE("%p %08x %p\n", hMenu, item->wID, item->hSubMenu);
+    TRACE("hMenu %p wID %08x hSubMenu %p fType %04x\n", hMenu, item->wID, item->hSubMenu, item->fType);
 
     if (!(item->fType & MF_POPUP))
     {
@@ -2566,10 +2566,13 @@ static INT MENU_ButtonUp( MTRACKER* pmt,
 
 	if( item && (ptmenu->FocusedItem == id ))
 	{
+            debug_print_menuitem ("FocusedItem: ", item, "");
+
 	    if( !(item->fType & MF_POPUP) )
 	    {
 	        INT executedMenuId = MENU_ExecFocusedItem( pmt, hPtMenu, wFlags);
-	        return (executedMenuId < 0) ? -1 : executedMenuId;
+                if (executedMenuId == -1 || executedMenuId == -2) return -1;
+                return executedMenuId;
 	    }
 
 	    /* If we are dealing with the top-level menu            */
@@ -3050,6 +3053,7 @@ static BOOL MENU_TrackMenu( HMENU hmenu,
 		    if (hmenu)
 		    {
                         executedMenuId = MENU_ButtonUp( &mt, hmenu, wFlags);
+                        TRACE("executedMenuId %d\n", executedMenuId);
 
 			/* End the loop if executedMenuId is an item ID */
 			/* or if the job was done (executedMenuId = 0). */
@@ -3214,7 +3218,7 @@ static BOOL MENU_TrackMenu( HMENU hmenu,
 
     /* The return value is only used by TrackPopupMenu */
     if (!(wFlags & TPM_RETURNCMD)) return TRUE;
-    if (executedMenuId < 0) executedMenuId = 0;
+    if (executedMenuId == -1) executedMenuId = 0;
     return executedMenuId;
 }
 
@@ -3364,6 +3368,9 @@ BOOL WINAPI TrackPopupMenu( HMENU hMenu,
 {
     BOOL ret = FALSE;
 
+    TRACE("hmenu %p flags %04x (%d,%d) reserved %d hwnd %p rect %s\n",
+           hMenu, wFlags, x, y, nReserved, hWnd, wine_dbgstr_rect(lpRect));
+
     MENU_InitTracking(hWnd, hMenu, TRUE, wFlags);
 
     /* Send WM_INITMENUPOPUP message only if TPM_NONOTIFY flag is not specified */




More information about the wine-cvs mailing list