156 |
156 |
#include "balloon.h"
|
157 |
157 |
#include "qemu-option.h"
|
158 |
158 |
#include "qemu-config.h"
|
|
159 |
#include "qemu-objects.h"
|
159 |
160 |
|
160 |
161 |
#include "disas.h"
|
161 |
162 |
|
... | ... | |
490 |
491 |
return qemu_put_mouse_event_current->qemu_put_mouse_event_absolute;
|
491 |
492 |
}
|
492 |
493 |
|
493 |
|
void do_info_mice(Monitor *mon)
|
|
494 |
static void info_mice_iter(QObject *data, void *opaque)
|
|
495 |
{
|
|
496 |
QDict *mouse;
|
|
497 |
Monitor *mon = opaque;
|
|
498 |
|
|
499 |
mouse = qobject_to_qdict(data);
|
|
500 |
monitor_printf(mon, "%c Mouse #%" PRId64 ": %s\n",
|
|
501 |
(qdict_get_bool(mouse, "current") ? '*' : ' '),
|
|
502 |
qdict_get_int(mouse, "index"), qdict_get_str(mouse, "name"));
|
|
503 |
}
|
|
504 |
|
|
505 |
void do_info_mice_print(Monitor *mon, const QObject *data)
|
|
506 |
{
|
|
507 |
QList *mice_list;
|
|
508 |
|
|
509 |
mice_list = qobject_to_qlist(data);
|
|
510 |
if (qlist_empty(mice_list)) {
|
|
511 |
monitor_printf(mon, "No mouse devices connected\n");
|
|
512 |
return;
|
|
513 |
}
|
|
514 |
|
|
515 |
qlist_iter(mice_list, info_mice_iter, mon);
|
|
516 |
}
|
|
517 |
|
|
518 |
/**
|
|
519 |
* do_info_mice(): Show VM mice information
|
|
520 |
*
|
|
521 |
* Each mouse is represented by a QDict, the returned QObject is a QList of
|
|
522 |
* all mice.
|
|
523 |
*
|
|
524 |
* The mouse QDict contains the following:
|
|
525 |
*
|
|
526 |
* - "name": mouse's name
|
|
527 |
* - "index": mouse's index
|
|
528 |
* - "current": true if this mouse is receiving events, false otherwise
|
|
529 |
*
|
|
530 |
* Example:
|
|
531 |
*
|
|
532 |
* [ { "name": "QEMU Microsoft Mouse", "index": 0, "current": false },
|
|
533 |
* { "name": "QEMU PS/2 Mouse", "index": 1, "current": true } ]
|
|
534 |
*/
|
|
535 |
void do_info_mice(Monitor *mon, QObject **ret_data)
|
494 |
536 |
{
|
495 |
537 |
QEMUPutMouseEntry *cursor;
|
|
538 |
QList *mice_list;
|
496 |
539 |
int index = 0;
|
497 |
540 |
|
|
541 |
mice_list = qlist_new();
|
|
542 |
|
498 |
543 |
if (!qemu_put_mouse_event_head) {
|
499 |
|
monitor_printf(mon, "No mouse devices connected\n");
|
500 |
|
return;
|
|
544 |
goto out;
|
501 |
545 |
}
|
502 |
546 |
|
503 |
|
monitor_printf(mon, "Mouse devices available:\n");
|
504 |
547 |
cursor = qemu_put_mouse_event_head;
|
505 |
548 |
while (cursor != NULL) {
|
506 |
|
monitor_printf(mon, "%c Mouse #%d: %s\n",
|
507 |
|
(cursor == qemu_put_mouse_event_current ? '*' : ' '),
|
508 |
|
index, cursor->qemu_put_mouse_event_name);
|
|
549 |
QObject *obj;
|
|
550 |
obj = qobject_from_jsonf("{ 'name': %s, 'index': %d, 'current': %i }",
|
|
551 |
cursor->qemu_put_mouse_event_name,
|
|
552 |
index, cursor == qemu_put_mouse_event_current);
|
|
553 |
qlist_append_obj(mice_list, obj);
|
509 |
554 |
index++;
|
510 |
555 |
cursor = cursor->next;
|
511 |
556 |
}
|
|
557 |
|
|
558 |
out:
|
|
559 |
*ret_data = QOBJECT(mice_list);
|
512 |
560 |
}
|
513 |
561 |
|
514 |
562 |
void do_mouse_set(Monitor *mon, const QDict *qdict)
|