aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-04-01 16:58:04 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-04-01 16:58:04 +0100
commit507979a8bda895d56d02112907ccbca753dbbdce (patch)
tree39f8e2c54fffb8752300adf7d3a27ac3e5700007
parent95224e87a71d3190f46bf543ec9bc59ae36050eb (diff)
parentbdcc3a28b7f6ed6b90ad8b8af7b5d17e0d3f1f06 (diff)
downloadqemu-507979a8bda895d56d02112907ccbca753dbbdce.zip
qemu-507979a8bda895d56d02112907ccbca753dbbdce.tar.gz
qemu-507979a8bda895d56d02112907ccbca753dbbdce.tar.bz2
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>
-rw-r--r--trace-events2
-rw-r--r--ui/input.c19
2 files changed, 15 insertions, 6 deletions
diff --git a/trace-events b/trace-events
index 3df3f32..9303245 100644
--- a/trace-events
+++ b/trace-events
@@ -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"
diff --git a/ui/input.c b/ui/input.c
index 2761911..1ed0e78 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -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();