[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 1/5] xenfb: Unregister keyboard event handler correctly



The keyboard event handler was not being removed, a NULL-callback
entry was being added to intercept events. Use the unregister call
to remove the keyboard event handler when appropriate.

Signed-off-by: Owen smith <owen.smith@xxxxxxxxxx>
---
 hw/display/xenfb.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index 07ddc9d..9dcf9b6 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -62,6 +62,7 @@ struct XenInput {
     int abs_pointer_wanted; /* Whether guest supports absolute pointer */
     int button_state;       /* Last seen pointer button state */
     int extended;
+    QEMUPutKbdEntry *qkbd;
     QEMUPutMouseEntry *qmouse;
 };
 
@@ -364,7 +365,6 @@ static int input_initialise(struct XenDevice *xendev)
     if (rc != 0)
        return rc;
 
-    qemu_add_kbd_event_handler(xenfb_key_event, in);
     return 0;
 }
 
@@ -383,6 +383,11 @@ static void input_connected(struct XenDevice *xendev)
     in->qmouse = qemu_add_mouse_event_handler(xenfb_mouse_event, in,
                                              in->abs_pointer_wanted,
                                              "Xen PVFB Mouse");
+
+    if (in->qkbd) {
+        qemu_remove_kbd_event_handler(in->qkbd);
+    }
+    in->qkbd = qemu_add_kbd_event_handler(xenfb_key_event, in);
 }
 
 static void input_disconnect(struct XenDevice *xendev)
@@ -393,7 +398,10 @@ static void input_disconnect(struct XenDevice *xendev)
        qemu_remove_mouse_event_handler(in->qmouse);
        in->qmouse = NULL;
     }
-    qemu_add_kbd_event_handler(NULL, NULL);
+    if (in->qkbd) {
+        qemu_remove_kbd_event_handler(in->qkbd);
+        in->qkbd = NULL;
+    }
     common_unbind(&in->c);
 }
 
-- 
2.1.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.