aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-hid.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-01-05 16:42:13 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-01-05 16:42:13 +0000
commit455204eb1a0880a5e4474acf07d4641f51123a1d (patch)
treebfd45c2e35a33fe1289de48263177e111ff4ee7d /hw/usb-hid.c
parent6f30fa853b78203c3a03c91470b7d2d12f46955a (diff)
Dynamic handling of guest mice, by Lonnie Mendez.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2290 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/usb-hid.c')
-rw-r--r--hw/usb-hid.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 095fcb3e6c..bde3a7c67c 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -39,6 +39,7 @@ typedef struct USBMouseState {
int x, y;
int kind;
int mouse_grabbed;
+ QEMUPutMouseEntry *eh_entry;
} USBMouseState;
/* mostly the same values as the Bochs USB Mouse device */
@@ -259,7 +260,8 @@ static int usb_mouse_poll(USBMouseState *s, uint8_t *buf, int len)
int dx, dy, dz, b, l;
if (!s->mouse_grabbed) {
- qemu_add_mouse_event_handler(usb_mouse_event, s, 0);
+ s->eh_entry = qemu_add_mouse_event_handler(usb_mouse_event, s,
+ 0, "QEMU USB Mouse");
s->mouse_grabbed = 1;
}
@@ -295,7 +297,8 @@ static int usb_tablet_poll(USBMouseState *s, uint8_t *buf, int len)
int dz, b, l;
if (!s->mouse_grabbed) {
- qemu_add_mouse_event_handler(usb_tablet_event, s, 1);
+ s->eh_entry = qemu_add_mouse_event_handler(usb_tablet_event, s,
+ 1, "QEMU USB Tablet");
s->mouse_grabbed = 1;
}
@@ -503,7 +506,7 @@ static void usb_mouse_handle_destroy(USBDevice *dev)
{
USBMouseState *s = (USBMouseState *)dev;
- qemu_add_mouse_event_handler(NULL, NULL, 0);
+ qemu_remove_mouse_event_handler(s->eh_entry);
qemu_free(s);
}