winefile: conditional context menu refresh

Martin Fuchs martin-fuchs at gmx.net
Sun Jun 5 07:26:47 CDT 2005


Changelog:
refresh window content after context menu popups only if any command has been executed


Index: winefile.c
===================================================================
RCS file: /home/wine/wine/programs/winefile/winefile.c,v
retrieving revision 1.47
diff -u -p -d -w -b -r1.47 winefile.c
--- winefile.c	3 Jun 2005 11:25:17 -0000	1.47
+++ winefile.c	5 Jun 2005 12:22:03 -0000
@@ -3841,6 +3841,7 @@ static BOOL CtxMenu_HandleMenuMsg(UINT n
 static HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST* apidl, int x, int y)
 {
 	IContextMenu* pcm;
+	BOOL executed = FALSE;
 
 	HRESULT hr = (*shell_folder->lpVtbl->GetUIObjectOf)(shell_folder, hwndParent, cidl, apidl, &IID_IContextMenu, NULL, (LPVOID*)&pcm);
 /*	HRESULT hr = CDefFolderMenu_Create2(dir?dir->_pidl:DesktopFolder(), hwndParent, 1, &pidl, shell_folder, NULL, 0, NULL, &pcm); */
@@ -3872,6 +3873,7 @@ static HRESULT ShellFolderContextMenu(IS
 				  cmi.hIcon = 0;
 
 				  hr = (*pcm->lpVtbl->InvokeCommand)(pcm, &cmi);
+					executed = TRUE;
 				}
 			}
 		}
@@ -3879,7 +3881,7 @@ static HRESULT ShellFolderContextMenu(IS
 		(*pcm->lpVtbl->Release)(pcm);
 	}
 
-	return hr;
+	return FAILED(hr)? hr: executed? S_OK: S_FALSE;
 }
 
 
@@ -4210,7 +4212,7 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd,
 
 					 /* get and use the parent folder to display correct context menu in all cases */
 					if (SUCCEEDED(SHBindToParent(pidl_abs, &IID_IShellFolder, (LPVOID*)&parentFolder, &pidlLast))) {
-						if (SUCCEEDED(ShellFolderContextMenu(parentFolder, hwnd, 1, &pidlLast, pt.x, pt.y)))
+						if (ShellFolderContextMenu(parentFolder, hwnd, 1, &pidlLast, pt.x, pt.y) == S_OK)
 							refresh_child(child);
 
 						(*parentFolder->lpVtbl->Release)(parentFolder);





More information about the wine-patches mailing list