From ab34f4a53f59c35ed29304ed8cfb81a9c413e222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Wed, 17 Feb 2021 21:55:21 +0100 Subject: [PATCH] WebRTC cursor: set initial state. --- internal/webrtc/manager.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/webrtc/manager.go b/internal/webrtc/manager.go index 91ee6d7d..f05b7c6c 100644 --- a/internal/webrtc/manager.go +++ b/internal/webrtc/manager.go @@ -319,6 +319,15 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin // TODO: Refactor. manager.curImgListeners[cursorChangePtr] = &cursorChange manager.curPosListeners[cursorPositionPtr] = &cursorPosition + + // send initial cursor image + cur := manager.desktop.GetCursorImage() + cursorChange(cur) + + // send initial cursor position + x, y := manager.desktop.GetCursorPosition() + manager.logger.Warn().Int("x", x).Int("y", y).Msg("got cursor position") + cursorPosition(x, y) }) dataChannel.OnMessage(func(message webrtc.DataChannelMessage) {