On 02/25/2010 08:36 AM, Gerd Hoffmann wrote:
On 02/25/10 15:15, Anthony Liguori wrote:
But I wonder if it really makes sense to treat all of these things
differently since we end up duplicating a lot of code. Would it make
more sense to just introduce:

typedef struct QEMUInputHandler {
void (*put_kbd_event)(QEMUInputHandler *obj, int keycode);
void (*put_led_event)(QEMUInputHandler *obj, int ledstate);
void (*put_mouse_event)(QEMUInputHandler *obj, int dx, int dy, int dz,
int buttons_state);
QLIST_ENTRY(QEMUInputHandler) node;
} QEMUInputHandler;

void qemu_add_input_handler(QEMUInputHandler *handler);
void qemu_remove_input_handler(QEMUInputHandler *handler);

I don't think so. Devil is in the details. Note that kbd_event and mouse_event go to the kbd/mouse drivers, whereas led_event comes from the kbd driver, so they are different albeit related beasts.

Right, I hadn't thought it through enough.

Should led events be part of DisplayChangeListener? I think you could make the argument that it's part of the display state.

Regards,

Anthony Liguori


Also the mouse register/unregister does some extra care to update the pointer to the current mouse device, so we can't easily unify the list management.

Juan's suggestion to use QLISTs makes alot of sense though, will do that.

cheers,
  Gerd




Reply via email to