vnc: implement shared flag handling.
PATCH 1/1 vnc: implement shared flag handling.
VNC clients send a shared flag in the client init message. Up to now qemu completely ignores this. This patch implements shared flag handling. It comes with three policies: By default qemu behaves as one would expect: Asking for a exclusive access grants exclusive access to the client connecting. There is also a desktop sharing mode which disallows exclusive connects (so one forgetting -shared wouldn't drop everybody else) and a compatibility mode which mimics the traditional (but non-conforming) qemu behavior.
Signed-off-by Gerd Hoffmann <[email protected]>
--- qemu-options.hx | 13 +++++++ ui/vnc.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ ui/vnc.h | 16 +++++++++ 3 files changed, 127 insertions(+), 0 deletions(-)
qemu-options.hx +13 -0
@@ -1055,6 +1055,19 @@ This can be really helpful to save bandwidth when playing videos. Disabling adaptive encodings allows to restore the original static behavior of encodings like Tight. +@item share=[allow-exclusive|force-shared|ignore] + +Set display sharing policy. 'allow-exclusive' allows clients to ask +for exclusive access. As suggested by the rfb spec this is +implemented by dropping other connections. Connecting multiple +clients in parallel requires all clients asking for a shared session +(vncviewer: -shared switch). This is the default. 'force-shared' +disables exclusive client access. Useful for shared desktop sessions, +where you don't want someone forgetting specify -shared disconnect +everybody else. 'ignore' completely ignores the shared flag and +allows everybody connect unconditionally. Doesn't conform to the rfb +spec but is traditional qemu behavior. + @end table ETEXI
ui/vnc.c +98 -0
136 lines not on this page · raw message
ui/vnc.h +16 -0
@@ -122,9 +122,24 @@ struct VncSurfaceDisplaySurface *ds; }; +typedef enum VncShareMode { +VNC_SHARE_MODE_CONNECTING =1 , +VNC_SHARE_MODE_SHARED , +VNC_SHARE_MODE_EXCLUSIVE , +VNC_SHARE_MODE_DISCONNECTED , +}VncShareMode ; + +typedef enum VncSharePolicy { +VNC_SHARE_POLICY_IGNORE =1 , +VNC_SHARE_POLICY_ALLOW_EXCLUSIVE , +VNC_SHARE_POLICY_FORCE_SHARED , +}VncSharePolicy ; +struct VncDisplay { QTAILQ_HEAD(, VncState) clients; +int num_exclusive; +VncSharePolicy share_policy;QEMUTimer *timer;int timer_interval;int lsock;
@@ -250,6 +265,7 @@ struct VncStateint last_y;int client_width;int client_height; +VncShareMode share_mode;uint32_t vnc_encoding;
Signature · 1 line
1.7.1