Author: dquintana
Date: Sun Feb 23 15:02:02 2014
New Revision: 62303
URL:
http://svn.reactos.org/svn/reactos?rev=62303&view=rev
Log:
[RSHELL]
* CMenuBand: Send timer notifications for all items, so we can hide a previous submenu
when the user hovers an item without submenu.
* CMenuBand: Avoid a stack overflow in some versions of windows by relying on the stored
value instead of asking for it in the middle of a changed event.
CORE-7881
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Sun Feb 23
15:02:02 2014
@@ -676,9 +676,14 @@
case WM_TIMER:
if (wParam == TIMERID_HOTTRACK)
{
+ KillTimer(hWnd, TIMERID_HOTTRACK);
+
m_menuBand->_OnPopupSubMenu(NULL, NULL, NULL);
- PopupItem(m_hotItem);
- KillTimer(hWnd, TIMERID_HOTTRACK);
+
+ if (HasSubMenu(m_hotItem) == S_OK)
+ {
+ PopupItem(m_hotItem);
+ }
}
}
@@ -696,12 +701,9 @@
}
else if (m_hotItem != hot->idNew)
{
- if (HasSubMenu(hot->idNew) == S_OK)
- {
- DWORD elapsed = 0;
- SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &elapsed, 0);
- SetTimer(m_hwnd, TIMERID_HOTTRACK, elapsed, NULL);
- }
+ DWORD elapsed = 0;
+ SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &elapsed, 0);
+ SetTimer(m_hwnd, TIMERID_HOTTRACK, elapsed, NULL);
m_hotItem = hot->idNew;
m_menuBand->_OnHotItemChanged(this, m_hotItem);
@@ -838,7 +840,7 @@
HRESULT CMenuToolbarBase::ChangeHotItem(DWORD dwSelectType)
{
- int prev = SendMessage(m_hwnd, TB_GETHOTITEM, 0, 0);
+ int prev = m_hotItem;
int index = -1;
if (dwSelectType != 0xFFFFFFFF)
@@ -896,7 +898,7 @@
if (btn.dwData)
{
m_hotItem = btn.idCommand;
- if (prev != index)
+ if (prev != m_hotItem)
{
SendMessage(m_hwnd, TB_SETHOTITEM, index, 0);
return m_menuBand->_OnHotItemChanged(this, m_hotItem);
@@ -916,7 +918,7 @@
}
m_hotItem = -1;
- if (prev != index)
+ if (prev != m_hotItem)
{
SendMessage(m_hwnd, TB_SETHOTITEM, -1, 0);
m_menuBand->_OnHotItemChanged(NULL, -1);