ui/vdagent: send caps on fe_open

The spice-vdagentd doesn't send capabilities again on host/client
disconnect (but when the session agent connects and sends a
GUEST_XORG_RESOLUTION message)

When the dbus client disconnects, vdagent_disconnect() is called to
reset the agent state. Capabilities must be negotiated again on
reconnection.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20240717171541.201525-5-marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2024-07-17 21:15:40 +04:00
parent 63a5d4de58
commit 865714cb3b

View File

@ -185,7 +185,7 @@ static void vdagent_send_msg(VDAgentChardev *vd, VDAgentMessage *msg)
vdagent_send_buf(vd); vdagent_send_buf(vd);
} }
static void vdagent_send_caps(VDAgentChardev *vd) static void vdagent_send_caps(VDAgentChardev *vd, bool request)
{ {
g_autofree VDAgentMessage *msg = g_malloc0(sizeof(VDAgentMessage) + g_autofree VDAgentMessage *msg = g_malloc0(sizeof(VDAgentMessage) +
sizeof(VDAgentAnnounceCapabilities) + sizeof(VDAgentAnnounceCapabilities) +
@ -205,6 +205,7 @@ static void vdagent_send_caps(VDAgentChardev *vd)
#endif #endif
} }
caps->request = request;
vdagent_send_msg(vd, msg); vdagent_send_msg(vd, msg);
} }
@ -711,7 +712,7 @@ static void vdagent_chr_recv_caps(VDAgentChardev *vd, VDAgentMessage *msg)
vd->caps = caps->caps[0]; vd->caps = caps->caps[0];
if (caps->request) { if (caps->request) {
vdagent_send_caps(vd); vdagent_send_caps(vd, false);
} }
if (have_mouse(vd) && vd->mouse_hs) { if (have_mouse(vd) && vd->mouse_hs) {
qemu_input_handler_activate(vd->mouse_hs); qemu_input_handler_activate(vd->mouse_hs);
@ -885,6 +886,7 @@ static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open)
return; return;
} }
vdagent_send_caps(vd, true);
} }
static void vdagent_chr_parse(QemuOpts *opts, ChardevBackend *backend, static void vdagent_chr_parse(QemuOpts *opts, ChardevBackend *backend,