Holding Ctrl while clicking ignores LeftMouseDown and RightMouseUp actions, so the defaults, dragging and accessing context menu, are done instead.

This commit is contained in:
JamesAC 2011-08-31 14:49:45 +00:00
parent e721be6456
commit d51fc12841

View File

@ -4307,6 +4307,18 @@ LRESULT CMeterWindow::OnLeftButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam)
// Handle buttons
HandleButtons(pos, BUTTONPROC_DOWN, NULL);
SHORT state = GetKeyState(VK_CONTROL);
bool down = ((unsigned short) state) >> 15;
// Ctrl is pressed, so only run default action
if (down)
{
// Cancel the mouse event beforehand
SetMouseLeaveEvent(true);
// Run the DefWindowProc so the dragging works
return DefWindowProc(m_Window, uMsg, wParam, lParam);
}
if (!DoAction(pos.x, pos.y, MOUSE_LMB_DOWN, false) && m_WindowDraggable)
{
// Cancel the mouse event beforehand
@ -4415,6 +4427,14 @@ LRESULT CMeterWindow::OnRightButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam)
// Handle buttons
HandleButtons(pos, BUTTONPROC_MOVE, NULL);
SHORT state = GetKeyState(VK_CONTROL);
bool down = ((unsigned short) state) >> 15;
// Ctrl is pressed, so only run default action
if (down)
{
return DefWindowProc(m_Window, WM_RBUTTONUP, wParam, lParam);
}
if (!DoAction(pos.x, pos.y, MOUSE_RMB_UP, false))
{
// Run the DefWindowProc so the context menu works
@ -4563,12 +4583,18 @@ LRESULT CMeterWindow::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam)
// Handle buttons
HandleButtons(posc, BUTTONPROC_MOVE, NULL);
SHORT state = GetKeyState(VK_CONTROL);
bool down = ((unsigned short) state) >> 15;
// Ctrl is pressed, so ignore any actions
if (!down)
{
// If RMB up or RMB down or double-click cause actions, do not show the menu!
if (DoAction(posc.x, posc.y, MOUSE_RMB_UP, false) || DoAction(posc.x, posc.y, MOUSE_RMB_DOWN, true) || DoAction(posc.x, posc.y, MOUSE_RMB_DBLCLK, true))
{
return 0;
}
}
}
m_Rainmeter->ShowContextMenu(pos, this);