* Improve behaviour when hovering and clicking on the menubar. It's still somewhat glitchy though.
CORE-7586

svn path=/branches/shell-experiments/; revision=62539
This commit is contained in:
David Quintana 2014-03-21 10:13:18 +00:00
parent 0216102e0c
commit d2b33acd15
4 changed files with 38 additions and 4 deletions

View file

@ -56,6 +56,9 @@ CMenuBand::CMenuBand() :
m_site(NULL),
m_psmc(NULL),
m_subMenuChild(NULL),
m_subMenuParent(NULL),
m_childBand(NULL),
m_parentBand(NULL),
m_hmenu(NULL),
m_menuOwner(NULL),
m_useBigIcons(FALSE),
@ -352,6 +355,10 @@ HRESULT STDMETHODCALLTYPE CMenuBand::ShowDW(BOOL fShow)
if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
else if (m_parentBand)
{
m_parentBand->SetClient(NULL);
}
if (fShow)
hr = m_focusManager->PushMenu(this);
@ -490,6 +497,17 @@ HRESULT CMenuBand::_SetChildBand(CMenuBand * child)
return S_OK;
}
HRESULT CMenuBand::_SetParentBand(CMenuBand * parent)
{
m_parentBand = parent;
return S_OK;
}
HRESULT CMenuBand::_IsPopup()
{
return m_subMenuParent ? S_OK : S_FALSE;
}
HRESULT STDMETHODCALLTYPE CMenuBand::SetClient(IUnknown *punkClient)
{
if (m_subMenuChild)

View file

@ -48,6 +48,7 @@ private:
CComPtr<IMenuPopup> m_subMenuChild;
CComPtr<IMenuPopup> m_subMenuParent;
CComPtr<CMenuBand> m_childBand;
CComPtr<CMenuBand> m_parentBand;
UINT m_uId;
UINT m_uIdAncestor;
@ -180,6 +181,8 @@ public:
HRESULT _OnPopupSubMenu(IMenuPopup * popup, POINTL * pAt, RECTL * pExclude, CMenuToolbarBase * toolbar, INT item);
HRESULT _DisableMouseTrack(BOOL bDisable);
HRESULT _SetChildBand(CMenuBand * child);
HRESULT _SetParentBand(CMenuBand * parent);
HRESULT _IsPopup();
BOOL UseBigIcons()
{

View file

@ -188,7 +188,9 @@ HRESULT CMenuFocusManager::IsTrackedWindow(HWND hWnd)
return hr;
if (hwnd == hWnd)
return S_OK;
{
return band->_IsPopup();
}
}
return S_FALSE;
@ -232,10 +234,10 @@ LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
if (m_currentMenu)
SendMessage(m_currentFocus, WM_CANCELMODE, 0, 0);
else
m_currentBand->_MenuItemHotTrack(MPOS_SELECTLEFT);
m_currentBand->_MenuItemHotTrack(MPOS_CANCELLEVEL);
DbgPrint("Active popup cancelled, notifying of change...\n");
PostMessage(hwndToolbar, WM_USER_CHANGETRACKEDITEM, iHitTestResult, iHitTestResult);
return TRUE;
return FALSE;
}
}
@ -447,6 +449,7 @@ HRESULT CMenuFocusManager::PushMenu(CMenuBand * mb)
if (mbParent)
{
mbParent->_SetChildBand(mb);
mb->_SetParentBand(mbParent);
}
return UpdateFocus(mb);
@ -457,6 +460,11 @@ HRESULT CMenuFocusManager::PopMenu(CMenuBand * mb)
CMenuBand * mbc;
HRESULT hr;
if (m_currentBand)
{
m_currentBand->_SetParentBand(NULL);
}
HWND newFocus;
hr = mb->_GetTopLevelWindow(&newFocus);
if (FAILED_UNEXPECTEDLY(hr))

View file

@ -1050,6 +1050,12 @@ HRESULT CMenuStaticToolbar::OnContextMenu(NMMOUSE * rclick)
HRESULT CMenuStaticToolbar::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{
HRESULT hr;
if (m_isTracking)
{
return S_FALSE;
}
hr = CMenuToolbarBase::OnCommand(wParam, lParam, theResult);
if (FAILED_UNEXPECTEDLY(hr))
return hr;
@ -1057,7 +1063,6 @@ HRESULT CMenuStaticToolbar::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *the
// in case the clicked item has a submenu, we do not need to execute the item
if (hr == S_FALSE)
{
DbgPrint("CMenuToolbarBase::OnCommand told us to cancel.\n");
return hr;
}