]> source.dussan.org Git - tigervnc.git/commitdiff
Clear client cursor when switching to server side
authorPierre Ossman <ossman@cendio.se>
Fri, 15 Sep 2017 09:03:12 +0000 (11:03 +0200)
committerPierre Ossman <ossman@cendio.se>
Fri, 15 Sep 2017 09:03:12 +0000 (11:03 +0200)
Otherwise the client can end up with two visible cursors.

common/rfb/VNCSConnectionST.cxx

index 53dd364a6ad89a307a631a6e0d273de294b8f882..c92bdb4650e95bf98f66709ff56bcf46755d05a4 100644 (file)
@@ -64,6 +64,8 @@ struct RTTInfo {
   unsigned inFlight;
 };
 
+static Cursor emptyCursor(0, 0, Point(0, 0), NULL);
+
 VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s,
                                    bool reverse)
   : sock(s), reverseConnection(reverse),
@@ -357,6 +359,9 @@ bool VNCSConnectionST::getComparerState()
 void VNCSConnectionST::renderedCursorChange()
 {
   if (state() != RFBSTATE_NORMAL) return;
+  // Are we switching between client-side and server-side cursor?
+  if (damagedCursorRegion.is_empty() != needRenderedCursor())
+    setCursorOrClose();
   if (!damagedCursorRegion.is_empty())
     removeRenderedCursor = true;
   if (needRenderedCursor()) {
@@ -1132,7 +1137,11 @@ void VNCSConnectionST::setCursor()
   if (state() != RFBSTATE_NORMAL)
     return;
 
-  cp.setCursor(*server->cursor);
+  // We need to blank out the client's cursor or there will be two
+  if (needRenderedCursor())
+    cp.setCursor(emptyCursor);
+  else
+    cp.setCursor(*server->cursor);
 
   if (!writer()->writeSetCursorWithAlpha()) {
     if (!writer()->writeSetCursor()) {