mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
vnc: only alloc server surface with clients connected
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-15-git-send-email-kraxel@redhat.com
This commit is contained in:
parent
f7b3d68c95
commit
c7628bff41
1 changed files with 12 additions and 0 deletions
12
ui/vnc.c
12
ui/vnc.c
|
@ -731,6 +731,10 @@ static void vnc_update_server_surface(VncDisplay *vd)
|
||||||
qemu_pixman_image_unref(vd->server);
|
qemu_pixman_image_unref(vd->server);
|
||||||
vd->server = NULL;
|
vd->server = NULL;
|
||||||
|
|
||||||
|
if (QTAILQ_EMPTY(&vd->clients)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,
|
vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,
|
||||||
vnc_width(vd),
|
vnc_width(vd),
|
||||||
vnc_height(vd),
|
vnc_height(vd),
|
||||||
|
@ -1241,6 +1245,10 @@ void vnc_disconnect_finish(VncState *vs)
|
||||||
if (vs->initialized) {
|
if (vs->initialized) {
|
||||||
QTAILQ_REMOVE(&vs->vd->clients, vs, next);
|
QTAILQ_REMOVE(&vs->vd->clients, vs, next);
|
||||||
qemu_remove_mouse_mode_change_notifier(&vs->mouse_mode_notifier);
|
qemu_remove_mouse_mode_change_notifier(&vs->mouse_mode_notifier);
|
||||||
|
if (QTAILQ_EMPTY(&vs->vd->clients)) {
|
||||||
|
/* last client gone */
|
||||||
|
vnc_update_server_surface(vs->vd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vs->vd->lock_key_sync)
|
if (vs->vd->lock_key_sync)
|
||||||
|
@ -3079,6 +3087,7 @@ void vnc_init_state(VncState *vs)
|
||||||
{
|
{
|
||||||
vs->initialized = true;
|
vs->initialized = true;
|
||||||
VncDisplay *vd = vs->vd;
|
VncDisplay *vd = vs->vd;
|
||||||
|
bool first_client = QTAILQ_EMPTY(&vd->clients);
|
||||||
|
|
||||||
vs->last_x = -1;
|
vs->last_x = -1;
|
||||||
vs->last_y = -1;
|
vs->last_y = -1;
|
||||||
|
@ -3092,6 +3101,9 @@ void vnc_init_state(VncState *vs)
|
||||||
vs->bh = qemu_bh_new(vnc_jobs_bh, vs);
|
vs->bh = qemu_bh_new(vnc_jobs_bh, vs);
|
||||||
|
|
||||||
QTAILQ_INSERT_TAIL(&vd->clients, vs, next);
|
QTAILQ_INSERT_TAIL(&vd->clients, vs, next);
|
||||||
|
if (first_client) {
|
||||||
|
vnc_update_server_surface(vd);
|
||||||
|
}
|
||||||
|
|
||||||
graphic_hw_update(vd->dcl.con);
|
graphic_hw_update(vd->dcl.con);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue