Author: dquintana
Date: Wed Jul 9 00:42:05 2014
New Revision: 63702
URL:
http://svn.reactos.org/svn/reactos?rev=63702&view=rev
Log:
[RSHELL]
* CFocusManager: Try to fix some weird behaviour.
* CMergedFolder: Downgrade some prints to TRACEs, and implement a couple methods needed by
some debugging code.
* Activate merged folders by default. TODO: implement the filtering of the
"Programs" submenu, and use it for the real Programs menu item.
[SHELL32]
* defcontextmenu.cpp: Make a copy of the apidl array before storing it for later, since it
may be a pointer to the stack which may not be available later. Fixes the merged folders
not working on clicks and context menu.
* shlmenu.cpp: While debugging, I made Shell_MergeMenus closer to WINE's.
Modified:
branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
branches/shell-experiments/base/shell/rshell/CMenuToolbars.h
branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp
branches/shell-experiments/base/shell/rshell/precomp.h
branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
branches/shell-experiments/dll/win32/shell32/defcontextmenu.cpp
branches/shell-experiments/dll/win32/shell32/shlmenu.cpp
Modified: branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1] Wed
Jul 9 00:42:05 2014
@@ -319,7 +319,7 @@
}
BOOL isTracking = FALSE;
- if (entry)
+ if (entry && (entry->type == MenuBarEntry || m_current->type !=
TrackedMenuEntry))
{
ScreenToClient(child, &pt);
iHitTestResult = SendMessageW(child, TB_HITTEST, 0, (LPARAM) &pt);
@@ -485,7 +485,21 @@
if (hoveringMenuBar)
{
m_menuBar->mb->_DisableMouseTrack(TRUE);
+ if (m_current->type == TrackedMenuEntry)
+ {
+ SendMessage(m_parent->hwnd, WM_CANCELMODE, 0, 0);
+ msg->message = WM_NULL;
+ }
}
+ }
+ break;
+ case WM_NCLBUTTONUP:
+ case WM_LBUTTONUP:
+ case WM_NCRBUTTONUP:
+ case WM_RBUTTONUP:
+ if (m_current && m_current->type != TrackedMenuEntry)
+ {
+ msg->message = WM_NULL;
}
break;
case WM_MOUSEMOVE:
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1] Wed Jul 9
00:42:05 2014
@@ -63,7 +63,7 @@
return OnPagerCalcSize(reinterpret_cast<LPNMPGCALCSIZE>(hdr));
case TBN_DROPDOWN:
- return OnCommand(reinterpret_cast<LPNMTOOLBAR>(hdr)->iItem, 0,
theResult);
+ return ProcessClick(reinterpret_cast<LPNMTOOLBAR>(hdr)->iItem);
case TBN_HOTITEMCHANGE:
//return OnHotItemChange(reinterpret_cast<LPNMTBHOTITEM>(hdr),
theResult);
@@ -798,11 +798,10 @@
return m_menuBand->_TrackContextMenu(contextMenu, pt.x, pt.y);
}
-HRESULT CMenuToolbarBase::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult)
+HRESULT CMenuToolbarBase::ProcessClick(INT iItem)
{
if (m_disableMouseTrack)
{
- *theResult = 1;
TRACE("Item click prevented by DisableMouseTrack\n");
return S_OK;
}
@@ -814,10 +813,6 @@
return S_FALSE;
}
- *theResult = 0;
-
- INT iItem = (INT)wParam;
-
if (PopupItem(iItem, FALSE) == S_OK)
{
TRACE("PopupItem returned S_OK\n");
@@ -829,28 +824,26 @@
return m_menuBand->_MenuItemHotTrack(MPOS_EXECUTE);
}
-HRESULT CMenuToolbarBase::MenuBarMouseDown(INT item)
-{
- LRESULT theResult;
+HRESULT CMenuToolbarBase::MenuBarMouseDown(INT iIndex)
+{
TBBUTTON btn;
if (m_initFlags & SMINIT_VERTICAL)
return S_OK;
- SendMessage(m_hwndToolbar, TB_GETBUTTON, item,
reinterpret_cast<LPARAM>(&btn));
- return OnCommand(btn.idCommand, 0, &theResult);
-}
-
-HRESULT CMenuToolbarBase::MenuBarMouseUp(INT item)
-{
- LRESULT theResult;
+ ::SendMessageW(m_hwndToolbar, TB_GETBUTTON, iIndex,
reinterpret_cast<LPARAM>(&btn));
+ return ProcessClick(btn.idCommand);
+}
+
+HRESULT CMenuToolbarBase::MenuBarMouseUp(INT iIndex)
+{
TBBUTTON btn;
if (!(m_initFlags & SMINIT_VERTICAL))
return S_OK;
- SendMessage(m_hwndToolbar, TB_GETBUTTON, item,
reinterpret_cast<LPARAM>(&btn));
- return OnCommand(btn.idCommand, 0, &theResult);
+ ::SendMessageW(m_hwndToolbar, TB_GETBUTTON, iIndex,
reinterpret_cast<LPARAM>(&btn));
+ return ProcessClick(btn.idCommand);
}
HRESULT CMenuToolbarBase::ExecuteItem(INT iItem)
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuToolbars.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.h [iso-8859-1] Wed Jul 9
00:42:05 2014
@@ -97,8 +97,9 @@
HRESULT KillPopupTimer();
- HRESULT MenuBarMouseDown(INT item);
- HRESULT MenuBarMouseUp(INT item);
+ HRESULT MenuBarMouseDown(INT iIndex);
+ HRESULT MenuBarMouseUp(INT iIndex);
+ HRESULT ProcessClick(INT iItem);
protected:
virtual HRESULT OnDeletingButton(const NMTOOLBAR * tb) = 0;
@@ -119,7 +120,6 @@
private:
HRESULT UpdateImageLists();
- HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult);
HRESULT OnPagerCalcSize(LPNMPGCALCSIZE csize);
HRESULT OnPopupTimer(DWORD timerId);
HRESULT OnContextMenu(NMMOUSE * rclick);
Modified: branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp [iso-8859-1] Wed Jul 9
00:42:05 2014
@@ -394,7 +394,7 @@
SHCONTF grfFlags,
IEnumIDList **ppenumIDList)
{
- DbgPrint("EnumObjects\n");
+ TRACE("EnumObjects\n");
HRESULT hr = m_EnumSource->QueryInterface(IID_PPV_ARG(IEnumIDList,
ppenumIDList));
if (FAILED_UNEXPECTEDLY(hr))
return hr;
@@ -410,7 +410,7 @@
LocalPidlInfo info;
HRESULT hr;
- DbgPrint("BindToObject\n");
+ TRACE("BindToObject\n");
hr = m_EnumSource->FindPidlInList(pidl, &info);
if (FAILED_UNEXPECTEDLY(hr))
@@ -451,7 +451,7 @@
LPCITEMIDLIST pidl1,
LPCITEMIDLIST pidl2)
{
- DbgPrint("CompareIDs\n");
+ TRACE("CompareIDs\n");
return m_UserLocal->CompareIDs(lParam, pidl1, pidl2);
}
@@ -472,7 +472,7 @@
LocalPidlInfo info;
HRESULT hr;
- DbgPrint("GetAttributesOf\n");
+ TRACE("GetAttributesOf\n");
for (int i = 0; i < (int)cidl; i++)
{
@@ -506,7 +506,7 @@
LocalPidlInfo info;
HRESULT hr;
- DbgPrint("GetUIObjectOf\n");
+ TRACE("GetUIObjectOf\n");
for (int i = 0; i < (int)cidl; i++)
{
@@ -542,7 +542,7 @@
LocalPidlInfo info;
HRESULT hr;
- DbgPrint("GetDisplayNameOf\n");
+ TRACE("GetDisplayNameOf\n");
hr = m_EnumSource->FindPidlInList(pidl, &info);
if (FAILED_UNEXPECTEDLY(hr))
@@ -625,8 +625,24 @@
const SHCOLUMNID *pscid,
VARIANT *pv)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ LocalPidlInfo info;
+ HRESULT hr;
+
+ TRACE("GetDetailsEx\n");
+
+ hr = m_EnumSource->FindPidlInList(pidl, &info);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ CComPtr<IShellFolder2> parent2;
+ hr = info.parent->QueryInterface(IID_PPV_ARG(IShellFolder2, &parent2));
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ hr = parent2->GetDetailsEx(info.pidl, pscid, pv);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+ return S_OK;
}
HRESULT STDMETHODCALLTYPE CMergedFolder::GetDetailsOf(
@@ -634,8 +650,25 @@
UINT iColumn,
SHELLDETAILS *psd)
{
- UNIMPLEMENTED;
- return E_NOTIMPL;
+ LocalPidlInfo info;
+ HRESULT hr;
+
+ TRACE("GetDetailsOf\n");
+
+ hr = m_EnumSource->FindPidlInList(pidl, &info);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ CComPtr<IShellFolder2> parent2;
+ hr = info.parent->QueryInterface(IID_PPV_ARG(IShellFolder2, &parent2));
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ hr = parent2->GetDetailsOf(info.pidl, iColumn, psd);
+
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+ return S_OK;
}
HRESULT STDMETHODCALLTYPE CMergedFolder::MapColumnToSCID(
Modified: branches/shell-experiments/base/shell/rshell/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] Wed Jul 9
00:42:05 2014
@@ -26,7 +26,7 @@
#define WRAP_MENUBAND 0
#define WRAP_TRAYPRIV 0
-#define MERGE_FOLDERS 0
+#define MERGE_FOLDERS 1
#include <stdio.h>
#include <tchar.h>
Modified: branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Wed Jul 9
00:42:05 2014
@@ -3425,8 +3425,14 @@
{
HRESULT hr;
IEThreadParamBlock * parameters = (IEThreadParamBlock *) lpThreadParameter;
+ INITCOMMONCONTROLSEX iccex =
+ {
+ sizeof(iccex),
+ 0xFFFF /* everything! */
+ };
OleInitialize(NULL);
+ InitCommonControlsEx(&iccex);
ATLTRY(hr = ExplorerMessageLoop(parameters));
Modified: branches/shell-experiments/dll/win32/shell32/defcontextmenu.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/defcontextmenu.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/defcontextmenu.cpp [iso-8859-1] Wed Jul
9 00:42:05 2014
@@ -1672,13 +1672,21 @@
const HKEY *ahkeyClsKeys,
IContextMenu **ppcm)
{
+ // FIXME: This needs to be freed somewhere (like in the destructor of the context
menu)
+ LPCITEMIDLIST *apidl2 = (LPCITEMIDLIST *) SHAlloc(sizeof(LPCITEMIDLIST) * cidl);
+
+ for (int i = 0; i < cidl; i++)
+ {
+ apidl2[i] = apidl[i];
+ }
+
DEFCONTEXTMENU pdcm;
pdcm.hwnd = hwnd;
pdcm.pcmcb = NULL;
pdcm.pidlFolder = pidlFolder;
pdcm.psf = psf;
pdcm.cidl = cidl;
- pdcm.apidl = apidl;
+ pdcm.apidl = apidl2;
pdcm.punkAssociationInfo = NULL;
pdcm.cKeys = nKeys;
pdcm.aKeys = ahkeyClsKeys;
Modified: branches/shell-experiments/dll/win32/shell32/shlmenu.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/shlmenu.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/shlmenu.cpp [iso-8859-1] Wed Jul 9
00:42:05 2014
@@ -19,6 +19,8 @@
*/
#include "precomp.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(shellmenu);
#ifdef FM_SEPARATOR
#undef FM_SEPARATOR
@@ -55,8 +57,6 @@
static BOOL bAbortInit;
#define CCH_MAXITEMTEXT 256
-
-WINE_DEFAULT_DEBUG_CHANNEL(shell);
static LPFMINFO FM_GetMenuInfo(HMENU hmenu)
{
@@ -857,6 +857,8 @@
return uIDMax;
nItem = GetMenuItemCount(hmDst);
+ if (nItem == -1)
+ return uIDMax;
if (uInsert >= (UINT)nItem) /* insert position inside menu? */
{
@@ -900,16 +902,18 @@
/* This is a separator; don't put two of them in a row */
if (bAlreadySeparated)
continue;
+
bAlreadySeparated = TRUE;
}
else if (miiSrc.hSubMenu)
{
- if ((uFlags & MM_SUBMENUSHAVEIDS) != 0 && miiSrc.wID !=
(UINT)miiSrc.hSubMenu)
+ if (uFlags & MM_SUBMENUSHAVEIDS)
{
miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
- if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax
*/
+ if (miiSrc.wID > uIDAdjustMax) /* skip IDs higher than uIDAdjustMax
*/
continue;
+
if (uIDMax <= miiSrc.wID) /* remember the highest ID */
uIDMax = miiSrc.wID + 1;
}
@@ -934,9 +938,9 @@
{
miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
- if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax
*/{
+ if (miiSrc.wID > uIDAdjustMax) /* skip IDs higher than uIDAdjustMax */
continue;
- }
+
if (uIDMax <= miiSrc.wID) /* remember the highest ID */
uIDMax = miiSrc.wID + 1;