diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-03-06 11:53:27 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-03-06 11:53:27 +0000 |
commit | 1464ad45cd6cdeb0b5c1a54d3d3791396e47e52f (patch) | |
tree | 12e5fa81ad1f1cf455c598a5351c1b4248b38b84 /ui | |
parent | 3c0f12df65da872d5fbccae469f2cb21ed1c03b7 (diff) | |
parent | 48eb62a74fc2d6b0ae9e5f414304a85cfbf33066 (diff) | |
download | qemu-1464ad45cd6cdeb0b5c1a54d3d3791396e47e52f.zip qemu-1464ad45cd6cdeb0b5c1a54d3d3791396e47e52f.tar.gz qemu-1464ad45cd6cdeb0b5c1a54d3d3791396e47e52f.tar.bz2 |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2016-03-04' into staging
QAPI patches for 2016-03-04
# gpg: Signature made Sat 05 Mar 2016 09:47:19 GMT using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>"
* remotes/armbru/tags/pull-qapi-2016-03-04:
qapi: Drop useless 'data' member of unions
chardev: Drop useless ChardevDummy type
qapi: Avoid use of 'data' member of QAPI unions
ui: Shorten references into InputEvent
util: Shorten references into SocketAddress
chardev: Shorten references into ChardevBackend
qapi: Update docs to match recent generator changes
qapi-visit: Expose visit_type_FOO_members()
qapi: Rename 'fields' to 'members' in generated C code
qapi: Rename 'fields' to 'members' in generator
qapi-dealloc: Reduce use outside of generated code
qmp-shell: fix pretty printing of JSON responses
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/input-legacy.c | 25 | ||||
-rw-r--r-- | ui/input.c | 56 | ||||
-rw-r--r-- | ui/vnc.c | 39 |
3 files changed, 67 insertions, 53 deletions
diff --git a/ui/input-legacy.c b/ui/input-legacy.c index 703f0a6..f1c5cb4a 100644 --- a/ui/input-legacy.c +++ b/ui/input-legacy.c @@ -110,12 +110,13 @@ static void legacy_kbd_event(DeviceState *dev, QemuConsole *src, { QEMUPutKbdEntry *entry = (QEMUPutKbdEntry *)dev; int scancodes[3], i, count; + InputKeyEvent *key = evt->u.key; if (!entry || !entry->put_kbd) { return; } - count = qemu_input_key_value_to_scancode(evt->u.key->key, - evt->u.key->down, + count = qemu_input_key_value_to_scancode(key->key, + key->down, scancodes); for (i = 0; i < count; i++) { entry->put_kbd(entry->opaque, scancodes[i]); @@ -150,23 +151,25 @@ static void legacy_mouse_event(DeviceState *dev, QemuConsole *src, [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON, }; QEMUPutMouseEntry *s = (QEMUPutMouseEntry *)dev; + InputBtnEvent *btn; + InputMoveEvent *move; switch (evt->type) { case INPUT_EVENT_KIND_BTN: - if (evt->u.btn->down) { - s->buttons |= bmap[evt->u.btn->button]; + btn = evt->u.btn; + if (btn->down) { + s->buttons |= bmap[btn->button]; } else { - s->buttons &= ~bmap[evt->u.btn->button]; + s->buttons &= ~bmap[btn->button]; } - if (evt->u.btn->down && evt->u.btn->button == INPUT_BUTTON_WHEEL_UP) { + if (btn->down && btn->button == INPUT_BUTTON_WHEEL_UP) { s->qemu_put_mouse_event(s->qemu_put_mouse_event_opaque, s->axis[INPUT_AXIS_X], s->axis[INPUT_AXIS_Y], -1, s->buttons); } - if (evt->u.btn->down && - evt->u.btn->button == INPUT_BUTTON_WHEEL_DOWN) { + if (btn->down && btn->button == INPUT_BUTTON_WHEEL_DOWN) { s->qemu_put_mouse_event(s->qemu_put_mouse_event_opaque, s->axis[INPUT_AXIS_X], s->axis[INPUT_AXIS_Y], @@ -175,10 +178,12 @@ static void legacy_mouse_event(DeviceState *dev, QemuConsole *src, } break; case INPUT_EVENT_KIND_ABS: - s->axis[evt->u.abs->axis] = evt->u.abs->value; + move = evt->u.abs; + s->axis[move->axis] = move->value; break; case INPUT_EVENT_KIND_REL: - s->axis[evt->u.rel->axis] += evt->u.rel->value; + move = evt->u.rel; + s->axis[move->axis] += move->value; break; default: break; @@ -166,24 +166,25 @@ void qmp_input_send_event(bool has_device, const char *device, static void qemu_input_transform_abs_rotate(InputEvent *evt) { + InputMoveEvent *move = evt->u.abs; switch (graphic_rotate) { case 90: - if (evt->u.abs->axis == INPUT_AXIS_X) { - evt->u.abs->axis = INPUT_AXIS_Y; - } else if (evt->u.abs->axis == INPUT_AXIS_Y) { - evt->u.abs->axis = INPUT_AXIS_X; - evt->u.abs->value = INPUT_EVENT_ABS_SIZE - 1 - evt->u.abs->value; + if (move->axis == INPUT_AXIS_X) { + move->axis = INPUT_AXIS_Y; + } else if (move->axis == INPUT_AXIS_Y) { + move->axis = INPUT_AXIS_X; + move->value = INPUT_EVENT_ABS_SIZE - 1 - move->value; } break; case 180: - evt->u.abs->value = INPUT_EVENT_ABS_SIZE - 1 - evt->u.abs->value; + move->value = INPUT_EVENT_ABS_SIZE - 1 - move->value; break; case 270: - if (evt->u.abs->axis == INPUT_AXIS_X) { - evt->u.abs->axis = INPUT_AXIS_Y; - evt->u.abs->value = INPUT_EVENT_ABS_SIZE - 1 - evt->u.abs->value; - } else if (evt->u.abs->axis == INPUT_AXIS_Y) { - evt->u.abs->axis = INPUT_AXIS_X; + if (move->axis == INPUT_AXIS_X) { + move->axis = INPUT_AXIS_Y; + move->value = INPUT_EVENT_ABS_SIZE - 1 - move->value; + } else if (move->axis == INPUT_AXIS_Y) { + move->axis = INPUT_AXIS_X; } break; } @@ -193,22 +194,26 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt) { const char *name; int qcode, idx = -1; + InputKeyEvent *key; + InputBtnEvent *btn; + InputMoveEvent *move; if (src) { idx = qemu_console_get_index(src); } switch (evt->type) { case INPUT_EVENT_KIND_KEY: - switch (evt->u.key->key->type) { + key = evt->u.key; + switch (key->key->type) { case KEY_VALUE_KIND_NUMBER: - qcode = qemu_input_key_number_to_qcode(evt->u.key->key->u.number); + qcode = qemu_input_key_number_to_qcode(key->key->u.number); name = QKeyCode_lookup[qcode]; - trace_input_event_key_number(idx, evt->u.key->key->u.number, - name, evt->u.key->down); + trace_input_event_key_number(idx, key->key->u.number, + name, key->down); break; case KEY_VALUE_KIND_QCODE: - name = QKeyCode_lookup[evt->u.key->key->u.qcode]; - trace_input_event_key_qcode(idx, name, evt->u.key->down); + name = QKeyCode_lookup[key->key->u.qcode]; + trace_input_event_key_qcode(idx, name, key->down); break; case KEY_VALUE_KIND__MAX: /* keep gcc happy */ @@ -216,16 +221,19 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt) } break; case INPUT_EVENT_KIND_BTN: - name = InputButton_lookup[evt->u.btn->button]; - trace_input_event_btn(idx, name, evt->u.btn->down); + btn = evt->u.btn; + name = InputButton_lookup[btn->button]; + trace_input_event_btn(idx, name, btn->down); break; case INPUT_EVENT_KIND_REL: - name = InputAxis_lookup[evt->u.rel->axis]; - trace_input_event_rel(idx, name, evt->u.rel->value); + move = evt->u.rel; + name = InputAxis_lookup[move->axis]; + trace_input_event_rel(idx, name, move->value); break; case INPUT_EVENT_KIND_ABS: - name = InputAxis_lookup[evt->u.abs->axis]; - trace_input_event_abs(idx, name, evt->u.abs->value); + move = evt->u.abs; + name = InputAxis_lookup[move->axis]; + trace_input_event_abs(idx, name, move->value); break; case INPUT_EVENT_KIND__MAX: /* keep gcc happy */ @@ -462,7 +470,7 @@ InputEvent *qemu_input_event_new_move(InputEventKind kind, InputMoveEvent *move = g_new0(InputMoveEvent, 1); evt->type = kind; - evt->u.data = move; + evt->u.rel = move; /* evt->u.rel is the same as evt->u.abs */ move->axis = axis; move->value = value; return evt; @@ -3530,12 +3530,13 @@ void vnc_display_open(const char *id, Error **errp) } } else { unsigned long long baseport; + InetSocketAddress *inet; saddr->type = SOCKET_ADDRESS_KIND_INET; - saddr->u.inet = g_new0(InetSocketAddress, 1); + inet = saddr->u.inet = g_new0(InetSocketAddress, 1); if (vnc[0] == '[' && vnc[hlen - 1] == ']') { - saddr->u.inet->host = g_strndup(vnc + 1, hlen - 2); + inet->host = g_strndup(vnc + 1, hlen - 2); } else { - saddr->u.inet->host = g_strndup(vnc, hlen); + inet->host = g_strndup(vnc, hlen); } if (parse_uint_full(h + 1, &baseport, 10) < 0) { error_setg(errp, "can't convert to a number: %s", h + 1); @@ -3546,32 +3547,32 @@ void vnc_display_open(const char *id, Error **errp) error_setg(errp, "port %s out of range", h + 1); goto fail; } - saddr->u.inet->port = g_strdup_printf( + inet->port = g_strdup_printf( "%d", (int)baseport + 5900); if (to) { - saddr->u.inet->has_to = true; - saddr->u.inet->to = to + 5900; + inet->has_to = true; + inet->to = to + 5900; } - saddr->u.inet->ipv4 = ipv4; - saddr->u.inet->has_ipv4 = has_ipv4; - saddr->u.inet->ipv6 = ipv6; - saddr->u.inet->has_ipv6 = has_ipv6; + inet->ipv4 = ipv4; + inet->has_ipv4 = has_ipv4; + inet->ipv6 = ipv6; + inet->has_ipv6 = has_ipv6; if (vs->ws_enabled) { wsaddr->type = SOCKET_ADDRESS_KIND_INET; - wsaddr->u.inet = g_new0(InetSocketAddress, 1); - wsaddr->u.inet->host = g_strdup(saddr->u.inet->host); - wsaddr->u.inet->port = g_strdup(websocket); + inet = wsaddr->u.inet = g_new0(InetSocketAddress, 1); + inet->host = g_strdup(saddr->u.inet->host); + inet->port = g_strdup(websocket); if (to) { - wsaddr->u.inet->has_to = true; - wsaddr->u.inet->to = to; + inet->has_to = true; + inet->to = to; } - wsaddr->u.inet->ipv4 = ipv4; - wsaddr->u.inet->has_ipv4 = has_ipv4; - wsaddr->u.inet->ipv6 = ipv6; - wsaddr->u.inet->has_ipv6 = has_ipv6; + inet->ipv4 = ipv4; + inet->has_ipv4 = has_ipv4; + inet->ipv6 = ipv6; + inet->has_ipv6 = has_ipv6; } } } else { |