mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 01:05:42 +00:00
[SHELL32]
- CMenuBand: Do not open the context menu on mouse down but on mouse up. - Patch by Joachim Henze (reactosfanboy) CORE-10830 svn path=/trunk/; revision=72401
This commit is contained in:
parent
f156a8d727
commit
56970603ce
6 changed files with 22 additions and 32 deletions
|
@ -1132,12 +1132,12 @@ HRESULT CMenuBand::_MenuBarMouseDown(HWND hwnd, INT item, BOOL isLButton)
|
||||||
return S_OK;
|
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)
|
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)
|
if (m_SFToolbar && m_SFToolbar->IsWindowOwner(hwnd) == S_OK)
|
||||||
m_SFToolbar->MenuBarMouseUp(item);
|
m_SFToolbar->MenuBarMouseUp(item, isLButton);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ public:
|
||||||
HRESULT _IsTracking();
|
HRESULT _IsTracking();
|
||||||
HRESULT _KillPopupTimers();
|
HRESULT _KillPopupTimers();
|
||||||
HRESULT _MenuBarMouseDown(HWND hwnd, INT item, BOOL isLButton);
|
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 _HasSubMenu();
|
||||||
|
|
||||||
HRESULT AdjustForTheme(BOOL bFlatStyle);
|
HRESULT AdjustForTheme(BOOL bFlatStyle);
|
||||||
|
|
|
@ -185,7 +185,6 @@ CMenuFocusManager::CMenuFocusManager() :
|
||||||
m_selectedMenu(NULL),
|
m_selectedMenu(NULL),
|
||||||
m_selectedItem(0),
|
m_selectedItem(0),
|
||||||
m_selectedItemFlags(0),
|
m_selectedItemFlags(0),
|
||||||
m_isLButtonDown(FALSE),
|
|
||||||
m_movedSinceDown(FALSE),
|
m_movedSinceDown(FALSE),
|
||||||
m_windowAtDown(NULL),
|
m_windowAtDown(NULL),
|
||||||
m_PreviousForeground(NULL),
|
m_PreviousForeground(NULL),
|
||||||
|
@ -323,10 +322,7 @@ LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
|
||||||
POINT pt2 = { GET_X_LPARAM(msg->lParam), GET_Y_LPARAM(msg->lParam) };
|
POINT pt2 = { GET_X_LPARAM(msg->lParam), GET_Y_LPARAM(msg->lParam) };
|
||||||
ClientToScreen(msg->hwnd, &pt2);
|
ClientToScreen(msg->hwnd, &pt2);
|
||||||
|
|
||||||
// Don't do anything if the mouse has not been moved
|
|
||||||
POINT pt = msg->pt;
|
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.
|
// Don't do anything if another window is capturing the mouse.
|
||||||
HWND cCapture = ::GetCapture();
|
HWND cCapture = ::GetCapture();
|
||||||
|
@ -342,7 +338,7 @@ LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
|
||||||
StackEntry * entry = NULL;
|
StackEntry * entry = NULL;
|
||||||
if (IsTrackedWindow(child, &entry) == S_OK)
|
if (IsTrackedWindow(child, &entry) == S_OK)
|
||||||
{
|
{
|
||||||
TRACE("MouseMove %d\n", m_isLButtonDown);
|
TRACE("MouseMove");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL isTracking = FALSE;
|
BOOL isTracking = FALSE;
|
||||||
|
@ -426,8 +422,6 @@ LRESULT CMenuFocusManager::ProcessMouseDown(MSG* msg, BOOL isLButton)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("MouseDown %d\n", m_isLButtonDown);
|
|
||||||
|
|
||||||
if (entry->type == MenuBarEntry)
|
if (entry->type == MenuBarEntry)
|
||||||
{
|
{
|
||||||
if (entry != m_current)
|
if (entry != m_current)
|
||||||
|
@ -451,16 +445,15 @@ LRESULT CMenuFocusManager::ProcessMouseDown(MSG* msg, BOOL isLButton)
|
||||||
|
|
||||||
msg->message = WM_NULL;
|
msg->message = WM_NULL;
|
||||||
|
|
||||||
m_isLButtonDown = TRUE;
|
|
||||||
m_movedSinceDown = FALSE;
|
m_movedSinceDown = FALSE;
|
||||||
m_windowAtDown = child;
|
m_windowAtDown = child;
|
||||||
|
|
||||||
TRACE("MouseDown end %d\n", m_isLButtonDown);
|
TRACE("MouseDown end\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CMenuFocusManager::ProcessMouseUp(MSG* msg)
|
LRESULT CMenuFocusManager::ProcessMouseUp(MSG* msg, BOOL isLButton)
|
||||||
{
|
{
|
||||||
HWND child;
|
HWND child;
|
||||||
int iHitTestResult = -1;
|
int iHitTestResult = -1;
|
||||||
|
@ -472,11 +465,6 @@ LRESULT CMenuFocusManager::ProcessMouseUp(MSG* msg)
|
||||||
if (cCapture && cCapture != m_captureHwnd && m_current->type != TrackedMenuEntry)
|
if (cCapture && cCapture != m_captureHwnd && m_current->type != TrackedMenuEntry)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (!m_isLButtonDown)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
m_isLButtonDown = FALSE;
|
|
||||||
|
|
||||||
POINT pt = msg->pt;
|
POINT pt = msg->pt;
|
||||||
|
|
||||||
child = WindowFromPoint(pt);
|
child = WindowFromPoint(pt);
|
||||||
|
@ -485,8 +473,6 @@ LRESULT CMenuFocusManager::ProcessMouseUp(MSG* msg)
|
||||||
if (IsTrackedWindow(child, &entry) != S_OK)
|
if (IsTrackedWindow(child, &entry) != S_OK)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
TRACE("MouseUp %d\n", m_isLButtonDown);
|
|
||||||
|
|
||||||
if (entry)
|
if (entry)
|
||||||
{
|
{
|
||||||
ScreenToClient(child, &pt);
|
ScreenToClient(child, &pt);
|
||||||
|
@ -495,7 +481,7 @@ LRESULT CMenuFocusManager::ProcessMouseUp(MSG* msg)
|
||||||
if (iHitTestResult >= 0)
|
if (iHitTestResult >= 0)
|
||||||
{
|
{
|
||||||
TRACE("MouseUp send %d\n", iHitTestResult);
|
TRACE("MouseUp send %d\n", iHitTestResult);
|
||||||
entry->mb->_MenuBarMouseUp(child, iHitTestResult);
|
entry->mb->_MenuBarMouseUp(child, iHitTestResult, isLButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,9 +581,6 @@ LRESULT CMenuFocusManager::GetMsgHook(INT nCode, WPARAM hookWParam, LPARAM hookL
|
||||||
isLButton = TRUE;
|
isLButton = TRUE;
|
||||||
TRACE("LB\n");
|
TRACE("LB\n");
|
||||||
|
|
||||||
// fallthrough;
|
|
||||||
case WM_NCRBUTTONDOWN:
|
|
||||||
case WM_RBUTTONDOWN:
|
|
||||||
if (m_menuBar && m_current->type == MenuPopupEntry)
|
if (m_menuBar && m_current->type == MenuPopupEntry)
|
||||||
{
|
{
|
||||||
POINT pt = msg->pt;
|
POINT pt = msg->pt;
|
||||||
|
@ -623,10 +606,15 @@ LRESULT CMenuFocusManager::GetMsgHook(INT nCode, WPARAM hookWParam, LPARAM hookL
|
||||||
|
|
||||||
ProcessMouseDown(msg, isLButton);
|
ProcessMouseDown(msg, isLButton);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case WM_NCRBUTTONUP:
|
||||||
|
case WM_RBUTTONUP:
|
||||||
|
ProcessMouseUp(msg, isLButton);
|
||||||
break;
|
break;
|
||||||
case WM_NCLBUTTONUP:
|
case WM_NCLBUTTONUP:
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
ProcessMouseUp(msg);
|
isLButton = TRUE;
|
||||||
|
ProcessMouseUp(msg, isLButton);
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
callNext = ProcessMouseMove(msg);
|
callNext = ProcessMouseMove(msg);
|
||||||
|
|
|
@ -117,7 +117,7 @@ private:
|
||||||
|
|
||||||
LRESULT ProcessMouseMove(MSG* msg);
|
LRESULT ProcessMouseMove(MSG* msg);
|
||||||
LRESULT ProcessMouseDown(MSG* msg, BOOL isLButton);
|
LRESULT ProcessMouseDown(MSG* msg, BOOL isLButton);
|
||||||
LRESULT ProcessMouseUp(MSG* msg);
|
LRESULT ProcessMouseUp(MSG* msg, BOOL isLButton);
|
||||||
public:
|
public:
|
||||||
HRESULT PushMenuBar(CMenuBand * mb);
|
HRESULT PushMenuBar(CMenuBand * mb);
|
||||||
HRESULT PushMenuPopup(CMenuBand * mb);
|
HRESULT PushMenuPopup(CMenuBand * mb);
|
||||||
|
|
|
@ -827,8 +827,6 @@ HRESULT CMenuToolbarBase::MenuBarMouseDown(INT iIndex, BOOL isLButton)
|
||||||
TBBUTTON btn;
|
TBBUTTON btn;
|
||||||
|
|
||||||
GetButton(iIndex, &btn);
|
GetButton(iIndex, &btn);
|
||||||
if (!isLButton)
|
|
||||||
return ProcessContextMenu(btn.idCommand);
|
|
||||||
|
|
||||||
if ((m_initFlags & SMINIT_VERTICAL)
|
if ((m_initFlags & SMINIT_VERTICAL)
|
||||||
|| m_popupBar
|
|| m_popupBar
|
||||||
|
@ -841,7 +839,7 @@ HRESULT CMenuToolbarBase::MenuBarMouseDown(INT iIndex, BOOL isLButton)
|
||||||
return ProcessClick(btn.idCommand);
|
return ProcessClick(btn.idCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CMenuToolbarBase::MenuBarMouseUp(INT iIndex)
|
HRESULT CMenuToolbarBase::MenuBarMouseUp(INT iIndex, BOOL isLButton)
|
||||||
{
|
{
|
||||||
TBBUTTON btn;
|
TBBUTTON btn;
|
||||||
|
|
||||||
|
@ -851,7 +849,11 @@ HRESULT CMenuToolbarBase::MenuBarMouseUp(INT iIndex)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
GetButton(iIndex, &btn);
|
GetButton(iIndex, &btn);
|
||||||
return ProcessClick(btn.idCommand);
|
|
||||||
|
if (isLButton)
|
||||||
|
return ProcessClick(btn.idCommand);
|
||||||
|
else
|
||||||
|
return ProcessContextMenu(btn.idCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CMenuToolbarBase::PrepareExecuteItem(INT iItem)
|
HRESULT CMenuToolbarBase::PrepareExecuteItem(INT iItem)
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
HRESULT KillPopupTimer();
|
HRESULT KillPopupTimer();
|
||||||
|
|
||||||
HRESULT MenuBarMouseDown(INT iIndex, BOOL isLButton);
|
HRESULT MenuBarMouseDown(INT iIndex, BOOL isLButton);
|
||||||
HRESULT MenuBarMouseUp(INT iIndex);
|
HRESULT MenuBarMouseUp(INT iIndex, BOOL isLButton);
|
||||||
HRESULT ProcessClick(INT iItem);
|
HRESULT ProcessClick(INT iItem);
|
||||||
HRESULT ProcessContextMenu(INT iItem);
|
HRESULT ProcessContextMenu(INT iItem);
|
||||||
HRESULT BeforeCancelPopup();
|
HRESULT BeforeCancelPopup();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue