diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-09-24 09:03:53 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-09-24 09:03:53 +0200 |
commit | 704f9724d8af58314c4fafc8930666bb2be46722 (patch) | |
tree | d24b1f29e4661e29a945a3809e4aae09e1179f7a /common/rfb | |
parent | 43ce674dfbd2576fe5b382ad9f87e5beebc72812 (diff) | |
download | tigervnc-704f9724d8af58314c4fafc8930666bb2be46722.tar.gz tigervnc-704f9724d8af58314c4fafc8930666bb2be46722.zip |
More carefully release mouse buttons on close
Only the client that currently has buttons pressed should actually send
a release event as the client might not be currently in control of the
pointer state. This is most clearly seen in a client that hasn't event
authenticated properly yet.
Approximate this from the server by using the last known server cursor
position. It should hopefully not differ much from the last client
provided position.
Follow-up to 986280b382d57ef4f68d2d4afb13b26772e5acb0.
Diffstat (limited to 'common/rfb')
-rw-r--r-- | common/rfb/VNCSConnectionST.cxx | 3 | ||||
-rw-r--r-- | common/rfb/VNCServerST.cxx | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index 88deff8c..7dc2a0b8 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -83,9 +83,6 @@ VNCSConnectionST::~VNCSConnectionST() vlog.info("closing %s: %s", peerEndpoint.c_str(), closeReason.c_str()); - // Release any mouse buttons - server->pointerEvent(this, server->getCursorPos(), 0); - // Release any keys the client still had pressed while (!pressedKeys.empty()) { uint32_t keysym, keycode; diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index 114ff347..66b05fae 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -176,8 +176,11 @@ void VNCServerST::removeSocket(network::Socket* sock) { for (ci = clients.begin(); ci != clients.end(); ci++) { if ((*ci)->getSock() == sock) { // - Remove any references to it - if (pointerClient == *ci) + if (pointerClient == *ci) { + // Release the mouse buttons the client have pressed + desktop->pointerEvent(cursorPos, 0); pointerClient = nullptr; + } if (clipboardClient == *ci) handleClipboardAnnounce(*ci, false); clipboardRequestors.remove(*ci); |