aboutsummaryrefslogtreecommitdiff
path: root/ui/vnc.h
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2023-12-07 13:45:01 +0000
committerDaniel P. Berrangé <berrange@redhat.com>2024-02-09 12:48:02 +0000
commit0e74eb86eaf3ef57e9f9741cb668784c96e654ff (patch)
tree896e77a63f4d28e7cec532702280855cb4eb6257 /ui/vnc.h
parent03e471c41d8b1b6eb16c9714f387449f52fe5c1d (diff)
downloadqemu-0e74eb86eaf3ef57e9f9741cb668784c96e654ff.zip
qemu-0e74eb86eaf3ef57e9f9741cb668784c96e654ff.tar.gz
qemu-0e74eb86eaf3ef57e9f9741cb668784c96e654ff.tar.bz2
ui: drop VNC feature _MASK constants
Each VNC feature enum entry has a corresponding _MASK constant which is the bit-shifted value. It is very easy for contributors to accidentally use the _MASK constant, instead of the non-_MASK constant, or the reverse. No compiler warning is possible and it'll just silently do the wrong thing at runtime. By introducing the vnc_set_feature helper method, we can drop all the _MASK constants and thus prevent any future accidents. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'ui/vnc.h')
-rw-r--r--ui/vnc.h22
1 files changed, 5 insertions, 17 deletions
diff --git a/ui/vnc.h b/ui/vnc.h
index 96d19dc..4521dc8 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -467,23 +467,6 @@ enum VncFeatures {
VNC_FEATURE_AUDIO,
};
-#define VNC_FEATURE_RESIZE_MASK (1 << VNC_FEATURE_RESIZE)
-#define VNC_FEATURE_RESIZE_EXT_MASK (1 << VNC_FEATURE_RESIZE_EXT)
-#define VNC_FEATURE_HEXTILE_MASK (1 << VNC_FEATURE_HEXTILE)
-#define VNC_FEATURE_POINTER_TYPE_CHANGE_MASK (1 << VNC_FEATURE_POINTER_TYPE_CHANGE)
-#define VNC_FEATURE_WMVI_MASK (1 << VNC_FEATURE_WMVI)
-#define VNC_FEATURE_TIGHT_MASK (1 << VNC_FEATURE_TIGHT)
-#define VNC_FEATURE_ZLIB_MASK (1 << VNC_FEATURE_ZLIB)
-#define VNC_FEATURE_RICH_CURSOR_MASK (1 << VNC_FEATURE_RICH_CURSOR)
-#define VNC_FEATURE_ALPHA_CURSOR_MASK (1 << VNC_FEATURE_ALPHA_CURSOR)
-#define VNC_FEATURE_TIGHT_PNG_MASK (1 << VNC_FEATURE_TIGHT_PNG)
-#define VNC_FEATURE_ZRLE_MASK (1 << VNC_FEATURE_ZRLE)
-#define VNC_FEATURE_ZYWRLE_MASK (1 << VNC_FEATURE_ZYWRLE)
-#define VNC_FEATURE_LED_STATE_MASK (1 << VNC_FEATURE_LED_STATE)
-#define VNC_FEATURE_XVP_MASK (1 << VNC_FEATURE_XVP)
-#define VNC_FEATURE_CLIPBOARD_EXT_MASK (1 << VNC_FEATURE_CLIPBOARD_EXT)
-#define VNC_FEATURE_AUDIO_MASK (1 << VNC_FEATURE_AUDIO)
-
/* Client -> Server message IDs */
#define VNC_MSG_CLIENT_SET_PIXEL_FORMAT 0
@@ -599,6 +582,11 @@ static inline uint32_t vnc_has_feature(VncState *vs, int feature) {
return (vs->features & (1 << feature));
}
+static inline void vnc_set_feature(VncState *vs, enum VncFeatures feature)
+{
+ vs->features |= (1 << feature);
+}
+
/* Framebuffer */
void vnc_framebuffer_update(VncState *vs, int x, int y, int w, int h,
int32_t encoding);