@samitouri / QOSamiQemu / commits / 8f95c4053b

ui/vnc: add vnc-system unit, to allow different implementations

The qemu-vnc server will want to signal the XVP requests, let it have its own implementation. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Marc-André Lureau committed Mar 16, 2026 at 12:40 UTC 8f95c4053b51a5b665abfb628876039455798ff0
4 files changed +26 -3
ui/meson.build
+1 -1
@@ -48,7 +48,7 @@ vnc_ss.add(files(
48 vnc_ss.add(zlib, jpeg, png)
49 vnc_ss.add(when: sasl, if_true: files('vnc-auth-sasl.c'))
50 system_ss.add_all(when: [vnc, pixman], if_true: vnc_ss)
51 -system_ss.add(when: vnc, if_false: files('vnc-stubs.c'))
51 +system_ss.add(when: vnc, if_true: files('vnc-system.c'), if_false: files('vnc-stubs.c'))
52
53 ui_modules = {}
54
ui/vnc-system.c new
+19
@@ -0,0 +1,19 @@
1 +/*
2 + * QEMU VNC display driver
3 + *
4 + * SPDX-License-Identifier: GPL-2.0-or-later
5 + */
6 +#include "qemu/osdep.h"
7 +
8 +#include "ui/vnc.h"
9 +#include "system/runstate.h"
10 +
11 +void vnc_action_shutdown(VncState *vs)
12 +{
13 + qemu_system_powerdown_request();
14 +}
15 +
16 +void vnc_action_reset(VncState *vs)
17 +{
18 + qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET);
19 +}
ui/vnc.c
+2 -2
@@ -2522,13 +2522,13 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
2522
2523 switch (action) {
2524 case VNC_XVP_ACTION_SHUTDOWN:
2525 - qemu_system_powerdown_request();
2525 + vnc_action_shutdown(vs);
2526 break;
2527 case VNC_XVP_ACTION_REBOOT:
2528 send_xvp_message(vs, VNC_XVP_CODE_FAIL);
2529 break;
2530 case VNC_XVP_ACTION_RESET:
2531 - qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET);
2531 + vnc_action_reset(vs);
2532 break;
2533 default:
2534 send_xvp_message(vs, VNC_XVP_CODE_FAIL);
ui/vnc.h
+4
@@ -648,4 +648,8 @@ void vnc_server_cut_text_caps(VncState *vs);
648 void vnc_client_cut_text(VncState *vs, size_t len, uint8_t *text);
649 void vnc_client_cut_text_ext(VncState *vs, int32_t len, uint32_t flags, uint8_t *data);
650
651 +/* XVP events */
652 +void vnc_action_shutdown(VncState *vs);
653 +void vnc_action_reset(VncState *vs);
654 +
655 #endif /* QEMU_VNC_H */