LibVNC / libvncserver

LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program.
GNU General Public License v2.0
1.07k stars 481 forks source link

Show a server-side mouse cursor to clients that don't control it, fix multiple clients drawing cursors into framebuffer #576

Open VelorumS opened 1 year ago

VelorumS commented 1 year ago

From TurboVNC.

When multiple viewers are sharing a single TurboVNC session, ordinarily it would be necessary for a viewer to disable remote cursor shape updates in order to see the pointer movements initiated by other viewers. This commit automates that by using server-side cursor rendering (drawing the cursor into the framebuffer, not using remote cursor shape updates) to send cursor updates to all viewers that aren't moving the pointer ("collaborators.") The viewer that is moving the pointer (the "pointer owner") receives remote cursor shape updates while it is moving the pointer, if it has elected to receive them.

This mimics the behavior of RealVNC.

Also fixes the case when multiple clients draw the cursor into framebuffer simultaneously. Uses rwlock for pthreads or a simple mutex otherwise. If the multi-client performance is important then maybe any locks there aren't the best solution.