Author: dquintana
Date: Mon Mar 17 12:33:03 2014
New Revision: 62520
URL:
http://svn.reactos.org/svn/reactos?rev=62520&view=rev
Log:
[RSHELL]
* Begin work in improving the behaviour of the horizontal mode menuband. There's still
a lot of work to do, and some things are temporarily worse than before, but in other
places it has improved already.
CORE-7586
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h
branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
branches/shell-experiments/base/shell/rshell/CMenuFocusManager.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] Mon Mar 17
12:33:03 2014
@@ -680,6 +680,7 @@
UINT flags = TPM_VERPOSANIMATION | TPM_VERTICAL | TPM_LEFTALIGN;
m_trackingPopup = TRUE;
+ m_focusManager->PushTrackedPopup(this, popup);
if (m_menuOwner)
{
::TrackPopupMenuEx(popup, flags, x, y, m_menuOwner, ¶ms);
@@ -689,6 +690,7 @@
::TrackPopupMenuEx(popup, flags, x, y, m_topLevelWindow, ¶ms);
}
m_trackingPopup = FALSE;
+ m_focusManager->PopTrackedPopup(this, popup);
return S_OK;
}
@@ -716,7 +718,52 @@
{
HRESULT hr;
- if (changeType == VK_DOWN)
+ if (!(m_dwFlags & SMINIT_VERTICAL))
+ {
+ if (changeType == MPOS_SELECTRIGHT)
+ {
+ SendMessageW(m_menuOwner, WM_CANCELMODE, 0, 0);
+ if (m_SFToolbar && (m_hotBar == m_SFToolbar || m_hotBar == NULL))
+ {
+ DbgPrint("SF Toolbars in Horizontal menus is not
implemented.\n");
+ return S_FALSE;
+ }
+ else if (m_staticToolbar && m_hotBar == m_staticToolbar)
+ {
+ hr = m_staticToolbar->ChangeHotItem(VK_DOWN);
+ if (hr == S_FALSE)
+ {
+ if (m_SFToolbar)
+ return m_SFToolbar->ChangeHotItem(VK_HOME);
+ else
+ return m_staticToolbar->ChangeHotItem(VK_HOME);
+ }
+ return hr;
+ }
+ }
+ else if (changeType == MPOS_SELECTLEFT)
+ {
+ SendMessageW(m_menuOwner, WM_CANCELMODE, 0, 0);
+ if (m_staticToolbar && (m_hotBar == m_staticToolbar || m_hotBar ==
NULL))
+ {
+ hr = m_staticToolbar->ChangeHotItem(VK_UP);
+ if (hr == S_FALSE)
+ {
+ if (m_SFToolbar)
+ return m_SFToolbar->ChangeHotItem(VK_END);
+ else
+ return m_staticToolbar->ChangeHotItem(VK_END);
+ }
+ return hr;
+ }
+ else if (m_SFToolbar && m_hotBar == m_SFToolbar)
+ {
+ DbgPrint("SF Toolbars in Horizontal menus is not
implemented.\n");
+ return S_FALSE;
+ }
+ }
+ }
+ else if (changeType == VK_DOWN)
{
if (m_SFToolbar && (m_hotBar == m_SFToolbar || m_hotBar == NULL))
{
Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] Mon Mar 17
12:33:03 2014
@@ -345,7 +345,7 @@
y = rcWorkArea.bottom - cy;
}
- this->SetWindowPos(HWND_TOPMOST, x, y, cx, cy, SWP_SHOWWINDOW);
+ this->SetWindowPos(HWND_TOPMOST, x, y, cx, cy, SWP_SHOWWINDOW | SWP_NOACTIVATE);
m_ShowFlags = dwFlags;
m_Shown = true;
@@ -636,6 +636,11 @@
return 0;
}
+LRESULT CMenuDeskBar::_OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
&bHandled)
+{
+ return MA_NOACTIVATE;
+}
+
LRESULT CMenuDeskBar::_OnAppActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
&bHandled)
{
if (wParam == 0)
Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h [iso-8859-1] Mon Mar 17
12:33:03 2014
@@ -65,6 +65,7 @@
MESSAGE_HANDLER(WM_PAINT, _OnPaint)
MESSAGE_HANDLER(WM_ACTIVATE, _OnActivate)
MESSAGE_HANDLER(WM_ACTIVATEAPP, _OnAppActivate)
+ MESSAGE_HANDLER(WM_MOUSEACTIVATE, _OnMouseActivate)
END_MSG_MAP()
BEGIN_COM_MAP(CMenuDeskBar)
@@ -128,6 +129,7 @@
LRESULT _OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
LRESULT _OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
LRESULT _OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT _OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
&bHandled);
LRESULT _OnAppActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
BOOL _IsSubMenuParent(HWND hwnd);
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] Mon
Mar 17 12:33:03 2014
@@ -207,6 +207,20 @@
ActivationChange(msg->hwnd);
case WM_CLOSE:
break;
+ case WM_LBUTTONDOWN:
+ {
+ POINT pt = { GET_X_LPARAM(pos), GET_Y_LPARAM(pos) };
+
+ HWND window = WindowFromPoint(pt);
+
+ if (IsTrackedWindow(window) != S_OK)
+ {
+ DisableMouseTrack(NULL, FALSE);
+ m_currentBand->_MenuItemHotTrack(MPOS_FULLCANCEL);
+ }
+
+ break;
+ }
case WM_MOUSEMOVE:
if (m_lastMoveFlags != wParam || m_lastMovePos != pos)
{
@@ -229,34 +243,30 @@
break;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
- DisableMouseTrack(m_currentFocus, TRUE);
- switch (msg->wParam)
+ //if (!m_currentMenu)
{
- case VK_MENU:
- case VK_LMENU:
- case VK_RMENU:
- m_currentBand->_MenuItemHotTrack(MPOS_FULLCANCEL);
- break;
- case VK_LEFT:
- m_currentBand->_MenuItemHotTrack(MPOS_SELECTLEFT);
- break;
- case VK_RIGHT:
- m_currentBand->_MenuItemHotTrack(MPOS_SELECTRIGHT);
- break;
- case VK_UP:
- m_currentBand->_MenuItemHotTrack(VK_UP);
- break;
- case VK_DOWN:
- m_currentBand->_MenuItemHotTrack(VK_DOWN);
- break;
+ DisableMouseTrack(m_currentFocus, TRUE);
+ switch (msg->wParam)
+ {
+ case VK_MENU:
+ case VK_LMENU:
+ case VK_RMENU:
+ m_currentBand->_MenuItemHotTrack(MPOS_FULLCANCEL);
+ break;
+ case VK_LEFT:
+ m_currentBand->_MenuItemHotTrack(MPOS_SELECTLEFT);
+ break;
+ case VK_RIGHT:
+ m_currentBand->_MenuItemHotTrack(MPOS_SELECTRIGHT);
+ break;
+ case VK_UP:
+ m_currentBand->_MenuItemHotTrack(VK_UP);
+ break;
+ case VK_DOWN:
+ m_currentBand->_MenuItemHotTrack(VK_DOWN);
+ break;
+ }
}
- break;
- case WM_CHAR:
- //if (msg->wParam >= 'a' && msg->wParam <=
'z')
- //{
- // callNext = FALSE;
- // PostMessage(m_currentFocus, WM_SYSCHAR, wParam, lParam);
- //}
break;
}
@@ -311,7 +321,7 @@
return UpdateFocus(newBand);
}
-HRESULT CMenuFocusManager::UpdateFocus(CMenuBand * newBand)
+HRESULT CMenuFocusManager::UpdateFocus(CMenuBand * newBand, HMENU popupToTrack)
{
HRESULT hr;
HWND newFocus;
@@ -323,6 +333,7 @@
hr = RemoveHooks(m_currentFocus);
m_currentFocus = NULL;
m_currentBand = NULL;
+ m_currentMenu = NULL;
return S_OK;
}
@@ -344,6 +355,7 @@
m_currentFocus = newFocus;
m_currentBand = newBand;
+ m_currentMenu = popupToTrack;
return S_OK;
}
@@ -394,3 +406,19 @@
return S_OK;
}
+
+HRESULT CMenuFocusManager::PushTrackedPopup(CMenuBand * mb, HMENU popup)
+{
+ HRESULT hr;
+
+ hr = PushToArray(mb);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ return UpdateFocus(mb, popup);
+}
+
+HRESULT CMenuFocusManager::PopTrackedPopup(CMenuBand * mb, HMENU popup)
+{
+ return PopMenu(mb);
+}
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] Mon Mar
17 12:33:03 2014
@@ -41,6 +41,7 @@
private:
CMenuBand * m_currentBand;
HWND m_currentFocus;
+ HMENU m_currentMenu;
HHOOK m_hHook;
DWORD m_threadId;
BOOL m_mouseTrackDisabled;
@@ -71,7 +72,7 @@
LRESULT GetMsgHook(INT nCode, WPARAM wParam, LPARAM lParam);
HRESULT PlaceHooks(HWND window);
HRESULT RemoveHooks(HWND window);
- HRESULT UpdateFocus(CMenuBand * newBand);
+ HRESULT UpdateFocus(CMenuBand * newBand, HMENU popupToTrack = NULL);
HRESULT ActivationChange(HWND newHwnd);
void DisableMouseTrack(HWND enableTo, BOOL disableThis);
HRESULT IsTrackedWindow(HWND hWnd);
@@ -79,4 +80,6 @@
public:
HRESULT PushMenu(CMenuBand * mb);
HRESULT PopMenu(CMenuBand * mb);
+ HRESULT PushTrackedPopup(CMenuBand * mb, HMENU popup);
+ HRESULT PopTrackedPopup(CMenuBand * mb, HMENU popup);
};