[PATCH xserver] xwayland: clear cursor frame callback

Pekka Paalanen ppaalanen at gmail.com
Mon Mar 6 14:33:19 UTC 2017


On Mon,  6 Mar 2017 15:03:53 +0100
Olivier Fourdan <ofourdan at redhat.com> wrote:

> After an X cursor is unrealized, the seat's corresponding x_cursor is
> cleared, but if a frame callback was pending at the time, it will
> remain and thus prevent any further cursor update, leaving the window
> with no cursor.
> 
> Make sure to destroy the frame callback if any when that occurs, so that
> next time a cursor needs to be set, it won't be ignored for a frame
> callback that will never be triggered.
> 
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1389327
> Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
> ---
>  hw/xwayland/xwayland-cursor.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
> index 0c1cd34..12d1fe1 100644
> --- a/hw/xwayland/xwayland-cursor.c
> +++ b/hw/xwayland/xwayland-cursor.c
> @@ -96,14 +96,22 @@ xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
>  }
>  
>  static void
> +clear_frame_callback(struct xwl_seat *xwl_seat)
> +{
> +   if (xwl_seat->cursor_frame_cb) {
> +       wl_callback_destroy (xwl_seat->cursor_frame_cb);
> +       xwl_seat->cursor_frame_cb = NULL;
> +   }
> +}
> +
> +static void
>  frame_callback(void *data,
>                 struct wl_callback *callback,
>                 uint32_t time)
>  {
>      struct xwl_seat *xwl_seat = data;
>  
> -    wl_callback_destroy (xwl_seat->cursor_frame_cb);
> -    xwl_seat->cursor_frame_cb = NULL;
> +    clear_frame_callback(xwl_seat);
>      if (xwl_seat->cursor_needs_update) {
>          xwl_seat->cursor_needs_update = FALSE;
>          xwl_seat_set_cursor(xwl_seat);
> @@ -127,6 +135,8 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
>      if (!xwl_seat->x_cursor) {
>          wl_pointer_set_cursor(xwl_seat->wl_pointer,
>                                xwl_seat->pointer_enter_serial, NULL, 0, 0);
> +        clear_frame_callback(xwl_seat);
> +        xwl_seat->cursor_needs_update = FALSE;
>          return;
>      }
>  

Hi,

the rationale sounds good to me, and the code looks fine though I have
not checked the surrounding code not shown in the patch context.

Would it be better to call it clear_cursor_frame_callback() instead?

In any case:
Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <https://lists.x.org/archives/xorg-devel/attachments/20170306/893002ee/attachment.sig>


More information about the xorg-devel mailing list