Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161013-1' into staging
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 13 Oct 2016 13:27:58 +0000 (14:27 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 13 Oct 2016 13:27:58 +0000 (14:27 +0100)
ui: vnc cleanups, input-linux kbd fix.

# gpg: Signature made Thu 13 Oct 2016 09:47:43 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# 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>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/pull-ui-20161013-1:
  input-linux: initialize key state
  ui: rename vnc_init_state to vnc_start_protocol
  ui: move some initialization out of vnc_init_state
  ui: remove bogus call to reset_keys() in vnc_init_state
  ui: remove bogus call to graphic_hw_update() in vnc_listen_io
  ui: refactor method for setting up VncDisplay auth types
  ui: rename misleading 'VncDisplay' variables
  ui: remove 'ws_tls' field from VncState
  ui: remove 'enabled' and 'ws_enabled' fields from VncState
  ui: remove misleading comment from vnc_init_state

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
include/sysemu/char.h
qemu-char.c

index 0d12175..19dad3f 100644 (file)
@@ -107,7 +107,6 @@ struct CharDriverState {
     int explicit_be_open;
     int avail_connections;
     int is_mux;
-    int mux_idx;
     guint fd_in_tag;
     bool replay;
     DECLARE_BITMAP(features, QEMU_CHAR_FEATURE_LAST);
index 721ce21..d83a896 100644 (file)
@@ -165,7 +165,6 @@ CharDriverState *qemu_chr_alloc(ChardevCommon *backend, Error **errp)
     CharDriverState *chr = g_malloc0(sizeof(CharDriverState));
     qemu_mutex_init(&chr->chr_write_lock);
 
-    chr->mux_idx = -1;
     if (backend->has_logfile) {
         int flags = O_WRONLY | O_CREAT;
         if (backend->has_logappend &&
@@ -739,25 +738,17 @@ static void mux_chr_update_read_handler(CharDriverState *chr,
                                         GMainContext *context)
 {
     MuxDriver *d = chr->opaque;
-    int idx;
 
     if (d->mux_cnt >= MAX_MUX) {
         fprintf(stderr, "Cannot add I/O handlers, MUX array is full\n");
         return;
     }
-
-    if (chr->mux_idx == -1) {
-        chr->mux_idx = d->mux_cnt++;
-    }
-
-    idx = chr->mux_idx;
-    d->ext_opaque[idx] = chr->handler_opaque;
-    d->chr_can_read[idx] = chr->chr_can_read;
-    d->chr_read[idx] = chr->chr_read;
-    d->chr_event[idx] = chr->chr_event;
-
+    d->ext_opaque[d->mux_cnt] = chr->handler_opaque;
+    d->chr_can_read[d->mux_cnt] = chr->chr_can_read;
+    d->chr_read[d->mux_cnt] = chr->chr_read;
+    d->chr_event[d->mux_cnt] = chr->chr_event;
     /* Fix up the real driver with mux routines */
-    if (d->mux_cnt == 1) {
+    if (d->mux_cnt == 0) {
         qemu_chr_add_handlers_full(d->drv, mux_chr_can_read,
                                    mux_chr_read,
                                    mux_chr_event,
@@ -766,7 +757,8 @@ static void mux_chr_update_read_handler(CharDriverState *chr,
     if (d->focus != -1) {
         mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_OUT);
     }
-    d->focus = idx;
+    d->focus = d->mux_cnt;
+    d->mux_cnt++;
     mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_IN);
 }