Revision 03a23a85 input.c

b/input.c
33 33
static void *qemu_put_kbd_event_opaque;
34 34
static QEMUPutMouseEntry *qemu_put_mouse_event_head;
35 35
static QEMUPutMouseEntry *qemu_put_mouse_event_current;
36
static QTAILQ_HEAD(, QEMUPutLEDEntry) led_handlers = QTAILQ_HEAD_INITIALIZER(led_handlers);
36 37

  
37 38
void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque)
38 39
{
......
102 103
    qemu_free(entry);
103 104
}
104 105

  
106
QEMUPutLEDEntry *qemu_add_led_event_handler(QEMUPutLEDEvent *func,
107
                                            void *opaque)
108
{
109
    QEMUPutLEDEntry *s;
110

  
111
    s = qemu_mallocz(sizeof(QEMUPutLEDEntry));
112

  
113
    s->put_led = func;
114
    s->opaque = opaque;
115
    QTAILQ_INSERT_TAIL(&led_handlers, s, next);
116
    return s;
117
}
118

  
119
void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry)
120
{
121
    if (entry == NULL)
122
        return;
123
    QTAILQ_REMOVE(&led_handlers, entry, next);
124
    qemu_free(entry);
125
}
126

  
105 127
void kbd_put_keycode(int keycode)
106 128
{
107 129
    if (qemu_put_kbd_event) {
......
109 131
    }
110 132
}
111 133

  
134
void kbd_put_ledstate(int ledstate)
135
{
136
    QEMUPutLEDEntry *cursor;
137

  
138
    QTAILQ_FOREACH(cursor, &led_handlers, next) {
139
        cursor->put_led(cursor->opaque, ledstate);
140
    }
141
}
142

  
112 143
void kbd_mouse_event(int dx, int dy, int dz, int buttons_state)
113 144
{
114 145
    QEMUPutMouseEvent *mouse_event;

Also available in: Unified diff