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>
This commit is contained in:
Marc-André Lureau
2026-03-16 12:40:16 +04:00
parent d4895fb4bf
commit 8f95c4053b
4 changed files with 26 additions and 3 deletions

View File

@@ -48,7 +48,7 @@ vnc_ss.add(files(
vnc_ss.add(zlib, jpeg, png)
vnc_ss.add(when: sasl, if_true: files('vnc-auth-sasl.c'))
system_ss.add_all(when: [vnc, pixman], if_true: vnc_ss)
system_ss.add(when: vnc, if_false: files('vnc-stubs.c'))
system_ss.add(when: vnc, if_true: files('vnc-system.c'), if_false: files('vnc-stubs.c'))
ui_modules = {}

19
ui/vnc-system.c Normal file
View File

@@ -0,0 +1,19 @@
/*
* QEMU VNC display driver
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "qemu/osdep.h"
#include "ui/vnc.h"
#include "system/runstate.h"
void vnc_action_shutdown(VncState *vs)
{
qemu_system_powerdown_request();
}
void vnc_action_reset(VncState *vs)
{
qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET);
}

View File

@@ -2522,13 +2522,13 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
switch (action) {
case VNC_XVP_ACTION_SHUTDOWN:
qemu_system_powerdown_request();
vnc_action_shutdown(vs);
break;
case VNC_XVP_ACTION_REBOOT:
send_xvp_message(vs, VNC_XVP_CODE_FAIL);
break;
case VNC_XVP_ACTION_RESET:
qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET);
vnc_action_reset(vs);
break;
default:
send_xvp_message(vs, VNC_XVP_CODE_FAIL);

View File

@@ -648,4 +648,8 @@ void vnc_server_cut_text_caps(VncState *vs);
void vnc_client_cut_text(VncState *vs, size_t len, uint8_t *text);
void vnc_client_cut_text_ext(VncState *vs, int32_t len, uint32_t flags, uint8_t *data);
/* XVP events */
void vnc_action_shutdown(VncState *vs);
void vnc_action_reset(VncState *vs);
#endif /* QEMU_VNC_H */