input bugfixes for 2.0

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTOoP7AAoJEEy22O7T6HE43/cQAL137RodyAnxFdAqgTMJijdK
 nijcm5liqzZ7VHfAFRlaTQZBCO3iPVddDMxqgnFgo33bL2uJryKFeThmOlOScKWR
 J3oIH8VF0B8BUFpfAfN9UZ/Zso6ZImG4moAyypWtKMHjaWdjyE+B4pnKeNTuATyO
 xfbSHRvoTuaxhc7FoJNSwLbgd6D9eYswp7l6TkhUl1X1q+yB4wVcefzXDOgTweb2
 8kmJ6HGIu+A55KHz23qtgVrJlPP1bOtz3gqm/mdNoGtgmnw+NxRrqEuE6BK4ZSqu
 NegI31PSEjdA80XvnH5ebMSsvdFbuO9N81li0Jl4v83gC4Kod/Llg4CPnCRSnvu6
 stkB8nh+ahMdokVF7hH72DQM9Sim3zpMlJtq2afBj/+WmtA1xMw+B4Z85tCjMWjS
 rezgedmUDrI2F1NUlzRApkR9l12R0E0uQUTNa9WYm9FCjR26uUJD6mekWZcNi7Mn
 VbUgg/52zHcqxOmftA2kqhMtjPgWtr4CxZ7UqPtDN1zJqmJCGridSWrTFr6xog3U
 h4ZyD/jjpYr4d8PFv4CU9veuxVK0KGY6iHM8iE51c5ohnrLL6HXdccZu8Bzl9GDZ
 tT166lOlexyvu9/R3hg493UMyT0+MSh4PT96w50SnJAxg3AU89JOvcAfnaeSjy/8
 XrlM45uR9sD8T78cfgP2
 =4rVw
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-7' into staging

input bugfixes for 2.0

# gpg: Signature made Tue 01 Apr 2014 10:16:43 BST 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-input-7:
  input: add sanity check
  input: mouse_set should check input device type.
  input: fix input_event_key_number trace event

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-04-01 16:58:04 +01:00
commit 507979a8bd
2 changed files with 15 additions and 6 deletions

View File

@ -1022,7 +1022,7 @@ gd_update(int x, int y, int w, int h) "x=%d, y=%d, w=%d, h=%d"
gd_key_event(int gdk_keycode, int qemu_keycode, const char *action) "translated GDK keycode %d to QEMU keycode %d (%s)"
# ui/input.c
input_event_key_number(int conidx, int number, bool down) "con %d, key number 0x%d, down %d"
input_event_key_number(int conidx, int number, bool down) "con %d, key number 0x%x, down %d"
input_event_key_qcode(int conidx, const char *qcode, bool down) "con %d, key qcode %s, down %d"
input_event_btn(int conidx, const char *btn, bool down) "con %d, button %s, down %d"
input_event_rel(int conidx, const char *axis, int value) "con %d, axis %s, value %d"

View File

@ -143,6 +143,9 @@ void qemu_input_event_send(QemuConsole *src, InputEvent *evt)
/* send event */
s = qemu_input_find_handler(1 << evt->kind);
if (!s) {
return;
}
s->handler->event(s->dev, src, evt);
s->events++;
}
@ -342,15 +345,21 @@ void do_mouse_set(Monitor *mon, const QDict *qdict)
int found = 0;
QTAILQ_FOREACH(s, &handlers, node) {
if (s->id == index) {
found = 1;
qemu_input_handler_activate(s);
break;
if (s->id != index) {
continue;
}
if (!(s->handler->mask & (INPUT_EVENT_MASK_REL |
INPUT_EVENT_MASK_ABS))) {
error_report("Input device '%s' is not a mouse", s->handler->name);
return;
}
found = 1;
qemu_input_handler_activate(s);
break;
}
if (!found) {
monitor_printf(mon, "Mouse at given index not found\n");
error_report("Mouse at index '%d' not found", index);
}
qemu_input_check_mode_change();