/* guest surface */
qemu_pixman_image_unref(vd->guest.fb);
vd->guest.fb = pixman_image_ref(surface->image);
- vd->guest.format = surface->format;
+ vd->guest.format = surface_format(surface);
if (pageflip) {
*/
static int vnc_client_read(VncState *vs)
{
- size_t ret;
+ size_t sz;
#ifdef CONFIG_VNC_SASL
if (vs->sasl.conn && vs->sasl.runSSF)
- ret = vnc_client_read_sasl(vs);
+ sz = vnc_client_read_sasl(vs);
else
#endif /* CONFIG_VNC_SASL */
- ret = vnc_client_read_plain(vs);
- if (!ret) {
+ sz = vnc_client_read_plain(vs);
+ if (!sz) {
if (vs->disconnecting) {
vnc_disconnect_finish(vs);
return -1;
static void check_pointer_type_change(Notifier *notifier, void *data)
{
VncState *vs = container_of(notifier, VncState, mouse_mode_notifier);
- int absolute = qemu_input_is_absolute();
+ int absolute = qemu_input_is_absolute(vs->vd->dcl.con);
if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE) && vs->absolute != absolute) {
vnc_lock_output(vs);
case 0xb8: /* Right ALT */
break;
case 0xc8:
- kbd_put_keysym(QEMU_KEY_UP);
+ qemu_text_console_put_keysym(NULL, QEMU_KEY_UP);
break;
case 0xd0:
- kbd_put_keysym(QEMU_KEY_DOWN);
+ qemu_text_console_put_keysym(NULL, QEMU_KEY_DOWN);
break;
case 0xcb:
- kbd_put_keysym(QEMU_KEY_LEFT);
+ qemu_text_console_put_keysym(NULL, QEMU_KEY_LEFT);
break;
case 0xcd:
- kbd_put_keysym(QEMU_KEY_RIGHT);
+ qemu_text_console_put_keysym(NULL, QEMU_KEY_RIGHT);
break;
case 0xd3:
- kbd_put_keysym(QEMU_KEY_DELETE);
+ qemu_text_console_put_keysym(NULL, QEMU_KEY_DELETE);
break;
case 0xc7:
- kbd_put_keysym(QEMU_KEY_HOME);
+ qemu_text_console_put_keysym(NULL, QEMU_KEY_HOME);
break;
case 0xcf:
- kbd_put_keysym(QEMU_KEY_END);
+ qemu_text_console_put_keysym(NULL, QEMU_KEY_END);
break;
case 0xc9:
- kbd_put_keysym(QEMU_KEY_PAGEUP);
+ qemu_text_console_put_keysym(NULL, QEMU_KEY_PAGEUP);
break;
case 0xd1:
- kbd_put_keysym(QEMU_KEY_PAGEDOWN);
+ qemu_text_console_put_keysym(NULL, QEMU_KEY_PAGEDOWN);
break;
case 0x47:
- kbd_put_keysym(numlock ? '7' : QEMU_KEY_HOME);
+ qemu_text_console_put_keysym(NULL, numlock ? '7' : QEMU_KEY_HOME);
break;
case 0x48:
- kbd_put_keysym(numlock ? '8' : QEMU_KEY_UP);
+ qemu_text_console_put_keysym(NULL, numlock ? '8' : QEMU_KEY_UP);
break;
case 0x49:
- kbd_put_keysym(numlock ? '9' : QEMU_KEY_PAGEUP);
+ qemu_text_console_put_keysym(NULL, numlock ? '9' : QEMU_KEY_PAGEUP);
break;
case 0x4b:
- kbd_put_keysym(numlock ? '4' : QEMU_KEY_LEFT);
+ qemu_text_console_put_keysym(NULL, numlock ? '4' : QEMU_KEY_LEFT);
break;
case 0x4c:
- kbd_put_keysym('5');
+ qemu_text_console_put_keysym(NULL, '5');
break;
case 0x4d:
- kbd_put_keysym(numlock ? '6' : QEMU_KEY_RIGHT);
+ qemu_text_console_put_keysym(NULL, numlock ? '6' : QEMU_KEY_RIGHT);
break;
case 0x4f:
- kbd_put_keysym(numlock ? '1' : QEMU_KEY_END);
+ qemu_text_console_put_keysym(NULL, numlock ? '1' : QEMU_KEY_END);
break;
case 0x50:
- kbd_put_keysym(numlock ? '2' : QEMU_KEY_DOWN);
+ qemu_text_console_put_keysym(NULL, numlock ? '2' : QEMU_KEY_DOWN);
break;
case 0x51:
- kbd_put_keysym(numlock ? '3' : QEMU_KEY_PAGEDOWN);
+ qemu_text_console_put_keysym(NULL, numlock ? '3' : QEMU_KEY_PAGEDOWN);
break;
case 0x52:
- kbd_put_keysym('0');
+ qemu_text_console_put_keysym(NULL, '0');
break;
case 0x53:
- kbd_put_keysym(numlock ? '.' : QEMU_KEY_DELETE);
+ qemu_text_console_put_keysym(NULL, numlock ? '.' : QEMU_KEY_DELETE);
break;
case 0xb5:
- kbd_put_keysym('/');
+ qemu_text_console_put_keysym(NULL, '/');
break;
case 0x37:
- kbd_put_keysym('*');
+ qemu_text_console_put_keysym(NULL, '*');
break;
case 0x4a:
- kbd_put_keysym('-');
+ qemu_text_console_put_keysym(NULL, '-');
break;
case 0x4e:
- kbd_put_keysym('+');
+ qemu_text_console_put_keysym(NULL, '+');
break;
case 0x9c:
- kbd_put_keysym('\n');
+ qemu_text_console_put_keysym(NULL, '\n');
break;
default:
if (control) {
- kbd_put_keysym(sym & 0x1f);
+ qemu_text_console_put_keysym(NULL, sym & 0x1f);
} else {
- kbd_put_keysym(sym);
+ qemu_text_console_put_keysym(NULL, sym);
}
break;
}
send_ext_key_event_ack(vs);
break;
case VNC_ENCODING_AUDIO:
- send_ext_audio_ack(vs);
+ if (vs->vd->audio_state) {
+ vs->features |= VNC_FEATURE_AUDIO_MASK;
+ send_ext_audio_ack(vs);
+ }
break;
case VNC_ENCODING_WMVi:
vs->features |= VNC_FEATURE_WMVI_MASK;
break;
case VNC_ENCODING_XVP:
if (vs->vd->power_control) {
- vs->features |= VNC_FEATURE_XVP;
+ vs->features |= VNC_FEATURE_XVP_MASK;
send_xvp_message(vs, VNC_XVP_CODE_INIT);
}
break;
vnc_client_cut_text(vs, read_u32(data, 4), data + 8);
break;
case VNC_MSG_CLIENT_XVP:
- if (!(vs->features & VNC_FEATURE_XVP)) {
+ if (!vnc_has_feature(vs, VNC_FEATURE_XVP)) {
error_report("vnc: xvp client message while disabled");
vnc_client_error(vs);
break;
read_u32(data, 4), read_u32(data, 8));
break;
case VNC_MSG_CLIENT_QEMU_AUDIO:
+ if (!vnc_has_feature(vs, VNC_FEATURE_AUDIO)) {
+ error_report("Audio message %d with audio disabled", read_u8(data, 2));
+ vnc_client_error(vs);
+ break;
+ }
+
if (len == 2)
return 4;
vs, vs->ioc, vs->as.fmt, vs->as.nchannels, vs->as.freq);
break;
default:
- VNC_DEBUG("Invalid audio message %d\n", read_u8(data, 4));
+ VNC_DEBUG("Invalid audio message %d\n", read_u8(data, 2));
vnc_client_error(vs);
break;
}
cmp_bytes = MIN(VNC_DIRTY_PIXELS_PER_BIT * VNC_SERVER_FB_BYTES,
server_stride);
if (vd->guest.format != VNC_SERVER_FB_FORMAT) {
- int width = pixman_image_get_width(vd->server);
- tmpbuf = qemu_pixman_linebuf_create(VNC_SERVER_FB_FORMAT, width);
+ int w = pixman_image_get_width(vd->server);
+ tmpbuf = qemu_pixman_linebuf_create(VNC_SERVER_FB_FORMAT, w);
} else {
int guest_bpp =
PIXMAN_FORMAT_BPP(pixman_image_get_format(vd->guest.fb));
} else {
const char *port;
size_t hostlen;
- unsigned long long baseport = 0;
+ uint64_t baseport = 0;
InetSocketAddress *inet;
port = strrchr(addrstr, ':');
}
} else {
int offset = reverse ? 0 : 5900;
- if (parse_uint_full(port, &baseport, 10) < 0) {
+ if (parse_uint_full(port, 10, &baseport) < 0) {
error_setg(errp, "can't convert to a number: %s", port);
goto cleanup;
}
audiodev = qemu_opt_get(opts, "audiodev");
if (audiodev) {
- vd->audio_state = audio_state_by_name(audiodev);
+ vd->audio_state = audio_state_by_name(audiodev, errp);
if (!vd->audio_state) {
- error_setg(errp, "Audiodev '%s' not found", audiodev);
goto fail;
}
+ } else {
+ vd->audio_state = audio_get_default_audio_state(NULL);
}
device_id = qemu_opt_get(opts, "display");