if (!s->mouse_grabbed) {
s->eh_entry = qemu_add_mouse_event_handler(usb_mouse_event, s, 0,
"QEMU PenPartner tablet");
+ qemu_activate_mouse_event_handler(s->eh_entry);
s->mouse_grabbed = 1;
}
if (!s->mouse_grabbed) {
s->eh_entry = qemu_add_mouse_event_handler(usb_wacom_event, s, 1,
"QEMU PenPartner tablet");
+ qemu_activate_mouse_event_handler(s->eh_entry);
s->mouse_grabbed = 1;
}
ret = 0;
break;
case WACOM_SET_REPORT:
- qemu_remove_mouse_event_handler(s->eh_entry);
- s->mouse_grabbed = 0;
+ if (s->mouse_grabbed) {
+ qemu_remove_mouse_event_handler(s->eh_entry);
+ s->mouse_grabbed = 0;
+ }
s->mode = data[0];
ret = 0;
break;
{
USBWacomState *s = (USBWacomState *) dev;
- qemu_remove_mouse_event_handler(s->eh_entry);
+ if (s->mouse_grabbed) {
+ qemu_remove_mouse_event_handler(s->eh_entry);
+ s->mouse_grabbed = 0;
+ }
}
static int usb_wacom_initfn(USBDevice *dev)