mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed focus on tray context menu
This commit is contained in:
parent
b2d245016a
commit
0388c63faf
@ -62,6 +62,7 @@ CTrayWindow::CTrayWindow() :
|
|||||||
m_Values(),
|
m_Values(),
|
||||||
m_Pos(),
|
m_Pos(),
|
||||||
m_Notification(TRAY_NOTIFICATION_NONE),
|
m_Notification(TRAY_NOTIFICATION_NONE),
|
||||||
|
m_TrayContextMenuEnabled(true),
|
||||||
m_IconEnabled(true)
|
m_IconEnabled(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -553,7 +554,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0; // Don't send WM_COMMANDS any further
|
break; // Don't send WM_COMMANDS any further
|
||||||
|
|
||||||
case WM_TRAY_NOTIFYICON:
|
case WM_TRAY_NOTIFYICON:
|
||||||
{
|
{
|
||||||
@ -579,18 +580,26 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsCtrlKeyDown() && // Ctrl is pressed, so only run default action
|
if (!bang.empty() &&
|
||||||
!bang.empty())
|
!IsCtrlKeyDown()) // Ctrl is pressed, so only run default action
|
||||||
{
|
{
|
||||||
Rainmeter->ExecuteCommand(bang.c_str(), NULL);
|
Rainmeter->ExecuteCommand(bang.c_str(), NULL);
|
||||||
|
tray->m_TrayContextMenuEnabled = (uMouseMsg != WM_RBUTTONDOWN);
|
||||||
}
|
}
|
||||||
else if (uMouseMsg == WM_RBUTTONDOWN)
|
else if (uMouseMsg == WM_RBUTTONDOWN)
|
||||||
{
|
{
|
||||||
POINT point;
|
tray->m_TrayContextMenuEnabled = true;
|
||||||
GetCursorPos(&point);
|
|
||||||
Rainmeter->ShowContextMenu(point, NULL);
|
|
||||||
}
|
}
|
||||||
else if (uMouseMsg == WM_LBUTTONDOWN || uMouseMsg == WM_LBUTTONDBLCLK)
|
else if (uMouseMsg == WM_RBUTTONUP)
|
||||||
|
{
|
||||||
|
if (tray->m_TrayContextMenuEnabled)
|
||||||
|
{
|
||||||
|
POINT point;
|
||||||
|
GetCursorPos(&point);
|
||||||
|
Rainmeter->ShowContextMenu(point, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (uMouseMsg == WM_LBUTTONUP || uMouseMsg == WM_LBUTTONDBLCLK)
|
||||||
{
|
{
|
||||||
CDialogManage::Open();
|
CDialogManage::Open();
|
||||||
}
|
}
|
||||||
@ -705,8 +714,8 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
tray->TryAddTrayIcon();
|
tray->TryAddTrayIcon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,8 @@ private:
|
|||||||
|
|
||||||
TRAY_NOTIFICATION m_Notification;
|
TRAY_NOTIFICATION m_Notification;
|
||||||
|
|
||||||
|
bool m_TrayContextMenuEnabled;
|
||||||
|
|
||||||
bool m_IconEnabled;
|
bool m_IconEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user