Wondering if anyone else is having this issue. While using a Windows 10 VM in Parallels 11 on El Capitan, it seems you can't check the modifier keys if you're in a Mouse event with a mouse key pressed.
I'm observing if the mouse is currently down, Parallels only sends/stores the modifier key changes when a mouse button or different, non-modifier keyboard key changes state (or a different modifier key is released, but not when pressed).
So... anyone know how to get around this? We definitely want to support Parallels. (I've also filed a bug with them about this because it definitely seems wrong.)
Here's the code. Simply create a new project and paste this into the code-behind of the main window.
bool isDragging;
protected override void OnMouseDown(MouseButtonEventArgs e)
{
if(e.ClickCount == 1 && e.ChangedButton == MouseButton.Left)
{
e.Handled = true;
isDragging = true;
CaptureMouse();
}
base.OnMouseDown(e);
}
protected override void OnMouseMove(MouseEventArgs e)
{
if(isDragging)
{
e.Handled = true;
Title = "Pressed: " + (Keyboard.Modifiers == ModifierKeys.Shift);
}
base.OnMouseMove(e);
}
protected override void OnMouseUp(MouseButtonEventArgs e)
{
if(isDragging && e.ChangedButton == MouseButton.Left)
{
e.Handled = true;
isDragging = false;
ReleaseMouseCapture();
}
base.OnMouseUp(e);
}