Author: dquintana
Date: Thu Apr 3 18:30:25 2014
New Revision: 62603
URL:
http://svn.reactos.org/svn/reactos?rev=62603&view=rev
Log:
[RSHELL]
* Further improvements. Not working yet. Commiting as backup/history.
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuBand.h
branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
branches/shell-experiments/base/shell/rshell/CMenuFocusManager.h
branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
branches/shell-experiments/base/shell/rshell/CMenuToolbars.h
branches/shell-experiments/base/shell/rshell/precomp.h
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] Thu Apr 3
18:30:25 2014
@@ -523,6 +523,11 @@
return m_subMenuParent ? S_OK : S_FALSE;
}
+HRESULT CMenuBand::_IsTracking()
+{
+ return m_popupBar != NULL;
+}
+
HRESULT STDMETHODCALLTYPE CMenuBand::SetClient(IUnknown *punkClient)
{
m_subMenuChild = NULL;
@@ -669,8 +674,6 @@
UINT flags = TPM_VERPOSANIMATION | TPM_VERTICAL | TPM_LEFTALIGN;
- //_DisableMouseTrack(TRUE);
-
m_focusManager->PushTrackedPopup(popup);
if (m_menuOwner)
{
@@ -700,8 +703,7 @@
DbgPrint("Hot item changed from %p %p, to %p %p\n", m_hotBar, m_hotItem,
tb, id);
- if (m_hotBar != tb)
- _KillPopupTimers();
+ _KillPopupTimers();
m_hotBar = tb;
m_hotItem = id;
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuBand.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuBand.h [iso-8859-1] Thu Apr 3
18:30:25 2014
@@ -186,6 +186,7 @@
HRESULT _SetChildBand(CMenuBand * child);
HRESULT _SetParentBand(CMenuBand * parent);
HRESULT _IsPopup();
+ HRESULT _IsTracking();
HRESULT _KillPopupTimers();
BOOL UseBigIcons()
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] Thu
Apr 3 18:30:25 2014
@@ -150,6 +150,8 @@
m_hGetMsgHook(NULL),
m_mouseTrackDisabled(FALSE),
m_captureHwnd(0),
+ m_hwndUnderMouse(NULL),
+ m_entryUnderMouse(NULL),
m_bandCount(0)
{
m_ptPrev.x = 0;
@@ -261,20 +263,32 @@
child = WindowFromPoint(pt);
+ StackEntry * entry = NULL;
+ IsTrackedWindow(child, &entry);
+
if (m_hwndUnderMouse != child)
{
WCHAR cn[1024];
GetClassName(child, cn, 1023);
DbgPrint("Mouse moved to %p (%S)\n", child, cn);
- m_hwndUnderMouse = child;
- }
-
- StackEntry * entry = NULL;
-
- if (IsTrackedWindow(child, &entry) == S_OK)
+
+ if (!entry)
+ {
+ if (m_entryUnderMouse)
+ {
+ m_entryUnderMouse->mb->_ChangeHotItem(NULL, -1, HICF_MOUSE);
+ }
+ SetCapture(NULL);
+ }
+
+ }
+
+ if (entry)
{
ScreenToClient(child, &pt);
iHitTestResult = SendMessageW(child, TB_HITTEST, 0, (LPARAM) &pt);
+
+ BOOL isTracking = entry->mb->_IsTracking();
if (iHitTestResult >= 0 &&
SendMessage(child, WM_USER_ISTRACKEDITEM, iHitTestResult, 0) == S_FALSE)
@@ -283,16 +297,26 @@
DisableMouseTrack(NULL, FALSE);
if (m_current->type == TrackedMenuEntry)
SendMessage(entry->hwnd, WM_CANCELMODE, 0, 0);
- PostMessage(child, WM_USER_CHANGETRACKEDITEM, iHitTestResult,
iHitTestResult);
+ PostMessage(child, WM_USER_CHANGETRACKEDITEM, iHitTestResult, isTracking);
return FALSE;
}
-
- if (m_current->type == MenuPopupEntry)
+ }
+
+ if (m_hwndUnderMouse != child)
+ {
+ if (entry)
{
SetCapture(child);
- ScreenToClient(child, &pt2);
- SendMessage(child, WM_MOUSEMOVE, msg->wParam, MAKELPARAM(pt2.x, pt2.y));
- }
+
+ if (m_current->type == MenuPopupEntry)
+ {
+ ScreenToClient(child, &pt2);
+ SendMessage(child, WM_MOUSEMOVE, msg->wParam, MAKELPARAM(pt2.x,
pt2.y));
+ }
+ }
+
+ m_hwndUnderMouse = child;
+ m_entryUnderMouse = entry;
}
if (m_current->type == MenuPopupEntry)
@@ -325,7 +349,6 @@
BOOL hoveringMenuBar = m_menuBar->mb->IsWindowOwner(child) ==
S_OK;
if (hoveringMenuBar)
{
- HWND parent = GetAncestor(child, GA_ROOT);
m_menuBar->mb->_DisableMouseTrack(TRUE);
}
}
@@ -352,18 +375,15 @@
BOOL callNext = TRUE;
MSG* msg = reinterpret_cast<MSG*>(lParam);
POINT pt = msg->pt;
-
+
switch (msg->message)
{
- case WM_CLOSE:
- break;
-
case WM_NCLBUTTONDOWN:
case WM_LBUTTONDOWN:
if (m_current->type == MenuPopupEntry)
{
HWND child = WindowFromPoint(pt);
-
+
if (IsTrackedWindow(child) != S_OK)
{
SetCapture(NULL);
@@ -376,26 +396,29 @@
break;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
- DisableMouseTrack(m_current->hwnd, TRUE);
- switch (msg->wParam)
- {
- case VK_MENU:
- case VK_LMENU:
- case VK_RMENU:
- m_current->mb->_MenuItemHotTrack(MPOS_FULLCANCEL);
- break;
- case VK_LEFT:
- m_current->mb->_MenuItemHotTrack(MPOS_SELECTLEFT);
- break;
- case VK_RIGHT:
- m_current->mb->_MenuItemHotTrack(MPOS_SELECTRIGHT);
- break;
- case VK_UP:
- m_current->mb->_MenuItemHotTrack(VK_UP);
- break;
- case VK_DOWN:
- m_current->mb->_MenuItemHotTrack(VK_DOWN);
- break;
+ if (m_current->type == MenuPopupEntry)
+ {
+ DisableMouseTrack(m_current->hwnd, TRUE);
+ switch (msg->wParam)
+ {
+ case VK_MENU:
+ case VK_LMENU:
+ case VK_RMENU:
+ m_current->mb->_MenuItemHotTrack(MPOS_FULLCANCEL);
+ break;
+ case VK_LEFT:
+ m_current->mb->_MenuItemHotTrack(MPOS_SELECTLEFT);
+ break;
+ case VK_RIGHT:
+ m_current->mb->_MenuItemHotTrack(MPOS_SELECTRIGHT);
+ break;
+ case VK_UP:
+ m_current->mb->_MenuItemHotTrack(VK_UP);
+ break;
+ case VK_DOWN:
+ m_current->mb->_MenuItemHotTrack(VK_DOWN);
+ break;
+ }
}
break;
}
@@ -414,7 +437,7 @@
DbgPrint("Entering MSGFILTER hook...\n");
m_hMsgFilterHook = SetWindowsHookEx(WH_MSGFILTER, s_MsgFilterHook, NULL,
m_threadId);
}
- else if (m_current->type == MenuPopupEntry)
+ else
{
DbgPrint("Entering GETMESSAGE hook...\n");
m_hGetMsgHook = SetWindowsHookEx(WH_GETMESSAGE, s_GetMsgHook, NULL, m_threadId);
@@ -475,7 +498,7 @@
if (old && (!m_current || old->type != m_current->type))
{
- if (m_current->type != TrackedMenuEntry)
+ if (m_current && m_current->type != TrackedMenuEntry)
{
DisableMouseTrack(m_current->hwnd, FALSE);
}
Modified: branches/shell-experiments/base/shell/rshell/CMenuFocusManager.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuFocusManager.h [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuFocusManager.h [iso-8859-1] Thu Apr
3 18:30:25 2014
@@ -71,6 +71,7 @@
HWND m_captureHwnd;
HWND m_hwndUnderMouse;
+ StackEntry * m_entryUnderMouse;
// TODO: make dynamic
#define MAX_RECURSE 20
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] Thu Apr 3
18:30:25 2014
@@ -64,7 +64,8 @@
return OnCommand(reinterpret_cast<LPNMTOOLBAR>(hdr)->iItem, 0,
theResult);
case TBN_HOTITEMCHANGE:
- return OnHotItemChange(reinterpret_cast<LPNMTBHOTITEM>(hdr),
theResult);
+ //return OnHotItemChange(reinterpret_cast<LPNMTBHOTITEM>(hdr),
theResult);
+ return S_OK;
case NM_RCLICK:
return OnContextMenu(reinterpret_cast<LPNMMOUSE>(hdr));
@@ -99,6 +100,9 @@
case NM_TOOLTIPSCREATED:
break;
+
+ // Unknown
+ case -714: return S_FALSE;
default:
DbgPrint("WM_NOTIFY unknown code %d, %d\n", hdr->code,
hdr->idFrom);
@@ -127,7 +131,7 @@
return IsTrackedItem(wParam);
case WM_USER_CHANGETRACKEDITEM:
m_SubclassOld(hWnd, uMsg, wParam, lParam);
- return ChangeTrackedItem(wParam);
+ return ChangeTrackedItem(wParam, lParam);
case WM_COMMAND:
OnWinEvent(hWnd, uMsg, wParam, lParam, &lr);
@@ -188,8 +192,8 @@
hdc = cdraw->nmcd.hdc;
// The item with an active submenu gets the CHECKED flag.
- isHot = m_hotBar == this && cdraw->nmcd.dwItemSpec == m_hotItem;
- isPopup = m_popupBar == this && cdraw->nmcd.dwItemSpec ==
m_popupItem;
+ isHot = m_hotBar == this && (int)cdraw->nmcd.dwItemSpec == m_hotItem;
+ isPopup = m_popupBar == this && (int)cdraw->nmcd.dwItemSpec ==
m_popupItem;
if (m_initFlags & SMINIT_VERTICAL)
{
@@ -621,8 +625,6 @@
}
else if (m_isTracking)
{
- m_menuBand->_KillPopupTimers();
-
PopupItem(m_hotItem);
}
}
@@ -684,14 +686,14 @@
return S_FALSE;
}
-HRESULT CMenuToolbarBase::ChangeTrackedItem(INT index)
+HRESULT CMenuToolbarBase::ChangeTrackedItem(INT index, BOOL wasTracking)
{
TBBUTTON btn;
if (!SendMessage(m_hwndToolbar, TB_GETBUTTON, index,
reinterpret_cast<LPARAM>(&btn)))
return E_FAIL;
DbgPrint("Changing tracked item to %d...\n", index);
- m_isTracking = TRUE;
+ m_isTracking = wasTracking;
m_menuBand->_ChangeHotItem(this, btn.idCommand, HICF_MOUSE);
return S_OK;
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] Thu Apr 3
18:30:25 2014
@@ -77,7 +77,7 @@
HRESULT OnHotItemChange(const NMTBHOTITEM * hot, LRESULT * theResult);
HRESULT IsTrackedItem(INT index);
- HRESULT ChangeTrackedItem(INT index);
+ HRESULT ChangeTrackedItem(INT index, BOOL wasTracking);
HRESULT GetIdealSize(SIZE& size);
HRESULT SetPosSize(int x, int y, int cx, int cy);
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] Thu Apr 3
18:30:25 2014
@@ -72,7 +72,7 @@
else
fname++;
- szMsgStart = szMsg + sprintf(szMsg, "[%10d] %s:%d: ", GetTickCount(),
fname, line);
+ szMsgStart = szMsg + sprintf(szMsg, "[%10lu] %s:%d: ", GetTickCount(),
fname, line);
va_start(vl, lpFormat);
uRet = (ULONG) vsprintf(szMsgStart, lpFormat, vl);