shell desktop context menu

Martin Fuchs martin-fuchs at gmx.net
Sun Mar 13 10:12:19 CST 2005


Changelog:
- switch to correct shell desktop context menu
- launch desk.cpl when activating the desktop context menu entry "properties"
- don't send WM_COMMAND if we didn't get a shell view window


Index: shell32_main.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32_main.h,v
retrieving revision 1.93
diff -u -p -d -r1.93 shell32_main.h
--- shell32_main.h	9 Mar 2005 16:41:17 -0000	1.93
+++ shell32_main.h	13 Mar 2005 16:09:34 -0000
@@ -81,7 +81,7 @@ LPENUMFORMATETC	IEnumFORMATETC_Construct
 
 LPCLASSFACTORY	IClassFactory_Constructor(REFCLSID);
 IContextMenu2 *	ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *aPidls, UINT uItemCount);
-IContextMenu2 *	ISvBgCm_Constructor(LPSHELLFOLDER pSFParent);
+IContextMenu2 *	ISvBgCm_Constructor(LPSHELLFOLDER pSFParent, BOOL bDesktop);
 LPSHELLVIEW	IShellView_Constructor(LPSHELLFOLDER);
 
 HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
Index: shfldr_desktop.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr_desktop.c,v
retrieving revision 1.33
diff -u -p -d -r1.33 shfldr_desktop.c
--- shfldr_desktop.c	2 Mar 2005 10:16:41 -0000	1.33
+++ shfldr_desktop.c	13 Mar 2005 16:09:34 -0000
@@ -524,8 +524,10 @@ static HRESULT WINAPI ISF_Desktop_fnGetU
 
     if (IsEqualIID (riid, &IID_IContextMenu))
     {
-        pObj = (LPUNKNOWN) ISvItemCm_Constructor( (IShellFolder *) iface,
-                                                  This->pidlRoot, apidl, cidl);
+        if (cidl > 0)
+            pObj = (LPUNKNOWN) ISvItemCm_Constructor( (IShellFolder *) iface, This->pidlRoot, apidl, cidl);
+        else
+            pObj = (LPUNKNOWN) ISvBgCm_Constructor( (IShellFolder *) iface, TRUE);
         hr = S_OK;
     }
     else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
Index: shlview.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlview.c,v
retrieving revision 1.111
diff -u -p -d -r1.111 shlview.c
--- shlview.c	7 Mar 2005 11:05:03 -0000	1.111
+++ shlview.c	13 Mar 2005 16:09:35 -0000
@@ -988,7 +988,7 @@ static void ShellView_DoContextMenu(IShe
 	{
 	  hMenu = CreatePopupMenu();
 
-	  pCM = ISvBgCm_Constructor(This->pSFParent);
+	  pCM = ISvBgCm_Constructor(This->pSFParent, FALSE);
 	  IContextMenu2_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
 
 	  uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
@@ -1977,7 +1977,7 @@ static HRESULT WINAPI IShellView_fnGetIt
 	switch(uItem)
 	{
 	  case SVGIO_BACKGROUND:
-	    *ppvOut = ISvBgCm_Constructor(This->pSFParent);
+	    *ppvOut = ISvBgCm_Constructor(This->pSFParent, FALSE);
 	    break;
 
 	  case SVGIO_SELECTION:
Index: shv_bg_cmenu.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shv_bg_cmenu.c,v
retrieving revision 1.36
diff -u -p -d -r1.36 shv_bg_cmenu.c
--- shv_bg_cmenu.c	14 Jan 2005 16:02:20 -0000	1.36
+++ shv_bg_cmenu.c	13 Mar 2005 16:09:36 -0000
@@ -46,6 +46,7 @@ typedef struct
 	IContextMenu2Vtbl *lpVtbl;
 	IShellFolder*	pSFParent;
 	DWORD		ref;
+	BOOL		bDesktop;
 } BgCmImpl;
 
 
@@ -54,7 +55,7 @@ static struct IContextMenu2Vtbl cmvt;
 /**************************************************************************
 *   ISVBgCm_Constructor()
 */
-IContextMenu2 *ISvBgCm_Constructor(IShellFolder*	pSFParent)
+IContextMenu2 *ISvBgCm_Constructor(IShellFolder* pSFParent, BOOL bDesktop)
 {
 	BgCmImpl* cm;
 
@@ -62,6 +63,7 @@ IContextMenu2 *ISvBgCm_Constructor(IShel
 	cm->lpVtbl = &cmvt;
 	cm->ref = 1;
 	cm->pSFParent = pSFParent;
+	cm->bDesktop = bDesktop;
 	if(pSFParent) IShellFolder_AddRef(pSFParent);
 
 	TRACE("(%p)->()\n",cm);
@@ -362,12 +364,22 @@ static HRESULT WINAPI ISVBgCm_fnInvokeCo
 	      case FCIDM_SHVIEW_NEWFOLDER:
 	        DoNewFolder(iface, lpSV);
 		break;
+
 	      case FCIDM_SHVIEW_INSERT:
 	        DoPaste(iface);
 	        break;
+
+	      case FCIDM_SHVIEW_PROPERTIES:
+		if (This->bDesktop) {
+		    ShellExecuteA(lpcmi->hwnd, "open", "rundll32.exe shell32.dll,Control_RunDLL desk.cpl", NULL, NULL, SW_SHOWNORMAL);
+		} else {
+		    FIXME("launch item properties dialog\n");
+		}
+		break;
+
 	      default:
 	        /* if it's a id just pass it to the parent shv */
-	        SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 );
+	        if (hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 );
 		break;
 	    }
 	  }





More information about the wine-patches mailing list