Diff for /qemu/input.c between versions 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2018/04/24 18:55:39 version 1.1.1.3, 2018/04/24 19:16:41
Line 26 Line 26
 #include "net.h"  #include "net.h"
 #include "monitor.h"  #include "monitor.h"
 #include "console.h"  #include "console.h"
 #include "qjson.h"  #include "error.h"
   #include "qmp-commands.h"
   
 static QEMUPutKBDEvent *qemu_put_kbd_event;  static QEMUPutKBDEvent *qemu_put_kbd_event;
 static void *qemu_put_kbd_event_opaque;  static void *qemu_put_kbd_event_opaque;
Line 73  QEMUPutMouseEntry *qemu_add_mouse_event_ Line 74  QEMUPutMouseEntry *qemu_add_mouse_event_
     QEMUPutMouseEntry *s;      QEMUPutMouseEntry *s;
     static int mouse_index = 0;      static int mouse_index = 0;
   
     s = qemu_mallocz(sizeof(QEMUPutMouseEntry));      s = g_malloc0(sizeof(QEMUPutMouseEntry));
   
     s->qemu_put_mouse_event = func;      s->qemu_put_mouse_event = func;
     s->qemu_put_mouse_event_opaque = opaque;      s->qemu_put_mouse_event_opaque = opaque;
     s->qemu_put_mouse_event_absolute = absolute;      s->qemu_put_mouse_event_absolute = absolute;
     s->qemu_put_mouse_event_name = qemu_strdup(name);      s->qemu_put_mouse_event_name = g_strdup(name);
     s->index = mouse_index++;      s->index = mouse_index++;
   
     QTAILQ_INSERT_TAIL(&mouse_handlers, s, node);      QTAILQ_INSERT_TAIL(&mouse_handlers, s, node);
Line 100  void qemu_remove_mouse_event_handler(QEM Line 101  void qemu_remove_mouse_event_handler(QEM
 {  {
     QTAILQ_REMOVE(&mouse_handlers, entry, node);      QTAILQ_REMOVE(&mouse_handlers, entry, node);
   
     qemu_free(entry->qemu_put_mouse_event_name);      g_free(entry->qemu_put_mouse_event_name);
     qemu_free(entry);      g_free(entry);
   
     check_mode_change();      check_mode_change();
 }  }
Line 111  QEMUPutLEDEntry *qemu_add_led_event_hand Line 112  QEMUPutLEDEntry *qemu_add_led_event_hand
 {  {
     QEMUPutLEDEntry *s;      QEMUPutLEDEntry *s;
   
     s = qemu_mallocz(sizeof(QEMUPutLEDEntry));      s = g_malloc0(sizeof(QEMUPutLEDEntry));
   
     s->put_led = func;      s->put_led = func;
     s->opaque = opaque;      s->opaque = opaque;
Line 124  void qemu_remove_led_event_handler(QEMUP Line 125  void qemu_remove_led_event_handler(QEMUP
     if (entry == NULL)      if (entry == NULL)
         return;          return;
     QTAILQ_REMOVE(&led_handlers, entry, next);      QTAILQ_REMOVE(&led_handlers, entry, next);
     qemu_free(entry);      g_free(entry);
 }  }
   
 void kbd_put_keycode(int keycode)  void kbd_put_keycode(int keycode)
Line 211  int kbd_mouse_has_absolute(void) Line 212  int kbd_mouse_has_absolute(void)
     return 0;      return 0;
 }  }
   
 static void info_mice_iter(QObject *data, void *opaque)  MouseInfoList *qmp_query_mice(Error **errp)
 {  
     QDict *mouse;  
     Monitor *mon = opaque;  
   
     mouse = qobject_to_qdict(data);  
     monitor_printf(mon, "%c Mouse #%" PRId64 ": %s%s\n",  
                   (qdict_get_bool(mouse, "current") ? '*' : ' '),  
                    qdict_get_int(mouse, "index"), qdict_get_str(mouse, "name"),  
                    qdict_get_bool(mouse, "absolute") ? " (absolute)" : "");  
 }  
   
 void do_info_mice_print(Monitor *mon, const QObject *data)  
 {  
     QList *mice_list;  
   
     mice_list = qobject_to_qlist(data);  
     if (qlist_empty(mice_list)) {  
         monitor_printf(mon, "No mouse devices connected\n");  
         return;  
     }  
   
     qlist_iter(mice_list, info_mice_iter, mon);  
 }  
   
 void do_info_mice(Monitor *mon, QObject **ret_data)  
 {  {
       MouseInfoList *mice_list = NULL;
     QEMUPutMouseEntry *cursor;      QEMUPutMouseEntry *cursor;
     QList *mice_list;      bool current = true;
     int current;  
   
     mice_list = qlist_new();  
   
     if (QTAILQ_EMPTY(&mouse_handlers)) {      QTAILQ_FOREACH(cursor, &mouse_handlers, node) {
         goto out;          MouseInfoList *info = g_malloc0(sizeof(*info));
     }          info->value = g_malloc0(sizeof(*info->value));
           info->value->name = g_strdup(cursor->qemu_put_mouse_event_name);
           info->value->index = cursor->index;
           info->value->absolute = !!cursor->qemu_put_mouse_event_absolute;
           info->value->current = current;
   
     current = QTAILQ_FIRST(&mouse_handlers)->index;          current = false;
   
     QTAILQ_FOREACH(cursor, &mouse_handlers, node) {          info->next = mice_list;
         QObject *obj;          mice_list = info;
         obj = qobject_from_jsonf("{ 'name': %s,"  
                                  "  'index': %d,"  
                                  "  'current': %i,"  
                                  "  'absolute': %i }",  
                                  cursor->qemu_put_mouse_event_name,  
                                  cursor->index,  
                                  cursor->index == current,  
                                  !!cursor->qemu_put_mouse_event_absolute);  
         qlist_append_obj(mice_list, obj);  
     }      }
   
 out:      return mice_list;
     *ret_data = QOBJECT(mice_list);  
 }  }
   
 void do_mouse_set(Monitor *mon, const QDict *qdict)  void do_mouse_set(Monitor *mon, const QDict *qdict)

Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3


unix.superglobalmegacorp.com