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

Re: [Xen-devel] [PATCH 1/3] xenfb: Unregister keyboard event handler correctly



On Wed, 10 Sep 2014, Owen smith wrote:
> Keyboard event handler was replaced with a new handler on disconnect.
> Use the unregister function to remove keyboard handler.
> 
> Signed-off-by: Owen smith <owen.smith@xxxxxxxxxx>
> ---
>  hw/display/xenfb.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
> index 07ddc9d..2c39753 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,17 +383,26 @@ 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");
> +    qemu_activate_mouse_event_handler(in->qmouse);

This change is not described in the commit message.
Why is this necessary? Is it related to the keyboard change?


> +    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)
>  {
>      struct XenInput *in = container_of(xendev, struct XenInput, c.xendev);
>  
> +    if (in->qkbd) {
> +        qemu_remove_kbd_event_handler(in->qkbd);
> +        in->qkbd = NULL;
> +    }
>      if (in->qmouse) {
>       qemu_remove_mouse_event_handler(in->qmouse);
>       in->qmouse = NULL;
>      }
> -    qemu_add_kbd_event_handler(NULL, 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®.