/// <summary> /// Send mouse move event to the streaming PC /// </summary> private void MouseMove(object sender, PointerRoutedEventArgs e) { // Only use this fake relative mode on non-mice if (e.Pointer.PointerDeviceType != PointerDeviceType.Mouse) { PointerPoint ptrPt = e.GetCurrentPoint(StreamDisplay); short eventX = (short)ptrPt.Position.X; short eventY = (short)ptrPt.Position.Y; if (eventX != lastX || eventY != lastY) { hasMoved = true; short xToSend = (short)(eventX - lastX); short yToSend = (short)(eventY - lastY); // Send the values to the streaming PC so it can register mouse movement MoonlightCommonRuntimeComponent.SendMouseMoveEvent(xToSend, yToSend); lastX = eventX; lastY = eventY; } // Prevent most handlers along the event route from handling the same event again. e.Handled = true; } }
private void RelativeMouseMoved(MouseDevice device, MouseEventArgs e) { if (!capturingMouse) { return; } MoonlightCommonRuntimeComponent.SendMouseMoveEvent((short)e.MouseDelta.X, (short)e.MouseDelta.Y); }