Method and device for dragging and dropping file in compatible layer environment, equipment and medium

By setting up the proxy drag-and-drop target interface in the compatibility layer software, the problem of missing file drag-and-drop function of compatible application windows to Linux system windows is solved, and cross-platform file drag-and-drop operations are realized, improving user experience.

CN119718474AActive Publication Date: 2025-03-28ZHONGKE FANGDE SOFTWARE CO LTD

Patent Information

Application Number
CN202510238324.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-03
Publication Date
2025-03-28
Estimated Expiration
2045-03-03

AI Technical Summary

Technical Problem

The existing compatibility layer software has limitations in implementing file drag and drop functions, and cannot drag and drop files from compatible application windows to Linux system windows, resulting in inconvenience to users.

Method used

By setting up the proxy drag-and-drop target interface, drag-and-drop target files from windows of compatible applications to system windows of Unix-like systems, solving the problem of inconsistent drag-and-drop protocols between Windows and Unix-like systems.

Benefits of technology

It realizes the drag-and-drop function from a compatible application window to a Unix-like system window, improving the convenience of user operations and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718474A_ABST
    Figure CN119718474A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method and device for dragging and dropping a file in a compatible layer environment, equipment and a medium, and the method comprises the steps that when a target window dragged and dropped by compatible layer software is a system window, a dragging and dropping target interface of the system window is set as an agent dragging and dropping target interface; according to the drag-and-drop state, calling the proxy drag-and-drop target interface, generating an interaction message, and sending the interaction message to a system window; the proxy drag-and-drop target interface obtains drag-and-drop related data conforming to Windows specifications, and an interaction message is generated; the interaction message accords with a drag and drop protocol corresponding to a graphical user interface system of the Unix-like system; receiving a data request message sent by the system window; and obtaining a file path of the target file from the compatible application, and binding the file path of the target file with the system window. According to the embodiment of the invention, the target file can be dragged to the Unix-like system window from the window compatible with the application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a method, device, equipment and medium for dragging and dropping files in a compatible layer environment. Background Art

[0002] Wine (Wine Is Not an Emulator) is a compatibility layer software that can port applications from a second operating system to a first operating system. Since Wine can translate Windows API (Application Program Interface) calls into dynamic POSIX (Portable Operating System Interface) calls, it can enable Windows applications to run in operating systems other than Windows.

[0003] Windows applications running in a compatibility layer environment can be called compatible applications. Currently, in actual usage scenarios, users often have the need to drag and drop files from the compatible application window to the Linux system window. For example, a compatible communication application runs in the compatibility layer software. When a user receives and downloads a document in the compatible communication application, he often hopes to directly drag and drop the document to a designated folder in the Linux system for storing work files.

[0004] However, after in-depth analysis, it was found that the existing compatibility layer software has certain limitations in the implementation of the file drag and drop function. They only implement the function of dragging and dropping files from the Linux system window to the compatible application, but do not implement the function of dragging and dropping files from the compatible application window to the Linux system window. This has brought inconvenience to the user's operation to a great extent and reduced the user experience. Summary of the invention

[0005] The embodiment of the present application provides a method for dragging and dropping files in a compatibility layer environment, which can realize dragging and dropping a target file from a compatible application window to a Unix-like system window.

[0006] Correspondingly, the embodiments of the present application also provide a device for dragging and dropping files in a compatible layer environment, an electronic device and a machine-readable medium to ensure the implementation and application of the above method.

[0007] In order to solve the above problems, an embodiment of the present application discloses a method for dragging and dropping files in a compatibility layer environment, the method being applied to a compatibility layer software running on a Unix-like system, and being used to drag and drop a target file from a window of a compatible application to a system window of the Unix-like system, the compatible application being a Windows application in a compatibility layer environment provided by the compatibility layer software; the method comprising: receiving a drag and drop initiation request sent by a compatible application; In response to a drag and drop initiation request, obtaining a mouse position; According to the mouse position, determine whether the target window of the drag and drop is a system window; If the drag and drop target window is a system window, the drag and drop target interface of the system window is set as a proxy drag and drop target interface; the proxy drag and drop target interface includes: a drag and drop entry interface, a drag and drop hover interface and a placement interface; According to the drag-and-drop state of the target file, the proxy drag-and-drop target interface is called, and the proxy drag-and-drop target interface generates an interactive message, and sends the interactive message to the system window; the proxy drag-and-drop target interface is used to obtain drag-and-drop related data that conforms to the Windows specification, and generates an interactive message according to the drag-and-drop related data that conforms to the Windows specification; the interactive message conforms to a preset drag-and-drop protocol, and the preset drag-and-drop protocol is a drag-and-drop protocol corresponding to a graphical user interface system of a Unix-like system; wherein, when the drag-and-drop state is the first time entering the system window, the drag-and-drop entry interface is called to obtain a drag-and-drop entry message; the drag-and-drop entry message is used to notify the system window that the mouse has entered the system window; when the drag-and-drop state is to continue dragging and dropping, the drag-and-drop hover interface is called to obtain a drag-and-drop position message; the drag-and-drop position message is used to notify the system window of the position of the mouse in the system window; when the drag-and-drop state is to release the mouse to end dragging and dropping, the placement interface is called to obtain a send placement message; the placement message indicates that the user has completed the drag-and-drop action, so that the system window performs placement processing of the target file; After sending a placement message to the system window, receive a data request message sent by the system window; According to the data request message, obtaining a file path of a target file from a compatible application, and binding the file path of the target file to a system window; Send a notification message to the system window; the notification message is used to notify the system window that the file path of the target file is ready.

[0008] The embodiment of the present application further discloses a device for dragging and dropping files in a compatibility layer environment, the device is applied to a compatibility layer software running on a Unix-like system, and is used to drag and drop a target file from a window of a compatible application to a system window of the Unix-like system, the compatible application being a Windows application in a compatibility layer environment provided by the compatibility layer software; the device comprises: A start request receiving module, used for receiving a drag and drop start request sent by a compatible application; A position acquisition module, used for acquiring a mouse position in response to a drag-and-drop start request; The window judgment module is used to judge whether the dragged and dropped target window is a system window according to the mouse position; A setting module, for setting the drag and drop target interface of the system window as a proxy drag and drop target interface if the drag and drop target window is a system window; the proxy drag and drop target interface includes: a drag and drop entry interface, a drag and drop hover interface and a placement interface; A calling module is used to call the proxy drag-and-drop target interface according to the drag-and-drop state of the target file, generate an interactive message by the proxy drag-and-drop target interface, and send the interactive message to the system window; the proxy drag-and-drop target interface is used to obtain drag-and-drop related data that conforms to the Windows specification, and generate an interactive message according to the drag-and-drop related data that conforms to the Windows specification; the interactive message conforms to a preset drag-and-drop protocol, and the preset drag-and-drop protocol is a drag-and-drop protocol corresponding to a graphical user interface system of a Unix-like system; wherein, when the drag-and-drop state is the first time entering the system window, the drag-and-drop entry interface is called to obtain a drag-and-drop entry message; the drag-and-drop entry message is used to notify the system window that the mouse has entered the system window; when the drag-and-drop state is to continue dragging and dropping, the drag-and-drop hover interface is called to obtain a drag-and-drop position message; the drag-and-drop position message is used to notify the system window of the position of the mouse in the system window; when the drag-and-drop state is to release the mouse to end dragging and dropping, the placement interface is called to obtain a send placement message; the placement message indicates that the user has completed the drag-and-drop action, so that the system window performs placement processing of the target file; A data request receiving module, used for receiving a data request message sent by the system window after sending a placement message to the system window; A request processing module, used for obtaining a file path of a target file from a compatible application according to the data request message, and binding the file path of the target file to a system window; The notification sending module is used to send a notification message to the system window; the notification message is used to notify the system window that the file path of the target file has been prepared.

[0009] Optionally, the window determination module includes: A handle determination module, used to determine the window handle corresponding to the mouse position; The system window determination module is used to determine that if the window handle corresponding to the mouse position is not a window handle created by the compatibility layer software, the target window of the drag and drop is a system window.

[0010] Optionally, the proxy drag-and-drop target interface further includes: a drag-and-drop leaving interface; and calling the proxy drag-and-drop target interface according to the drag-and-drop state of the target file further includes: When the drag-and-drop state is to cancel the drag-and-drop or to leave the system window, the drag-and-drop leaving interface is called, and the drag-and-drop leaving interface generates a drag-and-drop leaving message; the drag-and-drop leaving message is used to notify the system window that the mouse leaves the system window.

[0011] Optionally, if the proxy drag-and-drop target interface is a drag-and-drop entry interface, the drag-and-drop related data is clipboard format information of the target file, and the interaction message is a drag-and-drop entry message; If the proxy drag-and-drop target interface is a drag-and-drop hover interface, the drag-and-drop related data is the mouse position and the window identifier of the source window where the target file is located, and the interaction message is a drag-and-drop position message; If the proxy drag-and-drop target interface is a placement interface, the interaction message is a placement message.

[0012] Optionally, before calling the proxy drag-and-drop target interface according to the drag-and-drop state of the target file, the device further comprises: The selection set processing module is used for mapping the target file to a selection set conforming to a preset drag-and-drop protocol and setting the source window as the owner of the selection set.

[0013] Optionally, the device further comprises: A response message receiving module, used for receiving a response message conforming to a preset drag-and-drop protocol from a system window; A conversion module, used for converting a response message conforming to a preset drag-and-drop protocol into a response message conforming to a Windows specification; The message processing module is used to process the response messages that comply with Windows specifications.

[0014] Optionally, the response message receiving module includes: A first response message receiving module, used for receiving a drag-and-drop response message that complies with a preset drag-and-drop protocol from the system window after sending a drag-and-drop entry message to the system window and before calling the drag-and-drop hover interface; The message processing module includes: A response judgment module is used to judge whether the system window receives the placement of the target file according to the response message that complies with the Windows specification, and obtain a judgment result; The display module is used to display the video feedback information corresponding to the judgment result.

[0015] Optionally, the response message receiving module includes: A second response message receiving module, configured to receive a placement completion message that complies with a preset drag-and-drop protocol from the system window after sending a notification message to the system window; The device further includes: a completion notification module, configured to send a drag-and-drop completion notification to a compatible application according to the placement completion message.

[0016] Optionally, the device further comprises: A compatible window processing module is used to obtain an interface pointer of a registered drag and drop target interface that has been successfully registered by the compatible window if the drag and drop target window is a compatible window created by the compatible layer software, and send a call request for a function included in the registered drag and drop target interface to the compatible window based on the interface pointer, and perform drag and drop processing of the target file to the compatible window based on the call request and the call result of the call request.

[0017] The embodiment of the present application further discloses an electronic device, including: a processor; and a memory, on which executable code is stored. When the executable code is executed, the processor executes the method described in the embodiment of the present application.

[0018] The embodiment of the present application further discloses a machine-readable medium on which executable code is stored. When the executable code is executed, a processor executes the method described in the embodiment of the present application.

[0019] The embodiments of the present application include the following advantages: In the technical solution of the embodiment of the present application, the proxy drag-and-drop target interface is set up, which can convert the drag-and-drop related data that conforms to the Windows specification into an interactive message that conforms to the preset drag-and-drop protocol of the Unix-like system, solving the problem of inconsistent drag-and-drop protocols between the Windows system and the Unix-like system. In addition, the embodiment of the present application binds the file path of the acquired target file to the system window, taking into account the differences in file path representation and management between the Windows system and the Unix-like system, so that the file path of the target file can be correctly transferred and processed between the two system environments.

[0020] Since the embodiments of the present application overcome the differences between Windows systems and Unix-like systems in drag-and-drop protocols, file path representation, and management, the embodiments of the present application can realize dragging and dropping target files from the window of a compatible application to a Unix-like system window, thereby providing convenience for users to drag and drop files between different systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1It is a flowchart of a method for dragging and dropping files in a compatible layer environment according to an embodiment of the present application; Figure 2 It is a flowchart of a method for dragging and dropping files in a compatible layer environment according to an embodiment of the present application; Figure 3 This is a schematic diagram of the structure of a device for dragging and dropping files in a compatible layer environment according to an embodiment of the present application; Figure 4 It is a schematic diagram of the structure of a device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0023] The method for dragging and dropping files in a compatibility layer environment of an embodiment of the present application can be used to drag and drop files from a compatible application window to a system window of a Unix-like system. A Unix-like system can specifically refer to a system that has evolved from the design style of UNIX. Examples of Unix-like systems may include: Linux, FreeBSD (Free Berkeley Software Distribution), etc.

[0024] In view of the technical problem that the existing compatibility layer software does not realize the function of dragging and dropping files from the window of a compatible application to the system window of Linux, an embodiment of the present application provides a method for dragging and dropping files in a compatibility layer environment, which is applied to the compatibility layer software running on a Unix-like system, and is used to drag and drop a target file from the window of a compatible application to the system window of a Unix-like system, wherein the compatible application is a Windows application in the compatibility layer environment provided by the compatibility layer software; the method specifically comprises the following steps: receiving a drag and drop initiation request sent by a compatible application; In response to a drag and drop initiation request, obtaining a mouse position; According to the mouse position, determine whether the target window of the drag and drop is a system window; If the drag and drop target window is a system window, the drag and drop target interface of the system window is set as the proxy drag and drop target interface; the proxy drag and drop target interface specifically includes: a drag and drop entry interface, a drag and drop hover interface and a placement interface; According to the drag and drop state of the target file, the above-mentioned proxy drag and drop target interface is called, and the above-mentioned proxy drag and drop target interface generates an interactive message, and sends the interactive message to the system window; the above-mentioned proxy drag and drop target interface is used to obtain drag and drop related data that conforms to the Windows specification, and generates an interactive message according to the drag and drop related data that conforms to the Windows specification; the above-mentioned interactive message conforms to the preset drag and drop protocol, and the above-mentioned preset drag and drop protocol is the drag and drop protocol corresponding to the graphical user interface system of the Unix-like system; wherein, when the drag and drop state is the first time entering the system window, the drag and drop entry interface is called to obtain a drag and drop entry message; the above-mentioned drag and drop entry message is used to notify the system window that the mouse enters the system window; when the drag and drop state is to continue dragging and dropping, the drag and drop hover interface is called to obtain a drag and drop position message; the above-mentioned drag and drop position message is used to notify the system window of the position of the mouse in the system window; when the drag and drop state is to release the mouse to end drag and drop, the placement interface is called to obtain a send placement message; the above-mentioned placement message indicates that the user has completed the drag and drop action, so that the system window can place the target file; After sending a placement message to the system window, receive a data request message sent by the system window; According to the data request message, the file path of the target file is obtained from the compatible application, and the file path of the target file is bound to the system window; Send a notification message to the system window; the above notification message is used to notify the system window that the file path of the target file has been prepared.

[0025] The technical solution of the embodiment of the present application specifically includes the following steps: Drag-and-drop start and target window judgment link: receive the drag-and-drop start request sent by the compatible application, then respond to the drag-and-drop start request, obtain the mouse position, and determine whether the drag-and-drop target window is a system window based on the mouse position.

[0026] Proxy drag and drop target interface setting and calling link: When the target window is determined to be a system window, the drag and drop target interface of the system window is set as the proxy drag and drop target interface, which specifically includes a drag and drop entry interface, a drag and drop hover interface, and a placement interface. In addition, during the drag and drop process, the corresponding proxy drag and drop target interface is called according to the different drag and drop states of the target file, such as the first entry into the system window, continued drag and drop, and releasing the mouse to end drag and drop. The proxy drag and drop target interface will obtain drag and drop related data that complies with the Windows specification and convert it into an interactive message that complies with the preset drag and drop protocol corresponding to the Unix-like system graphical user interface system. Then, the interactive message is sent to the system window so that the system window can understand and process the drag and drop operation from the compatible application.

[0027] File path binding and notification message sending phase: After sending a placement message to the system window, the system window will send a data request message. At this time, the compatibility layer software obtains the file path of the target file from the compatible application according to the data request message, and binds it to the system window, and establishes a mapping between the file path of the target file and the system window of the Unix-like system, providing the necessary path information for the subsequent system window to operate on the target file, so that the system window can find and process the target file through the file path. On this basis, the compatibility layer software sends a notification message to the system window to inform the system window that the file path of the target file has been prepared. After receiving the notification message, the system window can perform subsequent operations such as corresponding file placement processing according to the file path, thereby completing the file drag and drop from the compatible application window to the Unix-like system window.

[0028] The proxy drag-and-drop target interface set in the embodiment of the present application can convert the drag-and-drop related data that complies with the Windows specification into an interactive message that complies with the preset drag-and-drop protocol of the Unix-like system, solving the problem of inconsistent drag-and-drop protocols between the Windows system and the Unix-like system. In addition, the embodiment of the present application binds the file path of the acquired target file to the system window, taking into account the differences in file path representation and management between the Windows system and the Unix-like system, so that the file path of the target file can be correctly transferred and processed between the two system environments.

[0029] In summary, since the embodiments of the present application overcome the differences between Windows systems and Unix-like systems in drag-and-drop protocols, file path representation and management, the embodiments of the present application can realize dragging and dropping the target file from the window of a compatible application to the Unix-like system window, thereby providing convenience for users to drag and drop files between different systems.

[0030] Method Example 1 refer to Figure 1 , shows a schematic flow chart of the steps of a method for dragging and dropping files in a compatibility layer environment according to an embodiment of the present application, the method is applied to a compatibility layer software running on a Unix-like system, and is used to drag and drop a target file from a window of a compatible application to a system window of the Unix-like system, wherein the compatible application is a Windows application in a compatibility layer environment provided by the compatibility layer software; the method specifically comprises the following steps: Step 101: receiving a drag-and-drop start request sent by a compatible application; Step 102: In response to the drag-and-drop start request, obtain the mouse position; Step 103: judging whether the target window to be dragged and dropped is a system window according to the mouse position; Step 104: If the drag and drop target window is a system window, the drag and drop target interface of the system window is set as a proxy drag and drop target interface; the proxy drag and drop target interface specifically includes: a drag and drop entry interface, a drag and drop hover interface, and a placement interface; Step 105: According to the drag-and-drop state of the target file, the proxy drag-and-drop target interface is called, the proxy drag-and-drop target interface generates an interactive message, and sends the interactive message to the system window.

[0031] The proxy drag-and-drop target interface is used to obtain drag-and-drop related data that complies with Windows specifications, and generate interactive messages based on the drag-and-drop related data that complies with Windows specifications; the interactive messages comply with a preset drag-and-drop protocol, and the preset drag-and-drop protocol is a drag-and-drop protocol corresponding to a graphical user interface system of a Unix-like system.

[0032] Wherein, when the drag-and-drop state is the first time entering the system window, the drag-and-drop entry interface is called to obtain a drag-and-drop entry message; the drag-and-drop entry message is used to notify the system window that the mouse enters the system window.

[0033] When the drag-and-drop state is to continue dragging and dropping, the drag-and-drop hovering interface is called to obtain a drag-and-drop position message; the drag-and-drop position message is used to notify the system window of the position of the mouse in the system window.

[0034] When the drag-and-drop state is to release the mouse to end the drag-and-drop, the placement interface is called to obtain a placement message; the placement message indicates that the user has completed the drag-and-drop action, so that the system window performs placement processing of the target file.

[0035] Step 106: After sending the placement message to the system window, receiving the data request message sent by the system window; Step 107: Obtain the file path of the target file from the compatible application according to the data request message, and bind the file path of the target file to the system window; Step 108: Send a notification message to the system window; the notification message is used to notify the system window that the file path of the target file has been prepared.

[0036] Figure 1 The illustrated method embodiment includes steps that can be used to drag and drop files from a compatible application window to a system window of a Unix-like system.

[0037] Figure 1 The method embodiment shown can be executed by a compatibility layer software running on a Unix-like system. Examples of the compatibility layer software may include: Wine, CrossOver, etc. It can be understood that the embodiment of the present application is not limited to the specific compatibility layer software.

[0038] Since the compatible application is a Windows application, the compatibility layer software can provide a virtual Windows operating environment for the compatible application. The above-mentioned Windows operating environment specifically includes: simulating Windows system calls, registry, file system and graphical interface, etc., so that Windows applications can start and run normally on Unix-like systems. The compatibility layer software can also adapt and optimize the installation process of Windows applications, automatically solve dependency problems that may arise on Unix-like systems, and ensure that the application can be installed and deployed smoothly. At the same time, the compatibility layer software will provide input and output processing mechanisms similar to those of the Windows system, including support for devices such as mouse, keyboard, and printer, so that the operating experience of Windows applications on Unix-like systems is consistent with that on Windows systems, and users can perform input, output, and printing operations normally as in Windows systems. In addition, the compatibility layer software can optimize and adjust the performance problems that may occur in Windows applications on Unix-like systems, and improve the running speed and stability of applications by reasonably allocating system resources, optimizing memory management and graphics rendering, and reducing the occurrence of freezes and crashes, providing users with a smooth user experience.

[0039] In step 101 , the compatible application may send a drag-and-drop start request to the compatible layer software in response to a user's drag-and-drop operation on a target file.

[0040] For example, the compatible application may call the DoDragDrop (perform a drag-and-drop operation) function to initiate a drag-and-drop start request. The drag-and-drop start request is specifically: a call request for the DoDragDrop function by the compatible application.

[0041] The DoDragDrop function is used to start a drag-and-drop operation in the Windows system environment. It allows users to drag data between windows or controls, such as dragging a file from an Explorer to another folder or application. This function is mainly used to implement the drag-and-drop interaction function in the user interface, so that files and other data can be easily transferred between different objects.

[0042] In step 102, the compatibility layer software may utilize the window management mechanism provided by the Unix-like system to create a virtual window on the Unix-like system to capture the mouse position.

[0043] In the specific implementation, in the Linux system, you can use the relevant functions and interfaces of the X Window system to create a virtual window. For example, by calling functions such as XcreateSimpleWindow (create a simple window), you can create a virtual window that complies with the X Window system specification.

[0044] After creating a virtual window, the compatibility layer software will call the corresponding function to set the mouse capture mode so that mouse events can be captured by the virtual window. For example, in the X Window System, you can use functions such as XgrabPointer (grab the mouse pointer) to implement mouse capture.

[0045] When the mouse event is captured by the virtual window, the compatibility layer software can obtain the mouse position through the interface provided by the system. For example, in the X Window System, you can use functions such as XqueryPointer (query mouse pointer) to obtain the mouse coordinates as the mouse position.

[0046] It should be noted that the mouse position may be acquired according to a preset time period to acquire a real-time mouse position.

[0047] In step 103, the window handle corresponding to the mouse position may be determined first; if the window handle corresponding to the mouse position is not a window handle created by the compatibility layer software, the target window of the drag and drop is a system window.

[0048] In the specific implementation, functions such as WindowFromPoint can be used to determine whether the mouse position is a compatible window belonging to the compatible layer software. The WindowFromPoint function is used to return the window handle of the mouse position according to the mouse position. If the window handle corresponding to the mouse position is created by the compatible layer software, then the target window of the drag and drop can be considered to be a compatible window of the compatible application; conversely, if the window handle corresponding to the mouse position is not a window handle created by the compatible layer software, then the target window of the drag and drop can be considered to be a system window.

[0049] When the target window of the drag and drop is a system window, the window ID of the system window can be obtained by using Xlib (X library) interfaces such as XqueryTree (X query tree) and XwindowAttributes (X window attributes).

[0050] Among them, Xlib is a C language programming interface library provided by the X Window System. The XQueryTree function is used to obtain the root window ID (identity) of the system window, the parent window ID, the child window ID and other candidate window IDs.

[0051] XwindowAttributes is used to obtain the attributes of the candidate window after obtaining the window ID of the candidate window, such as the window position, size, visibility, etc. In this way, the window ID of the system window can be filtered out from the candidate window according to the attributes of the candidate window.

[0052] In step 104, if the drag-and-drop target window is a system window, the drag-and-drop target interface of the system window is set as the proxy drag-and-drop target interface.

[0053] In the Windows system environment, the drag and drop target (IDropTarget) interface is used to handle drag and drop operations in the application where the target window is located.

[0054] In the conventional technology, the drag and drop target interface can be called a registered drag and drop target interface. The conventional technology often uses the RegisterDragDrop function to register a pointer of an object of the drag and drop target interface (hereinafter referred to as the interface pointer of the registered drag and drop target interface) for the drag and drop target window, and sends a call request for a function included in the registered drag and drop target interface to the target window according to the interface pointer, and performs a drag and drop process of the target file to the target window according to the call request and the call result of the call request.

[0055] However, when the target window is a system window, due to the difference in drag-and-drop protocols between Windows and Unix-like systems, it is not possible to directly send a call request for the function included in the registered drag-and-drop target interface to the target window according to the interface pointer. Therefore, the conventional technology cannot realize the function of dragging and dropping files from the window of a compatible application to the system window of Linux.

[0056] The embodiment of the present application creatively sets the drag and drop target interface of the system window as a proxy drag and drop target interface when the drag and drop target window is a system window, and in step 105, the proxy drag and drop target interface is called according to the drag and drop status of the target file, and the proxy drag and drop target interface generates an interaction message and sends the interaction message to the system window.

[0057] Among them, the proxy drag and drop target interface is used to obtain drag and drop related data that conforms to Windows specifications, and generate interactive messages based on the drag and drop related data that conforms to Windows specifications; the interactive messages conform to a preset drag and drop protocol, and the preset drag and drop protocol is a drag and drop protocol corresponding to a graphical user interface system of a Unix-like system.

[0058] An example of a preset drag-and-drop protocol may be XDND (X Window System Drag-and-Drop). The XDND protocol is a standard protocol for implementing drag-and-drop operations in the X Window System, allowing applications to transfer data through drag-and-drop operations. The XDND protocol defines the various stages of a drag-and-drop operation, including the start of dragging, data transfer during dragging, and operations when dragging ends.

[0059] Since the proxy drag and drop target interface of the embodiment of the present application can convert the drag and drop related data conforming to the Windows specification into the interactive message conforming to the preset drag and drop protocol of the Unix-like system, the embodiment of the present application solves the problem of inconsistent drag and drop protocols between Windows system and Unix-like system.

[0060] Referring to Table 1, an example of the drag and drop state and determination method according to an embodiment of the present application is shown.

[0061] The first entry into the system window may refer to: the mouse pointer first enters an area of ​​a system window, indicating that the drag-and-drop operation begins to interact with the system window.

[0062] Continued drag and drop may indicate that during a drag and drop operation that has already started, the mouse button is still pressed, and the mouse pointer is moving within or between system windows, and the drag and drop process is continuing.

[0063] Ending the drag and drop by releasing the mouse may mean that the drag and drop operation ends when the user releases the mouse button.

[0064] Canceling a drag and drop may mean that during the drag and drop process, the drag and drop operation is interrupted because the user presses a specific cancel key (such as the Esc key) or other cancel conditions are met.

[0065] Leaving a system window means that the mouse pointer moves out of the area of ​​a system window.

[0066] Table 1

[0067] In an embodiment of the present application, if the proxy drag and drop target interface is a drag and drop entry interface, the drag and drop related data is the clipboard format information of the target file, and the interactive message is a drag and drop entry message; wherein, the drag and drop entry message is used to notify the system window that the mouse enters the system window, so that the system window determines whether to accept the drag and drop operation of the target file based on the clipboard format information of the target file.

[0068] If the proxy drag-and-drop target interface is a drag-and-drop hover interface, the drag-and-drop related data is the mouse position and the window identifier of the source window where the target file is located, and the interactive message is a drag-and-drop position message; the drag-and-drop position message is used to notify the system window of the position of the mouse in the system window. The compatibility layer software can send the drag-and-drop position message to the system window multiple times according to a preset time frequency.

[0069] If the proxy drag-and-drop target interface is a placement interface, the interaction message is a placement message. The placement message indicates that the user has completed the drag-and-drop action, so that the system window performs placement processing of the target file.

[0070] Therefore, the compatibility layer software of the embodiment of the present application calls the drag-and-drop entry interface when the drag-and-drop state is the first time to enter the system window. The processing process of the drag-and-drop entry interface specifically includes: obtaining clipboard format information that complies with Windows specifications, and generating a drag-and-drop entry message according to the clipboard format information that complies with Windows specifications.

[0071] Among them, the process of generating a drag-and-drop entry message according to the clipboard format information that complies with the Windows specification may include: converting the clipboard format information that complies with the Windows specification into clipboard format information that complies with the preset drag-and-drop protocol, and encapsulating the clipboard format information that complies with the preset drag-and-drop protocol in the drag-and-drop entry message.

[0072] For example, when the clipboard format information represents the clipboard format of the file type, the clipboard format information that complies with the Windows specification may be: CF_HDROP; while the clipboard format information that complies with the XDND protocol may be: text / uri-list. Among them, CF stands for "Clipboard Format" and HDROP is a data structure type used to process file lists. "text" means that the data is stored and transmitted in text format. uri (Uniform Resource Identifier) ​​represents a resource. list represents a list of one or more uris.

[0073] It should be noted that the preset drag-and-drop protocol provides a message structure for each interactive message. The embodiments of the present application can encapsulate the interactive messages according to the message structure, and are not limited to the specific message structure and encapsulation process.

[0074] The compatibility layer software of the embodiment of the present application calls the drag-and-drop hover interface when the drag-and-drop state is to continue drag-and-drop. The processing process of the drag-and-drop hover interface specifically includes: obtaining the mouse position and the window identifier of the source window that comply with the Windows specification, and generating a drag-and-drop position message according to the mouse position and the window identifier of the source window that comply with the Windows specification. Specifically, the mouse position that complies with the Windows specification can be converted into a mouse position and a window identifier of the source window that comply with the preset drag-and-drop protocol, and the mouse position and the window identifier of the source window that comply with the preset drag-and-drop protocol are encapsulated in the drag-and-drop position message.

[0075] There are often differences in the descriptions of window identifiers in different system environments. In the Windows system environment, the window ID exists in the form of a window handle, which is a specific value used by the system kernel to manage windows, such as 0x00567890. In a Unix-like system environment that follows the XDND protocol, the window ID usually uses the URI format, such as "x11:window:0xABCDEF12", where "x11" clearly indicates that it is based on the X Window System, "window" identifies it as window-related, and "0xABCDEF12" is the unique identity of the window in the X Window System. Therefore, the embodiment of the present application can convert the window identifier of the source window in the form of a window handle into a window identifier in the URI format, and then obtain the window identifier of the source window that complies with the preset drag and drop protocol.

[0076] The compatible layer software of the embodiment of the present application calls the placement interface when the drag-and-drop state is to release the mouse to end the drag-and-drop. The processing process of the placement interface specifically includes: generating a placement message that complies with the preset drag-and-drop protocol.

[0077] It should be noted that the compatibility layer software may also map the target file to a selection set that complies with a preset drag-and-drop protocol and set the source window as the owner of the selection set before calling the proxy drag-and-drop target interface according to the drag-and-drop state of the target file.

[0078] The Selections mechanism is a mechanism for information exchange between clients in the window system protocol of Unix-like systems, covering various operation scenarios such as copying / pasting between different windows, dragging and dropping files or data, etc.

[0079] In the implementation, there can be any number of selection sets, each of which can be named by an Atom. Atom is a data type used to identify and reference various resources (such as window properties, selection sets, etc.). It is essentially a unique integer identifier used to quickly and efficiently find and reference specific resources in the window system.

[0080] The selection set communicates between its owner (who owns the data stored in the selection set) and the requester (who wishes to obtain the data). Specifically in the embodiment of the present application, the owner of the selection set may be a source window running on the compatibility layer software, and the requester of the selection set may be a system window.

[0081] The conditions for the requester to obtain data: Selection set name: Specifies the identifier of the selection set to be obtained.

[0082] Attribute name to request: Specifies the specific attribute of the data required.

[0083] The system window to which the selection set is attached: Know the window to which the selection set is associated.

[0084] Atom value of the desired data type: Determines the expected data type.

[0085] Owner's Action: If the requester obtains a selection set, the owner receives an event, converts the contents of the selection set to the requested data type, places the data in the properties of the system window, and sends an event to the requester to inform it that the properties are available.

[0086] In one example, you can use the XSetSelectionOwner function to obtain ownership of a selection set. XSetSelectionOwner is a function in the Xlib library that is used to set a window as the owner of a selection set.

[0087] In an optional implementation of the present application, the above-mentioned proxy drag and drop target interface may also include: a drag and drop leaving interface; calling the proxy drag and drop target interface according to the drag and drop status of the target file may also include: when the drag and drop status is to cancel the drag and drop or leave the system window, calling the drag and drop leaving interface, and generating a drag and drop leaving message by the drag and drop leaving interface; the drag and drop leaving message is used to notify the system window that the mouse leaves the system window.

[0088] Canceling a drag and drop may mean that the user actively terminates the drag and drop behavior during the drag and drop operation. Leaving the system window may mean that the object of the drag and drop operation (such as the mouse pointer, or the cursor position associated with the drag and drop operation) moves out of the boundary range of the system window. The drag and drop leave message is used to notify the system window that the mouse has left the system window, so that the system window is aware of the change in the drag and drop state, thereby maintaining the consistency and accuracy of the drag and drop operation process.

[0089] It should be noted that the drag and drop process of a target file may involve one or more system windows.

[0090] In the case of one system window, the user can directly drag the target file from the source window of the compatible application to the specific area of ​​the first system window, and then release the mouse to end the drag and drop.

[0091] In the case of multiple system windows, the user can first drag the target file from the source window of the compatible application to the first system window, then drag the target file to a specific area of ​​the second system window, and then release the mouse to end the drag and drop.

[0092] In step 106, after sending a drop message to the system window, the compatibility layer software receives a data request message sent by the system window. The data request message is used to notify the source window that the system window needs data, where the data may refer to the target file after the drag and drop is completed. The data request data complies with the aforementioned selection set mechanism.

[0093] In the specific implementation, when the system window needs to view the dragged and dropped data, it will call XConvertSelection to request the data. The above call will trigger a SelectionRequest event, which will trigger the sending of the data request message.

[0094] In step 107, after receiving the data request message, the compatibility layer software obtains the file path of the target file from the compatible application according to the data request message, and binds the file path of the target file to the system window.

[0095] In actual applications, according to the data request message, the process of obtaining the file path of the target file from the compatible application specifically includes: using the IDataObject (data object) interface to obtain the file path of the target file, and converting the obtained result into target data of the data type corresponding to the preset drag-and-drop protocol. For example, the data type corresponding to the preset drag-and-drop protocol may be: text / uri – list.

[0096] The IDataObject interface is an important interface in COM (Component Object Model) technology, which is mainly used to implement the drag-and-drop operation of data objects on the Windows platform. By implementing the IDataObject interface, applications can provide data representation and operations of data objects and support the drag-and-drop function of data.

[0097] The process of binding the file path of the target file to the system window specifically includes: calling the XChangeProperty function to place the target data.

[0098] In the window system protocol of Unix-like systems, the XChangeProperty function is used to set or modify properties on the system window. In this case, the compatibility layer software can set the converted target data as the property value to the specified property of the system window.

[0099] In step 108, the compatibility layer software may send a notification message to the system window; the notification message is used to notify the system window that the file path of the target file has been prepared.

[0100] After receiving the notification message, the system window can use the XGetWindowProperty (X Get Window Properties) function to retrieve the target data. The XGetWindowProperty() function is a function in the window system protocol of Unix-like systems, which is used to obtain the property value of the window. In this way, the system window can obtain the file path of the target file, and then complete the drag and drop of the target file from the source window to the target window. It can be understood that the system window can perform preset processing based on the file path of the target file. For example, the preset processing can be: reading the target file from the file path and storing the target file in the folder of the system window.

[0101] In an optional implementation of the present application, a response message that complies with a preset drag-and-drop protocol may also be received from a system window; the response message that complies with the preset drag-and-drop protocol is converted into a response message that complies with Windows specifications; The response message that complies with the Windows specification is processed. In other words, the embodiment of the present application has the function of processing the response message.

[0102] In one implementation, the above-mentioned receiving a response message that complies with the preset drag and drop protocol from the system window includes: after sending a drag and drop entry message to the system window and before calling the drag and drop hover interface, receiving a drag and drop response message that complies with the preset drag and drop protocol from the system window; after the system window receives the drag and drop entry message, it will decide whether to accept the drop operation based on its own status and strategy, and send a drag and drop response message as a response.

[0103] The above process of processing the response message that complies with the Windows specification specifically includes: judging whether the system window receives the placement of the target file according to the response message that complies with the Windows specification, and obtaining a judgment result; and displaying the video feedback information corresponding to the judgment result.

[0104] If the judgment result is that the system window accepts the placement of the target file, a first prompt message may be displayed, and the first prompt message is used to prompt the user to drop the file. If the judgment result is that the system window does not accept the placement of the target file, a second prompt message may be displayed, and the second prompt message is used to inform the user of the reason why the file cannot be placed, such as the file type is not supported.

[0105] In another implementation, the process of receiving a response message that complies with a preset drag and drop protocol from a system window specifically includes: after sending a notification message to the system window, receiving a placement completion message that complies with the preset drag and drop protocol from the system window; after the system window processes the target file, it sends a placement completion message to the source window to tell the source window that the data is no longer needed.

[0106] In this case, the method may further include: sending a drag-and-drop completion notification to the compatible application according to the placement completion message. The drag-and-drop completion notification is used to inform the compatible application that the system window has processed the target file and the drag-and-drop operation is officially ended.

[0107] The method of the embodiment of the present application may also include: if the drag and drop target window is a compatible window created by the compatibility layer software, then obtaining an interface pointer of a registered drag and drop target interface that has been successfully registered by the compatible window, and based on the interface pointer, sending a call request for a function included in the registered drag and drop target interface to the compatible window, and performing drag and drop processing of the target file to the compatible window based on the call request and the call result of the call request.

[0108] An interface pointer is a pointer that points to an object that implements a specific interface. In a drag-and-drop operation, the interface pointer that registers the drag-and-drop target interface can be understood as a bridge that points to an object that implements the drag-and-drop function.

[0109] Through this interface pointer, the compatibility layer software can access and call various functions contained in the registered drag and drop target interface. These functions define how to handle different stages of the drag and drop operation, such as drag and drop start, drag and drop in progress, and drag and drop end, so as to achieve control and management of the drag and drop operation.

[0110] In one example, the registration drag and drop target interface specifically includes the following functions: 1. Drag and drop into the function, The drag-and-drop entry function is called when the drag-and-drop operation begins to enter a compatible window. It is used to determine whether to accept the drag and drop based on the incoming information and provide corresponding visual feedback, and pass the result to the callee through the drag-and-drop effect parameter.

[0111] The parameters that are dragged and dropped into the function include: Data object pointer: an interface pointer pointing to the object containing the drag and drop data. In this scenario, the drag and drop data is mainly related information of the target file, such as file path, file type, etc. These related information are encapsulated in the data object pointer in a specific data format.

[0112] Key status parameter: indicates the current status of the keyboard keys.

[0113] Mouse position coordinate parameters: record the current position of the mouse, used to determine the specific position of the drag and drop into the compatible window.

[0114] Drag and drop effect parameter: used to return the suggested effect of the drag and drop operation, which can be used as the call result of the drag and drop entry function.

[0115] After receiving the call request of the drag-and-drop function, the compatible window can decide whether to accept the drag-and-drop operation according to its own state (for example, the compatible window may only accept files of a specific type, or whether it is currently in a state where it can accept drag-and-drop). If it accepts, the drag-and-drop effect parameter will be set to the corresponding valid drag-and-drop effect; if it does not accept, the drag-and-drop effect parameter will be set to not allowed.

[0116] 2. Drag and drop hover function When the mouse moves within a compatible window, the drag and drop hover function is called. The drag and drop hover function is used to update the visual feedback and adjust the drag and drop effect according to the mouse position and keyboard status, and pass the adjusted effect to the caller through the drag and drop effect parameter.

[0117] After receiving the call request of the drag and drop hover function, the compatible window can update the visual feedback of the drag and drop according to the parameter value of the mouse position coordinate parameter.

[0118] Update the visual feedback of drag and drop, and adjust the user interface accordingly to provide users with more intuitive operation information and experience. For example, you can change the shape of the mouse pointer to display an icon indicating that drag and drop is allowed (such as an arrow with a "+" sign) or an icon indicating that drag and drop is prohibited (such as a circle with a slash); or highlight the corresponding area of ​​the compatible window to prompt users of the possible effects of the drag and drop operation.

[0119] 3. Drag and drop to leave the function The drag-and-drop exit function is called when the drag-and-drop operation is canceled or the mouse leaves the compatible window. The drag-and-drop exit function is mainly responsible for cleaning up the temporary resources and visual feedback set up during the drag-and-drop entry function and drag-and-drop hover function. For example, restore the original style of the mouse pointer, clear the previously highlighted drag-and-drop target area, etc.

[0120] 4. Placement function The drop function is called when the drag-and-drop operation ends. It is used to place the target file in the appropriate position of the compatible window, adjust the drag-and-drop effect parameters according to the drop result, and display corresponding information. For example, if the file is successfully dropped, the user may be shown the success information through a message prompt in the user interface, a file list update, etc., such as displaying a "file successfully dropped" notification, or updating the file list in the compatible window so that the user can see the newly added file.

[0121] Therefore, when the target window is a compatible window, the compatible layer software of the embodiment of the present application communicates with the compatible window through an interface pointer. First, the compatible window is registered, and this process will establish an association between the compatible window and the registered drag-and-drop target interface, and as a result of the registration operation, the interface pointer will point to the registered drag-and-drop target interface. Afterwards, the compatible layer software can use the interface pointer to send operation instructions or request information to the target window, and the target window will receive and process these operation instructions or request information in real time, and thus make a corresponding response.

[0122] In summary, the method for dragging and dropping files in a compatible layer environment of the embodiment of the present application can convert the drag-and-drop related data that complies with the Windows specification into interactive messages that comply with the preset drag-and-drop protocol of the Unix-like system due to the set proxy drag-and-drop target interface, thereby solving the problem of inconsistent drag-and-drop protocols between the Windows system and the Unix-like system. In addition, the embodiment of the present application binds the file path of the acquired target file to the system window, taking into account the differences in file path representation and management between the Windows system and the Unix-like system, so that the file path of the target file can be correctly transferred and processed between the two system environments.

[0123] Since the embodiments of the present application overcome the differences between Windows systems and Unix-like systems in drag-and-drop protocols, file path representation, and management, the embodiments of the present application can realize dragging and dropping target files from the window of a compatible application to a Unix-like system window, thereby providing convenience for users to drag and drop files between different systems.

[0124] Method Example 2 refer to Figure 2 , shows a schematic flow chart of the steps of a method for dragging and dropping files in a compatibility layer environment according to an embodiment of the present application, the method is applied to a compatibility layer software running on a Unix-like system, and is used to drag and drop a target file from a window of a compatible application to a system window of the Unix-like system, wherein the compatible application is a Windows application in a compatibility layer environment provided by the compatibility layer software; the method specifically comprises the following steps: Step 201: receiving a drag-and-drop start request sent by a compatible application; Step 202: In response to the drag-and-drop start request, obtain the mouse position; Step 203: judging whether the target window to be dragged and dropped is a system window according to the mouse position; Step 204: If the drag-and-drop target window is a system window, the drag-and-drop target interface of the system window is set as a proxy drag-and-drop target interface; the proxy drag-and-drop target interface specifically includes: a drag-and-drop entry interface, a drag-and-drop hover interface, and a placement interface; Step 205, determining the drag and drop state of the target file; Step 206: If the drag-and-drop state is the first time entering the system window, the drag-and-drop entry interface is called to obtain a drag-and-drop entry message, and the drag-and-drop entry message is sent to the system window; The processing process of the drag-and-drop entry interface specifically includes: obtaining clipboard format information that complies with Windows specifications, and generating a drag-and-drop entry message according to the clipboard format information that complies with Windows specifications. The drag-and-drop entry message is used to notify the system window that the mouse enters the system window.

[0125] Step 207: receiving a drag-and-drop response message that complies with a preset drag-and-drop protocol from the system window; Step 208: If the drag-and-drop response message indicates that the drag-and-drop operation of the target file is accepted, and the drag-and-drop state is to continue drag-and-drop, then the drag-and-drop hovering interface is called to obtain the drag-and-drop position message, and the drag-and-drop position information is sent to the system window; The processing process of the drag and drop hover interface specifically includes: obtaining the mouse position and the window identifier of the source window that comply with the Windows specification, and generating a drag and drop position message according to the mouse position and the window identifier of the source window that comply with the Windows specification.

[0126] It should be noted that if the drag and drop response message indicates that the drag and drop operation of the target file is not accepted, the corresponding video feedback information can be displayed to enable the user to perform the next operation, such as leaving the system window or canceling the drag and drop.

[0127] Step 209: If the drag-and-drop state is to release the mouse to end the drag-and-drop, the placement interface is called to obtain a send placement message, and the placement message is sent to the system window; Step 210: Receive a data request message sent by the system window; Step 211: Obtain a file path of a target file from a compatible application according to the data request message, and bind the file path of the target file to a system window; Step 212: Send a notification message to the system window; the notification message is used to notify the system window that the file path of the target file has been prepared; Step 213: If the drag and drop state is to cancel the drag and drop or leave the system window, the drag and drop leaving interface is called, the drag and drop leaving interface generates a drag and drop leaving message, and sends the drag and drop leaving message to the system window; the drag and drop leaving message is used to notify the system window that the mouse leaves the system window.

[0128] In summary, the method for dragging and dropping files in a compatible layer environment of an embodiment of the present application realizes the function of dragging files from a compatible application to a system window according to a preset drag and drop protocol.

[0129] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.

[0130] Based on the above embodiment, this embodiment also provides a device for dragging and dropping files in a compatible layer environment. Figure 3 As shown in the structural schematic diagram, the device is applied to the compatibility layer software running on the Unix-like system, and is used to drag and drop the target file from the window of the compatible application to the system window of the Unix-like system, and the compatible application is a Windows application under the compatibility layer environment provided by the compatibility layer software; the device includes: a start request receiving module 301, a position acquisition module 302, a window judgment module 303, a setting module 304, a calling module 305, a data request receiving module 306, a request processing module 307 and a notification sending module 308.

[0131] The start request receiving module 301 is used to receive a drag and drop start request sent by a compatible application; The position acquisition module 302 is used to obtain the mouse position in response to the drag and drop start request; The window determination module 303 is used to determine whether the dragged and dropped target window is a system window according to the mouse position; The setting module 304 is used to set the drag and drop target interface of the system window as a proxy drag and drop target interface if the drag and drop target window is a system window; the proxy drag and drop target interface includes: a drag and drop entry interface, a drag and drop hover interface and a placement interface; The calling module 305 is used to call the proxy drag-and-drop target interface according to the drag-and-drop state of the target file, generate an interactive message by the proxy drag-and-drop target interface, and send the interactive message to the system window; the proxy drag-and-drop target interface is used to obtain drag-and-drop related data that conforms to the Windows specification, and generate an interactive message according to the drag-and-drop related data that conforms to the Windows specification; the interactive message conforms to the preset drag-and-drop protocol, and the preset drag-and-drop protocol is the drag-and-drop protocol corresponding to the graphical user interface system of the Unix-like system; wherein, when the drag-and-drop state is the first time entering the system window, the drag-and-drop entry interface is called to obtain a drag-and-drop entry message; the drag-and-drop entry message is used to notify the system window that the mouse has entered the system window; when the drag-and-drop state is to continue dragging and dropping, the drag-and-drop hover interface is called to obtain a drag-and-drop position message; the drag-and-drop position message is used to notify the system window of the position of the mouse in the system window; when the drag-and-drop state is to release the mouse to end dragging and dropping, the placement interface is called to obtain a send placement message; the placement message indicates that the user has completed the drag-and-drop action, so that the system window performs placement processing of the target file; The data request receiving module 306 is used to receive a data request message sent by the system window after sending a placement message to the system window; The request processing module 307 is used to obtain the file path of the target file from the compatible application according to the data request message, and bind the file path of the target file to the system window; The notification sending module 308 is used to send a notification message to the system window; the notification message is used to notify the system window that the file path of the target file has been prepared.

[0132] Optionally, the window determination module includes: A handle determination module, used to determine the window handle corresponding to the mouse position; The system window determination module is used to determine that if the window handle corresponding to the mouse position is not a window handle created by the compatibility layer software, the target window of the drag and drop is a system window.

[0133] Optionally, the proxy drag-and-drop target interface further includes: a drag-and-drop leaving interface; and calling the proxy drag-and-drop target interface according to the drag-and-drop state of the target file further includes: When the drag-and-drop state is to cancel the drag-and-drop or to leave the system window, the drag-and-drop leaving interface is called, and the drag-and-drop leaving interface generates a drag-and-drop leaving message; the drag-and-drop leaving message is used to notify the system window that the mouse leaves the system window.

[0134] Optionally, if the proxy drag-and-drop target interface is a drag-and-drop entry interface, the drag-and-drop related data is clipboard format information of the target file, and the interaction message is a drag-and-drop entry message; If the proxy drag-and-drop target interface is a drag-and-drop hover interface, the drag-and-drop related data is the mouse position and the window identifier of the source window where the target file is located, and the interaction message is a drag-and-drop position message; If the proxy drag-and-drop target interface is a placement interface, the interaction message is a placement message.

[0135] Optionally, before calling the proxy drag-and-drop target interface according to the drag-and-drop state of the target file, the device further comprises: The selection set processing module is used for mapping the target file to a selection set conforming to a preset drag-and-drop protocol and setting the source window as the owner of the selection set.

[0136] Optionally, the device further comprises: A response message receiving module, used for receiving a response message conforming to a preset drag-and-drop protocol from a system window; A conversion module, used for converting a response message conforming to a preset drag-and-drop protocol into a response message conforming to a Windows specification; The message processing module is used to process the response messages that comply with Windows specifications.

[0137] Optionally, the response message receiving module includes: A first response message receiving module, used for receiving a drag-and-drop response message that complies with a preset drag-and-drop protocol from the system window after sending a drag-and-drop entry message to the system window and before calling the drag-and-drop hover interface; The message processing module includes: A response judgment module is used to judge whether the system window receives the placement of the target file according to the response message that complies with the Windows specification, and obtain a judgment result; The display module is used to display the video feedback information corresponding to the judgment result.

[0138] Optionally, the response message receiving module includes: A second response message receiving module, configured to receive a placement completion message that complies with a preset drag-and-drop protocol from the system window after sending a notification message to the system window; The device further includes: a completion notification module, configured to send a drag-and-drop completion notification to a compatible application according to the placement completion message.

[0139] Optionally, the device further comprises: A compatible window processing module is used to obtain an interface pointer of a registered drag and drop target interface that has been successfully registered by the compatible window if the drag and drop target window is a compatible window created by the compatible layer software, and send a call request for a function included in the registered drag and drop target interface to the compatible window based on the interface pointer, and perform drag and drop processing of the target file to the compatible window based on the call request and the call result of the call request.

[0140] The embodiment of the present application further provides a non-volatile readable storage medium, in which one or more modules (programs) are stored. When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiment of the present application.

[0141] The present application embodiment provides one or more machine-readable media, on which instructions are stored, and when executed by one or more processors, an electronic device executes one or more of the methods described in the above embodiments. In the present application embodiment, the electronic device includes various types of devices such as terminal devices, servers (clusters), etc.

[0142] The embodiments of the present disclosure may be implemented as a device that uses any appropriate hardware, firmware, software, or any combination thereof to perform a desired configuration, and the device may include: electronic devices such as terminal devices and servers (clusters). Figure 4 An exemplary apparatus 1100 that can be used to implement various embodiments described in this application is schematically illustrated.

[0143] For one embodiment, Figure 4 An exemplary apparatus 1100 is shown having one or more processors 1102, a control module (chip set) 1104 coupled to at least one of the processor(s) 1102, a memory 1106 coupled to the control module 1104, a non-volatile memory / storage device 1108 coupled to the control module 1104, one or more input / output devices 1110 coupled to the control module 1104, and a network interface 1112 coupled to the control module 1104.

[0144] The processor 1102 may include one or more single-core or multi-core processors, and the processor 1102 may include any combination of general-purpose processors or special-purpose processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, the device 1100 can be used as a terminal device, server (cluster), etc. described in the embodiments of the present application.

[0145] In some embodiments, the device 1100 may include one or more computer-readable media (e.g., memory 1106 or non-volatile memory / storage device 1108) having instructions 1114 and one or more processors 1102 configured to execute the instructions 1114 in combination with the one or more computer-readable media to implement a module to perform the actions described in the present disclosure.

[0146] For one embodiment, the control module 1104 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 1102 and / or any suitable device or component in communication with the control module 1104 .

[0147] The control module 1104 may include a memory controller module to provide an interface to the memory 1106. The memory controller module may be a hardware module, a software module, and / or a firmware module.

[0148] The memory 1106 may be used, for example, to load and store data and / or instructions 1114 for the device 1100. For one embodiment, the memory 1106 may include any suitable volatile memory, such as a suitable DRAM (Dynamic Random Access Memory). In some embodiments, the memory 1106 may include a double data rate type four synchronous dynamic random access memory.

[0149] For one embodiment, the control module 1104 may include one or more input / output controllers to provide an interface to the non-volatile memory / storage device 1108 and the input / output device(s) 1110 .

[0150] For example, non-volatile memory / storage 1108 may be used to store data and / or instructions 1114. Non-volatile memory / storage 1108 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives, one or more optical disk drives, and / or one or more digital versatile optical disk drives).

[0151] The non-volatile memory / storage device 1108 may include storage resources that are physically part of the device on which the apparatus 1100 is installed, or it may be accessible to the device without being part of the device. For example, the non-volatile memory / storage device 1108 may be accessed via (one or more) input / output devices 1110 over a network.

[0152] The input / output device(s) 1110 may provide an interface for the apparatus 1100 to communicate with any other appropriate device, and the input / output device 1110 may include a communication component, an audio component, a sensor component, etc. The network interface 1112 may provide an interface for the apparatus 1100 to communicate through one or more networks, and the apparatus 1100 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as WiFi (Wireless Fidelity), 2G (2nd Generation Wireless Telephone Technology), 3G (3rd Generation Wireless Telephone Technology), 4G (4th Generation Wireless Telephone Technology), 5G (5th Generation Wireless Telephone Technology), etc., or a combination thereof for wireless communication.

[0153] For one embodiment, at least one of the processor(s) 1102 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of the control module 1104. For one embodiment, at least one of the processor(s) 1102 may be packaged together with the logic of one or more controllers of the control module 1104 to form a system-in-package. For one embodiment, at least one of the processor(s) 1102 may be integrated on the same die with the logic of one or more controllers of the control module 1104. For one embodiment, at least one of the processor(s) 1102 may be integrated on the same die with the logic of one or more controllers of the control module 1104 to form a system-on-chip.

[0154] In various embodiments, the device 1100 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a touch screen device, a netbook, etc.). In various embodiments, the device 1100 may have more or fewer components and / or a different architecture. For example, in some embodiments, the device 1100 includes one or more cameras, a keyboard, a liquid crystal display screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, a dedicated integrated circuit, and a speaker.

[0155] Among them, the main control chip can be used as a processor or control module in the detection device, sensor data, location information, etc. are stored in a memory or non-volatile memory / storage device, the sensor group can be used as an input / output device, and the communication interface may include a network interface.

[0156] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0157] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0158] The present application embodiment is described with reference to the flowchart and / or block diagram of the method, terminal device (system) and computer program product according to the embodiment of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, and the combination of the process and / or box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device produce a device for implementing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.

[0159] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0160] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0161] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0162] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0163] The above describes in detail a method and device for dragging and dropping files in a compatible layer environment, an electronic device, and a machine-readable medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for a person skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application sets. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for dragging and dropping files in a compatibility layer environment, characterized in that: The method is applied to a compatibility layer software running on a Unix-like system, and is used to drag and drop a target file from a window of a compatible application to a system window of the Unix-like system, wherein the compatible application is a Windows application program in a compatibility layer environment provided by the compatibility layer software; the method comprises: receiving a drag and drop initiation request sent by a compatible application; In response to a drag and drop initiation request, obtaining a mouse position; According to the mouse position, determine whether the target window of the drag and drop is a system window; If the drag and drop target window is a system window, the drag and drop target interface of the system window is set as a proxy drag and drop target interface; the proxy drag and drop target interface includes: a drag and drop entry interface, a drag and drop hover interface and a placement interface; According to the drag-and-drop state of the target file, the proxy drag-and-drop target interface is called, and the proxy drag-and-drop target interface generates an interactive message, and sends the interactive message to the system window; the proxy drag-and-drop target interface is used to obtain drag-and-drop related data that conforms to the Windows specification, and generates an interactive message according to the drag-and-drop related data that conforms to the Windows specification; the interactive message conforms to a preset drag-and-drop protocol, and the preset drag-and-drop protocol is a drag-and-drop protocol corresponding to a graphical user interface system of a Unix-like system; wherein, when the drag-and-drop state is the first time entering the system window, the drag-and-drop entry interface is called to obtain a drag-and-drop entry message; the drag-and-drop entry message is used to notify the system window that the mouse has entered the system window; when the drag-and-drop state is to continue dragging and dropping, the drag-and-drop hover interface is called to obtain a drag-and-drop position message; the drag-and-drop position message is used to notify the system window of the position of the mouse in the system window; when the drag-and-drop state is to release the mouse to end dragging and dropping, the placement interface is called to obtain a send placement message; the placement message indicates that the user has completed the drag-and-drop action, so that the system window performs placement processing of the target file; After sending a placement message to the system window, receive a data request message sent by the system window; According to the data request message, obtaining a file path of a target file from a compatible application, and binding the file path of the target file to a system window; A notification message is sent to the system window; the notification message is used to notify the system window that the file path of the target file has been prepared.

2. The method according to claim 1, characterized in that The step of determining whether the target window for dragging and dropping is a system window according to the mouse position includes: Determine the window handle corresponding to the mouse position; If the window handle corresponding to the mouse position is not the window handle created by the compatibility layer software, the target window of the drag and drop is the system window.

3. The method according to claim 1, characterized in that: The proxy drag-and-drop target interface also includes: a drag-and-drop leaving interface; The calling of the proxy drag-and-drop target interface according to the drag-and-drop state of the target file further includes: When the drag-and-drop state is to cancel the drag-and-drop or to leave the system window, the drag-and-drop leaving interface is called, and the drag-and-drop leaving interface generates a drag-and-drop leaving message; the drag-and-drop leaving message is used to notify the system window that the mouse leaves the system window.

4. The method according to claim 1, characterized in that If the proxy drag-and-drop target interface is a drag-and-drop entry interface, the drag-and-drop related data is the clipboard format information of the target file, and the interaction message is a drag-and-drop entry message; If the proxy drag-and-drop target interface is a drag-and-drop hover interface, the drag-and-drop related data is the mouse position and the window identifier of the source window where the target file is located, and the interaction message is a drag-and-drop position message; If the proxy drag-and-drop target interface is a placement interface, the interaction message is a placement message.

5. The method according to claim 1, characterized in that Before calling the proxy drag-and-drop target interface according to the drag-and-drop state of the target file, the method further includes: Maps the target file to a selection set that complies with the preset drag-and-drop protocol and sets the source window as the owner of the selection set.

6. The method according to claim 1, characterized in that The method further comprises: Receive a response message from the system window that complies with the preset drag and drop protocol; Convert the response message that complies with the preset drag-and-drop protocol into a response message that complies with the Windows specification; Process the response message in accordance with Windows specifications.

7. The method according to claim 6, characterized in that The receiving a response message conforming to a preset drag-and-drop protocol from the system window includes: After sending a drag-and-drop entry message to the system window and before calling the drag-and-drop hover interface, receiving a drag-and-drop response message that complies with a preset drag-and-drop protocol from the system window; The processing of the response message conforming to the Windows specification includes: According to the response message conforming to the Windows specification, it is judged whether the system window accepts the placement of the target file, and a judgment result is obtained; The video feedback information corresponding to the judgment result is displayed.

8. The method according to claim 6, characterized in that The receiving a response message from the system window that complies with a preset drag-and-drop protocol includes: After sending a notification message to the system window, receiving a placement completion message from the system window that complies with the preset drag-and-drop protocol; The method further includes sending a drag-and-drop completion notification to a compatible application based on the drop completion message.

9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: If the target window for dragging and dropping is a compatible window created by the compatible layer software, an interface pointer of a registered drag and drop target interface that has been successfully registered by the compatible window is obtained, and based on the interface pointer, a call request for a function included in the registered drag and drop target interface is sent to the compatible window, and based on the call request and the call result of the call request, the target file is dragged and dropped to the compatible window.

10. A device for dragging and dropping files in a compatible layer environment, characterized in that: The device is applied to a compatibility layer software running on a Unix-like system, and is used to drag and drop a target file from a window of a compatible application to a system window of the Unix-like system, wherein the compatible application is a Windows application program in a compatibility layer environment provided by the compatibility layer software; the device comprises: A start request receiving module, used for receiving a drag and drop start request sent by a compatible application; A position acquisition module, used for acquiring a mouse position in response to a drag-and-drop start request; The window judgment module is used to judge whether the dragged and dropped target window is a system window according to the mouse position; A setting module, for setting the drag and drop target interface of the system window as a proxy drag and drop target interface if the drag and drop target window is a system window; the proxy drag and drop target interface includes: a drag and drop entry interface, a drag and drop hover interface and a placement interface; A calling module is used to call the proxy drag-and-drop target interface according to the drag-and-drop state of the target file, generate an interactive message by the proxy drag-and-drop target interface, and send the interactive message to the system window; the proxy drag-and-drop target interface is used to obtain drag-and-drop related data that conforms to the Windows specification, and generate an interactive message according to the drag-and-drop related data that conforms to the Windows specification; the interactive message conforms to a preset drag-and-drop protocol, and the preset drag-and-drop protocol is a drag-and-drop protocol corresponding to a graphical user interface system of a Unix-like system; wherein, when the drag-and-drop state is the first time entering the system window, the drag-and-drop entry interface is called to obtain a drag-and-drop entry message; the drag-and-drop entry message is used to notify the system window that the mouse has entered the system window; when the drag-and-drop state is to continue dragging and dropping, the drag-and-drop hover interface is called to obtain a drag-and-drop position message; the drag-and-drop position message is used to notify the system window of the position of the mouse in the system window; when the drag-and-drop state is to release the mouse to end dragging and dropping, the placement interface is called to obtain a send placement message; the placement message indicates that the user has completed the drag-and-drop action, so that the system window performs placement processing of the target file; A data request receiving module, used for receiving a data request message sent by the system window after sending a placement message to the system window; A request processing module, used for obtaining a file path of a target file from a compatible application according to the data request message, and binding the file path of the target file to a system window; The notification sending module is used to send a notification message to the system window; the notification message is used to notify the system window that the file path of the target file has been prepared.

11. An electronic device, characterized in that: include: processor; and A memory having executable codes stored thereon, which, when executed, causes the processor to execute the method according to any one of claims 1 to 9.

12. A machine-readable medium having executable codes stored thereon, which, when executed, causes a processor to execute the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Drawing support method and device

    CN101452403A

  • File sending method and device for compatible operation of Android system on Linux

    CN113204307A

  • Cross-system target object transmission method and device

    CN115700453A

  • Method and device for processing window problem in compatible layer environment, equipment and medium

    CN119292659A

  • Seamless integration and installation of non-host application into native operating system

    US7681134B1

Cited By

  • Method and system for dragging X application data in wayland environment

    CN120872472A