qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 1/3] vnc: move check into vnc_cursor_define


From: Daniel P . Berrangé
Subject: Re: [PATCH v3 1/3] vnc: move check into vnc_cursor_define
Date: Thu, 14 Jan 2021 17:33:33 +0000
User-agent: Mutt/1.14.6 (2020-07-11)

On Tue, Jan 12, 2021 at 02:41:18PM +0100, Gerd Hoffmann wrote:
> Move the check whenever a cursor exists into the vnc_cursor_define()
> function so callers don't have to do it.
> 
> Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  ui/vnc.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

> 
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 7452ac7df2ce..84c4972b895b 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -792,9 +792,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
>      QTAILQ_FOREACH(vs, &vd->clients, next) {
>          vnc_colordepth(vs);
>          vnc_desktop_resize(vs);
> -        if (vs->vd->cursor) {
> -            vnc_cursor_define(vs);
> -        }
> +        vnc_cursor_define(vs);
>          memset(vs->dirty, 0x00, sizeof(vs->dirty));
>          vnc_set_area_dirty(vs->dirty, vd, 0, 0,
>                             vnc_width(vd),
> @@ -928,6 +926,10 @@ static int vnc_cursor_define(VncState *vs)
>      QEMUCursor *c = vs->vd->cursor;
>      int isize;
>  
> +    if (!vs->vd->cursor) {
> +        return -1;
> +    }

None of the callers check the return value, so we could just
make this function void, as a future cleanup patch.

> +
>      if (vnc_has_feature(vs, VNC_FEATURE_ALPHA_CURSOR)) {
>          vnc_lock_output(vs);
>          vnc_write_u8(vs,  VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
> @@ -2137,9 +2139,7 @@ static void set_encodings(VncState *vs, int32_t 
> *encodings, size_t n_encodings)
>      vnc_desktop_resize(vs);
>      check_pointer_type_change(&vs->mouse_mode_notifier, NULL);
>      vnc_led_state_change(vs);
> -    if (vs->vd->cursor) {
> -        vnc_cursor_define(vs);
> -    }
> +    vnc_cursor_define(vs);
>  }
>  
>  static void set_pixel_conversion(VncState *vs)
> -- 
> 2.29.2
> 
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]