aboutsummaryrefslogtreecommitdiff
path: root/ui/vnc.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2021-01-12 14:41:18 +0100
committerGerd Hoffmann <kraxel@redhat.com>2021-01-15 11:22:43 +0100
commitb3c2de9cd5bc0023901e7a4d568dfc5152b6cc4a (patch)
tree6da8fe3d20bc2c434f27313f3fef0dd70ba6a352 /ui/vnc.c
parent5f8679fe46d78acfa5fc43a3fd6b3fe95525d9bd (diff)
vnc: move check into vnc_cursor_define
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> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20210112134120.2031837-2-kraxel@redhat.com
Diffstat (limited to 'ui/vnc.c')
-rw-r--r--ui/vnc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ui/vnc.c b/ui/vnc.c
index d4854d351b..0f01481cac 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -793,9 +793,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),
@@ -929,6 +927,10 @@ static int vnc_cursor_define(VncState *vs)
QEMUCursor *c = vs->vd->cursor;
int isize;
+ if (!vs->vd->cursor) {
+ return -1;
+ }
+
if (vnc_has_feature(vs, VNC_FEATURE_ALPHA_CURSOR)) {
vnc_lock_output(vs);
vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
@@ -2155,9 +2157,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)