From: Pierre Ossman Date: Thu, 16 Nov 2017 15:40:44 +0000 (+0100) Subject: Fix for initial client side cursor X-Git-Tag: v1.8.90~67 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=25db44a164e9dfb76b65e8b5540abef4668596df;p=tigervnc.git Fix for initial client side cursor Improve the tracking of what cursor we've sent to the client to make sure the initial cursor is sent properly. We previously tried to infer this information based on if we've rendered a server side cursor or not. This logic broke down if things triggered before we've sent the first update to the client. --- diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index 0e97a784..6a3e1c7d 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -80,6 +80,7 @@ VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s, server(server_), updates(false), updateRenderedCursor(false), removeRenderedCursor(false), continuousUpdates(false), encodeManager(this), pointerEventTime(0), + clientHasCursor(false), accessRights(AccessDefault), startTime(time(0)) { setStreams(&sock->inStream(), &sock->outStream()); @@ -379,9 +380,9 @@ void VNCSConnectionST::renderedCursorChange() { if (state() != RFBSTATE_NORMAL) return; // Are we switching between client-side and server-side cursor? - bool hasRenderedCursor = !damagedCursorRegion.is_empty(); - if (hasRenderedCursor != needRenderedCursor()) + if (clientHasCursor == needRenderedCursor()) setCursorOrClose(); + bool hasRenderedCursor = !damagedCursorRegion.is_empty(); if (hasRenderedCursor) removeRenderedCursor = true; if (needRenderedCursor()) { @@ -1256,10 +1257,13 @@ void VNCSConnectionST::setCursor() return; // We need to blank out the client's cursor or there will be two - if (needRenderedCursor()) + if (needRenderedCursor()) { cp.setCursor(emptyCursor); - else + clientHasCursor = false; + } else { cp.setCursor(*server->cursor); + clientHasCursor = true; + } if (!writer()->writeSetCursorWithAlpha()) { if (!writer()->writeSetCursor()) { diff --git a/common/rfb/VNCSConnectionST.h b/common/rfb/VNCSConnectionST.h index 42eb85ad..8d6a7bc6 100644 --- a/common/rfb/VNCSConnectionST.h +++ b/common/rfb/VNCSConnectionST.h @@ -215,6 +215,7 @@ namespace rfb { time_t lastEventTime; time_t pointerEventTime; Point pointerEventPos; + bool clientHasCursor; AccessRights accessRights;