Author: gadamopoulos
Date: Sat Aug 20 22:05:12 2016
New Revision: 72401
URL:
http://svn.reactos.org/svn/reactos?rev=72401&view=rev
Log:
[SHELL32]
- CMenuBand: Do not open the context menu on mouse down but on mouse up.
- Patch by Joachim Henze (reactosfanboy)
CORE-10830
Modified:
trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp
trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.h
trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp
trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.h
trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.cpp
trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.h
Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp [iso-8859-1] Sat Aug 20
22:05:12 2016
@@ -1132,12 +1132,12 @@
return S_OK;
}
-HRESULT CMenuBand::_MenuBarMouseUp(HWND hwnd, INT item)
+HRESULT CMenuBand::_MenuBarMouseUp(HWND hwnd, INT item, BOOL isLButton)
{
if (m_staticToolbar && m_staticToolbar->IsWindowOwner(hwnd) == S_OK)
- m_staticToolbar->MenuBarMouseUp(item);
+ m_staticToolbar->MenuBarMouseUp(item, isLButton);
if (m_SFToolbar && m_SFToolbar->IsWindowOwner(hwnd) == S_OK)
- m_SFToolbar->MenuBarMouseUp(item);
+ m_SFToolbar->MenuBarMouseUp(item, isLButton);
return S_OK;
}
Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.h [iso-8859-1] Sat Aug 20 22:05:12
2016
@@ -199,7 +199,7 @@
HRESULT _IsTracking();
HRESULT _KillPopupTimers();
HRESULT _MenuBarMouseDown(HWND hwnd, INT item, BOOL isLButton);
- HRESULT _MenuBarMouseUp(HWND hwnd, INT item);
+ HRESULT _MenuBarMouseUp(HWND hwnd, INT item, BOOL isLButton);
HRESULT _HasSubMenu();
HRESULT AdjustForTheme(BOOL bFlatStyle);
Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp [iso-8859-1]
(original)
+++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp [iso-8859-1] Sat Aug
20 22:05:12 2016
@@ -185,7 +185,6 @@
m_selectedMenu(NULL),
m_selectedItem(0),
m_selectedItemFlags(0),
- m_isLButtonDown(FALSE),
m_movedSinceDown(FALSE),
m_windowAtDown(NULL),
m_PreviousForeground(NULL),
@@ -323,10 +322,7 @@
POINT pt2 = { GET_X_LPARAM(msg->lParam), GET_Y_LPARAM(msg->lParam) };
ClientToScreen(msg->hwnd, &pt2);
- // Don't do anything if the mouse has not been moved
POINT pt = msg->pt;
- if (pt.x == m_ptPrev.x && pt.y == m_ptPrev.y)
- return TRUE;
// Don't do anything if another window is capturing the mouse.
HWND cCapture = ::GetCapture();
@@ -342,7 +338,7 @@
StackEntry * entry = NULL;
if (IsTrackedWindow(child, &entry) == S_OK)
{
- TRACE("MouseMove %d\n", m_isLButtonDown);
+ TRACE("MouseMove");
}
BOOL isTracking = FALSE;
@@ -426,8 +422,6 @@
return TRUE;
}
- TRACE("MouseDown %d\n", m_isLButtonDown);
-
if (entry->type == MenuBarEntry)
{
if (entry != m_current)
@@ -451,16 +445,15 @@
msg->message = WM_NULL;
- m_isLButtonDown = TRUE;
m_movedSinceDown = FALSE;
m_windowAtDown = child;
- TRACE("MouseDown end %d\n", m_isLButtonDown);
+ TRACE("MouseDown end\n");
return TRUE;
}
-LRESULT CMenuFocusManager::ProcessMouseUp(MSG* msg)
+LRESULT CMenuFocusManager::ProcessMouseUp(MSG* msg, BOOL isLButton)
{
HWND child;
int iHitTestResult = -1;
@@ -472,11 +465,6 @@
if (cCapture && cCapture != m_captureHwnd && m_current->type !=
TrackedMenuEntry)
return TRUE;
- if (!m_isLButtonDown)
- return TRUE;
-
- m_isLButtonDown = FALSE;
-
POINT pt = msg->pt;
child = WindowFromPoint(pt);
@@ -485,8 +473,6 @@
if (IsTrackedWindow(child, &entry) != S_OK)
return TRUE;
- TRACE("MouseUp %d\n", m_isLButtonDown);
-
if (entry)
{
ScreenToClient(child, &pt);
@@ -495,7 +481,7 @@
if (iHitTestResult >= 0)
{
TRACE("MouseUp send %d\n", iHitTestResult);
- entry->mb->_MenuBarMouseUp(child, iHitTestResult);
+ entry->mb->_MenuBarMouseUp(child, iHitTestResult, isLButton);
}
}
@@ -595,9 +581,6 @@
isLButton = TRUE;
TRACE("LB\n");
- // fallthrough;
- case WM_NCRBUTTONDOWN:
- case WM_RBUTTONDOWN:
if (m_menuBar && m_current->type == MenuPopupEntry)
{
POINT pt = msg->pt;
@@ -624,9 +607,14 @@
ProcessMouseDown(msg, isLButton);
break;
+ case WM_NCRBUTTONUP:
+ case WM_RBUTTONUP:
+ ProcessMouseUp(msg, isLButton);
+ break;
case WM_NCLBUTTONUP:
case WM_LBUTTONUP:
- ProcessMouseUp(msg);
+ isLButton = TRUE;
+ ProcessMouseUp(msg, isLButton);
break;
case WM_MOUSEMOVE:
callNext = ProcessMouseMove(msg);
Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.h [iso-8859-1] Sat Aug 20
22:05:12 2016
@@ -117,7 +117,7 @@
LRESULT ProcessMouseMove(MSG* msg);
LRESULT ProcessMouseDown(MSG* msg, BOOL isLButton);
- LRESULT ProcessMouseUp(MSG* msg);
+ LRESULT ProcessMouseUp(MSG* msg, BOOL isLButton);
public:
HRESULT PushMenuBar(CMenuBand * mb);
HRESULT PushMenuPopup(CMenuBand * mb);
Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.cpp [iso-8859-1] Sat Aug 20
22:05:12 2016
@@ -827,8 +827,6 @@
TBBUTTON btn;
GetButton(iIndex, &btn);
- if (!isLButton)
- return ProcessContextMenu(btn.idCommand);
if ((m_initFlags & SMINIT_VERTICAL)
|| m_popupBar
@@ -841,7 +839,7 @@
return ProcessClick(btn.idCommand);
}
-HRESULT CMenuToolbarBase::MenuBarMouseUp(INT iIndex)
+HRESULT CMenuToolbarBase::MenuBarMouseUp(INT iIndex, BOOL isLButton)
{
TBBUTTON btn;
@@ -851,7 +849,11 @@
return S_OK;
GetButton(iIndex, &btn);
- return ProcessClick(btn.idCommand);
+
+ if (isLButton)
+ return ProcessClick(btn.idCommand);
+ else
+ return ProcessContextMenu(btn.idCommand);
}
HRESULT CMenuToolbarBase::PrepareExecuteItem(INT iItem)
Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.h [iso-8859-1] Sat Aug 20
22:05:12 2016
@@ -97,7 +97,7 @@
HRESULT KillPopupTimer();
HRESULT MenuBarMouseDown(INT iIndex, BOOL isLButton);
- HRESULT MenuBarMouseUp(INT iIndex);
+ HRESULT MenuBarMouseUp(INT iIndex, BOOL isLButton);
HRESULT ProcessClick(INT iItem);
HRESULT ProcessContextMenu(INT iItem);
HRESULT BeforeCancelPopup();