The qemu-vnc server will want to signal the XVP requests, let it have its own implementation.
Signed-off-by: Marc-André Lureau <[email protected]> --- ui/vnc.h | 4 ++++ ui/vnc-system.c | 19 +++++++++++++++++++ ui/vnc.c | 4 ++-- ui/meson.build | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ui/vnc.h b/ui/vnc.h index 6afe0f16d12..1db9747599c 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -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 */ diff --git a/ui/vnc-system.c b/ui/vnc-system.c new file mode 100644 index 00000000000..0632885f655 --- /dev/null +++ b/ui/vnc-system.c @@ -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); +} diff --git a/ui/vnc.c b/ui/vnc.c index c38be7113f1..fe2659a39ca 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2520,13 +2520,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); diff --git a/ui/meson.build b/ui/meson.build index b31ddf96282..f959f8972b5 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -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 = {} -- 2.53.0
