void multicastClient_OnInputPositionReceived(object sender, MulticastClient.InputEventArgs e) { if (player == null || isExiting) { return; } Point center; currentCursorPosition = e.cursorPosition; currentCaretPosition = e.caretPosition; if (!isTyping) { if (currentCaretPosition != lastCaretPosition) { isTyping = true; } } else { if (currentCursorPosition != lastCursorPosition) { isTyping = false; } } lastCursorPosition = currentCursorPosition; lastCaretPosition = currentCaretPosition; center = isTyping ? new Point(currentCaretPosition.Left + currentCaretPosition.Width / 2, currentCaretPosition.Top + currentCaretPosition.Height / 2) : currentCursorPosition; Size videoResolution = player.GetSize(); int x = (int)((float)center.X / e.screenSize.X * videoResolution.Width); int y = (int)((float)center.Y / e.screenSize.Y * videoResolution.Height); if (cropMode == CropMode.NoCropping) { player.SetLogoInt((uint)LibVlc.libvlc_video_logo_option_t.libvlc_logo_enable, 1); player.SetLogoString("cursor_highlight.png"); player.SetLogoInt((uint)LibVlc.libvlc_video_logo_option_t.libvlc_logo_x, x); player.SetLogoInt((uint)LibVlc.libvlc_video_logo_option_t.libvlc_logo_y, y); player.SetLogoInt((uint)LibVlc.libvlc_video_logo_option_t.libvlc_logo_repeat, -1); player.SetLogoInt((uint)LibVlc.libvlc_video_logo_option_t.libvlc_logo_opacity, 255); // 0-255 return; } int x0, y0; // Keep cropping rectangle within bounds if (x - ucVLC.Width / 2 < 0) { x0 = 0; } else if (x + ucVLC.Width / 2 > videoResolution.Width) { x0 = videoResolution.Width - ucVLC.Width; } else { x0 = x - ucVLC.Width / 2; } if (y - ucVLC.Height / 2 < 0) { y0 = 0; } else if (y + ucVLC.Height / 2 > videoResolution.Height) { y0 = videoResolution.Height - ucVLC.Height; } else { y0 = y - ucVLC.Height / 2; } player.SetCropGeometry(x0, y0, ucVLC.Width, ucVLC.Height); }