mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[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. svn path=/branches/shell-experiments/; revision=63702
This commit is contained in:
parent
2ac4637056
commit
0ffe346179
8 changed files with 95 additions and 37 deletions
|
@ -319,7 +319,7 @@ LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
|
|||
}
|
||||
|
||||
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,9 +485,23 @@ LRESULT CMenuFocusManager::MsgFilterHook(INT nCode, WPARAM hookWParam, LPARAM ho
|
|||
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:
|
||||
callNext = ProcessMouseMove(msg);
|
||||
break;
|
||||
|
|
|
@ -63,7 +63,7 @@ HRESULT CMenuToolbarBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
|
|||
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 @@ HRESULT CMenuToolbarBase::TrackContextMenu(IContextMenu* contextMenu, POINT pt)
|
|||
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 @@ HRESULT CMenuToolbarBase::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theRe
|
|||
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 @@ HRESULT CMenuToolbarBase::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theRe
|
|||
return m_menuBand->_MenuItemHotTrack(MPOS_EXECUTE);
|
||||
}
|
||||
|
||||
HRESULT CMenuToolbarBase::MenuBarMouseDown(INT item)
|
||||
HRESULT CMenuToolbarBase::MenuBarMouseDown(INT iIndex)
|
||||
{
|
||||
LRESULT theResult;
|
||||
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::MenuBarMouseUp(INT item)
|
||||
HRESULT CMenuToolbarBase::MenuBarMouseUp(INT iIndex)
|
||||
{
|
||||
LRESULT theResult;
|
||||
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)
|
||||
|
|
|
@ -97,8 +97,9 @@ public:
|
|||
|
||||
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 @@ protected:
|
|||
private:
|
||||
HRESULT UpdateImageLists();
|
||||
|
||||
HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
||||
HRESULT OnPagerCalcSize(LPNMPGCALCSIZE csize);
|
||||
HRESULT OnPopupTimer(DWORD timerId);
|
||||
HRESULT OnContextMenu(NMMOUSE * rclick);
|
||||
|
|
|
@ -394,7 +394,7 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::EnumObjects(
|
|||
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 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::BindToObject(
|
|||
LocalPidlInfo info;
|
||||
HRESULT hr;
|
||||
|
||||
DbgPrint("BindToObject\n");
|
||||
TRACE("BindToObject\n");
|
||||
|
||||
hr = m_EnumSource->FindPidlInList(pidl, &info);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
|
@ -451,7 +451,7 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::CompareIDs(
|
|||
LPCITEMIDLIST pidl1,
|
||||
LPCITEMIDLIST pidl2)
|
||||
{
|
||||
DbgPrint("CompareIDs\n");
|
||||
TRACE("CompareIDs\n");
|
||||
return m_UserLocal->CompareIDs(lParam, pidl1, pidl2);
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::GetAttributesOf(
|
|||
LocalPidlInfo info;
|
||||
HRESULT hr;
|
||||
|
||||
DbgPrint("GetAttributesOf\n");
|
||||
TRACE("GetAttributesOf\n");
|
||||
|
||||
for (int i = 0; i < (int)cidl; i++)
|
||||
{
|
||||
|
@ -506,7 +506,7 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::GetUIObjectOf(
|
|||
LocalPidlInfo info;
|
||||
HRESULT hr;
|
||||
|
||||
DbgPrint("GetUIObjectOf\n");
|
||||
TRACE("GetUIObjectOf\n");
|
||||
|
||||
for (int i = 0; i < (int)cidl; i++)
|
||||
{
|
||||
|
@ -542,7 +542,7 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::GetDisplayNameOf(
|
|||
LocalPidlInfo info;
|
||||
HRESULT hr;
|
||||
|
||||
DbgPrint("GetDisplayNameOf\n");
|
||||
TRACE("GetDisplayNameOf\n");
|
||||
|
||||
hr = m_EnumSource->FindPidlInList(pidl, &info);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
|
@ -625,8 +625,24 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::GetDetailsEx(
|
|||
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 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::GetDetailsOf(
|
|||
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(
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -3425,8 +3425,14 @@ DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter)
|
|||
{
|
||||
HRESULT hr;
|
||||
IEThreadParamBlock * parameters = (IEThreadParamBlock *) lpThreadParameter;
|
||||
INITCOMMONCONTROLSEX iccex =
|
||||
{
|
||||
sizeof(iccex),
|
||||
0xFFFF /* everything! */
|
||||
};
|
||||
|
||||
OleInitialize(NULL);
|
||||
InitCommonControlsEx(&iccex);
|
||||
|
||||
ATLTRY(hr = ExplorerMessageLoop(parameters));
|
||||
|
||||
|
|
|
@ -1672,13 +1672,21 @@ CDefFolderMenu_Create2(
|
|||
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;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(shellmenu);
|
||||
|
||||
#ifdef FM_SEPARATOR
|
||||
#undef FM_SEPARATOR
|
||||
#endif
|
||||
|
@ -56,8 +58,6 @@ static BOOL bAbortInit;
|
|||
|
||||
#define CCH_MAXITEMTEXT 256
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
||||
|
||||
static LPFMINFO FM_GetMenuInfo(HMENU hmenu)
|
||||
{
|
||||
MENUINFO MenuInfo;
|
||||
|
@ -857,6 +857,8 @@ UINT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAd
|
|||
return uIDMax;
|
||||
|
||||
nItem = GetMenuItemCount(hmDst);
|
||||
if (nItem == -1)
|
||||
return uIDMax;
|
||||
|
||||
if (uInsert >= (UINT)nItem) /* insert position inside menu? */
|
||||
{
|
||||
|
@ -900,16 +902,18 @@ UINT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAd
|
|||
/* 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 @@ UINT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAd
|
|||
{
|
||||
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue