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
|
// Handle buttons
|
||||||
HandleButtons(pos, BUTTONPROC_DOWN, NULL);
|
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)
|
if (!DoAction(pos.x, pos.y, MOUSE_LMB_DOWN, false) && m_WindowDraggable)
|
||||||
{
|
{
|
||||||
// Cancel the mouse event beforehand
|
// Cancel the mouse event beforehand
|
||||||
@ -4415,6 +4427,14 @@ LRESULT CMeterWindow::OnRightButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
// Handle buttons
|
// Handle buttons
|
||||||
HandleButtons(pos, BUTTONPROC_MOVE, NULL);
|
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))
|
if (!DoAction(pos.x, pos.y, MOUSE_RMB_UP, false))
|
||||||
{
|
{
|
||||||
// Run the DefWindowProc so the context menu works
|
// Run the DefWindowProc so the context menu works
|
||||||
@ -4563,12 +4583,18 @@ LRESULT CMeterWindow::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
// Handle buttons
|
// Handle buttons
|
||||||
HandleButtons(posc, BUTTONPROC_MOVE, NULL);
|
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 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))
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_Rainmeter->ShowContextMenu(pos, this);
|
m_Rainmeter->ShowContextMenu(pos, this);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user