mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
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:
parent
e721be6456
commit
d51fc12841
@ -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,10 +4583,16 @@ LRESULT CMeterWindow::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
// Handle buttons
|
||||
HandleButtons(posc, BUTTONPROC_MOVE, NULL);
|
||||
|
||||
// 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))
|
||||
SHORT state = GetKeyState(VK_CONTROL);
|
||||
bool down = ((unsigned short) state) >> 15;
|
||||
// Ctrl is pressed, so ignore any actions
|
||||
if (!down)
|
||||
{
|
||||
return 0;
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user