ui: misc small gtk/spice/vnc patches.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJWnQotAAoJEEy22O7T6HE48LUP/iPPO1Hw8RRDCEwZ9fA6adgd /D9D0/EvHcW1t+x1VZBLVKnMHugVQur6E6BJ9y94Rb/T08tT2b3Zprqj1zKM/IQ9 VRvUIy8Kr3mJksdNKlY/9bV/PLVxv0UaxXjz9gvCyP+OZM97mxsQcjEHKncGkoc4 fGg/ubHTRLQ7DKbC2P9TCSGBoBQJULu/Gke2FmFtmu9YrUT6gNSV3H/8oR0+LgAm EAx0DHeu34EOEkNNKvJsLKpRaPo6svjpLSPteh2yiwSyHOilJ6APaNcsSvEbRizG HX5UbMiw3DeUS0C+6V7HBRfa3m8ubffsOMFYMRtv9a5uXw1ZpkZYV8OmEfMSD5wG R26NpM3MKfa1CgTgwlt5JWIBtBjJ948qQqg6aapZnB131dCVUUOxiW11/FFYzum9 grUzFecsaC5mN3YFpezOiEtdpuRKR36uVW5a98Y77AFCvXPkPxxDmbUzrb3Xc6It RddP6mkDs7CO9RHBxDjqs3x27OdywFGJdlFY2eFWOJHqAH5pNQDNezG/5L7FHoEO H/FnSM8b1ioYjo8oQYEK1urSy3O4FgbTZzDRhsxVR/FQhN9caQmvFyIV4fGreXci nTugnpTkavaNvfJILKmikpX2Prt39GlWjQhtuklg8jm80NqWg2UsTGtkYjl9golR SUzyl3TY7aouj7IZGxgE =g3CX -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160118-1' into staging ui: misc small gtk/spice/vnc patches. # gpg: Signature made Mon 18 Jan 2016 15:52:13 GMT using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-ui-20160118-1: vnc: fix tls-creds error message Fix corner-case when using VNC+SASL+SPICE vnc: clear vs->tlscreds after unparenting it gtk: implement set_echo Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
46188349ad
@ -61,6 +61,7 @@ typedef struct VirtualVteConsole {
|
||||
GtkWidget *scrollbar;
|
||||
GtkWidget *terminal;
|
||||
CharDriverState *chr;
|
||||
bool echo;
|
||||
} VirtualVteConsole;
|
||||
#endif
|
||||
|
||||
|
45
ui/gtk.c
45
ui/gtk.c
@ -1588,6 +1588,13 @@ static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
|
||||
return len;
|
||||
}
|
||||
|
||||
static void gd_vc_chr_set_echo(CharDriverState *chr, bool echo)
|
||||
{
|
||||
VirtualConsole *vc = chr->opaque;
|
||||
|
||||
vc->vte.echo = echo;
|
||||
}
|
||||
|
||||
static int nb_vcs;
|
||||
static CharDriverState *vcs[MAX_VCS];
|
||||
|
||||
@ -1597,6 +1604,11 @@ static CharDriverState *gd_vc_handler(ChardevVC *unused, Error **errp)
|
||||
|
||||
chr = g_malloc0(sizeof(*chr));
|
||||
chr->chr_write = gd_vc_chr_write;
|
||||
chr->chr_set_echo = gd_vc_chr_set_echo;
|
||||
|
||||
/* Temporary, until gd_vc_vte_init runs. */
|
||||
chr->opaque = g_new(VirtualConsole, 1);
|
||||
|
||||
/* defer OPENED events until our vc is fully initialized */
|
||||
chr->explicit_be_open = true;
|
||||
|
||||
@ -1610,6 +1622,24 @@ static gboolean gd_vc_in(VteTerminal *terminal, gchar *text, guint size,
|
||||
{
|
||||
VirtualConsole *vc = user_data;
|
||||
|
||||
if (vc->vte.echo) {
|
||||
VteTerminal *term = VTE_TERMINAL(vc->vte.terminal);
|
||||
int i;
|
||||
for (i = 0; i < size; i++) {
|
||||
uint8_t c = text[i];
|
||||
if (c >= 128 || isprint(c)) {
|
||||
/* 8-bit characters are considered printable. */
|
||||
vte_terminal_feed(term, &text[i], 1);
|
||||
} else if (c == '\r' || c == '\n') {
|
||||
vte_terminal_feed(term, "\r\n", 2);
|
||||
} else {
|
||||
char ctrl[2] = { '^', 0};
|
||||
ctrl[1] = text[i] ^ 64;
|
||||
vte_terminal_feed(term, ctrl, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qemu_chr_be_write(vc->vte.chr, (uint8_t *)text, (unsigned int)size);
|
||||
return TRUE;
|
||||
}
|
||||
@ -1622,9 +1652,14 @@ static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||
GtkWidget *box;
|
||||
GtkWidget *scrollbar;
|
||||
GtkAdjustment *vadjustment;
|
||||
VirtualConsole *tmp_vc = chr->opaque;
|
||||
|
||||
vc->s = s;
|
||||
vc->vte.echo = tmp_vc->vte.echo;
|
||||
|
||||
vc->vte.chr = chr;
|
||||
chr->opaque = vc;
|
||||
g_free(tmp_vc);
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "vc%d", idx);
|
||||
vc->label = g_strdup_printf("%s", vc->vte.chr->label
|
||||
@ -1634,6 +1669,15 @@ static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||
vc->vte.terminal = vte_terminal_new();
|
||||
g_signal_connect(vc->vte.terminal, "commit", G_CALLBACK(gd_vc_in), vc);
|
||||
|
||||
/* The documentation says that the default is UTF-8, but actually it is
|
||||
* 7-bit ASCII at least in VTE 0.38.
|
||||
*/
|
||||
#if VTE_CHECK_VERSION(0, 40, 0)
|
||||
vte_terminal_set_encoding(VTE_TERMINAL(vc->vte.terminal), "UTF-8", NULL);
|
||||
#else
|
||||
vte_terminal_set_encoding(VTE_TERMINAL(vc->vte.terminal), "UTF-8");
|
||||
#endif
|
||||
|
||||
vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->vte.terminal), -1);
|
||||
vte_terminal_set_size(VTE_TERMINAL(vc->vte.terminal),
|
||||
VC_TERM_X_MIN, VC_TERM_Y_MIN);
|
||||
@ -1656,7 +1700,6 @@ static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||
gtk_box_pack_start(GTK_BOX(box), vc->vte.terminal, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(box), scrollbar, FALSE, FALSE, 0);
|
||||
|
||||
vc->vte.chr->opaque = vc;
|
||||
vc->vte.box = box;
|
||||
vc->vte.scrollbar = scrollbar;
|
||||
|
||||
|
@ -727,8 +727,7 @@ void qemu_spice_init(void)
|
||||
qemu_spice_set_passwd(password, false, false);
|
||||
}
|
||||
if (qemu_opt_get_bool(opts, "sasl", 0)) {
|
||||
if (spice_server_set_sasl_appname(spice_server, "qemu") == -1 ||
|
||||
spice_server_set_sasl(spice_server, 1) == -1) {
|
||||
if (spice_server_set_sasl(spice_server, 1) == -1) {
|
||||
error_report("spice: failed to enable sasl");
|
||||
exit(1);
|
||||
}
|
||||
@ -794,6 +793,7 @@ void qemu_spice_init(void)
|
||||
|
||||
seamless_migration = qemu_opt_get_bool(opts, "seamless-migration", 0);
|
||||
spice_server_set_seamless_migration(spice_server, seamless_migration);
|
||||
spice_server_set_sasl_appname(spice_server, "qemu");
|
||||
if (spice_server_init(spice_server, &core_interface) != 0) {
|
||||
error_report("failed to initialize spice server");
|
||||
exit(1);
|
||||
|
3
ui/vnc.c
3
ui/vnc.c
@ -3134,6 +3134,7 @@ static void vnc_display_close(VncDisplay *vs)
|
||||
vs->subauth = VNC_AUTH_INVALID;
|
||||
if (vs->tlscreds) {
|
||||
object_unparent(OBJECT(vs->tlscreds));
|
||||
vs->tlscreds = NULL;
|
||||
}
|
||||
g_free(vs->tlsaclname);
|
||||
vs->tlsaclname = NULL;
|
||||
@ -3605,7 +3606,7 @@ void vnc_display_open(const char *id, Error **errp)
|
||||
qemu_opt_get(opts, "x509") ||
|
||||
qemu_opt_get(opts, "x509verify")) {
|
||||
error_setg(errp,
|
||||
"'credid' parameter is mutually exclusive with "
|
||||
"'tls-creds' parameter is mutually exclusive with "
|
||||
"'tls', 'x509' and 'x509verify' parameters");
|
||||
goto fail;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user