From 78ed6114c86648b20d617e77729a236b7ea20e81 Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Mon, 11 Dec 2023 15:24:28 +0100 Subject: [PATCH] Fix mouse cursor shift --- virtweb_backend/src/actors/libvirt_actor.rs | 6 ++++++ virtweb_backend/src/libvirt_lib_structures.rs | 11 +++++++++++ .../src/libvirt_rest_structures.rs | 19 +++++++++++++++---- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/virtweb_backend/src/actors/libvirt_actor.rs b/virtweb_backend/src/actors/libvirt_actor.rs index b06118d..3c26928 100644 --- a/virtweb_backend/src/actors/libvirt_actor.rs +++ b/virtweb_backend/src/actors/libvirt_actor.rs @@ -133,9 +133,15 @@ impl Handler for LibVirtActor { let start_offset = network_xml.find(", } +#[derive(serde::Serialize, serde::Deserialize)] +#[serde(rename = "input")] +pub struct DomainInputXML { + #[serde(rename(serialize = "@type"))] + pub r#type: String, +} + /// Devices information #[derive(serde::Serialize, serde::Deserialize)] #[serde(rename = "devices")] @@ -94,6 +101,10 @@ pub struct DevicesXML { /// Networks cards #[serde(default, rename = "interface", skip_serializing_if = "Vec::is_empty")] pub net_interfaces: Vec, + + /// Input devices + #[serde(default, rename = "input", skip_serializing_if = "Vec::is_empty")] + pub inputs: Vec, } /// Screen information diff --git a/virtweb_backend/src/libvirt_rest_structures.rs b/virtweb_backend/src/libvirt_rest_structures.rs index 3677699..dc10acd 100644 --- a/virtweb_backend/src/libvirt_rest_structures.rs +++ b/virtweb_backend/src/libvirt_rest_structures.rs @@ -2,10 +2,10 @@ use crate::app_config::AppConfig; use crate::constants; use crate::libvirt_lib_structures::{ DevicesXML, DiskBootXML, DiskDriverXML, DiskReadOnlyXML, DiskSourceXML, DiskTargetXML, DiskXML, - DomainCPUTopology, DomainCPUXML, DomainMemoryXML, DomainNetInterfaceXML, DomainVCPUXML, - DomainXML, FeaturesXML, GraphicsXML, NetIntSourceXML, NetworkDHCPRangeXML, NetworkDHCPXML, - NetworkDNSForwarderXML, NetworkDNSXML, NetworkDomainXML, NetworkForwardXML, NetworkIPXML, - NetworkXML, OSLoaderXML, OSTypeXML, XMLUuid, ACPIXML, OSXML, + DomainCPUTopology, DomainCPUXML, DomainInputXML, DomainMemoryXML, DomainNetInterfaceXML, + DomainVCPUXML, DomainXML, FeaturesXML, GraphicsXML, NetIntSourceXML, NetworkDHCPRangeXML, + NetworkDHCPXML, NetworkDNSForwarderXML, NetworkDNSXML, NetworkDomainXML, NetworkForwardXML, + NetworkIPXML, NetworkXML, OSLoaderXML, OSTypeXML, XMLUuid, ACPIXML, OSXML, }; use crate::libvirt_rest_structures::LibVirtStructError::StructureExtraction; use crate::utils::disks_utils::Disk; @@ -270,6 +270,17 @@ impl VMInfo { graphics: vnc_graphics, disks, net_interfaces: networks, + inputs: vec![ + DomainInputXML { + r#type: "mouse".to_string(), + }, + DomainInputXML { + r#type: "keyboard".to_string(), + }, + DomainInputXML { + r#type: "tablet".to_string(), + }, + ], }, memory: DomainMemoryXML {