SystemTrayIconComponent mouse clicks

I recently added a system tray icon to my app. On one machine, I was having trouble receiving mouse clicks.

It looks like the JUCE code uses getCurrentModifiersRealtime when it processes the WM_TRAYNOTIFY message to set the modifiers for the MouseEvent passed to the component. In this case, getCurrentModifiersRealtime is returning zero.

The lParam sent with the message contains mouse button information which seems to be correct, so I did the following:

// MouseEvent just as before but no const
MouseEvent e (0, 0, ModifierKeys::getCurrentModifiersRealtime(),
getMouseEventTime(), 0, 0, getMouseEventTime(),

if (lParam == WM_LBUTTONDOWN || lParam == WM_RBUTTONDOWN)
if (lParam == WM_LBUTTONDOW)
e.mods = ModifierKeys(e.mods.getRawFlags() | ModifierKeys::leftButtonModifier);
else if (lParam == WM_RBUTTONDOWN)
e.mods = ModifierKeys(e.mods.getRawFlags() | ModifierKeys::rightButtonModifier);[/code]

It’s not the most elegant solution, but it solved the problem.

Nice fix! Thanks for spotting that!