Shear plate management method and device, equipment, medium and product
By performing process identification and content comparison on data in the clipboard manager, the problems of lag and memory consumption during large data transfers are solved, achieving efficient data filtering and management, and improving user experience and system performance.
Patent Information
- Application Number
- CN202511445694.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-10
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-10-10
AI Technical Summary
Existing clipboard management solutions cannot effectively interrupt the data transmission process during large data transfers, resulting in user interface lag and failure to directly filter copied content, increasing memory usage and resource consumption.
By comparing the process identifier and data content of the data to be added with the data currently being added or already added in the clipboard manager, it is determined whether to interrupt or filter data transmission. The process identifier is obtained using the Wayland protocol extension interface, and the data content is determined to be the same using the MD5 algorithm.
It effectively avoids lag caused by multiple large data copying operations, reduces memory usage, improves operational smoothness and efficiency, and provides a smoother user experience and system performance.
Smart Images

Figure CN120929286A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a clipboard management method, apparatus, device, medium, and product. Background Technology
[0002] In operating systems, the clipboard is a crucial mechanism for data transfer, and its performance and user experience are paramount. With the development of computer technology, the implementation of clipboard functionality has changed significantly. In some cases, a clipboard manager can be used to manage and save copied or cut content, improving the efficiency of clipboard data transfer.
[0003] However, when performing copy or cut, if the operation of adding data to the clipboard needs to be performed multiple times, it may cause problems such as repeated data transmission and excessive transmission time, resulting in lag in the user interface and seriously affecting operational efficiency and user experience. Summary of the Invention
[0004] In view of the problems that may cause user interface lag due to data duplication and excessive transmission time in copy or cut operations in related technologies, this disclosure provides a clipboard management method, apparatus, device, medium, and product to at least solve or alleviate the above-mentioned problems. The technical solution of this disclosure is as follows: According to a first aspect of this disclosure, a clipboard management method is provided, the clipboard management method being applied to a clipboard manager, wherein the clipboard management method includes: in response to receiving a clipboard instruction to add first data to the clipboard, comparing the first data with data previously instructed to be added to the clipboard; and determining, based on the result of the comparison, whether to add the first data to the clipboard.
[0005] Optionally, comparing the first data with data previously indicated to be added to the clipboard includes: in response to the existence of second data currently being added to the clipboard, comparing a first process of the first data with a second process of the second data, wherein determining whether to add the first data to the clipboard based on the comparison result includes: in response to the first process being the same as the second process, interrupting the addition of the second data to the clipboard, and determining to add the first data to the clipboard.
[0006] Optionally, the clipboard command carries the process identifier of the first process, and the clipboard command is sent to the clipboard manager by the window manager via the Wayland protocol, wherein the Wayland protocol includes an extension interface for obtaining the process identifier of the process corresponding to the data to be added to the clipboard.
[0007] Optionally, comparing the first data with data previously instructed to be added to the clipboard further includes: in response to the absence of data currently being added to the clipboard, comparing the first process with the processes of each data already added to the clipboard, wherein determining whether to add the first data to the clipboard based on the comparison result includes: stopping the addition of the first data to the clipboard in response to the first process being the same as the third process of the third data already added to the clipboard, and the interval between the clipboard instruction for the first data and the clipboard instruction for the third data being less than a preset time.
[0008] Optionally, the clipboard management method further includes: in response to the first process being different from the second process, continuing to add the second data to the clipboard, and adding the first data to the clipboard after the addition of the second data is completed.
[0009] Optionally, comparing the first data with data that was previously instructed to be added to the clipboard includes: comparing the first data with each piece of data already added to the clipboard, wherein determining whether to add the first data to the clipboard based on the result of the comparison includes: stopping the addition of the first data to the clipboard in response to the first data being the same as a fourth piece of data already added to the clipboard, and placing the fourth piece of data at the beginning of the clipboard.
[0010] Optionally, determining whether to add the first data to the clipboard based on the comparison result further includes: in response to the first data being different from all data already added to the clipboard, performing the step of starting to add the first data to the clipboard.
[0011] Optionally, comparing the first data with each piece of data already added to the clipboard includes: comparing the data type of the first data with the data type of each piece of data already added to the clipboard; in response to the first data having the same data type as any data, comparing the data features of the first data with the data features of the arbitrary data, wherein the data features characterize the content of the data, and the same data features indicate that the data are the same.
[0012] According to a second aspect of this disclosure, a clipboard management device is provided, the clipboard management device being applied to a clipboard manager, wherein the clipboard management device includes: a comparison unit configured to compare the first data with data previously instructed to be added to the clipboard in response to receiving a clipboard instruction to add first data to the clipboard; and a determination unit configured to determine whether to add the first data to the clipboard based on the result of the comparison.
[0013] According to a third aspect of this disclosure, a computing device is provided, the computing device comprising: a processor; and a memory for storing computer-executable instructions, wherein the computer-executable instructions, when executed by the processor, cause the processor to perform a clipboard management method according to an embodiment of this disclosure.
[0014] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided that, when instructions in the computer-readable storage medium are executed by a processor of a computing device, enables the computing device to perform a clipboard management method according to embodiments of this disclosure.
[0015] According to a fifth aspect of this disclosure, a computer program product is provided, including computer-executable instructions that, when executed by at least one processor, implement the clipboard management method according to embodiments of this disclosure.
[0016] The technical solution provided in this disclosure brings at least the following beneficial effects: By employing the clipboard management scheme disclosed herein, the first data can be compared with the data previously instructed to be added to the clipboard. Based on the comparison result, it can be determined whether to add the first data to the clipboard. Thus, the data currently being operated on can be compared with data that has been added to or is being added to the clipboard. Based on the data comparison result, it can be determined whether to continue the operation of adding the first data to the clipboard. This allows for the determination of whether to perform operations on subsequently copied / cut data, taking into account the data copied / cut first, thereby avoiding unnecessary data transfer, improving the smoothness and efficiency of the operation, reducing user waiting time, and avoiding problems such as interface lag, bringing users a smoother operation efficiency and system experience.
[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0019] Figure 1 This is a schematic flowchart of a clipboard management method according to exemplary embodiments of the present disclosure.
[0020] Figure 2 This is a schematic flowchart illustrating process-based data filtering in a clipboard management method according to exemplary embodiments of the present disclosure.
[0021] Figure 3 This is an illustrative flowchart illustrating data filtering based on data content in a clipboard management method according to exemplary embodiments of the present disclosure.
[0022] Figure 4 This is a schematic flowchart illustrating an application example of a clipboard management method according to exemplary embodiments of the present disclosure.
[0023] Figure 5 This is a schematic block diagram of a clipboard management device according to exemplary embodiments of the present disclosure.
[0024] Figure 6 This is a block diagram of a computing device according to exemplary embodiments of the present disclosure. Detailed Implementation
[0025] In order to enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0026] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0027] It should be noted that the phrase "at least one of several items" in this disclosure refers to three parallel cases: "any one of the several items", "a combination of any number of the several items", and "all of the several items". For example, "including at least one of A and B" includes the following three parallel cases: (1) including A; (2) including B; (3) including A and B. Another example is "performing at least one of step one and step two", which means the following three parallel cases: (1) performing step one; (2) performing step two; (3) performing both step one and step two.
[0028] As mentioned earlier, in related technologies, because copy or cut operations cannot be interrupted, users may experience lag when repeatedly performing clipboard operations.
[0029] Taking Unix-like systems as an example, the Wayland protocol is a display protocol for Unix-like systems that defines how windows are managed, aiming to provide efficient and secure window management services. Compared to the traditional X Window system, the Wayland protocol uses a simpler and more direct communication method, making the interaction between applications and the display server more efficient and secure.
[0030] The implementation of clipboard functionality changed significantly in the Wayland protocol. The Wayland protocol employs a decentralized design, allowing applications to communicate directly without going through a central server. This design improves data transmission efficiency and enhances system security.
[0031] However, the clipboard can still face some issues when it comes to copying large amounts of data (including copying and cutting). Specifically, because data needs to be transferred directly between applications, large datasets can lead to excessively long transfer times, impacting user experience. Furthermore, some applications may filter or transform clipboard data, which also increases the complexity and time consumption of copy operations.
[0032] To address these issues, the Wayland protocol and its implementations can employ several optimization measures. For example, data compression mechanisms can be introduced to reduce the amount of data transmitted, thereby decreasing the time required for copy operations. Furthermore, support for asynchronous transfers can be provided, allowing applications to continue performing other tasks while the copy operation is in progress, thus avoiding user interface lag and excessively long waiting times.
[0033] In some cases, applications may not want to receive all data from the clipboard, or they may need to filter out certain content. For example, a text editor might want to filter out HTML tags or special characters from copied content. Clipboard services can clean and filter data before it is sent to the target application.
[0034] Furthermore, for data that requires a longer processing time (such as large files or complex format conversions), asynchronous processing can be used. That is, when data is copied to the clipboard, a flag indicating the start of the operation can be returned, and then data processing and conversion can be performed in the background. This allows users to continue with other operations without waiting for the data processing to complete.
[0035] However, existing clipboard filtering solutions still have significant drawbacks. One of the most prominent issues is that the filtering mechanism cannot effectively interrupt the data transfer process when handling large data transfers. This means that once large data begins to be copied from the source application to the clipboard, the user must wait for the entire transfer to complete without being able to cancel or pause it midway. This uninterrupted characteristic often causes the user interface to lag when copying large amounts of data, severely impacting user experience and efficiency.
[0036] Furthermore, existing clipboard filtering schemes have another problem: they don't directly filter the copied content. This means that regardless of the content being copied, it's first copied completely to the clipboard and stored in memory. This approach not only increases the memory usage required during the copying process but can also lead to unnecessary resource consumption. Especially when processing large amounts of data, the need to copy the entire data to the clipboard undoubtedly exacerbates the memory consumption problem and may even cause system resource strain, affecting the normal operation of other applications.
[0037] Overall, existing clipboard management solutions have significant shortcomings in terms of large data transfer and memory management. To address these issues, a more efficient and flexible filtering mechanism is needed, capable of interrupting data transfer and directly filtering copied content to reduce memory usage and improve system performance.
[0038] In view of the foregoing, exemplary embodiments of the present disclosure provide a clipboard management method, clipboard management apparatus, computing device, computer-readable storage medium, and computer program product that can solve or at least alleviate the aforementioned problems.
[0039] In a first aspect of exemplary embodiments of this disclosure, a clipboard management method is provided. This method can be applied to a clipboard manager, and an example implementation scenario of the clipboard management method according to exemplary embodiments of this disclosure is given below.
[0040] The subject executing this method can be a computing device capable of performing copy and / or cut operations. For example, the operating system of the computing device may have a clipboard manager loaded. The clipboard manager can manage the data added to the clipboard by executing the clipboard management method according to the embodiments of this disclosure.
[0041] The aforementioned computing device may be, but is not limited to, a desktop computer, laptop computer, tablet computer, personal digital assistant, smartphone, or other device capable of performing the above methods. However, the implementation scenario of the above method is merely an example scenario. The method according to the exemplary embodiments of this disclosure can also be applied to other application scenarios. For example, a user may request a server to perform copy or cut reference execution via a network on a user terminal (e.g., mobile phone, desktop computer, tablet computer, etc.). The server can manage the clipboard by executing the method according to the exemplary embodiments of this disclosure. Here, the server may be a standalone server, a server cluster, a cloud computing platform, or a virtualization center.
[0042] The following will refer to Figures 1 to 4 Examples of clipboard management methods according to embodiments of the present disclosure are described. This clipboard management method can be applied to a clipboard manager, such as... Figure 1 As shown, the method may include the following steps: In step 110, in response to receiving a clipboard instruction to add first data to the clipboard, the first data may be compared with data that was previously instructed to be added to the clipboard.
[0043] In step 120, based on the comparison results, it can be determined whether to add the first data to the clipboard.
[0044] Specifically, clipboard commands can be generated based on the user's copy or cut operation on the first data input.
[0045] The first data can be data from any application in any process, and its data type can include, but is not limited to, video, images, text, audio, and application data.
[0046] Here, the objects of comparison may include at least one of the following: the process in which the data resides; the data type; and the data content.
[0047] In one example, the object of comparison can be the process in which the data resides. Specifically, in step 110, comparing the first data with data that was previously instructed to be added to the clipboard may include: in response to the presence of second data currently being added to the clipboard, comparing the first process of the first data with the second process of the second data.
[0048] Here, the first process can be the process that performs a copy or cut operation on the first data, such as the process that the user is currently operating, which can be a process in any application.
[0049] In this example, the first process can be determined by identifying the source of the first data. For example, the first data and information characterizing the source of the first data can be provided together to the clipboard manager.
[0050] For example, using the Wayland protocol, when a user performs a copy or cut operation on first data in any application, the application can send the first data to a window manager (such as KWIN). The window manager can receive the first data and record its source, such as the process that performed the copy or cut operation (e.g., the first process mentioned above). In Unix systems, KWIN is a window manager within a desktop environment, forming part of the desktop environment, and can be used independently or in other desktop environments.
[0051] In addition, the window manager can generate a clipboard instruction that instructs the first data to be added to the clipboard, and can send this clipboard instruction to the clipboard manager. Here, the clipboard instruction may include the address information of the first data.
[0052] As an example, the clipboard command can carry the process ID (PID) of the first process, and the clipboard command can be sent to the clipboard manager by the window manager via the Wayland protocol.
[0053] Here, the Wayland protocol can be extended to send the process ID of the first process to the clipboard manager. Specifically, the Wayland protocol can include an extended interface that can be used to obtain the process ID of the process corresponding to the data to be added to the clipboard.
[0054] For example, the global clipboard protocol wrr-data-control-unstable-v1 can be extended with an interface. To ensure compatibility, this can be controlled by the version number. Example code for the extended interface is as follows: <interface name="zwlr_data_control_offer_v1" version="2"> <description summary="offer to transfer data"> 一个wlr_data_control_offer表示由另一个客户端(源客户端)提供用于传输的数据片段。该提议描述了数据可以转换为的不同MIME类型,并提供了直接从源客户端传输数据的机制。 by another client (the source client). The offer describes thedifferent MIME types that the data can be converted to and provides themechanism for transferring the data directly from the source client. <!-- Add the get_pid event (since version 2) to transfer the process ID of the source client, facilitating the receiving party to identify the data source --> <!-- Can be used to prevent repeated transmission by the same process, implement clipboard deduplication, security policy control, etc.--> < / description> <!-- Sent by the synthesizer to inform the recipient of the process ID (PID) of the client that provided the data. --> <!-- The recipient can use this PID to determine if it is from the same source, for deduplication or to avoid data reflux. --> <!-- Must be sent before the start of data transmission and is only issued if the synthesizer supports obtaining the source process PID. --> <event name="get_pid" since="2"> <description summary="advertise get pid"> Sent by the compositor to inform the receiver of the sourceclient's process ID. < / description> <arg name="pid" type="uint" summary="process ID of the sourceclient" / > < / event> < / interface> The code above is just an example of an extended interface. The Wayland protocol can also be modified in other ways, as long as the window manager can add the process ID of the current copy or cut operation (such as the first process mentioned above) to the clipboard command when sending clipboard commands through the Wayland protocol.
[0055] Using the above method, based on the existing Wayland protocol, the clipboard manager can know the source of the data to be added to the clipboard or the corresponding process, and thus be able to identify the data that needs to be filtered out or interrupted in subsequent steps.
[0056] In embodiments of this disclosure, in response to receiving a clipboard instruction for the first data, it can be determined whether there is data currently being added to the clipboard. When there is second data being added to the clipboard, it can be determined whether the first process of the first data and the second process of the second data are consistent.
[0057] Specifically, the second data can be data that has been copied or cut before the first data. For example, the second data can be large data, so it takes a long time to add it to the clipboard. During the process of adding the second data to the clipboard, the clipboard manager receives copy or cut operations for the first data.
[0058] In related technologies, this process requires waiting for the second data to be completely added to the clipboard before adding the first data. If the second data is large, the user may experience lag in copying or cutting the first data due to the transmission of the second data, affecting user efficiency and system experience. However, in the embodiments of this disclosure, by adding a comparison between the first data to be added to the clipboard and the second data being added to the clipboard, it can be determined whether the second data needs to be filtered out.
[0059] Here, the second data can be data from any application in any process, and its data type can include, but is not limited to, video, images, text, audio, and other application data. The second process can be a process that performs copy or cut operations on the second data; for example, it can be a process that the user has previously operated on or is currently operating on, and it can be a process within any application. Furthermore, the second data can be any data that is related to or completely unrelated to the first data.
[0060] Furthermore, since the second data is data that was copied or cut before the first data, similar to the process described above for the first data, the clipboard manager, in response to receiving a clipboard instruction to add the second data to the clipboard, can determine the second process. For example, the second process can be determined by identifying the source of the second data; for instance, the second data and information characterizing its source can be provided to the clipboard manager together. Similarly, the clipboard instruction for the second data can carry the process identifier (PID) of the second process, and the clipboard instruction for the second data can be sent to the clipboard manager by the window manager via the Wayland protocol.
[0061] In this example, the clipboard manager can compare the process ID of the first process with the process ID of the second process.
[0062] In this example, in step 120, determining whether to add the first data to the clipboard based on the comparison result may include: interrupting the addition of the second data to the clipboard in response to the first process being the same as the second process, and determining to add the first data to the clipboard.
[0063] Specifically, when the first and second processes are the same, it means that the user has performed copy or cut operations on the second data and the first data in the same process. Only the data copied or cut later, i.e. the first data, can be retained, while the data copied or cut earlier, i.e. the second data, can be interrupted or discarded. This solves the problem of lag when copying large amounts of data multiple times and improves the user experience of copying large amounts of data.
[0064] Furthermore, in the method according to embodiments of this disclosure, in response to the difference between the first process and the second process, the second data can continue to be added to the clipboard, and the first data can be added to the clipboard after the addition of the second data is completed.
[0065] In this case, it can be assumed that both the first and second data need to be added to the clipboard, so they can be added sequentially.
[0066] Furthermore, when determining whether there is currently any data being added to the clipboard, as an example, in response to the absence of data being added to the clipboard, the second data can be added to the clipboard, and the first data can be added to the clipboard after the second data has been added.
[0067] As another example, comparing the first data with data that was previously instructed to be added to the clipboard also includes: in response to the absence of data currently being added to the clipboard, comparing the first process with the processes of each piece of data that has already been added to the clipboard.
[0068] In this example, determining whether to add the first data to the clipboard based on the comparison result includes: stopping the addition of the first data to the clipboard in response to the fact that the first process is the same as the third process of the third data that has already been added to the clipboard, and the time interval between the clipboard command for the first data and the clipboard command for the third data is less than a preset time.
[0069] Specifically, the third data is the data that has already been added to the clipboard, which can be data that was copied or cut before the first data.
[0070] Here, the interval between receiving the clipboard command for the first data and the clipboard command for the third data can be determined. If the interval is less than a preset time, it can be considered that key sticking or delay has occurred, resulting in two copy or cut operations occurring within a short period, while the user has actually only performed one copy or cut operation. In this case, the third data can be considered identical to the first data, and adding the first data can be stopped to avoid unnecessary data transfer. The preset time can be set according to actual conditions, for example, it can be 200ms.
[0071] In addition, in response to the fact that the first process is different from all the processes of data that have been added to the clipboard, or that the interval between the clipboard command for the first data and the clipboard command for the third data is greater than or equal to the preset time mentioned above, the first data can be added to the clipboard, or other subsequent steps can be performed (e.g., the data filtering process based on data content described below).
[0072] Figure 2 An example of process-based data filtering in a clipboard management method according to embodiments of the present disclosure is shown. Figure 2 As shown, in step S201, the application can send a copy or cut operation for the first data to the window manager; in step S202, the window manager can send a clipboard instruction to the clipboard manager to add the first data to the clipboard; in step S203, the clipboard manager can perform data verification on the first data; and in step S204, the process identifier of the first process of the first data can be determined.
[0073] In step S205, the clipboard manager can determine whether there is data being transmitted (or added to the clipboard). If so, in step S206, the previous transmission process is closed and a new transmission process begins to add the first data to the clipboard. If not, in step S207, it can determine whether there is data in the same process as the first data, and the interval between the two clipboard commands is less than a preset time. If it is less than the preset time, in step S208, adding the first data to the clipboard can be stopped; if it is not less than the preset time, in step S209, the first data can be added to the clipboard, or other subsequent steps can be executed (e.g., executing a data filtering process based on data content).
[0074] The clipboard management method described above, according to embodiments of the present disclosure, may compare the process in which the data resides, and determine whether the transmission of the preceding data needs to be interrupted or the transmission of the subsequent data needs to be stopped by comparing the processes of each data. In another example of the present disclosure, the objects of comparison may also be the data type and / or the data content of the data.
[0075] Specifically, in step 110, comparing the first data with the data that was previously instructed to be added to the clipboard may include: comparing the first data with each of the data that has already been added to the clipboard, and determining whether to add the first data to the clipboard based on the comparison result may include: stopping the addition of the first data to the clipboard in response to the first data being the same as the fourth data that has already been added to the clipboard, and placing the fourth data at the beginning of the clipboard.
[0076] Furthermore, determining whether to add the first data to the clipboard based on the comparison results may also include: in response to the first data being different from all data already added to the clipboard, the step of adding the first data to the clipboard may be performed.
[0077] Specifically, if a fourth piece of data identical to the first piece of data already exists in the clipboard before adding the first piece of data, then adding the first piece of data to the clipboard can be stopped, and the fourth piece of data can be placed at the beginning of the clipboard to facilitate subsequent pasting operations, etc. If a fourth piece of data identical to the first piece of data does not exist in the clipboard, then the first piece of data can be added to the clipboard.
[0078] By using the above method, you can avoid repeatedly adding the same data to the clipboard, thus avoiding consuming clipboard memory space.
[0079] In the above process, as an example, the first data can be directly compared with each data that has been added to the clipboard. However, in order to improve the processing efficiency of the clipboard manager, as another example, the data characteristics of the first data can be compared with the data characteristics of each data that has been added to the clipboard.
[0080] Here, data features characterize the content of the data; identical data features indicate identical data. For example, a data feature can be an MD5 value. Specifically, the MD5 value of the first data can be calculated using the MD5 algorithm as its data feature. If the data features are identical, the two data sets can be considered to have the same content. This method of comparing data features allows for faster identification of duplicate content. Here, the MD5 algorithm is a widely used cryptographic hash function that produces a 128-bit (16-byte) hash value to ensure the integrity and consistency of transmitted information. However, the embodiments of this disclosure are not limited to this; other methods can also be used to extract data features for comparison.
[0081] As another example, comparing the first data with each piece of data already added to the clipboard includes: comparing the data type of the first data with the data type of each piece of data already added to the clipboard; and, in response to the first data having the same data type as any data, comparing the data characteristics of the first data with the data characteristics of any data.
[0082] Here, data types can be represented, for example, using the MIME type (Multipurpose Internet Mail Extensions type) in the Wayland protocol. As an example, data types can include various data formats such as video, images, text, audio, and applications. As another example, clipboard commands can also carry the data type; thus, the data type and process identifier can be sent together in the clipboard command by the window manager to the clipboard manager via the Wayland protocol.
[0083] In embodiments of this disclosure, the first data can be added to the clipboard in response to the fact that the data type of the first data is different from the data type of any data.
[0084] Specifically, we can first compare the data types. If the data types are the same, we can then compare their features. If the data types are different, there's no need to compare features. For example, if the first data is text, we can simply compare its features with other text data already added to the clipboard. This simplifies the data comparison process, reduces computation, and allows us to more quickly identify duplicate data and eliminate duplicates.
[0085] Figure 3 An example of data filtering based on data content in a clipboard management method according to an embodiment of the present disclosure is shown. For example... Figure 3 As shown, in step S301, the application can send a copy or cut operation for the first data to the window manager; in step S302, the window manager can send a clipboard instruction to the clipboard manager to add the first data to the clipboard; in step S303, the clipboard manager can perform data verification on the first data, and can compare the data type of the first data with the data type of the data already added to the clipboard, and can further compare the data characteristics of the first data with the data characteristics of data of the same type.
[0086] In step S304, based on the comparison result, it can be determined whether the first data is duplicated with the data already added to the clipboard. If duplicates are found, in step S305, the data identical to the first data can be placed at the top of the clipboard, and there is no need to store the first data in the clipboard. If no duplicates are found, in step S306, the first data can be added to / stored in the clipboard.
[0087] In the above example, the process of comparing data types and / or data content can be performed separately or after the process of comparing each piece of data. For example, if it is determined that the second piece of data is added to the clipboard and the first piece of data is added to the clipboard, data filtering can be performed based on the content of the data itself before the first piece of data is added to the clipboard to reduce unnecessary clipboard data transfer.
[0088] Figure 4 An example of a clipboard management method according to an embodiment of the present disclosure, including process comparison and data content comparison, is shown. Figure 4 As shown, in step S401, the application can send a copy or cut operation for the first data to the window manager. In step S402, the window manager can send a clipboard command to the clipboard manager via the Wayland protocol to add the first data to the clipboard. The clipboard command can carry the data type and process identifier of the first data.
[0089] In step S403, the clipboard manager can perform data verification on the first data. Specifically, after receiving the clipboard command for the first data from the window manager, the clipboard manager can determine whether the first data and the data being received have the same process identifier. If they have the same process identifier, data verification and filtering can be performed. Specifically, if the two process identifiers are the same, the previous transmission can be directly disconnected and the current first data can be received.
[0090] Furthermore, in step S403, after receiving the clipboard instruction for the first data from the window manager, the clipboard manager can also determine whether the first data and the stored data have the same MIME type. If they have the same MIME type, the content MD5 check can be performed. Specifically, if the first data is duplicated with the stored data, the existing data in the clipboard can be moved to the top position, and the clipboard content order can be set to activate the current data. If there is no duplicate data with the first data, the first data can be stored directly, and the clipboard content can be set to activate the first data.
[0091] In step S404, based on the comparison result, it can be determined whether the first data is duplicated with the data already added to the clipboard. If there is a duplicate, in step S405, the data that is the same as the first data can be placed at the top of the clipboard, and there is no need to add the first data to the clipboard. If there is no duplicate, in step S406, the first data can be added to the clipboard.
[0092] The clipboard, as an important data sharing mechanism in operating systems, is responsible for transferring data between different applications. However, existing clipboard technologies have significant shortcomings in large-scale data copying / cutting and data deduplication filtering. To address these issues, embodiments of this disclosure propose a novel clipboard management scheme aimed at resolving the lag problem associated with multiple large-scale data copying / cutting, thereby improving the user experience of large-scale data copying, and resolving the problem of duplicate data storage, thus reducing system memory usage and improving system smoothness. This, in turn, enhances clipboard performance in large-scale data copying / cutting and data filtering.
[0093] Specifically, according to an exemplary embodiment of this disclosure, when the clipboard manager receives new data, it first determines the source based on the process ID of the sending end. If the process ID is the same as the process ID of the currently transmitting data, it is considered to be a continuous or repeated operation from the same source, and the previous transmission can be interrupted to avoid wasting resources. On this basis, it further compares the MIME type of the newly received data with the data already stored in the clipboard. When the types are the same, a content-level deduplication mechanism is initiated. The MD5 digest values of the two are calculated and compared to determine whether the content is consistent. If they are consistent, it is determined to be completely duplicate data, and the new data is directly discarded. Otherwise, the clipboard content is updated.
[0094] In the above process, "process ID judgment" is the first layer of filtering, which can quickly eliminate duplicate triggers from the same source; while "MIME+MD5" is the second layer of fine filtering, which can prevent data redundancy from different sources but with the same content. The two constitute a complete deduplication system with logical hierarchy, thus demonstrating strong correlation and technical synergy.
[0095] Specifically, to address the lag caused by multiple copies of large amounts of data, the embodiments of this disclosure significantly improve the user experience of copying large amounts of data by optimizing the copy mechanism. Specifically, a process identifier and interval time verification mechanism are introduced to effectively reduce unnecessary data transmissions, thereby greatly improving the smoothness and efficiency of the copy operation.
[0096] Furthermore, to address the issue of excessive system memory consumption caused by multiple storage of duplicate data, the embodiments of this disclosure implement an efficient data deduplication mechanism that automatically identifies and filters duplicate content before data is copied to the clipboard, thereby avoiding multiple storage of duplicate data. This improvement not only effectively reduces system memory usage but also enhances the efficiency and accuracy of data management. In addition, it provides users with a clearer and more concise clipboard view, improving user convenience.
[0097] Overall, the embodiments of this disclosure achieve precise filtering of clipboard data by comprehensively utilizing extended image protocols and interval time verification mechanisms, significantly reducing the number of data transfers. Furthermore, the adoption of advanced data content filtering methods effectively reduces memory usage and improves system resource utilization efficiency. This method is applicable to any scenario, such as the development of the PC Wayland clipboard, providing developers with a more efficient and flexible means of clipboard data processing.
[0098] In a second aspect of exemplary embodiments of this disclosure, a clipboard management device is provided, such as... Figure 5 As shown, the shear plate management device 500 may include a comparison unit 510 and a determination unit 520.
[0099] The comparison unit 510 is configured to compare the first data with data that was previously instructed to be added to the clipboard in response to receiving a clipboard instruction to add the first data to the clipboard.
[0100] The determining unit 520 is configured to determine whether to add the first data to the clipboard based on the result of the comparison.
[0101] As an example, the comparison unit 510 is configured to: in response to the existence of second data being added to the clipboard, compare the first process of the first data with the second process of the second data, wherein the determination unit 520 is configured to: in response to the first process being the same as the second process, interrupt the addition of the second data to the clipboard, and determine to add the first data to the clipboard.
[0102] As an example, the clipboard command carries the process identifier of the first process. The clipboard command is sent by the window manager to the clipboard manager via the Wayland protocol. The Wayland protocol includes an extension interface for obtaining the process identifier of the process corresponding to the data to be added to the clipboard.
[0103] As an example, the comparison unit 510 is configured to: in response to the absence of data currently being added to the clipboard, compare the first process with the processes of each data already added to the clipboard, wherein the determination unit 520 is configured to: in response to the first process being the same as the third process of the third data already added to the clipboard, and the interval between the clipboard instruction for the first data and the clipboard instruction for the third data being less than a preset duration, stop adding the first data to the clipboard.
[0104] As an example, the determining unit 520 is also configured to: continue adding second data to the clipboard in response to the difference between the first process and the second process, and add the first data to the clipboard after the addition of the second data is completed.
[0105] As an example, the comparison unit 510 is configured to compare the first data with each piece of data already added to the clipboard, wherein the determination unit 520 is configured to stop adding the first data to the clipboard and place the fourth data at the beginning of the clipboard in response to the first data being the same as the fourth data already added to the clipboard.
[0106] As an example, the determining unit 520 is also configured to: in response to the fact that the first data is different from all the data already added to the clipboard, perform the step of starting to add the first data to the clipboard.
[0107] As an example, the comparison unit 510 is configured to: compare the data type of the first data with the data types of each data that has been added to the clipboard; in response to the data type of the first data being the same as the data type of any data, compare the data features of the first data with the data features of any data, wherein the data features characterize the content of the data, and the same data features indicate that the data are the same.
[0108] Regarding the apparatus in the above embodiments, the specific manner in which each unit performs the operation has been described in detail in the embodiments related to the method. Each unit in the clipboard management apparatus can perform the corresponding steps in the method according to the clipboard management method in the method embodiments of the first aspect above, which will not be described in detail here.
[0109] In a third aspect of exemplary embodiments of the present disclosure, a computing device is provided, the computing device comprising: a processor; and a memory for storing computer-executable instructions, wherein the computer-executable instructions, when executed by the processor, cause the processor to perform the clipboard management method according to the present disclosure.
[0110] Figure 6 This is an example block diagram of a computing device according to exemplary embodiments of the present disclosure. Figure 6 As shown, the computing device 600 may include a processor 610 and a memory 620, which may be used to store computer-executable instructions 621 and an operating system 622. Here, when the computer-executable instructions are executed by the processor 610, they cause the processor 610 to execute the clipboard management method as described in the exemplary embodiments above. The computer-executable instructions 621 may run together with the operating system 622 in the processor.
[0111] As an example, computing device 600 is not necessarily a single device, but can be a collection of any means or circuits capable of executing the aforementioned instructions (or instruction sets) individually or in combination. Computing device 600 can also be part of an integrated control system or system manager, or can be configured to interconnect with a server locally or remotely (e.g., via wireless transmission) through an interface.
[0112] In computing device 600, processor 610 may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller, or a microprocessor. By way of example and not limitation, processor 610 may also include an analog processor, a digital processor, a microprocessor, a multi-core processor, a processor array, a network processor, etc.
[0113] The processor 610 can execute instructions or code stored in the memory 620, which can also store data. Instructions and data can also be sent and received over a network via a network interface device, which can employ any known transmission protocol.
[0114] The memory 620 may be integrated with the processor 610, for example, by placing RAM or flash memory within an integrated circuit microprocessor. Alternatively, the memory 620 may include a separate device, such as an external disk drive, a storage array, or any other storage device usable by a database system. The memory 620 and the processor 610 may be operatively coupled, or may communicate with each other, for example, via I / O ports, network connections, etc., enabling the processor 610 to read files stored in the memory 620.
[0115] In addition, the computing device 600 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, mouse, touch input device, etc.). All components of the computing device 600 can be interconnected via a bus and / or network.
[0116] In an exemplary embodiment, a computer-readable storage medium may also be provided, which, when executed by a processor of a computing device, enables the computing device to perform the clipboard management method as described in the exemplary embodiment above. The computer-readable storage medium may be, for example, a memory including instructions. Optionally, the computer-readable storage medium may be: a read-only memory (ROM), a random access memory (RAM), a random access programmable read-only memory (PROM), an electrically erasable programmable read-only memory (EEPROM), a dynamic random access memory (DRAM), a static random access memory (SRAM), flash memory, non-volatile memory, a CD-ROM, a CD-R, a CD+R, a CD-RW, a CD+RW, a DVD-ROM, a DVD-R, a DVD+R, a DVD-RW, a DVD+RW, a DVD-RAM, a BD-ROM, a BD-R, or a BD-R... LTH, BD-RE, Blu-ray or optical disc storage, hard disk drive (HDD), solid-state drive (SSD), card storage (such as multimedia cards, secure digital (SD) cards, or ultra-fast digital (XD) cards), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, and any other device configured to store a computer program and any associated data, data files, and data structures in a non-transitory manner and to provide the computer program and any associated data, data files, and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the aforementioned computer-readable storage medium can run in an environment deployed in computer devices such as clients, hosts, agent devices, servers, etc. Furthermore, in one example, the computer program and any associated data, data files, and data structures are distributed across a networked computer system, such that the computer program and any associated data, data files, and data structures are stored, accessed, and executed in a distributed manner through one or more processors or computers.
[0117] According to exemplary embodiments of the present disclosure, a computer program product may also be provided, the computer program product including computer-executable instructions that, when executed by at least one processor, implement a clipboard management method according to exemplary embodiments of the present disclosure.
[0118] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0119] Furthermore, it should be noted that although several examples of each step have been described above with reference to the specific accompanying drawings, it should be understood that the embodiments of this disclosure are not limited to the combinations given in the examples. The steps appearing in different drawings can be combined, and the execution order of each step can be changed, which will not be exhaustive here.
[0120] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A clipboard management method, characterized in that, The clipboard management method is applied to the clipboard manager, wherein the clipboard management method includes: In response to receiving a clipboard instruction to add first data to the clipboard, the first data is compared with data that was previously instructed to be added to the clipboard. Based on the results of the comparison, determine whether to add the first data to the clipboard.
2. The shear board management method according to claim 1, characterized in that, The comparison of the first data with data that was previously instructed to be added to the clipboard includes: In response to the presence of second data currently being added to the clipboard, the first process of the first data is compared with the second process of the second data. The step of determining whether to add the first data to the clipboard based on the comparison result includes: In response to the first process being the same as the second process, the addition of the second data to the clipboard is interrupted, and the addition of the first data to the clipboard is determined.
3. The shear plate management method according to claim 2, characterized in that, The clipboard command carries the process identifier of the first process. The clipboard command is sent to the clipboard manager by the window manager via the Wayland protocol. The Wayland protocol includes an extension interface for obtaining the process identifier of the process corresponding to the data to be added to the clipboard.
4. The shear plate management method according to claim 2, characterized in that, The comparison of the first data with data that was previously instructed to be added to the clipboard also includes: In response to the absence of data currently being added to the clipboard, the first process is compared with the processes that have already added data to the clipboard. The step of determining whether to add the first data to the clipboard based on the comparison result includes: In response to the first process being the same as the third process of the third data already added to the clipboard, and the interval between the clipboard command for the first data and the clipboard command for the third data being less than a preset time, the addition of the first data to the clipboard is stopped.
5. The shear plate management method according to claim 2, characterized in that, The clipboard management method further includes: In response to the difference between the first process and the second process, the second data is added to the clipboard, and the first data is added to the clipboard after the second data is added.
6. The shear plate management method according to any one of claims 1 to 5, characterized in that, The comparison of the first data with data that was previously instructed to be added to the clipboard includes: Compare the first data with the data that have already been added to the clipboard. The step of determining whether to add the first data to the clipboard based on the comparison result includes: In response to the fact that the first data is the same as the fourth data that has already been added to the clipboard, the addition of the first data to the clipboard is stopped, and the fourth data is placed at the beginning of the clipboard.
7. The shear plate management method according to claim 6, characterized in that, The step of determining whether to add the first data to the clipboard based on the comparison result further includes: In response to the fact that the first data is different from all the data already added to the clipboard, the step of adding the first data to the clipboard is performed.
8. The shear board management method according to claim 6, characterized in that, The comparison of the first data with each piece of data already added to the clipboard includes: Compare the data type of the first data with the data types of each data already added to the clipboard; In response to the fact that the data type of the first data is the same as the data type of any data, the data features of the first data are compared with the data features of the arbitrary data, wherein the data features characterize the content of the data, and the same data features indicate that the data are the same.
9. A shear plate management device, characterized in that, The clipboard management device is applied to the clipboard manager, wherein the clipboard management device includes: The comparison unit is configured to compare the first data with data that was previously instructed to be added to the clipboard in response to receiving a clipboard instruction to add the first data to the clipboard. The determining unit is configured to determine, based on the result of the comparison, whether to add the first data to the clipboard.
10. A computing device, characterized in that, The computing device includes: processor; Memory used to store executable instructions for a computer. Wherein, when the computer-executable instructions are executed by the processor, they cause the processor to execute the clipboard management method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of a computing device, the computing device is able to perform the clipboard management method according to any one of claims 1 to 8.
12. A computer program product comprising computer-executable instructions, characterized in that, When the computer-executable instructions are executed by at least one processor, they implement the clipboard management method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Input method-based practical cloud clipboard
CN106354387A
Display method and electronic terminal equipment
CN113672404A
Method and device for reading clipboard content and electronic equipment
CN115408168A
System and method for manipulating multiple clip items of data
US20040100496A1