Method and device for processing clip data, electronic equipment, storage medium and program product

By using the clipboard manager to process clipboard data within the Wayland environment, the performance bottleneck of clipboard data conversion between X11 applications and Wayland applications was resolved. This enabled efficient data format conversion and storage, improving user experience and system stability.

CN120892227BActive Publication Date: 2025-12-09UNIONTECH SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511394783.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-28
Publication Date
2025-12-09
Estimated Expiration
2045-09-28

AI Technical Summary

Technical Problem

When implementing clipboard functionality for X11 applications in the Wayland environment, there are performance bottlenecks and delays in clipboard data conversion, which affect the user experience.

Method used

Clipboard data is processed independently through the clipboard manager, enabling cross-window system format conversion and storing clipboard data to a specified storage device. This reduces reliance on other functional modules and optimizes the data transfer and format conversion process.

Benefits of technology

It improves the performance of clipping data conversion, reduces latency and computing resource consumption, enhances user experience, and ensures compatibility and stability for applications across different window systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120892227B_ABST
    Figure CN120892227B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method and apparatus for processing clip data, an electronic device, a storage medium and a program product. The method comprises: in response to a clip event initiated by a first window system application, reading first clip data associated with the clip event by a clipboard manager, wherein the first window system application is an application running under a first window system; performing cross-window system format conversion on the first clip data by the clipboard manager to convert the first clip data from a first data format to a second data format, to obtain second clip data, wherein the first data format is a data format supported by the first window system, and the second data format is a data format supported by a second window system and corresponding to the first data format; and in response to a paste event initiated by a second window system application, sending the second clip data to the second window system application by the clipboard manager, wherein the second window system application is an application running under the second window system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of window system, and particularly relates to a method and apparatus for processing clip data, an electronic device, a storage medium and a program product. BACKGROUND

[0002] X11 (X Window System) is a network transparent window system based on bitmap display. X11 uses a client-server model, in which an X server program runs on a computer with a graphical display and communicates with various X client programs.

[0003] Wayland represents the next generation evolution of display server technology, which redefines window management and graphics rendering in a more efficient and secure way. By communicating directly with the graphics subsystem of the Linux kernel, Wayland eliminates the multi-layer architecture of the traditional X11 system, thereby achieving significant performance and security improvements.

[0004] In order to maintain compatibility with widely used X11 applications, XWayland (X Window System on Wayland) emerges as the times require, which is essentially an X server that allows X applications to run on the Wayland compositor. As an intermediate compatibility layer, XWayland enables X11 applications to run seamlessly in the Wayland environment without the need for deep modifications to existing applications, ensuring that users can continue to use the software they rely on.

[0005] Although XWayland provides a transitional solution, when implementing the clipboard function of X11 applications in the Wayland environment, a bridge is still needed to convert the clipboard format data of X11 applications and Wayland applications to each other, and this conversion process may introduce performance bottlenecks and delays, affecting user experience. SUMMARY

[0006] The present disclosure provides a method and apparatus for processing clip data, an electronic device, a storage medium and a program product to at least solve the problem of how to guarantee the conversion performance of clip data of different window system applications in related technologies.

[0007] According to a first aspect of embodiments of the present disclosure, a method for processing clip data is provided. The method comprises: in response to a clip event initiated by a first window system application, reading, by a clipboard manager, first clip data associated with the clip event, wherein the first window system application is an application running under a first window system; performing, by the clipboard manager, cross-window system format conversion on the first clip data to convert the first clip data from a first data format supported by the first window system to a second data format corresponding to the first data format and supported by a second window system different from the first window system, to obtain second clip data; and in response to a paste event initiated by a second window system application, sending, by the clipboard manager, the second clip data to the second window system application, wherein the second window system application is an application running under the second window system.

[0008] Optionally, the method further comprises: storing, by the clipboard manager, the second clip data in a specified storage device; and the sending, by the clipboard manager, of the second clip data to the second window system application comprises: in a case where the second window system application has the capability of reading data from a storage device, passing, by the clipboard manager, an access mode of the second clip data to the second window system application, so that the second window system application reads the second clip data from the specified storage device.

[0009] Optionally, the second data format comprises a data format of a different content format for a same content type as the first data format.

[0010] Optionally, in a case where the first data format is a data format for a picture content type, the second data format comprises a lossless compression data format for the picture content type.

[0011] Optionally, in a case where the first data format is a data format for a text content type, the second data format comprises a general encoding data format for the text content type.

[0012] Optionally, one of the first window system application and the second window system application is an X application, and the other of the first window system application and the second window system application is a Wayland application.

[0013] Optionally, in the case that the first window system application is an X application, in response to a window of the first window system application initiating the cut event being closed, the clipboard manager replaces the first window system application to become an owner of the first clip data, so as to send the first clip data to other X applications in response to a paste event initiated by the other X applications.

[0014] According to a second aspect of the embodiments of the present disclosure, a clip data processing apparatus is provided, comprising: a reading unit configured to read, in response to a cut event initiated by a first window system application, first clip data associated with the cut event by a clipboard manager, wherein the first window system application is an application running under a first window system; a converting unit configured to perform cross-window system format conversion on the first clip data by the clipboard manager, so as to convert the first clip data from a first data format into a second data format, to obtain second clip data, wherein the first data format is a data format supported by the first window system, the second data format is a data format corresponding to the first data format and supported by a second window system, and the second window system is different from the first window system; and a sending unit configured to send, in response to a paste event initiated by a second window system application, the second clip data to the second window system application by the clipboard manager, wherein the second window system application is an application running under the second window system.

[0015] Optionally, the clip data processing apparatus further comprises: a storage unit configured to store the second clip data into a specified storage device by the clipboard manager; and the sending unit is further configured to, in the case that the second window system application has the capability of reading data from a storage device, transmit, by the clipboard manager, an access mode of the second clip data to the second window system application, so as to enable the second window system application to read the second clip data from the specified storage device.

[0016] Optionally, the second data format comprises a data format of different content format for the same content type as the first data format.

[0017] Optionally, in the case that the first data format is a data format for picture content type, the second data format comprises a lossless compression data format for picture content type.

[0018] Optionally, in the case that the first data format is a data format for text content type, the second data format comprises a general encoding data format for text content type.

[0019] Optionally, one of the first window system application and the second window system application is an X application, and the other of the first window system application and the second window system application is a Wayland application.

[0020] Optionally, in a case where the first window system application is an X application, in response to a window that initiates the clipping event of the first window system application being closed, the clipboard manager replaces the first window system application to become an owner of the first clip data, so as to send the first clip data to other X applications in response to a pasting event initiated by the other X applications.

[0021] According to a third aspect of embodiments of the present disclosure, an electronic device is provided, comprising: at least one processor; at least one memory storing computer-executable instructions, wherein the computer-executable instructions, when executed by the at least one processor, cause the at least one processor to perform the clip data processing method according to the example embodiments of the present disclosure.

[0022] According to a fourth aspect of embodiments of the present disclosure, a computer-readable storage medium is provided, wherein instructions in the computer-readable storage medium, when executed by at least one processor, cause the at least one processor to perform the clip data processing method according to the example embodiments of the present disclosure.

[0023] According to a fifth aspect of embodiments of the present disclosure, a computer program product is provided, comprising computer instructions, wherein the computer instructions, when executed by at least one processor, cause the at least one processor to perform the clip data processing method according to the example embodiments of the present disclosure.

[0024] The technical solutions provided by the embodiments of the present disclosure at least bring the following beneficial effects: according to the clip data processing method, device, electronic device, storage medium and program product of the present disclosure, by separately splitting the processing logic of clip data and handing it over to the clipboard manager for execution, without relying on other existing functional modules, the clip data conversion performance of different window system applications can be reliably guaranteed, and the calculation resource occupation of other existing functional modules can be reduced, which helps to improve the user experience.

[0025] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0026] The accompanying drawings incorporated in and forming a part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure without imposing on the disclosure any undue limitations.

[0027] Figure 1is a flowchart of a clip data processing method of the related art.

[0028] Figure 2 is a flowchart of a clip data processing method according to an example embodiment of the present disclosure.

[0029] Figure 3 is a flowchart of a clip data processing method according to a specific embodiment of the present disclosure.

[0030] Figure 4 is a flowchart of a clip data processing method according to a specific embodiment of the present disclosure.

[0031] Figure 5 is a flowchart of a clip data processing method according to a specific embodiment of the present disclosure.

[0032] Figure 6 is a block diagram of a clip data processing apparatus according to an example embodiment of the present disclosure.

[0033] Figure 7 is a block diagram of an electronic device according to an example embodiment of the present disclosure. DETAILED DESCRIPTION

[0034] In order to make the ordinary person skilled in the art better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below in conjunction with the drawings.

[0035] It should be noted that the terms "first", "second", and the like in the specification and claims of the present disclosure and the above-described drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following embodiments do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0036] It is to be noted that "at least one of a plurality" appearing in the present disclosure indicates three types of alternatives, i.e., "any one of the plurality", "a combination of any multiple of the plurality", and "all of the plurality". For example, "including at least one of A and B" includes three alternatives, i.e., (1) including A, (2) including B, and (3) including A and B. For another example, "performing at least one of step one and step two" indicates three alternatives, i.e., (1) performing step one, (2) performing step two, and (3) performing step one and step two.

[0037] Hereinafter, a clip data processing method, apparatus, electronic device, storage medium, and program product according to an exemplary embodiment of the present disclosure will be described in detail with reference to the accompanying drawings.

[0038] The related art generally uses KWIN (KDE Window Manager, KDE is a proprietary technology brand, which is responsible for managing the creation, destruction, movement, resizing of windows, and providing window decorations such as borders and title bars) to realize the exchange of clip data between X11 applications and Wayland applications through XWL (a logical module in KWIN for converting X11 protocol and wayland protocol, represented as XWL to distinguish from XWayland as an X server) as a bridge. This technology allows users to share clip content between X11 applications running in a Wayland session and native Wayland applications.

[0039] In this process, XWL is responsible for processing the conversion between X11 protocol and Wayland protocol, ensuring that data can be seamlessly transmitted between different window systems. Referring to Figure 1When a user copies content in an X11 application, the XWL of KWIN listens to the corresponding event and captures the copied content as clip data, specifically by creating an X11 window, using the window to obtain the copied data in the window where the copy event occurs, storing the clipboard memory, and converting the clipboard data into a format that Wayland can understand to obtain converted clipboard data. The converted data is transmitted to the Wayland clipboard through the pipe (the pipe is a data transmission method in the Wayland protocol, and different pipes are distinguished by fd) of the XWL of KWIN. The user can perform a paste operation in any Wayland application, and at this time the Wayland clipboard transmits the converted data to the corresponding Wayland application through the pipe. Similarly, when a user copies content in a Wayland application, the XWL of KWIN also converts the data back to the X11 format and updates the X11 clipboard, so that it can be pasted in the X11 application. As can be seen, the clip data of X11 and Wayland needs to be transmitted through the pipe twice, which may introduce data synchronization and delay problems, affecting the response speed of the clip operation. In addition, when the data volume of the clip data is large, a large amount of data will consume a large amount of KWIN resources when transmitted between X11 and Wayland, affecting the image composition function of KWIN itself and causing a crash.

[0040] Figure 2 is a flowchart of a clip data processing method according to an example embodiment of the present disclosure, which can be executed by any electronic device with corresponding computing capability.

[0041] Referring to Figure 2 In step 201, in response to a clip event initiated by a first window system application, the first clip data associated with the clip event is read by a clipboard manager.

[0042] The first window system application is an application running under the first window system. This step realizes the listening of the clip event and the acquisition of the original clip data.

[0043] In step 202, the first clip data is converted by the clipboard manager across the window system formats to convert the first clip data from a first data format to a second data format, to obtain second clip data.

[0044] This step realizes the conversion of the clip data across the window system formats. The first data format is a data format supported by the first window system, and the second data format is a data format supported by the second window system corresponding to the first data format, and the second window system is different from the first window system. For example but not limited to, the first data format is an image data format supported by the first window system, and the second data format is an image data format supported by the second window system.

[0045] In step 203, in response to the paste event initiated by the second window system application, the second clip data is sent to the second window system application by the clipboard manager.

[0046] The second window system application is an application running under the second window system. This step performs corresponding data provision in response to the paste event.

[0047] According to the clip data processing method of the example embodiment of the present disclosure, by separating the processing logic of the clip data and entrusting it to the clipboard manager for execution, without relying on other existing functional modules, the clip data conversion performance of different window system applications can be reliably guaranteed, and the calculation resource occupation of other existing functional modules can be reduced, which helps to improve the user experience. It should be understood that the clipboard manager will also retain the original first clip data for other applications running under the first window system to paste.

[0048] Specifically, for the foregoing related technology of using KWIN to realize the exchange of clip data between X11 applications and Wayland applications, if the clip data processing method of the example embodiment of the present disclosure is adopted, the window compositor can be liberated, and no matter how much the data amount of the clip data is, KWIN resources will not be consumed, which guarantees the synthesis effect of the image synthesis function of the window, and guarantees the reliable execution of data copying. In addition, since the clip data is uniformly managed by the clipboard manager, only one pipeline transmission is required, which reduces the number of pipeline transmissions and can effectively reduce data delay. For the convenience of comparison with the prior art, still taking the transmission of clip data from X11 applications to Wayland applications as an example, referring to Figure 1 For comparison, still taking the transmission of clip data from X11 applications to Wayland applications as an example, referring to Figure 3 When the user copies content in the X11 application, the clipboard manager also creates an X11 window to obtain the first clip data associated with the copy event, and then performs format conversion to obtain the second clip data, and then stores it in the clipboard memory or the disk (for storage in the disk, please refer to the introduction of the embodiment below). When the user performs a paste operation in a Wayland application, the clipboard manager can transmit the converted second clip data to the corresponding Wayland application through the pipeline.

[0049] Next, the clip data processing method according to the example embodiment of the present disclosure will be further introduced.

[0050] Optionally, the method further comprises: storing the second clip data in the specified storage device by the clipboard manager; and sending the second clip data to the second window system application by the clipboard manager, including: in the case that the second window system application has the capability of reading data from the storage device, passing the access mode of the second clip data to the second window system application by the clipboard manager, so that the second window system application reads the second clip data from the specified storage device. By storing the converted second clip data in the specified storage device instead of temporarily storing it in the clipboard memory, the stable storage capability of the storage device (for example, including but not limited to a disk) can be used to realize the overall storage of a large amount of data. This not only can be used as data backup, but also can prevent the memory from being occupied too high and reduce the risk of system crash when processing a large amount of data. In addition, since the related art stores data in the clipboard memory, a protocol needs to be used when reading data, and the protocol has a data reading limit, so when the data amount is large, multiple reading needs to be performed in batches. The present disclosure stores the second clip data in the stable specified storage device, and when the second window system application with corresponding reading capability needs to read the second clip data, it only needs to pass the access mode of the second clip data to the second window system application, for example, including but not limited to passing the access mode by a handle, so that the second window system application reads the second clip data in the specified storage device at one time through the access mode, which can effectively improve the data reading speed and reduce the reading delay of large data. At the same time, for the case of multiple reading in batches, if only one reading is performed when actually reading data, the read data will be incomplete, causing copy failure. The one-time reading based on the specified storage device of the present disclosure can effectively solve the problem of copy failure.

[0051] Optionally, the second data format includes a data format of a different content format for the same content type as the first data format. Specifically, the second data format includes a data format supported by the second window system, which is of a different content format for the same content type as the first data format. In other words, when performing cross-window system format conversion in step 202, in addition to converting the data format for different window systems, the conversion can also be performed for different content formats of the same content type, realizing two levels of data format conversion to meet more format requirements and also solve the compatibility and copy failure problems caused by different content formats used between different applications.

[0052] For example, in a case where the first data format is a data format for picture content type, the second data format includes a lossless compression data format for picture content type, for example, the first data format can be bmp format, and the second data format can be jpeg format, which can reduce the amount of data and reduce the consumption of storage resources. In a case where the first data format is a data format for text content type, the second data format includes a general encoding data format for text content type, for example, the first data format can be a text encoding format specific to a certain field, such as a Founder GBK subset encoding, and the second data format can be a UTF-8 format, which can reduce garbled characters.

[0053] It should be noted that, on this basis, considering that different second window system applications can support different data formats, the second data format can also include a data format supported by the second window system and having the same content format as the first data format for the same content type, and the clipboard manager can send the second clip data in the corresponding format to the second window system application according to the data format supported by the second window system application that initiates the paste event, so as to simultaneously consider the conversion of the content format and the reliable operation of the second window system application. Similarly, the content format of the first clip data can also be converted, and the first clip data in two formats can be simultaneously retained to meet the data format requirements of different applications running under the first window system.

[0054] Optionally, one of the first window system application and the second window system application is an X application (for example, including but not limited to an X11 application), and the other of the first window system application and the second window system application is a Wayland application, and compatibility of the clip data between the two window system applications can be realized.

[0055] As can be known from the foregoing description of the related art, when capturing the clip data of the X application, a new X window needs to be created to obtain the first clip data in the X window that initiates the paste event by using the window, because the X application needs to realize data transmission through the window. This also means that when a certain X window is closed, the clip data of the window will disappear.

[0056] In this regard, optionally, in a case where the first window system application is an X application, in response to the window of the first window system application that initiates the paste event being closed, the clipboard manager takes over as the owner of the first clip data to send the first clip data to other X applications in response to a paste event initiated by the other X applications. By letting the clipboard manager take over the first clip data of the closed first window system application window, it can be ensured that the first clip data can continue to be used by other X applications, thereby prolonging the service life of the clip data of the X application.

[0057] Next, the data processing method of the specific embodiment of the present disclosure is introduced. This specific embodiment is used to share the clipboard data between X11 applications and Wayland applications, mainly including the following three aspects of main content.

[0058] 1. Clipboard manager integration: The clipboard conversion logic of XWL is transplanted into the clipboard manager, making it the central node for handling clipboard data. This can reduce data transmission between different modules, reduce pipeline transmission times, and reduce latency.

[0059] 2. Data format conversion optimization: A more efficient data format conversion mechanism is implemented in the clipboard manager to ensure that clipboard data between X11 and Wayland can be quickly and accurately converted, solving compatibility problems.

[0060] 3. Data disk writing mechanism: Introducing data disk writing function, that is, temporarily storing clipboard data to disk. This not only serves as a data backup, but also prevents high memory usage when processing large amounts of data, avoiding system crashes.

[0061] Referring to Figure 3 , the processing steps of this specific embodiment from X11 applications to Wayland applications (and vice versa) are as follows.

[0062] 1. Capture X11 clipboard event: When the user performs a copy operation in the X11 application, the clipboard manager listens to and captures the X11 clipboard event.

[0063] 2. Create X11 window: After capturing the X11 clipboard event, create an X11 window to accept and temporarily store the first clipboard data copied by the X11 application.

[0064] 3. Data format conversion: Convert the X11 format data in the receiver to a format that Wayland can recognize.

[0065] 4. Data disk writing: To prevent high memory usage when processing large data, store the converted second clipboard data on disk.

[0066] 5. Data transmission to Wayland application: When the user performs a paste operation in the Wayland application, transfer the access method of the second clipboard data on disk to the Wayland application for its use.

[0067] Through this series of optimization steps, the processing flow of clipboard data can be effectively optimized, improving the performance and user experience of KWIN in the Wayland environment. This method not only reduces the delay of data transmission, but also solves the problem of system crashes caused by large data copying, and improves the compatibility of X11 and Wayland clipboard data.

[0068] Figure 4 is a schematic diagram of the specific processing flow of the X11 application to the Wayland application of the specific embodiment according to the present disclosure.

[0069] Referring to Figure 4 First, the XWL of KWIN no longer listens to the CLIPBOARD clipboard event of X11, and the clipboard manager listens to the CLIPBOARD clipboard event through xcb_xfixes_select_selection_input.

[0070] After receiving the CLIPBOARD clipboard Owner (owner, indicating the application currently holding the clipboard data) change, the targets (i.e. MimeType) are obtained through xcb_convert_selection.

[0071] After receiving the MimeType, the corresponding first clipboard data content is obtained through xcb_get_property.

[0072] After receiving the first clipboard data, the data is stored and landed, and the format conversion (i.e. from X11 to Wayland) and content format conversion (i.e. image format and text encoding conversion) across the window system are performed to obtain the second clipboard data. At the same time, the content format conversion of the first clipboard data is performed, i.e. the image format and text encoding conversion.

[0073] The second clipboard data sets the MimeType to KWIN through the zwlr_data_control_device_v1 in the Wayland protocol, i.e. the clipboard manager as a client declares itself as the Owner to the KWIN server, and sends a message to all Wayland applications, so that these Wayland applications can obtain the second clipboard data from the clipboard manager.

[0074] When the Wayland application requests data through the protocol, the clipboard manager sends the format-converted second clipboard data to the application end through the pipe through the send function in zwlr_data_control_source_v1.

[0075] When the X11 application requests data through the X11 protocol, the clipboard manager sends the Mimetype and content of the content format-converted first clipboard data to the client through the xcb_change_property function.

[0076] Figure 5is a schematic diagram of the specific processing flow of the Wayland application to X11 application of the clip data according to the specific embodiments of the present disclosure.

[0077] Referring to Figure 5 , first, the clipboard manager listens to the clip event.

[0078] Then, the clip event is obtained through selection in the wayland protocol zwlr_data_control_device_v1.

[0079] Then, the MimeType is obtained through offer in the wayland protocol zwlr_data_control_device_v1.

[0080] Next, the content of the first clip data is obtained through receive in the wayland protocol zwlr_data_control_device_v1.

[0081] After receiving the first clip data, the data is stored and the format conversion (i.e. from Wayland to X11) and content format conversion (i.e. image format and text encoding conversion) across the window system are performed to obtain the second clip data. At the same time, the content format conversion (i.e. image format and text encoding conversion) of the first clip data is performed.

[0082] Similarly Figure 4 , the first clip data sets the MimeType to KWIN through set_selection in the wayland protocol zwlr_data_control_device_v1, i.e. the clipboard manager declares itself as the Owner.

[0083] Next, to realize the data paste of the X11 application, an X11 window needs to be created and set as the Owner.

[0084] The clipboard manager sets the Mimetype to the created window through xcb_change_property.

[0085] When the Wayland application requests data through the protocol, the clipboard manager sends the content format converted first clip data to the application end through the pipe through the send function in zwlr_data_control_source_v1.

[0086] When the X11 application requests data through the X11 protocol, the clipboard manager sends the format converted second clip data to the client through the xcb_change_property function.

[0087] The embodiment optimizes the workflow of the clipboard manager in depth, and innovatively integrates the clipboard conversion logic of XWL into the clipboard manager seamlessly. This optimization not only simplifies the cumbersome steps of data flow, but also greatly reduces the operation delay, significantly improving the system response speed.

[0088] The embodiment also converts the clipboard data Mimetype of X11 and Wayland in the clipboard manager while adding data format conversion mechanisms such as picture and text encoding, ensuring that the clipboard data between X11 and Wayland can be quickly and accurately converted, not only solving the long-standing compatibility problem, but also bringing users a seamless switching experience.

[0089] In addition, the embodiment innovatively introduces a data disk function, temporarily storing massive clipboard data in the disk, effectively avoiding the system freezing phenomenon caused by high memory occupation. This function not only improves the stability of the system, but also ensures that users can still enjoy a smooth operation experience when processing a large amount of data.

[0090] Through the implementation of a series of optimization measures, the embodiment covers the delicate design of the clipboard manager, diversified data conversion methods, and fine-grained data disk strategies. These innovations not only reduce the problems of freezing, delay, and high memory occupation, greatly improve the stability of the system X11 clipboard in the Wayland environment, significantly improve the performance of X11 in processing clipboard data in the Wayland environment, and realize consistent experience in the X11 environment, bringing users a better user experience. Looking to the future, these technological achievements will lay a solid foundation for the continuous development of the system, leading the industry technology to a new height.

[0091] Figure 6 is a block diagram of a clipboard data processing apparatus according to an example embodiment of the present disclosure. Referring to Figure 6 The apparatus includes a reading unit 601, a conversion unit 602, and a sending unit 603.

[0092] The reading unit 601 is configured to read, in response to a clipboard event initiated by a first window system application, first clipboard data associated with the clipboard event through a clipboard manager, wherein the first window system application is an application running under a first window system.

[0093] The conversion unit 602 is configured to perform cross-window system format conversion on the first clip data by the clipboard manager to convert the first clip data from a first data format to a second data format, to obtain second clip data, wherein the first data format is a data format supported by the first window system, the second data format is a data format supported by the second window system and corresponding to the first data format, and the second window system is different from the first window system.

[0094] The sending unit 603 is configured to send the second clip data to a second window system application by the clipboard manager in response to a paste event initiated by the second window system application, wherein the second window system application is an application running under the second window system.

[0095] Optionally, the clip data processing apparatus further comprises a storage unit (not shown in the figure) configured to store the second clip data into a specified storage device by the clipboard manager; and the sending unit 603 is further configured to, in the case that the second window system application has the capability of reading data from the storage device, pass an access mode of the second clip data to the second window system application by the clipboard manager, so that the second window system application reads the second clip data from the specified storage device.

[0096] Optionally, the second data format comprises a data format of different content format for the same content type as the first data format.

[0097] Optionally, in the case that the first data format is a data format for picture content type, the second data format comprises a lossless compression data format for picture content type.

[0098] Optionally, in the case that the first data format is a data format for text content type, the second data format comprises a general encoding data format for text content type.

[0099] Optionally, one of the first window system application and the second window system application is an X application, and the other of the first window system application and the second window system application is a Wayland application.

[0100] Optionally, in the case that the first window system application is an X application, in response to the window initiating the paste event of the first window system application being closed, the clipboard manager takes over the first window system application to become the owner of the first clip data, so as to send the first clip data to other X applications in response to paste events initiated by the other X applications.

[0101] As to the apparatus in the above-mentioned embodiments, the specific manners in which the units perform operations have been described in detail in the embodiments of the method, and thus will not be described in detail here.

[0102] According to an embodiment of the present disclosure, an electronic device can be provided. Figure 7 is a block diagram of an electronic device 700 according to an embodiment of the present disclosure, the electronic device including at least one memory 701 and at least one processor 702, the at least one memory having stored therein a set of computer executable instructions 7011 and an operating system 7012, the set of computer executable instructions 7011, when executed by the at least one processor 702, performing a method of processing clip data according to an embodiment of the present disclosure.

[0103] As an example, the electronic device 700 can be a PC computer, a tablet device, a personal digital assistant, a smart phone, or other device capable of executing the above-described set of instructions. Here, the electronic device 700 need not be a single electronic device, but can be a collection of any devices or circuits capable of executing the above-described instructions (or set of instructions) individually or jointly. The electronic device 700 can also be part of an integrated control system or system manager, or can be configured as a portable electronic device that interfaces with local or remote (e.g., via wireless transmission) devices.

[0104] In the electronic device 700, the processor 702 can include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller, or a microprocessor. As an example and not by way of limitation, the processor 702 can also include an analog processor, a digital processor, a microprocessor, a multi-core processor, a processor array, a network processor, etc.

[0105] The processor 702 can execute instructions or code stored in the memory, where the memory 701 can also store data. The instructions and data can also be sent and received over a network via a network interface device, which can employ any known transmission protocol.

[0106] The memory 701 can be integrated with the processor 702, e.g., disposed within an integrated circuit microprocessor, etc. Further, the memory 701 can include a separate device, such as an external disk drive, a storage array, or other storage device usable by any database system. The memory 701 and the processor 702 can be operatively coupled, or can communicate with each other, e.g., through I / O ports, network connections, etc., such that the processor 702 can read files stored in the memory 701.

[0107] Further, the electronic device 700 can also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, a mouse, a touch input device, etc.). All components of the electronic device can be connected to each other via a bus and / or a network.

[0108] According to an embodiment of the present disclosure, a computer readable storage medium is also provided, wherein when instructions in the computer readable storage medium are run by at least one processor, the at least one processor is caused to perform the method for processing clip data according to an embodiment of the present disclosure. Examples of the computer readable storage medium herein include read-only memory (ROM), programmable read-only memory (PROM), electrically programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, nonvolatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-RLTH, BD-RE, Blu-ray or optical disk memory, hard disk drive (HDD), solid state disk (SSD), card memory (such as a multimedia card, a secure digital (SD) card or an extreme digital (XD) card), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid state disk, and any other device configured to store a computer program in a non-transitory manner and provide the computer program to a processor or computer so that the processor or computer can execute the computer program. The computer program in the computer readable storage medium described above can be run in an environment deployed in a computer device such as a client, a host, an agent device, a server, etc., and in addition, in one example, the computer program and any associated data, data files and data structures are distributed on a networked computer system, so that the computer program and any associated data, data files and data structures are stored, accessed and executed by one or more processors or computers in a distributed manner.

[0109] According to an embodiment of the present disclosure, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the method for processing clip data according to an embodiment of the present disclosure.

[0110] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the aspects disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure following, in general, the principles of the present disclosure and including such features that are evident to those skilled in the art or are known in the art and can be used in combination with the present disclosure. The specification and examples are to be considered exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.

[0111] It should be understood that the present disclosure is not limited to the precise construction that has been described above and shown in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the present disclosure. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for processing cut-and-paste data, characterized in that, include: In response to a clipping event initiated by a first window system application, the first clipping data associated with the clipping event is read through the clipboard manager, wherein the first window system application is an application running under the first window system; The clipboard manager performs cross-window system format conversion on the first clipboard data to convert the first clipboard data from a first data format to a second data format, thereby obtaining second clipboard data. The first data format is a data format supported by the first window system, and the second data format is a data format supported by the second window system that corresponds to the first data format. The second window system is different from the first window system. In response to a paste event initiated by the second window system application, the second clipboard data is sent to the second window system application through the clipboard manager, wherein the second window system application is an application running under the second window system.

2. The clipping data processing method as described in claim 1, characterized in that, The clipboard data processing method further includes: storing the second clipboard data into a specified storage device through the clipboard manager; Sending the second clipboard data to the second window system application via the clipboard manager includes: when the second window system application has the ability to read data from a storage device, passing the access method of the second clipboard data to the second window system application via the clipboard manager, so that the second window system application can read the second clipboard data from the specified storage device.

3. The clipping data processing method as described in claim 1, characterized in that, The second data format includes data formats that are for the same content type as the first data format but use a different content format.

4. The clipping data processing method as described in claim 3, characterized in that, When the first data format is a data format for image content types, the second data format includes a lossless compressed data format for image content types; and / or When the first data format is a data format for text content types, the second data format includes a general encoded data format for text content types.

5. The clipping data processing method according to any one of claims 1 to 4, characterized in that, One of the first window system application and the second window system application is the X application, and the other of the first window system application and the second window system application is the Wayland application.

6. The clipping data processing method as described in claim 5, characterized in that, When the first window system application is an X application, the window that initiated the clipping event in response to the first window system application is closed, and the clipboard manager takes over as the owner of the first clipping data from the first window system application, so as to send the first clipping data to the other X application in response to a paste event initiated by the other X application.

7. A clipping data processing device, characterized in that, include: The reading unit is configured to read the first clipping data associated with the clipping event through the clipboard manager in response to a clipping event initiated by the first window system application, wherein the first window system application is an application running under the first window system; The conversion unit is configured to perform cross-window system format conversion on the first clipboard data through the clipboard manager to convert the first clipboard data from a first data format to a second data format to obtain second clipboard data. The first data format is a data format supported by the first window system, and the second data format is a data format supported by the second window system that corresponds to the first data format. The second window system is different from the first window system. The sending unit is configured to send the second clipping data to the second window system application via the clipboard manager in response to a paste event initiated by the second window system application, wherein the second window system application is an application running under the second window system.

8. An electronic device, characterized in that, include: At least one processor; At least one memory that stores computer-executable instructions. The computer-executable instructions, when executed by the at least one processor, cause the at least one processor to perform the clipping data processing method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by at least one processor, the at least one processor causes the at least one processor to perform the clipping data processing method as described in any one of claims 1 to 6.

10. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by at least one processor, they cause the at least one processor to perform the clipping data processing method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and apparatus of managing items on clipboard of portable terminal

    CN103430140A

  • Method and device for processing clipped and pasted content

    CN114518965A