A method for synchronizing virtual machine and host machine tray interaction
By capturing structured metadata and using virtualized communication channels, real-time and accurate synchronization and bidirectional interaction of tray data between Windows virtual machines and domestically produced host operating systems were achieved. This solved the problems of inaccurate tray status synchronization, fragmented user interaction logic, and insufficient interaction positioning accuracy in the context of domestic IT innovation, thus improving the system's compatibility and operational efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENGWEI DIGITAL (SHENZHEN) TECHNOLOGY CO LTD
- Filing Date
- 2026-03-11
- Publication Date
- 2026-06-09
AI Technical Summary
In the context of domestic IT innovation, when Windows virtual machines and domestically produced host operating systems run in a cross-system compatible manner, issues arise such as inaccurate and non-real-time synchronization of tray status, fragmented user interaction logic, insufficient interaction positioning accuracy in specific desktop environments, and poor compatibility.
By capturing structured tray metadata, a full-cycle status monitoring mechanism is established, a standardized bidirectional communication mechanism based on virtualization communication channels is constructed, and a low-level input event capture and precise coordinate mapping mechanism is introduced to achieve real-time and accurate synchronization and bidirectional interaction of tray data between the virtual machine and the host machine.
It achieves high-fidelity restoration of tray icons across systems and complete synchronization of structured information, solving the problems of inaccurate synchronization and poor visual consistency in traditional solutions. It improves the real-time performance of interaction and operational efficiency, eliminates the problems of fragmented interaction logic and coordinate offset, and ensures the high stability and compatibility of the system.
Smart Images

Figure CN122173202A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of operating system virtualization and cross-system desktop interaction technology, specifically relating to a method for synchronizing tray interaction between a virtual machine and a host machine. Background Technology
[0002] With the deepening of the Information Technology Application Innovation Project, in order to achieve compatibility between domestic operating systems and the traditional Windows ecosystem, the industry generally adopts virtual machine or remote desktop technology to embed the Windows system into the host environment of the domestic operating system. This ensures that Windows business applications that have not completed domestic adaptation can run smoothly on domestically developed terminals and achieve a smooth transition of business processes.
[0003] In this architecture, the Windows taskbar tray handles crucial interactive functions such as program status display, flashing notifications, bubble tips, and right-click shortcut menus. The real-time status prompts and interactive operations of office, security, and maintenance applications it supports directly impact user efficiency and system availability. However, due to fundamental differences in the tray implementation mechanisms between Windows and domestically developed operating systems, there is a lack of a standardized two-way tray communication mechanism between them. Existing virtual machine or remote desktop solutions suffer from several unavoidable shortcomings in tray interaction synchronization.
[0004] First, tray icon synchronization is inaccurate. Most existing technologies use unstructured methods such as screenshots or icon sharing for tray icon synchronization, which can only transmit static image data and cannot capture and synchronize dynamic state changes of icons, such as flashing reminders or state switching. At the same time, this method lacks structured icon metadata support, which makes it impossible for domestic host machines to accurately restore the icon attributes and actual running state of the application on the Windows virtual machine, and it is also difficult to ensure the resolution adaptation and visual display consistency of icons on the host machine.
[0005] Second, the user interaction logic is severely fragmented. Due to the lack of a standardized tray interaction communication mechanism, users must frequently switch between the main interface of the domestic system and the virtual machine window after receiving a tray notification to complete all interactive actions such as clicking the tray icon, right-clicking menu operations, and viewing notifications. This operation mode creates a serious interaction gap, significantly increasing the complexity of user operations and reducing business processing efficiency, especially in scenarios requiring rapid response to system notifications, failing to meet the needs of real-time interaction.
[0006] Third, the interactive positioning accuracy in the Wayland environment is insufficient. Under the Wayland desktop protocol, due to its security isolation mechanism, traditional methods struggle to accurately obtain mouse click masks and real-time global coordinate information, and existing desktop protocols exhibit significant compatibility defects in this environment. This leads to issues such as coordinate offsets, accidental touches, or click malfunctions in tray icon interaction responses in heterogeneous system integration scenarios, making it difficult to meet the requirements for high-precision and high-reliability tray interaction.
[0007] Therefore, a method for synchronizing tray interaction between a virtual machine and a host machine is needed to solve the problems of insufficient tray status synchronization accuracy, fragmented user interaction logic, and poor reliability of interaction positioning in cross-system compatibility operation between Windows virtual machines and domestically produced host operating systems under the domestic IT innovation environment. This method should be able to achieve accurate real-time synchronization of tray data and seamless two-way interaction while retaining all the original functions of the Windows system tray, thus meeting the practical application needs of stable operation of business applications and efficient and convenient user operation during the domestic IT innovation migration process. Summary of the Invention
[0008] To address the technical problems existing in the cross-system compatibility operation of Windows virtual machines and domestically produced host operating systems under the domestic IT innovation environment, such as inaccurate and non-real-time tray status synchronization, fragmented user interaction logic leading to low operation efficiency, insufficient interaction positioning accuracy in specific desktop environments, and poor compatibility, this invention provides a tray interaction synchronization method between the virtual machine and the host machine. This method achieves real-time and accurate synchronization of tray data between the virtual machine and the host machine, and seamless bidirectional interaction, ensuring the complete availability of the native Windows tray function in cross-system operation scenarios.
[0009] This invention aims to capture structured tray metadata and establish a full-cycle status monitoring mechanism to accurately acquire and synchronously restore dynamic states such as tray icon blinking and style switching within the virtual machine to the host machine, thus solving the core defect of existing unstructured synchronization solutions that cannot capture dynamic icon behavior. It also aims to construct a standardized bidirectional communication mechanism based on virtualization communication channels, enabling native proxying of virtual machine tray functions on the host machine. This allows users to directly complete all tray interaction operations on the host machine, resolving the interaction gap problem caused by frequent window switching in existing solutions and improving real-time interaction and operational efficiency. Furthermore, it aims to introduce a low-level input event capture and precise coordinate mapping mechanism to eliminate interaction coordinate offset and accidental touch problems in heterogeneous system integration scenarios, and solve the event capture difficulties caused by security isolation mechanisms in desktop environments such as Wayland, comprehensively improving the accuracy, reliability, and environmental compatibility of tray interaction.
[0010] To achieve the above objectives, the present invention provides the following technical solution: a method for tray interaction and synchronization between a virtual machine and a host machine, wherein the virtual machine running on the host machine has been started, the virtual machine runs an application with system tray functionality, and a bidirectional virtualization communication channel has been established between the host machine and the virtual machine; the method includes: The virtual machine side captures the structured metadata corresponding to the tray icon and monitors the dynamic status information of the tray icon in real time; the virtual machine side standardizes and encapsulates the captured structured metadata and the dynamic status information to generate cross-platform compatible structured data packets. The virtual machine side transmits the structured data packets to the host machine side through the pre-established bidirectional virtualization communication channel; The host machine registers virtual tray objects corresponding one-to-one with the tray icons in the virtual machine according to the standard desktop tray protocol based on the received structured data packets, and synchronously updates the display attributes and running status of the virtual tray objects according to the dynamic status information; In response to a user interaction event acting on the virtual tray object, the host machine side obtains the complete parameters of the user interaction event and transmits them back to the virtual machine side through the bidirectional virtualization communication channel; The virtual machine receives the complete parameters, executes the corresponding tray's native interaction processing logic, and synchronizes the processing result to the host machine to update the display, thus completing the two-way interaction synchronization between the virtual machine and the host machine's tray.
[0011] Furthermore, the structured metadata corresponding to the tray icon captured on the virtual machine side includes: The system's internal API is used to parse the tray notification data structure NOTIFYICONDATAW to extract initial metadata containing the icon's unique identifier, window handle, tooltip text, process information, and screen position information. If the initial metadata contains an icon resource identifier, then the system resource management component is invoked to translate the icon resource identifier into an absolute file path. Icon bitmap data is extracted based on the absolute file path and a standardized format conversion is performed to generate a PNG format byte stream, which is used as part of the structured metadata.
[0012] Furthermore, the dynamic status information of the tray icon includes: Install a global system hook on the virtual machine side to listen for tray notification messages; Capture one or more of the following dynamic status information in real time: the flashing status, animation status, enabled / disabled status, and location change information of the tray icon; When a change in the dynamic state information is detected, incremental data encapsulation is performed and an update synchronization is triggered.
[0013] Furthermore, the method also includes: The virtual machine side synchronously captures the bubble notification message corresponding to the tray icon. The bubble notification message includes at least the message title, message content, message type, timeout time, and full lifecycle events. The virtual machine side uses a multi-source redundancy mechanism that combines the Shell notification interface and the user interface (UI) automation event interface to capture the bubble notification message. By comparing and verifying the message content obtained from the two sources and supplementing the fields, a full bubble notification data packet is generated.
[0014] Furthermore, the bidirectional virtualized communication channel is a dedicated virtio virtualization channel built on the Qemu PCI device framework; the pass-through process includes: Structured data transmission between the virtual machine and the host machine is performed through memory-mapped I / O region partitioning, direct memory access (DMA) cache mapping mechanism, and MSI-X interrupt notification mechanism.
[0015] Furthermore, the standard desktop tray protocol used on the host side is the FreedesktopStatusNotifierItem protocol; the registration of the virtual tray object on the host side includes: Register the standard services corresponding to the virtual tray object through the D-Bus message bus, and establish a bidirectional mapping table between the tray icon in the virtual machine and the virtual tray object on the host side.
[0016] Furthermore, the method also includes: The system synchronously monitors the entire lifecycle events of the tray icon on the virtual machine side, including creation, attribute changes, state triggering, and destruction, and synchronously executes the registration, attribute update, and deregistration operations of the virtual tray object on the host machine side via the D-Bus message bus. At the same time, a two-way heartbeat detection mechanism is established to periodically verify the consistency of the tray status between the virtual machine side and the host machine side, and to trigger full data synchronization when an inconsistency is detected.
[0017] Furthermore, the host machine obtains complete parameters of the user interaction event, including: The raw data of the user interaction events is captured through the underlying input interface, and the event type, click mask, and global coordinate information are parsed to obtain them. For the Wayland desktop environment, the raw input event stream is captured through the libinput underlying input interface. The timestamp and signal mechanism of the raw input event stream are used to complete the matching and verification, so as to calculate the coordinate mapping relationship and correct the coordinate offset.
[0018] Furthermore, the native interaction processing logic includes menu synchronization logic, including: In response to the menu call interaction event of the virtual tray object on the host side, the virtual machine side recursively traverses the native menu items of the corresponding tray to extract menu attribute information including menu item text, identifier, status and hierarchical relationship; The virtual machine serializes the extracted menu attribute information into a tree structure data TRAY_MENU_TREE containing tree nodes and synchronizes it to the host machine for native display. Incremental update synchronization is performed based on the listened menu item state change events.
[0019] Furthermore, the menu synchronization logic also includes: after the virtual machine generates the native menu, it executes a focus tracking mechanism to trigger the menu hiding logic corresponding to the virtual tray object on the host machine based on the focus change state, and realizes the forwarding of menu click events.
[0020] This invention precisely addresses the core technical pain points of cross-system tray interaction between Windows virtual machines and domestically produced host machines in the context of domestic IT innovation. Through a complete technical system encompassing structured metadata capture, the construction of dedicated virtualization communication channels, standardized tray agent registration, high-precision input event processing, and full lifecycle state management, it achieves seamless, real-time synchronization and bidirectional interaction of tray data between the virtual machine and the host machine. Compared to existing unstructured synchronization and window-switching interaction solutions, this invention achieves a qualitative improvement in synchronization accuracy, interactive experience, environmental compatibility, and communication efficiency. Simultaneously, it fully retains the native functionality of the Windows system tray, requiring no significant modifications to existing Windows applications and domestically produced operating systems. It is highly adaptable to the actual needs of stable business operation and efficient, convenient operation during the domestic IT innovation migration process. Specific beneficial effects are reflected in the following aspects: This invention achieves high-fidelity restoration of tray icons across systems and complete synchronization of structured information, solving the problems of inaccurate synchronization and poor visual consistency in traditional solutions. It directly parses the NOTIFYICONDATAW structure of the Windows tray using internal system APIs, and, in conjunction with system resource management components, translates icon resource identifiers into absolute file paths, extracts bitmap data, and converts it into a standardized PNG format byte stream. This accurately captures complete structured metadata, including unique icon identifiers, process information, tooltip text, and screen position information. Compared to existing unstructured methods such as screenshots and icon sharing, this effectively solves the problems of icon resolution mismatch and blurry display during cross-system synchronization, ensuring a high degree of visual consistency between the two systems. Simultaneously, through the unique icon identifier mechanism, it achieves precise association between the virtual machine tray and the host machine's virtual tray, laying the foundation for subsequent full information synchronization.
[0021] This invention achieves real-time and accurate synchronization between tray dynamic behavior and bubble notifications, solving the pain points of existing technologies that cannot capture dynamic states and are prone to missing notifications. It installs a global system hook on the virtual machine side to monitor tray notification messages in real time, accurately capturing dynamic state information such as blinking, animation, enabling / disabling, and location changes. Through incremental data encapsulation and update synchronization mechanisms, it achieves real-time transparent transmission of dynamic states, overcoming the limitation of traditional solutions that can only transmit static images. For bubble notifications, it employs a multi-source redundant capture mechanism combining the Shell notification interface and the UI automation event interface. By comparing and verifying the content of the two messages and supplementing fields, it generates a full bubble notification data packet, ensuring the complete acquisition and native display of information such as bubble title, content, type, and timeout on the host machine. This significantly improves the real-time information response in scenarios such as government office work, security protection, and instant messaging.
[0022] This invention overcomes the technical limitations of the Wayland desktop environment, achieving high-precision positioning for cross-system tray interaction and resolving issues such as coordinate offset, accidental touches, and click malfunctions. Addressing the industry challenge of obtaining mouse click parameters and inaccurate coordinate positioning due to Wayland's security isolation mechanism, this invention abandons traditional coordinate acquisition methods. It captures raw data of user interaction events through a low-level input interface conforming to the Linux input subsystem specification, accurately parsing event types, click masks, and global coordinate information. Simultaneously, it innovatively introduces a timestamp and signal mechanism matching and verification based on the libinput low-level input event stream, achieving precise coordinate mapping calculation and offset correction. This brings the host machine's operation accuracy on virtual tray objects to native levels, significantly improving the accuracy and reliability of tray interaction in heterogeneous system integration scenarios. It is also compatible with mainstream desktop environments such as X11 and Wayland, enhancing the solution's versatility. This achieves deep integration and seamless connection of cross-system tray interaction, completely eliminating the problems of fragmented interaction logic and low operational efficiency.
[0023] This invention, based on the FreedesktopStatusNotifierItem industry standard protocol and D-Bus message bus on the host side, completes the standardized registration of virtual tray objects and establishes a two-way mapping table between virtual machine tray icons and host virtual tray objects, realizing native proxying of the Windows tray on domestically produced host machines. For right-click menu interaction, a complete pipeline is constructed, including recursive traversal of native menu items, tree-structured data serialization, and incremental update synchronization. Simultaneously, a focus tracking mechanism is used to accurately forward menu hiding logic and click events. Users can directly complete all interactive operations such as tray icon clicking, right-click menu invocation, and bubble viewing on the host machine without frequently switching between host and virtual machine windows. Interaction event parameters are passed back to the virtual machine side to execute native processing logic and synchronously echo back, forming a complete two-way interactive closed loop, significantly improving business processing efficiency in domestic IT migration scenarios.
[0024] This invention achieves efficient and reliable data transmission across systems, ensuring long-term stable system operation and solving the problems of poor real-time performance and easy loss of state synchronization in traditional communication methods. Based on the Qemu PCI device framework, this invention builds a dedicated virtio virtualized communication channel. Through memory-mapped I / O area partitioning, DMA cache mapping, and MSI-X interrupt notification mechanism, it achieves hardware-level bidirectional transparent transmission of structured data. Compared with traditional Socket and shared memory methods, this significantly reduces I / O latency and system resource consumption during data transmission. Simultaneously, a full lifecycle event listening mechanism for tray icons is established, synchronously executing the registration, attribute update, and deregistration operations of virtual tray objects on the host side. A bidirectional heartbeat detection mechanism is also included to periodically verify the consistency of the tray states on both ends. When inconsistencies are detected, full data synchronization and anomaly repair are triggered, effectively avoiding problems such as "zombie icons," state residue, and information loss, ensuring high system stability.
[0025] This invention's technical solution boasts low modification costs, excellent scalability, and large-scale application value, making it highly adaptable to the construction needs of the domestic IT innovation ecosystem. The virtual machine-side tray data capture is implemented based on native Windows APIs and system hooks, while the host-side tray proxy mechanism is built upon the industry-standard FreedesktopStatusNotifierItem and D-Bus protocol. This eliminates the need for secondary development of existing Windows applications and modification of the underlying tray framework of domestic operating systems, significantly reducing the deployment difficulty and modification costs of domestic IT innovation migration. Simultaneously, incremental data synchronization and tree-structured menu serialization designs reduce bandwidth consumption for cross-system data transmission while ensuring functional integrity, improving system operating efficiency. It can be widely adapted to core domestic IT innovation application scenarios such as government office work, enterprise operation and maintenance, and security protection, providing reliable technical support for the deep integration of the Windows ecosystem and domestic operating systems. Attached Figure Description
[0026] Figure 1 This is a schematic diagram of the tray interaction and synchronization method between the virtual machine and the host machine according to the present invention. Detailed Implementation
[0027] Example 1 like Figure 1 As shown, a method for tray interaction and synchronization between a virtual machine and a host machine is disclosed. The virtual machine running on the host machine has been started. The host machine is a domestic operating system such as Kylin or Tongxin, while the virtual machine is a Windows system. The two have completed system-level compatible deployment, adapting to the compatibility requirements of domestic systems with the Windows ecosystem under the domestic IT innovation ecosystem, without requiring significant modifications to the existing system architecture. The virtual machine runs applications with system tray functionality. These applications are common Windows applications for government office work, security protection, and enterprise operation and maintenance, and their native tray functionality is fully retained without secondary development adaptation, reducing the application transformation cost of domestic IT innovation migration and ensuring a smooth transition of business applications. Furthermore, a bidirectional virtualization communication channel has been established between the host machine and the virtual machine. This channel is a dedicated communication link based on hardware-level virtualization, which is different from traditional software-level communication methods such as sockets and shared memory. It can improve the real-time performance and stability of cross-system data transmission and provide reliable communication support for bidirectional tray data synchronization. The method includes: The virtual machine side captures the structured metadata corresponding to the tray icon and monitors the dynamic status information of the tray icon in real time. It adopts a combination of Windows native system API and global hooks to achieve structured capture of static metadata of the tray and real-time perception of dynamic status. The captured data includes full information such as icon attributes, process association, and status changes. Unlike the unstructured screenshot method of the existing technology, by capturing structured metadata instead of simple pixel screenshots, it can completely preserve the functional attribute information of the tray icon (such as GUID and PID), realize high-fidelity extraction of icon resources, and solve the problems of traditional screenshot solutions being unable to adapt to different resolutions and unable to obtain the logical associations behind the icons. It provides a data foundation for high-fidelity synchronization of tray icons across systems.
[0028] The virtual machine side standardizes and encapsulates the captured structured metadata and dynamic status information to generate cross-platform compatible structured data packets. It encapsulates the data according to a custom cross-platform data format, uniformly converting icon data to PNG format, and storing status information in a structured manner according to fixed fields. This ensures that domestically produced host machines can directly parse the data. By standardizing the data format specific to Windows, it ensures that heterogeneous systems (such as domestically produced Linux host machines) can efficiently and accurately parse the data transmitted from the virtual machine. This lays the data foundation for achieving cross-system visual consistency and unified interaction logic, eliminates the differences in tray data formats between Windows and domestically produced operating systems, and enables universal parsing and processing of cross-system data.
[0029] The virtual machine side transmits the structured data packets to the host machine side through the pre-established bidirectional virtualized communication channel. The transmission process is based on hardware-level DMA cache mapping and MSI-X interrupt notification mechanism, with no redundant data forwarding links, ensuring low latency in data transmission. The dedicated virtualized communication channel achieves near-hardware performance transmission efficiency, effectively reducing I / O latency in cross-system data transmission, ensuring real-time synchronization of icon status changes (such as high-frequency flashing) on the host machine side, solving the problems of high transmission latency and poor real-time performance of traditional software-level communication methods, and ensuring that tray status changes can be quickly synchronized to the host machine.
[0030] Based on the received structured data packets, the host machine registers virtual tray objects that correspond one-to-one with the tray icons within the virtual machine according to the standard desktop tray protocol. The host machine follows the FreedesktopStatusNotifierItem industry standard protocol and completes the standardized registration of virtual tray objects through the D-Bus message bus, matching a unique virtual tray object to each Windows tray icon. Registration is based on industry standard protocols such as FreedesktopSNI, enabling virtual machine applications to be seamlessly embedded into the tray area of the host operating system as native icons. This eliminates the visual disjointedness of cross-system operation, improves the overall UI integration, and ensures that virtual tray objects can be correctly recognized and displayed by the tray host of domestic systems, guaranteeing visual and functional consistency of trays across systems.
[0031] The display attributes and running status of the virtual tray object are updated synchronously according to the dynamic status information. Based on the dynamic status field in the structured data packet, the flashing, enable / disable, position and other attributes of the virtual tray are updated in real time, and the tray status on the Windows virtual machine side is linked. This solves the problem of non-real-time and inaccurate tray status synchronization in the prior art, and realizes precise linkage between the tray status on both ends.
[0032] In response to a user interaction event acting on the virtual tray object, the host machine obtains the complete parameters of the user interaction event and transmits them back to the virtual machine through the bidirectional virtualization communication channel. The complete parameters include information such as event type, click mask, global coordinates, and operation object. The reverse transmission uses the same bidirectional virtualization communication channel to ensure accurate transmission of interaction commands. By collecting and feeding back complete parameters including click mask, coordinates, and event type, a reverse control loop from the host machine to the virtual machine is established, allowing users to directly operate virtual machine applications on the host machine, greatly reducing operational complexity and realizing lossless transmission of interaction commands from the host machine to the virtual machine, laying the foundation for bidirectional interaction across system trays.
[0033] The virtual machine receives the complete parameters and executes the corresponding tray native interaction processing logic. It directly calls the native tray processing logic of the Windows application without the need to develop additional interaction adaptation programs, ensuring the nativeness and integrity of the interaction operation, solving the problem of incomplete adaptation of interaction logic in the existing technology, and ensuring the normal implementation of the full tray interaction function.
[0034] The processing results are synchronized to the host machine to update the display, completing the two-way interaction and synchronization between the virtual machine and the host machine's tray. The processing results are encapsulated and returned in the same structured format. The host machine updates the display status of the virtual tray in real time, forming a closed loop of "host machine operation - virtual machine processing - host machine feedback". By executing native logic in the virtual machine and returning the results, the accuracy and functional integrity of the interactive response are guaranteed. A complete two-way interactive closed loop is constructed, realizing the deep integration of the virtual machine tray function on the host machine side. This completely eliminates the disconnect problem of cross-system tray interaction in existing technologies and enables users to perform one-stop tray operation on the host machine.
[0035] As one implementation method, the virtual machine-side capture of the structured metadata corresponding to the tray icon in this embodiment includes: parsing the tray notification data structure NOTIFYICONDATAW through the system's internal API to extract initial metadata containing the icon's unique identifier, window handle, tooltip text, process information, and screen position information. This directly calls the Windows underlying system's internal API to parse the native NOTIFYICONDATAW structure, and the extracted initial metadata is the original tray data of the Windows system. Unlike existing external screenshot parsing techniques, this method directly extracts metadata from the system kernel-level structure, ensuring the depth and breadth of captured information. This allows subsequent synchronization to extend beyond images to include program-related logic, ensuring the integrity and accuracy of the metadata and avoiding information loss or deviation caused by screenshot parsing.
[0036] If the initial metadata contains an icon resource identifier, the system resource management component is invoked to translate the icon resource identifier into an absolute file path. Windows system resource management components such as mrmcorer.dll are invoked to achieve accurate translation from icon resource name to actual absolute file path. This supports the parsing of various embedded and dynamically loaded icon resources. By reverse parsing components such as mrmcorer.dll to achieve resource translation, the problem that icon index resources in Windows systems cannot be directly displayed across systems is solved, ensuring the success rate of icon material extraction. This also solves the problem that traditional solutions cannot parse non-independent icons, ensuring the complete extraction of various Windows application tray icons.
[0037] Based on the absolute file path, icon bitmap data is extracted and standardized format conversion is performed to generate a PNG format byte stream as part of the structured metadata. The original bitmap data is obtained from the physical file through a dedicated icon extraction function and uniformly converted into a cross-platform compatible PNG format. At the same time, the icon data size and other attributes are recorded. The extracted bitmap is uniformly converted into a universal PNG byte stream, which not only ensures the high definition of the image, but also adapts to the rendering requirements of the host operating system, eliminates the compatibility problem of different format icons when displayed across systems, and ensures the visual clarity and consistency of the virtual tray icons on the host side.
[0038] As one implementation method, the dynamic status information of the tray icon in this embodiment includes: installing a global system hook on the virtual machine side to listen to tray notification messages; installing a global system hook of type WH_CALLWNDPROC to specifically listen to tray-specific notification messages such as WM_TRAY_NOTIFY of the Windows system; the listening scope covers all tray applications of the system; and using the global hook mechanism to realize real-time monitoring of system-level messages, avoiding the invalid CPU occupation caused by timed polling, improving the sensitivity of system response, realizing full and real-time listening of tray notification messages, and providing a trigger basis for dynamic status capture.
[0039] The system captures one or more dynamic state information of the tray icon in real time, including its blinking state, animation state, enabled / disabled state, and position change information. By parsing the message parameters captured by the system hook and combining functions such as GetIconFlashInfo, it extracts specific parameters of the tray's dynamic state, such as blinking frequency and animation mode. It accurately captures micro-state changes, including style flag bits (STATE_SYSTEM_FLASHING, etc.), so that users can perceive notifications and reminders from virtual machine programs through the host machine tray in real time. It accurately captures tray dynamic behaviors that cannot be obtained by existing technologies and achieves full-dimensional synchronization of tray states on both ends.
[0040] When a change in the dynamic state information is detected, incremental data encapsulation is performed and update synchronization is triggered. Only the changed dynamic state fields are encapsulated, and the complete tray data is not transmitted. Synchronization is triggered by asynchronous transmission, which does not block the main process. The incremental update strategy only transmits the changed parts, which greatly reduces the bandwidth load of the virtualization communication channel, improves the performance of the overall synchronization process, significantly reduces the amount of cross-system data transmission, reduces system resource consumption, and ensures the real-time performance of state synchronization.
[0041] As one implementation method, the method in this embodiment further includes: synchronously capturing the bubble notification message corresponding to the tray icon on the virtual machine side. The bubble notification message includes at least a message title, message content, message type, timeout time, and full lifecycle events. The captured bubble message is the full information native to the Windows application, including full lifecycle events such as display, hide, and click. Unlike existing technologies that can only capture part of the displayed content, this method achieves full field capture of bubble notifications, enabling asynchronous business reminders from programs within the virtual machine to reach the user instantly. This ensures that the host machine can fully restore the bubble notification function of the Windows tray, including display, automatic hiding, and click response.
[0042] The virtual machine side employs a multi-source redundancy mechanism combining the Shell notification interface and the UI automation event interface to capture bubble notification messages. The main channel captures bubble messages through the ITrayMonitor interface obtained by SHGetTrayMonitor, while the backup channel listens for UI automation events through SetWinEventHook, forming a dual-channel redundant capture. By comparing and verifying the message content obtained from both channels and supplementing fields, a full bubble notification data packet is generated. Field comparison, missing data supplementation, and error correction are performed on the message content captured by both channels to finally generate a full bubble notification data packet with complete fields and accurate data. The dual-channel verification mechanism effectively avoids notification omissions that may occur due to a single interface, greatly improving the reliability and stability of message synchronization. It solves the problems of incomplete bubble notification capture and information deviation in existing technologies, ensuring the native and accurate display of bubble messages on the host side, avoiding bubble message loss due to the failure of a single interface, and improving the stability and completeness of bubble capture.
[0043] As one implementation method, the bidirectional virtualized communication channel described in this embodiment is a dedicated virtio virtualization channel built on the Qemu PCI device framework. A standard Qemu PCI device virtio-tray-pci is created and a dedicated device ID is defined. An MMIO memory-mapped I / O area containing a control register area and a data buffer area is configured to build a dedicated hardware-level communication carrier for high-speed cross-system data transmission. This is different from the general virtualized communication channel and specifically improves the efficiency of tray data transmission.
[0044] The transparent transmission process includes: performing structured data transmission between the virtual machine side and the host machine side through memory-mapped I / O region partitioning, direct memory access (DMA) cache mapping mechanism, and MSI-X interrupt notification mechanism. The Windows side copies the data to the shared cache and notifies the driver through DeviceIoControl. The driver triggers the Qemu PCI device to read the data from the shared cache and write it to the DMA cache on the domestic system side. At the same time, it triggers the MSI-X interrupt to notify the domestic system. The domestic system kernel driver completes the data reception and distributes it to the user space. There is no redundant forwarding at the software layer throughout the process. The hardware-simulated communication mechanism breaks through the performance bottleneck of traditional Socket communication. Through kernel-level zero-copy and hardware interrupt mechanisms, it achieves extremely fast data throughput and response capabilities, realizes hardware-level low-latency and high-reliability data transparent transmission, and significantly reduces I / O latency and system resource consumption in data transmission.
[0045] As one implementation method, the standard desktop tray protocol used on the host side in this embodiment is the FreedesktopStatusNotifierItem protocol, which follows the industry-standard tray protocol to ensure that the virtual tray object is compatible with the tray hosts of mainstream domestic operating systems such as Kylin and UnionTech, thereby improving the universality and adaptability of the solution.
[0046] The host-side registration of virtual tray objects includes: registering the standard service corresponding to the virtual tray object through the D-Bus message bus, establishing a bidirectional mapping table between the tray icon in the virtual machine and the virtual tray object on the host side, registering the org.kde.StatusNotifierItem standard bus service interface through the QtDBus framework, assigning a service name to each virtual tray object using a unique naming rule, establishing and dynamically updating the bidirectional mapping table based on the unique identifier of the Windows tray icon, and implementing standardized object proxy using the DBus bus. The bidirectional mapping table ensures accurate matching of massive tray icons in heterogeneous environments, avoids mis-sending of interaction commands, ensures accurate association between the two-end tray objects, and provides a foundation for state synchronization and interaction command forwarding.
[0047] As one implementation method, the method in this embodiment further includes: synchronously listening to the entire lifecycle events of the tray icon creation, attribute change, state triggering, and destruction on the virtual machine side, and synchronously executing the registration, attribute update, and deregistration operations of the virtual tray object on the host machine side through the D-Bus message bus. The method captures the entire lifecycle events of the Windows tray in an event-driven manner, and realizes the linkage update of the virtual tray object through the attribute change mechanism of the D-Bus message bus. This achieves automated management of the entire lifecycle, ensures absolute synchronization between the icon display on the host machine side and the program state on the virtual machine side, ensures that the lifecycle states of the tray objects on both ends are completely consistent, and avoids the problem of tray object residue or missingness on the host machine side.
[0048] Simultaneously, a two-way heartbeat detection mechanism is established to periodically verify the consistency of the tray status between the virtual machine side and the host machine side. When a state inconsistency is detected, full data synchronization is triggered. The overall status of the trays on both ends is verified through periodic heartbeat packet interaction. When a state deviation is detected, full data synchronization and anomaly repair are automatically triggered. The heartbeat detection mechanism provides strong fault tolerance protection and can automatically repair state synchronization failures caused by sudden anomalies, ensuring the robustness of the system, effectively avoiding "zombie icon" residue, and effectively avoiding problems such as "zombie icons" and state synchronization failures, thus ensuring the stability of the system during long-term operation.
[0049] As one implementation method, the host side of this embodiment obtains the complete parameters of the user interaction event, including: capturing the raw data of the user interaction event through the underlying input interface, and parsing it to obtain the event type, click mask, and global coordinate information. By adopting the underlying input interface that conforms to the Linux input subsystem specification, the raw data of the interaction event is directly captured, avoiding information filtering and accuracy loss of the upper-layer interface. It directly connects to the underlying input subsystem and obtains richer interaction details (such as complex click masks) than the application layer API, providing data support for high-precision interaction and ensuring the integrity and accuracy of the event parameters.
[0050] For the Wayland desktop environment, the original input event stream is captured through the libinput underlying input interface. The timestamp and signal mechanism of the original input event stream are used to complete the matching and verification, so as to calculate the coordinate mapping relationship and correct the coordinate offset. This breaks through the security isolation mechanism limitation of the Wayland desktop environment. By capturing the unmodified original input event stream through libinput, and combining timestamps and Qt signal mechanism, accurate event matching and precise coordinate mapping are achieved. The innovative introduction of the timestamp matching mechanism overcomes the problem of coordinate positioning accuracy caused by security isolation in the Wayland environment, eliminates accidental touches and positioning offsets during the interaction process, and completely solves the problems of coordinate offset, accidental touches, and click failure in heterogeneous system integration scenarios, so that the operation accuracy on the host side reaches the native level.
[0051] As one implementation method, the native interaction processing logic in this embodiment includes menu synchronization logic, including: in response to the menu call interaction event of the virtual tray object on the host side, the virtual machine side recursively traverses the native menu items of the corresponding tray to extract menu attribute information including menu item text, identifier, status and hierarchical relationship. The recursive traversal of the native menu items is implemented through the EnumMenuItemsHook function, and the full attribute information of the menu items is extracted by the GetMenuItemInfoHook function, including text, ID, enabled / disabled status, hierarchical relationship, etc. The deep recursive traversal ensures the integrity of the right-click menu structure, so that the proxy menu on the host side can perfectly inherit the multi-level function menu of Windows natively, ensuring the complete capture of menu information and providing a foundation for native display on the host side.
[0052] The virtual machine serializes the extracted menu attribute information into a tree structure data TRAY_MENU_TREE containing tree nodes and synchronizes it to the host machine for native display. Based on the monitored menu item state change events, incremental update synchronization is performed. The extracted menu attribute information is stored in a custom TRAY_MENU_TREE tree structure, serialized, and synchronized to the host machine through the virtualization communication channel. The host machine restores the menu hierarchy based on this structure and displays it natively. At the same time, the menu item state changes are monitored through MenuStateChangeHook, and only the changed information is synchronized. The use of tree structure serialization improves the parsing efficiency of complex menus. Combined with the incremental update mechanism, real-time synchronization of menu states (such as grayed out or selected) is ensured, reducing the amount of data transmission while ensuring the integrity of menu synchronization.
[0053] As one implementation method, the menu synchronization logic in this embodiment also retains the following: After the virtual machine generates the native menu, it executes a focus tracking mechanism to trigger the menu hiding logic corresponding to the virtual tray object on the host side based on the focus change state, and realizes the forwarding of menu click events. The focus tracking mechanism monitors the focus state of the native menu in real time. When the focus is lost, the virtual menu hiding logic on the host side is triggered synchronously. The focus tracking mechanism solves the display conflict problem in cross-system window interaction, ensuring that the proxy menu can disappear automatically when it loses focus, just like the native menu, which greatly optimizes the user's interaction experience, ensures the consistency of the menu display state on both ends, and accurately forwards the menu click events on the host side to the corresponding menu items on the virtual machine side to execute the native menu click processing logic, realizing seamless connection of menu interaction.
[0054] Example 2 This embodiment, combined with the actual application needs of the domestic IT innovation environment, further discloses the specific technical details, underlying implementation process, and core execution scheme of the present invention for achieving the integration of Windows virtual machines and domestic host machine tray icons. This embodiment is applicable to domestic host machines such as Kylin and Tongxin that run Wayland / X11 desktop environments, and the cross-system compatible operating architecture formed by Windows series virtual machines. Through multi-level data capture on the Windows side, the establishment of hardware-level cross-system communication channels, and industry standard protocol adaptation on the domestic host machine side, it achieves accurate synchronization of all tray icon information and bidirectional cross-system interaction, effectively solving the technical problems in the prior art such as inaccurate tray icon synchronization, interrupted user interaction, and insufficient click accuracy in the Wayland environment. The specific technical solution is as follows: Multi-level capture mechanism for tray data on the Windows virtual machine side: On the Windows virtual machine side, this invention adopts a hierarchical dedicated capture mechanism to realize the structured reading of static metadata of the tray, real-time monitoring of the dynamic status of the tray, and full capture of bubble notification messages. It breaks through the technical limitations of traditional unstructured solutions such as screenshots and icon sharing, realizes the deep acquisition and standardized encapsulation of tray information in all dimensions, and lays the underlying data foundation for cross-system tray information synchronization.
[0055] Structured Reading and Cross-System Forwarding of Tray Static Metadata: This invention aims to obtain complete static metadata for all icons in the Windows system tray. It achieves this through precise window-level positioning, deep calls to internal system interfaces, professional translation of resource paths, and structured encapsulation of all information, thus capturing and forwarding tray static metadata. First, a dedicated system interface is used to locate the Windows main taskbar window based on the class name "Shell_TrayWnd". Then, the notification area handle is obtained from the main taskbar window. This step precisely anchors the physical location of the tray icons, providing a definite operation handle for subsequent icon traversal. Subsequently, all tray icons within the notification area are traversed. For each icon, a dedicated interface located in appresolver.dll is called to obtain the native Windows system NOTIFYICONDATAW structure. This structure contains key fields such as window handle, icon identifier, GUID identifier, and tooltip text. By directly calling internal system interfaces to parse the native structure, it can penetrate application-layer encapsulation and obtain window-related attributes that traditional screenshot methods cannot detect, ensuring the structured nature of the synchronized data.
[0056] Based on the parsed window handle, the corresponding process information is further retrieved. First, the system interface is called to obtain the process ID, and then the process name is obtained by matching the process ID. At the same time, a special interface located in mrmcorer.dll is called to parse the Windows system-specific icon resource name into the actual absolute file path, solving the path mapping problem under the Windows multi-language resource management mechanism. Then, the icon bitmap data is extracted from the parsed absolute file path and converted into a PNG format byte stream through a special interface, which not only ensures the high-definition display effect of the icon, but also adapts to the rendering requirements of the domestic host machine. Finally, all information such as process ID, process name, icon file path, PNG format icon data, icon screen position, tooltip text, and icon unique identifier are encapsulated into a TrayIconMetadata structure. This structure is sent to the domestic host machine through a cross-system communication channel. The structured metadata encapsulation scheme enables the domestic host machine to establish a complete tray object model, providing underlying data support for achieving high-precision cross-system interactive synchronization.
[0057] Real-time monitoring and precise transmission of tray icon dynamic status: This invention achieves zero-latency response to tray events through a system-wide hook mechanism, ensuring accurate replication of dynamic states on the domestically developed host machine, addressing dynamic information such as tray icon blinking, position changes, and state transitions. First, a global window process hook is installed via the system interface. This hook is used to monitor tray notification messages such as WM_TRAY_NOTIFY and icon selection events such as NIN_SELECT in the Windows system in real time. Compared to traditional timed polling mechanisms, this method significantly reduces the CPU resource overhead of the Windows virtual machine. Simultaneously, the system interface periodically checks the tray icon status, calling a dedicated interface to parse icon style flags and accurately determine whether the icon is in a dynamic state such as unavailable, animated, or blinking. For blinking, a crucial strong reminder state in government office and security scenarios, core parameters such as blinking frequency and blinking mode are specifically captured. Information such as icon identification, blinking state, screen position coordinates, and blinking parameters are encapsulated into a TrayIconFlashPacket structure, which is transmitted in real time to the domestically developed host machine through a cross-system communication channel, ensuring that important system notifications reach users instantly. In addition, the present invention will continuously acquire the screen coordinates of the tray icon and monitor position changes. When a change in the icon position is detected, the position information will be synchronized to the domestically produced host machine in real time to ensure the consistency of the tray icon position on both ends.
[0058] Multi-source Redundant Capture and Complete Encapsulation of Bubble Notification Messages: To achieve full lifecycle information capture of Windows tray bubble messages, this invention designs a multi-source redundant capture mechanism. This effectively avoids the risk of omissions when a single system interface processes complex bubble content, ensuring the integrity of bubble notifications displayed on domestically produced host machines. First, the Windows system's Shell notification interface is initialized. A dedicated interface is called to obtain the ITrayMonitor interface and complete the registration of event listeners, enabling the main channel capture of the entire lifecycle of bubble message events, including display, hiding, and clicking. When a bubble message display event is triggered, the system combines various methods such as the system text acquisition interface, WM_GETTEXT messages, and AccessibilityAPI to capture all information, including the bubble's title, body content, rich text format, and bubble resource data. Simultaneously, data captured from multiple channels is compared and verified, and missing information fields are supplemented to ensure the integrity of the bubble content. When a bubble message is hidden, the reason for hiding is recorded, including automatic hiding after timeout, manual closing by the user, and active hiding by the program. When a bubble is clicked, the screen position and timestamp of the click are recorded, providing accurate data for cross-system bubble interaction. Finally, the source process information, title and content text, bubble type, display position and size, timestamp, unique identifier and other information of the bubble are encapsulated into a TrayBalloonPacket structure, which is sent to the domestic host machine through the cross-system communication channel to achieve full and accurate synchronization of bubble messages.
[0059] Construction and Data Transparent Transmission of a Dedicated Virtualized Communication Channel for Cross-System Virtio-Tray-PCI: To address the issues of poor real-time performance and frequent stuttering during high-frequency updates in traditional methods such as Socket communication and shared memory for cross-system data transmission, this invention constructs a dedicated hardware-level virtualized communication channel based on PCI devices. Using virtio-tray-PCI as the core hardware carrier, and through memory mapping, DMA cache mapping, and hardware interrupt triggering, it achieves "zero-copy" high-speed transparent transmission of data between Windows virtual machines and domestically produced host machines, providing reliable communication support for real-time synchronization of tray information.
[0060] First, a standard Qemu-PCI device, virtio-tray-pci, is created in the Qemu emulator. This device inherits the standard PCI device framework, defining its vendor ID as 0x1AF4 and device ID as 0x1050. Employing a standard hardware emulation protocol effectively improves the channel's versatility, ensuring stable deployment across different virtualization platforms. Simultaneously, a PCI configuration space containing standard PCI header information and device-specific capabilities is configured for this device, and two independent MMIO memory-mapped I / O areas are allocated. A 4KB control register area is used for status control and command transmission during communication, while a 64KB data buffer area is used for actual cross-system data transmission, achieving separate management of control commands and data transmission.
[0061] After the hardware infrastructure for data transmission is built, cache allocation and mapping are completed on both the Windows virtual machine side and the domestic host machine side. On the Windows side, a shared cache is allocated through a dedicated interface, and on the domestic host machine side, a DMA cache is allocated through dma_alloc_coherent. At the same time, cache synchronization and memory barrier mechanisms are introduced to ensure that the cache data on both ends are consistent and to avoid data transmission errors caused by cache inconsistency. In the actual data pass-through process, the application on the Windows virtual machine side copies the packaged standardized tray data to the local shared cache, notifies the driver via DeviceIoControl, and the driver writes to the device register to trigger data transmission. After the virtio-tray-pci device in Qemu detects the register write operation, it reads the data from the shared cache on the Windows side and writes it to the DMA cache on the domestic host side, subsequently triggering an MSI-X interrupt to send a data arrival notification to the kernel of the domestic host. After the interrupt handler function of the domestic host kernel driver is called, it reads the data from the device cache and stores it in the kernel receive buffer, while waking up the waiting read process. Finally, it copies the data from the kernel buffer to the application buffer in user space, and after parsing and processing, displays the corresponding content in the system tray of the domestic host. The entire data transmission link is implemented based on hardware interrupts and DMA cache mapping, completely solving the stuttering problem of traditional communication methods during high-frequency tray updates, and realizing high-speed, real-time pass-through of cross-system data.
[0062] The domestically developed host machine-side tray registration and interaction mechanism based on the FreedesktopStatusNotifierItem specification: On the domestically produced host machine side, this invention strictly follows the FreedesktopStatusNotifierItem industry standard protocol and implements standardized registration, management and interaction of virtual tray icons through the QtDBus framework. This ensures that tray data on the Windows virtual machine side can be embedded into the tray area of the domestically produced host machine in a native form. At the same time, in response to the coordinate positioning problem in the Wayland desktop environment, a high-precision input event processing solution was designed to achieve accuracy and smoothness in cross-system interaction.
[0063] First, bus services in the format of org.kde.StatusNotifierItem_ are registered using the QtDBus framework, with the registration path being / StatusNotifierItem. A naming convention using a fixed prefix and a unique tray identifier ensures that each virtual tray icon corresponds to a unique bus service identifier, avoiding service conflicts. Simultaneously, a protocol structure adapted for cross-system data transmission is designed. This structure includes core fields such as icon data, process information, status text, and interaction attributes, achieving seamless adaptation between Windows-side tray data and domestically developed host machine protocols. Following industry-standard protocol design principles, this solution ensures seamless compatibility with the native desktop environments of mainstream domestic operating systems such as Kylin and UnionTech.
[0064] Subsequently, a TrayMetadata instance containing information such as icon data, tooltip text, tray status, last update time, and extended attributes is created on the domestically produced host machine. Based on the unique identifier of the tray icon on the Windows virtual machine side, a bidirectional mapping table is established between the Windows tray icon and the DBus service instance on the host machine side. This mapping table is dynamically maintained, supporting real-time updates and status synchronization to ensure that complex cross-system interaction actions can be accurately routed to the corresponding virtual machine application, avoiding confusion of operation commands. Simultaneously, this invention, based on the FreedesktopStatusNotifierItem specification, implements core D-Bus protocol interfaces such as Activate, ContextMenu, and SecondaryActivate. Each interface includes screen coordinate parameters of the click position, enabling precise positioning of the interaction location. Through a bridging mechanism, the user click signal on the domestically produced host machine side is forwarded to the Windows virtual machine side, where the virtual machine executes the native processing logic and then sends the processing result back to the domestically produced host machine side, displaying the corresponding interactive effect on the host machine, thus completing the cross-system interaction loop.
[0065] Addressing the industry pain point of insufficient accuracy in acquiring mouse click masks and coordinate information in the Wayland desktop environment, this invention employs a multi-layered technical solution to achieve high-precision input event processing. It captures raw input events through the libinput low-level input interface, bypassing information filtering from upper-layer interfaces and Wayland's security isolation restrictions. This allows for the acquisition of full raw interaction data, including click masks, coordinate trajectories, and event types. The raw input events are then distributed and processed using Qt's signal mechanism, establishing a mapping between raw input events and virtual tray icons on the domestically developed host machine. Simultaneously, the event stream's timestamp and Qt's signal mechanism are used for matching and verification, calculating a precise cross-system coordinate mapping relationship. This achieves accurate event type identification and response, completely resolving issues such as coordinate offset and click malfunction in the Wayland environment, and bringing the cross-system tray interaction experience to a native level.
[0066] An automated synchronization management mechanism for the entire lifecycle of tray icons: This invention establishes a tray icon lifecycle management mechanism that combines event-driven and timed heartbeat detection. It achieves real-time and consistent synchronization of tray status between Windows virtual machines and domestically produced host machines, possesses strong system self-healing capabilities, and effectively avoids the problem of "zombie icons" remaining due to virtual machine restarts, program crashes, and other situations.
[0067] This invention designs a fully automated, interconnected processing logic for the three core lifecycle stages of tray icon creation, attribute modification, and destruction. In the icon creation stage, after receiving tray icon metadata from the Windows virtual machine, the domestically developed host machine automatically registers the corresponding D-Bus object and initializes all attributes, creating and displaying the virtual tray icon in the system tray. In the status update stage, the host machine, based on dynamic status data transmitted through the cross-system communication channel, refreshes the flashing status, prompts, and position coordinates of the virtual tray icon in real time via the D-Bus bus, ensuring real-time consistency of the dynamic status of both trays. In the icon destruction stage, when the Windows virtual machine detects that a tray icon has been destroyed, it synchronizes the destruction information to the host machine. The host machine then automatically cleans up the corresponding virtual tray icon resources and unregisters the related D-Bus object, releasing resources and preventing the residue of invalid icons.
[0068] Meanwhile, this invention establishes a bidirectional heartbeat detection mechanism. The Windows virtual machine and the domestically produced host machine periodically exchange heartbeat packets to perform a full verification of the overall status of the tray icons on both ends. When an inconsistency between the two ends is detected due to anomalies, the system automatically triggers full data synchronization to complete the anomaly repair and ensure the stability of the system during long-term operation. In addition, this invention also adopts a status polling mechanism that combines event-driven and timed detection. Event-driven mechanisms ensure the real-time update of the tray status, while timed detection compensates for synchronization vulnerabilities caused by lost events, further improving the reliability of the dual-end tray status synchronization.
[0069] High-fidelity synchronization mechanism for cross-system context menus: In response to the cross-system synchronization requirements of the Windows tray right-click context menu, this invention designs a complete menu state synchronization pipeline, realizing the structural restoration, dynamic state synchronization and precise interaction of multi-level menus. This allows users to complete complex menu operations of virtual machine applications on the host machine without switching between the domestic host machine and the Windows virtual machine window, greatly optimizing cross-system collaboration efficiency.
[0070] When a user on the domestically produced host machine right-clicks the virtual tray icon, a menu display request is sent through the ContextMenu interface. This request is forwarded to the Windows virtual machine side through the virtio-tray-pci dedicated communication channel. After receiving and processing the request, the Windows virtual machine side generates the corresponding native tray menu, and then performs a recursive traversal operation on the native tray menu, covering all menu items and sub-menu items at all levels to ensure complete capture of the menu structure. At the same time, it extracts all attribute information of each menu item, such as text, ID, enabled / disabled / selected status, hierarchical relationship, and sub-menu handle, through a dedicated interface.
[0071] After extraction, the system stores all menu item information into a TRAY_MENU_TREE structure containing a tree-like array of nodes. Each node in this structure records the complete attributes of the menu item and its parent-child relationship index, achieving standardized storage of the menu structure. The structure is then serialized into a byte stream and synchronized in real-time to the domestically-owned host machine via a cross-system communication channel. Simultaneously, the Windows virtual machine registers a dedicated listening interface to monitor menu item state changes in real-time. When changes such as graying out or switching of selected states are detected, only the changed information is synchronized to the domestically-owned host machine, effectively reducing data transmission volume while ensuring real-time synchronization.
[0072] After parsing the received menu data, the domestically produced host machine restores the complete hierarchical structure of the menu and displays it natively within the system. Simultaneously, a focus tracking mechanism is established to monitor the focus state of the native menu on the Windows virtual machine side in real time. When the native menu loses focus, the hiding logic of the virtual menu on the host machine side is triggered synchronously, ensuring consistency in the display state of the menus on both ends. When a user clicks on the virtual menu on the host machine side, the click event is accurately forwarded to the corresponding menu item on the Windows virtual machine side. The virtual machine then executes the native menu click processing logic and echoes the processing result back to the domestically produced host machine side in real time, completing a full interactive loop for cross-system context menus.
[0073] This embodiment achieves deep integration of Windows virtual machines and domestically produced host machine trays in a domestic IT innovation environment through a technical solution that includes multi-level data capture on the Windows side, hardware-level virtio-tray-pci virtualization communication channels, FreedesktopStatusNotifierItem specification adaptation on the domestically produced host side, full lifecycle management of tray icons, and high-fidelity synchronization of context menus. Compared with existing technologies, it achieves several core technological breakthroughs and yields significant technical results. Firstly, it achieves accurate cross-system synchronization of complete Windows tray information. By calling internal Windows system interfaces, it captures structured metadata, dynamic status information, and the full content of bubble messages that cannot be obtained by traditional unstructured solutions such as screenshots and icon sharing. At the same time, through PNG format icon conversion and standardized data encapsulation, it ensures that the domestic host machine can accurately replicate all visual and status features of the Windows tray, solving the problems of inaccurate tray icon synchronization and poor resolution adaptation in existing technologies. Secondly, it enables two-way real-time interaction across system trays. Users can complete all related operations such as clicking tray icons, right-click menu operations, and bubble message interaction on the host machine without frequently switching between the domestic host machine and the Windows virtual machine window. This eliminates the sense of disconnect in user experience, improves work efficiency, and solves the problems of user interaction interruption and complex window switching in existing technologies. Third, it overcame the coordinate positioning problem in the Wayland desktop environment. Through the mechanism of matching the underlying input interface of libinput with the event stream timestamp, it achieved accurate mapping of cross-system coordinates, solved the problems of malfunction and accidental touch caused by insufficient mouse operation precision in traditional solutions, and made the cross-system tray interaction experience reach the native level. Fourth, it achieves high-speed real-time synchronization of tray information. Based on the hardware-level transparent transmission of the virtio-tray-pci dedicated virtualization communication channel, it solves the stuttering problem of traditional communication methods when updating the tray at high frequency, ensuring that important information such as flashing notifications and status changes can be synchronized to the domestic host machine in an instant, and ensuring the timely delivery of important notifications in scenarios such as government office work and security protection.
[0074] In practical application scenarios of information technology innovation migration, the technical solution of this embodiment enables the tray function of Windows applications to be natively integrated into the domestic operating system. In core information technology innovation scenarios such as government office, enterprise applications, and security protection, it effectively improves the availability of the system and the operational efficiency of users, ensures the smooth transition of business processes during the information technology innovation migration process, and provides reliable technical support for the compatible operation of the domestic operating system on the Windows ecosystem.
[0075] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. It should be noted that any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for synchronizing tray interaction between a virtual machine and a host machine, characterized in that: The virtual machine running on the host machine has been started, and the virtual machine is running an application with system tray functionality. A bidirectional virtualization communication channel has been established between the host machine and the virtual machine. The method includes: The virtual machine side captures the structured metadata corresponding to the tray icon and monitors the dynamic status information of the tray icon in real time; the virtual machine side standardizes and encapsulates the captured structured metadata and the dynamic status information to generate cross-platform compatible structured data packets. The virtual machine side transmits the structured data packets to the host machine side through the pre-established bidirectional virtualization communication channel; The host machine registers virtual tray objects corresponding one-to-one with the tray icons in the virtual machine according to the standard desktop tray protocol based on the received structured data packets, and synchronously updates the display attributes and running status of the virtual tray objects according to the dynamic status information; In response to a user interaction event acting on the virtual tray object, the host machine side obtains the complete parameters of the user interaction event and transmits them back to the virtual machine side through the bidirectional virtualization communication channel; The virtual machine receives the complete parameters, executes the corresponding tray's native interaction processing logic, and synchronizes the processing result to the host machine to update the display, thus completing the two-way interaction synchronization between the virtual machine and the host machine's tray.
2. The method according to claim 1, characterized in that: The structured metadata captured on the virtual machine side corresponding to the tray icon includes: The system's internal API is used to parse the tray notification data structure NOTIFYICONDATAW to extract initial metadata containing the icon's unique identifier, window handle, tooltip text, process information, and screen position information. If the initial metadata contains an icon resource identifier, then the system resource management component is invoked to translate the icon resource identifier into an absolute file path; Icon bitmap data is extracted based on the absolute file path and a standardized format conversion is performed to generate a PNG format byte stream, which is used as part of the structured metadata.
3. The method according to claim 1, characterized in that: The dynamic status information of the tray icon includes: Install a global system hook on the virtual machine side to listen for tray notification messages; Capture one or more of the following dynamic status information in real time: the flashing status, animation status, enabled / disabled status, and location change information of the tray icon; When a change in the dynamic state information is detected, incremental data encapsulation is performed and an update synchronization is triggered.
4. The method according to claim 1, characterized in that: The method further includes: The virtual machine side synchronously captures the bubble notification message corresponding to the tray icon. The bubble notification message includes at least the message title, message content, message type, timeout time, and full lifecycle events. The virtual machine side uses a multi-source redundancy mechanism that combines the Shell notification interface and the user interface (UI) automation event interface to capture the bubble notification message. By comparing and verifying the message content obtained from the two sources and supplementing the fields, a full bubble notification data packet is generated.
5. The method according to claim 1, characterized in that: The bidirectional virtualized communication channel is a dedicated virtio virtualization channel built on the Qemu PCI device framework; The transparent transmission process includes: Structured data transmission between the virtual machine and the host machine is performed through memory-mapped I / O region partitioning, direct memory access (DMA) cache mapping mechanism, and MSI-X interrupt notification mechanism.
6. The method according to claim 1, characterized in that: The standard desktop tray protocol used on the host side is the FreedesktopStatusNotifierItem protocol; the virtual tray object registration on the host side includes: Register the standard services corresponding to the virtual tray object through the D-Bus message bus, and establish a bidirectional mapping table between the tray icon in the virtual machine and the virtual tray object on the host side.
7. The method according to claim 6, characterized in that: The method further includes: The system synchronously monitors the entire lifecycle events of the tray icon on the virtual machine side, including creation, attribute changes, state triggering, and destruction, and synchronously executes the registration, attribute update, and deregistration operations of the virtual tray object on the host machine side via the D-Bus message bus. At the same time, a two-way heartbeat detection mechanism is established to periodically verify the consistency of the tray status between the virtual machine side and the host machine side, and to trigger full data synchronization when an inconsistency is detected.
8. The method according to claim 1, characterized in that: The host machine obtains complete parameters of the user interaction event, including: The raw data of the user interaction events is captured through the underlying input interface, and the event type, click mask, and global coordinate information are parsed to obtain them. For the Wayland desktop environment, the raw input event stream is captured through the libinput underlying input interface. The timestamp and signal mechanism of the raw input event stream are used to complete the matching and verification, so as to calculate the coordinate mapping relationship and correct the coordinate offset.
9. The method according to claim 1, characterized in that: The native interaction processing logic includes menu synchronization logic, including: In response to the menu call interaction event of the virtual tray object on the host side, the virtual machine side recursively traverses the native menu items of the corresponding tray to extract menu attribute information including menu item text, identifier, status and hierarchical relationship; The virtual machine serializes the extracted menu attribute information into a tree structure data TRAY_MENU_TREE containing tree nodes and synchronizes it to the host machine for native display. Incremental update synchronization is performed based on the listened menu item state change events.
10. The method according to claim 9, characterized in that: The menu synchronization logic also includes: after the virtual machine generates the native menu, it executes a focus tracking mechanism to trigger the menu hiding logic corresponding to the virtual tray object on the host machine based on the focus change state, and realizes the forwarding of menu click events.