Control equipment event processing method and system, electronic equipment and storage medium

By detecting and simulating the capture status of the mouse pointer release and adjusting the event distribution mechanism, the problem of mouse pointer event conflict and jamming in the operating system is solved, improving user experience and compatibility.

CN119938190APending Publication Date: 2025-05-06VISIONVERA INFORMATION TECH CO LTD
View PDF -1 Cites 0 Cited by

Patent Information

Application Number
CN202411812837.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

Some operating systems do not provide specific functions for releasing mouse pointer capture, resulting in mouse pointer event conflicts or stuck problems, affecting the user experience and the normal operation of the application.

Method used

By detecting the capture status of the control device in the target operating system, performing capture release simulation operations, and adjusting the event distribution mechanism to ensure that the control device events can be correctly passed and assigned to other objects.

Benefits of technology

It effectively resolves mouse pointer event conflicts and stuck phenomena, improves user experience and application stability, and enhances the compatibility of the target operating system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938190A_ABST
    Figure CN119938190A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a control equipment event processing method and system, and the method comprises the steps: detecting a control equipment capture state for a target object in a target operation system; executing a capture release simulation operation of the control equipment according to the control equipment capture state; an event distribution mechanism of the control equipment is adjusted, so that control equipment events are transmitted to other objects; wherein the event distribution mechanism is a mechanism for controlling the control equipment event to be transmitted in the target operating system and distributed to different objects. According to the embodiment of the invention, the native API or alternative function of the target operating system is called to simulate the effect of release capture, so that the event conflict or jamming phenomenon of the control equipment caused by non-release capture is avoided. Besides, by adjusting an event distribution mechanism, the scheme ensures that the control equipment events can be distributed to correct objects according to an expected sequence, and efficient and stable event processing in different operating systems is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method for processing a control device event, a system for processing a control device event, an electronic device, and a computer-readable storage medium. Background Art

[0002] In modern graphical user interface applications, the handling of mouse pointer events is crucial. In the Windows operating system, when a window captures the mouse pointer by calling a function, the window can still receive all subsequent mouse pointer events even if the mouse pointer moves out of the window boundary. To release the capture of the mouse pointer, Windows provides a specific function for releasing the capture.

[0003] However, in some other operating systems, due to differences in system architecture and application programming interface (API), no specific function is provided for releasing capture, or the specific function is not available. As a result, applications developed on some other operating systems may experience mouse pointer event conflicts or mouse pointer stuck problems, which in turn affects user experience and the normal operation of applications. Summary of the invention

[0004] In view of the above problems, embodiments of the present invention are proposed to provide a method for processing control device events, a system for processing control device events, an electronic device and a computer-readable storage medium that overcome the above problems or at least partially solve the above problems.

[0005] In order to solve the above problem, an embodiment of the present invention discloses a method for processing a control device event, the method comprising:

[0006] Detecting the capture status of the control device for the target object in the target operating system;

[0007] Execute a capture and release simulation operation of the control device according to the capture state of the control device;

[0008] Adjusting the event distribution mechanism of the control device so that the control device events are delivered to other objects;

[0009] The event distribution mechanism is a mechanism for controlling the transmission of the control device events in the target operating system and distributing them to different objects.

[0010] Optionally, the detecting a capture state of a control device for a target object in a target operating system includes:

[0011] The capture state of the control device is determined by monitoring the control device event stream at the system level or querying the state of the target object.

[0012] Optionally, the performing a capture and release simulation operation of the control device according to the capture state of the control device includes:

[0013] When the control device capture state indicates that the target object has captured the control device and the target object is about to release the control device, the capture and release simulation operation is performed.

[0014] Optionally, the performing the capture and release simulation operation includes:

[0015] The input control function of the graphical user interface system is called to execute the capture and release simulation operation.

[0016] Optionally, adjusting the event distribution mechanism of the control device includes:

[0017] In a control device event queue, clearing the control device event pointing to the target object;

[0018] The other control device events in the control device event queue are reallocated to the other objects.

[0019] Optionally, adjusting the event distribution mechanism of the control device includes:

[0020] The current rule of the control device event filter is switched to be the default event rule for the other objects, and the priority of the other objects in receiving the control device event is set so that the other objects receive the control device event preferentially.

[0021] Optionally, adjusting the event distribution mechanism of the control device includes:

[0022] Acquire current location information of the control device;

[0023] Determine the positional relationship between the control device and the other objects according to the current position information;

[0024] adjusting an event processing flow of the control device using the positional relationship;

[0025] The event processing flow includes analysis of the mouse event, response operation and exception handling.

[0026] The embodiment of the present invention further discloses a system for processing control device events, the system comprising:

[0027] A capture state detection module, used to detect the capture state of a control device for a target object in a target operating system;

[0028] A capture simulation release module, used to perform a capture and release simulation operation of the control device according to the capture state of the control device;

[0029] The distribution mechanism adjustment module is used to adjust the event distribution mechanism of the control device so that the control device events are transmitted to other objects.

[0030] Optionally, the capture state detection module is used to determine the capture state of the control device by monitoring a system-level control device event stream or querying a state of the target object.

[0031] Optionally, the capture simulation release module is used to perform the capture and release simulation operation when the capture state of the control device indicates that the target object has captured the control device and the target object is about to release the control device.

[0032] Optionally, the capture simulation release module is used to call an input control function of a graphical user interface system to perform the capture and release simulation operation.

[0033] Optionally, the distribution mechanism adjustment module includes:

[0034] An event clearing module, used for clearing the control device event pointing to the target object in the control device event queue;

[0035] The event allocation module is used to reallocate other control device events in the control device event queue to the other objects.

[0036] Optionally, the distribution mechanism adjustment module is used to switch the current rule of the control device event filter to the default event rule for the other objects, and set the priority of the other objects to receive the control device events so that the other objects receive the control device events preferentially.

[0037] Optionally, the distribution mechanism adjustment module includes:

[0038] A location information acquisition module, used to acquire the current location information of the control device;

[0039] A position relationship determination module, used to determine the position relationship between the control device and the other object according to the current position information;

[0040] A processing flow adjustment module, used for adjusting the event processing flow of the control device by using the position relationship;

[0041] The event processing flow includes analysis of the mouse event, response operation and exception handling.

[0042] An embodiment of the present invention also discloses an electronic device, comprising: one or more processors; and one or more machine-readable media storing instructions thereon, which, when executed by the one or more processors, enables the electronic device to execute the method for processing control device events as described above.

[0043] The embodiment of the present invention further discloses a computer-readable storage medium, wherein the computer program stored in the storage medium enables a processor to execute the method for processing a control device event as described above.

[0044] The embodiments of the present invention include the following advantages:

[0045] The control device event processing scheme provided in the embodiment of the present invention detects the capture status of the control device for the target object in the target operating system; performs the capture and release simulation operation of the control device according to the capture status of the control device; adjusts the event distribution mechanism of the control device so that the control device event is transmitted to other objects; wherein the event distribution mechanism is a mechanism for controlling the transmission of the control device event in the target operating system and distributing it to different objects.

[0046] Compared with the background technology, the embodiments of the present invention have the following beneficial effects:

[0047] 1. Solve the problem of mouse pointer event conflict:

[0048] In the background art, since some operating systems do not provide a specific release capture function or the specific function is unavailable, mouse pointer event conflicts may occur, affecting the reception of mouse events by other windows or objects. The embodiments of the present invention detect the capture state of a control device (such as a mouse pointer) and perform a capture and release simulation operation to ensure that the control device (such as a mouse pointer) event can be correctly transmitted, thereby effectively solving the control device (such as a mouse pointer) event conflict problem.

[0049] 2. Avoid mouse pointer stuck:

[0050] In the background art, the mouse pointer may be stuck due to the capture state not being released, which prevents the user from operating other windows or objects. The embodiment of the present invention ensures the normal flow of control device (such as mouse pointer) events by simulating the release of capture and adjusting the event distribution mechanism, thereby avoiding the stuck phenomenon and improving the user experience.

[0051] 3. Enhance the compatibility of target operating systems:

[0052] Background technology relies on Windows specific API and cannot be used directly in the target operating system. The embodiment of the present invention independently implements capture and release simulation operations to enable it to adapt to multiple target operating systems and enhance the compatibility of applications in different systems.

[0053] 4. Improve the distribution efficiency of mouse pointer events:

[0054] The background art does not clearly explain how to properly handle event distribution after releasing capture, which may lead to chaotic or unexpected distribution. In the embodiments of the present invention, the event distribution mechanism is adjusted to ensure that the control device (such as a mouse pointer) event is accurately transmitted to other objects, thereby optimizing the efficiency and accuracy of event distribution. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 is a flowchart of a method for processing a control device event according to an embodiment of the present invention;

[0056] Figure 2 is a flowchart of a solution to a mouse pointer event conflict according to an embodiment of the present invention;

[0057] Figure 3 It is a structural block diagram of a system for processing device events according to an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0059] The control device event processing scheme proposed in the embodiment of the present invention detects the capture status of the control device for the target object in the target operating system, performs capture and release simulation operations according to the detection results, and adjusts the event distribution mechanism to ensure that the control device events can be smoothly transmitted to other objects. Specifically, when a target object such as a window or control in the target operating system captures a control device (such as a mouse pointer), the scheme simulates the effect of releasing the capture by calling the native API or alternative function of the target operating system, thereby avoiding control device (such as mouse pointer) event conflicts or stuck phenomena caused by failure to release the capture. In addition, by adjusting the event distribution mechanism, the scheme ensures that control device (such as mouse pointer) events can be distributed to the correct object in the expected order, thereby achieving efficient and stable event processing in different operating systems.

[0060] Reference Figure 1 , shows a flowchart of the steps of a method for processing a control device event according to an embodiment of the present invention. The method for processing a control device event can be applied to a system for processing a control device event, referred to as a system. Below, the control device is a mouse pointer as an example for explanation. If the control device is other devices, the implementation can refer to the relevant contents of the embodiment of the present invention. The method for processing a control device event can specifically include the following steps:

[0061] Step 101: Detect the capture status of a control device for a target object in a target operating system.

[0062] In this step, the system needs to detect whether the control device in the target operating system is captured by a specific target object. The control device capture state is a mechanism of the operating system that specifies that an object such as a window or a control receives all control device events in the capture state, even if the control device moves out of the boundary of the window or control. During the detection process, the system first needs to identify the mouse event processing framework used by the target operating system (such as X11, which is a software window system displayed in bitmap mode). Different operating systems may manage the mouse capture state differently, so the system needs to select a suitable detection method for the target operating system. Taking X11 as an example, the system can query whether there is mouse pointer capture behavior by listening to the X11 event queue or calling the window management API, such as using certain functions. These functions can return the current state of the mouse pointer and the identification information of the window or control it is in. The detection process needs to ensure real-time and accuracy so that it can respond quickly when the mouse pointer capture state changes. In addition, the detection mechanism should also take into account the diversity of the target operating system, such as different desktop environments or specific hardware devices, to ensure that the control device capture state can be correctly identified in various scenarios.

[0063] Step 102: Execute a capture and release simulation operation of the control device according to the capture state of the control device.

[0064] After completing the detection of the capture state of the control device, the system will perform a capture release simulation operation according to the capture state of the control device. The goal of this process is to ensure that in the target operating system, the control device is released from the current capture state so that other objects such as other windows or other controls can receive control device events normally. Since the target operating system does not provide a specific function for releasing capture, the system needs to implement similar functions by calling the underlying API. For example, in the X11 environment, the system can call the XUngrabPointer function to simulate the effect of releasing capture. Specifically, when it is detected that an object such as a window or a control has captured the mouse pointer and needs to be released, the system sends a release instruction to the window manager by calling the API, thereby allowing the mouse pointer to move freely and reallocate events. In order to enhance compatibility, the system also needs to design corresponding simulation operation schemes for different target operating systems. In addition, the capture release simulation operation needs to take into account potential abnormal situations, such as conflicts or resource occupation problems that may be caused when the capture state changes frequently. The system should adopt appropriate error handling mechanisms, such as retry logic or event queue cleanup, to ensure the reliability of the capture release operation. This step not only restores the normal transmission of control device events, but also provides the necessary prerequisites for the adjustment of the event distribution mechanism.

[0065] Step 103: Adjust the event distribution mechanism of the control device so that the control device event is transmitted to other objects.

[0066] The event distribution mechanism is a mechanism that controls the transmission of control device events in the target operating system and distributes them to different objects. After releasing the capture state of the control device, in order to ensure that subsequent mouse events can be smoothly transmitted to the correct object, the event distribution mechanism of the target operating system needs to be adjusted. The event distribution mechanism is the core module in the target operating system for controlling the transmission of control device events. Its function is to distribute the control device's movement, click, scroll and other events to windows or objects according to certain rules. In this step, the system needs to optimize the configuration of the event distribution mechanism to adapt to the state change after the capture is released. During the adjustment process, the system first needs to clean up the event queue that may remain to ensure that the unprocessed old events do not interfere with the transmission of new events. Secondly, the system needs to reconfigure the event distribution logic according to the current window layout and object state. For example, when the mouse pointer moves from one window to another, the system needs to ensure that the events are transmitted in the expected order without event loss or confusion. For different operating systems, the adjustment method may be slightly different. In the X11 system, the reconfiguration of event distribution can be achieved by modifying the event filter or updating the event processing function. In addition, this step also needs to consider multi-device interaction scenarios, such as how to coordinate the event distribution priorities of the mouse and touchpad when they are connected at the same time. By adjusting the event distribution mechanism, the system can effectively avoid conflicts or omissions of mouse events, thereby ensuring the smoothness and accuracy of user interaction. This step is a key link in achieving a complete control device event processing flow, which directly affects the user's operating experience and the stability of the application.

[0067] The control device event processing scheme provided in the embodiment of the present invention detects the capture status of the control device for the target object in the target operating system; performs the capture and release simulation operation of the control device according to the capture status of the control device; adjusts the event distribution mechanism of the control device so that the control device event is transmitted to other objects; wherein the event distribution mechanism is a mechanism for controlling the transmission of the control device event in the target operating system and distributing it to different objects.

[0068] Compared with the background technology, the embodiments of the present invention have the following beneficial effects:

[0069] 1. Solve the mouse pointer event conflict problem:

[0070] In the background art, since some operating systems do not provide a specific release capture function or the specific function is unavailable, mouse pointer event conflicts may occur, affecting the reception of mouse events by other windows or objects. The embodiments of the present invention detect the capture state of a control device (such as a mouse pointer) and perform a capture and release simulation operation to ensure that the control device (such as a mouse pointer) event can be correctly transmitted, thereby effectively solving the control device (such as a mouse pointer) event conflict problem.

[0071] 2. Avoid mouse pointer stuck:

[0072] In the background art, the mouse pointer may be stuck due to the capture state not being released, which prevents the user from operating other windows or objects. The embodiment of the present invention ensures the normal flow of control device (such as mouse pointer) events by simulating the release of capture and adjusting the event distribution mechanism, thereby avoiding the stuck phenomenon and improving the user experience.

[0073] 3. Enhance the compatibility of target operating systems:

[0074] Background technology relies on Windows specific API and cannot be used directly in the target operating system. The embodiment of the present invention independently implements capture and release simulation operations to enable it to adapt to multiple target operating systems and enhance the compatibility of applications in different systems.

[0075] 4. Improve the distribution efficiency of mouse pointer events:

[0076] The background art does not clearly explain how to properly handle event distribution after releasing capture, which may lead to chaotic or unexpected distribution. In the embodiments of the present invention, the event distribution mechanism is adjusted to ensure that the control device (such as a mouse pointer) event is accurately transmitted to other objects, thereby optimizing the efficiency and accuracy of event distribution.

[0077] In an exemplary embodiment of the present invention, an implementation method of detecting the capture state of a control device for a target object in a target operating system is: determining the capture state of the control device by monitoring a system-level control device event stream or querying the state of the target object.

[0078] In the target operating system, control device events are usually processed by the underlying window management system or event management mechanism (such as X11) and distributed to specific windows or controls. When a window captures a control device, the event stream will show that all mouse operations are directed to that window. By monitoring the system-level event stream, the system can capture the path and target of the control device event, thereby determining whether there is a capture behavior. This monitoring method has the characteristics of strong real-time performance and wide application range, and can support a variety of different desktop environments and input devices.

[0079] Another method is to directly query the state of the target object to determine whether it is in the mouse capture state. For example, in the X11 system, you can check the current pointer position or the focus window information by calling a specific API function. If a window or a control reports that it is the event target and the mouse pointer is restricted, it can be determined that the window or the control has captured the mouse pointer. This method is more direct than event stream monitoring, but it may be more dependent on the operating system API and needs to be adapted for different platforms.

[0080] The embodiment of the present invention can efficiently identify the capture state of the control device in the target operating system, laying the foundation for the subsequent capture and release simulation operation. Secondly, the embodiment has both real-time and accuracy, especially by combining the event stream monitoring and status query method, the system can quickly and comprehensively capture the changes in the control device state, avoiding the subsequent processing failure due to misjudgment of the capture state.

[0081] In an exemplary embodiment of the present invention, an implementation method of performing a capture and release simulation operation of a control device according to the capture state of the control device is: when the capture state of the control device indicates that the target object has captured the control device and the target object is about to release the control device, a capture and release simulation operation is performed.

[0082] When a target object such as a window or a control captures the mouse pointer, it will have the exclusive right to receive mouse events, and other objects cannot receive mouse events even if they are logically related to user interaction. At this time, if the target object fails to release the capture state correctly, it will cause mouse pointer event conflicts or stuck phenomena, affecting the user's normal operation experience. Therefore, this implementation aims to achieve the release of capture through simulated operation, thereby solving such problems.

[0083] Specifically, when the system detects that the target object is in the control device capture state and needs to be released, the capture and release simulation operation will be performed. In the X11 environment, this can be achieved by calling the relevant function. The function sends an instruction to the window manager to release the control device capture, so that the control device is no longer bound to the current object, but is free to move again and is passed to other objects according to the system's event distribution mechanism. In the implementation process, the capture and release operation needs to be accurate and safe. For example, the system should avoid blindly performing the release operation without confirming that the target object is in the capture state, which may lead to incorrect state modification or waste of system resources.

[0084] For example, when a user clicks a tool button in a drawing application, the window captures the mouse pointer for subsequent drawing operations. If the user tries to switch to another window but fails to release the capture state correctly, the mouse pointer may be stuck in the drawing window, causing other windows to be unable to receive events. Through the above implementation, the system simulates the release operation after confirming the capture state, so that the mouse pointer can move freely again and the event can be normally transmitted to the target window switched by the user.

[0085] The embodiment of the present invention can effectively solve the event conflict or stuck problem caused by the failure to correctly release the capture state of the control device, and fundamentally improve the fluency of user interaction. This implementation method achieves good adaptation with the target operating system API by simulating the release operation, and can provide a reliable alternative solution even when the operating system does not provide a native capture and release function, thereby improving the cross-platform compatibility of the application.

[0086] In an exemplary embodiment of the present invention, an implementation method for performing a capture-release simulation operation is: calling an input control function of a graphical user interface (GUI) system to perform the capture-release simulation operation.

[0087] In modern operating systems, the GUI system is responsible for managing the capture and distribution of user input events, such as event processing of peripherals such as keyboards and mice. The GUI systems of different operating systems provide different API interfaces for developers to control the behavior of input devices. When an object captures and controls a device, the object monopolizes the mouse events, causing other objects to be unable to receive events. In this case, the capture state needs to be released through the input control function so that the mouse events can flow again. In the specific implementation, the input control function is the key tool for the GUI system to manage input devices. These functions allow developers to send clear instructions to the operating system to release the mouse capture state of an object.

[0088] The core advantage of calling input control functions is that it can directly interact with the underlying mechanism of the operating system to ensure the accuracy and efficiency of capture and release operations. The operating system manages the distribution path of mouse events through these functions, so calling these functions can accurately release the control device from the current capture state. For example, in the X11 environment, when the system detects that a window has captured the mouse pointer, it can send a request to the server to release the capture by calling the XUngrabPointer function, thereby allowing the mouse events to be reallocated to other windows.

[0089] By calling the input control function of the GUI system, the system can efficiently and accurately perform the capture and release operation, avoiding errors caused by operational complexity or state misjudgment. Secondly, the underlying API provided by the target operating system is directly used, reducing the need for additional code implementation, thereby reducing development costs and complexity.

[0090] In an exemplary embodiment of the present invention, an implementation method of adjusting the event distribution mechanism of the control device is: in the control device event queue, clearing the control device events pointing to the target object; and reallocating other control device events in the control device event queue to other objects.

[0091] In modern operating systems, control device events are centrally managed through event queues. The system arranges all user input events in chronological order and determines their delivery targets based on the event distribution mechanism. When an object captures a control device, most of the mouse events in the event queue will point to that object. If the capture is not released in time, other objects may not receive the expected events, resulting in a disordered event processing order or even a lag in interaction. By clearing redundant or invalid events in the queue and reallocating the remaining events to the correct target objects, this implementation solves the problem of chaotic mouse event distribution and ensures the smoothness of system interaction.

[0092] Specifically, this implementation includes two steps: first, clearing the mouse events pointing to the target object in the event queue. This step requires identifying all events related to the current capture state in the queue and removing these events to prevent them from interfering with normal event processing after capture and release. For example, if the target object has performed a capture and release simulation operation, the mouse events remaining in the queue pointing to the object will no longer be valid and need to be removed through a cleanup mechanism. Second, reallocate other mouse events in the queue to the correct object. This process requires resetting the target of the event according to the rules of the current window manager or event distribution mechanism. For example, in the X11 system, event allocation can be achieved by adjusting the window focus or calling an event redirection function. The difficulty of this step is to ensure that the reallocated events can maintain logical consistency to avoid delays or losses in event processing.

[0093] The embodiment of the present invention can effectively prevent the error event processing caused by the event residue after the capture state is released, and solve the confusion and conflict problems of mouse events from the root. By cleaning up invalid events and reallocating the remaining events, this implementation method ensures the order and accuracy of event processing, avoids the occurrence of event delay or loss, and improves the stability of system interaction.

[0094] In an exemplary embodiment of the present invention, an implementation method of adjusting the event distribution mechanism of the control device is: switching the current rule of the control device event filter to the default event rule for other objects, and setting the priority of other objects to receive the control device events so that other objects receive the control device events first.

[0095] In modern operating systems, control device events are usually passed to the target object according to the rules of the event filter. The event filter is an important module in the system for filtering and routing user input events. By setting specific rules, the distribution order and target of events can be controlled. When the mouse is captured and released, if the event filter rules are not updated, the mouse event may still point to the object that released the capture, and other objects cannot receive the event correctly. In order to solve this problem, this implementation proposes to switch the event filter rules to the default event rules after the capture and release are completed, so that the events can be distributed according to the normal logic of the system. At the same time, by setting the priority of other objects to receive mouse pointer events, it is further ensured that these objects get priority processing rights during the event distribution process.

[0096] In the specific implementation, switching event filter rules involves resetting the current event routing logic of the system. For example, in the X11 system, the window focus or event target can be modified by calling the relevant API to switch the matching conditions of the event filter. In addition, setting the priority of other objects to receive events is the key to ensuring the correct distribution of events. For example, when multiple windows request to receive mouse events at the same time, the priority setting ensures that the window currently operated by the user becomes the main target of the event to avoid the event being mistakenly assigned to the background window. For complex scenarios, such as multi-window applications or multi-display environments, this implementation can dynamically adjust the event distribution strategy to adapt to different interaction needs.

[0097] By switching the event filter rules, the system can quickly adapt to the state changes after capture and release, avoiding event distribution problems caused by lag or mismatch of event filter rules. Priority setting further optimizes the accuracy and efficiency of event delivery, ensuring that mouse events can be delivered to the object currently operated by the user first, thereby improving the smoothness and accuracy of interaction.

[0098] In an exemplary embodiment of the present invention, an implementation method of adjusting the event distribution mechanism of the control device is: obtaining the current position information of the control device; determining the position relationship between the control device and other objects based on the current position information; and adjusting the event processing flow of the control device using the position relationship; wherein the event processing flow includes analysis of mouse events, response operations, and exception handling.

[0099] In modern graphical user interface systems, the position of the control device is an important basis for determining event distribution. The system usually relies on the current position of the control device to determine its target window or object. However, when the mouse capture state is released, the system may need to recalculate the relative position of the mouse pointer and other objects to ensure that the event can be distributed to the correct target object. The first step of this implementation is to obtain the position information of the mouse pointer in real time, which can be achieved through the API provided by the operating system. For example, in the X11 system, the XQueryPointer function can be used to obtain the precise coordinates of the mouse pointer on the screen. With this information, the system can understand the absolute position of the mouse pointer.

[0100] Next, the system needs to determine the target object based on the positional relationship of the control device. This step involves determining the window area where the control device is located. For example, if the mouse pointer is located in the border area of ​​a window, a higher event priority may need to be set for the window; if the pointer is located in a blank area, the system may need to trigger a global event or ignore the current event. By analyzing the relative position of the mouse pointer and the object, the system can dynamically adjust the target object of event processing to avoid misdistribution or omission of events due to inaccurate positional relationship judgment. Finally, the system uses the positional relationship to adjust the processing flow of mouse pointer events. The event processing flow consists of three key parts: event analysis, response operation, and exception handling. Event analysis includes identifying the type of mouse operation (such as clicking, scrolling, or dragging) and its target; response operation refers to the specific behavior that triggers the target object, such as opening a menu or moving a window; exception handling is used to solve errors that may occur during event distribution, such as delayed mouse pointer position update or abnormal target object status.

[0101] This implementation method obtains the pointer position in real time and dynamically analyzes its relationship with the object. The system can quickly adapt to changes after the capture state is released, avoiding problems such as event distribution lag or incorrect target object selection. This implementation method optimizes the event processing process, ensures that events can be handled accurately and efficiently through clear analysis and response logic, and a complete exception handling mechanism, thereby improving the user's operating experience. For example, in a multi-window scenario, even if the mouse pointer is in the overlapping area of ​​the boundaries of two windows, this method can determine the distribution priority based on the position relationship and event type to avoid event confusion.

[0102] Based on the above description of the embodiment of a method for processing a control device event, a solution to a mouse pointer event conflict is introduced below. Figure 2 , shows a flowchart of the steps of a solution to a mouse pointer event conflict according to an embodiment of the present invention. The solution to a mouse pointer event conflict may specifically include the following steps:

[0103] Step 201, detecting the mouse capture state.

[0104] You can monitor the X11 mouse event stream to check whether there is a window that has captured the mouse pointer through the XGrabPointer function.

[0105] Step 202, simulating the release of capture.

[0106] When the mouse capture state is detected, call the XUngrabPointer function to simulate releasing the capture.

[0107] Step 203: event redirection.

[0108] After simulating the release of capture, the system needs to update its event distribution mechanism to ensure that mouse events can be correctly passed to other windows or controls. This may involve adjusting the event queue, updating event filters, or modifying event processing functions.

[0109] To ensure compatibility and stability, the method of the present invention can be fully tested when implemented, including testing on different versions of localized systems, different desktop environments, and different hardware configurations. In addition, configuration options or parameters can be provided so that users or developers can adjust the behavior of the method according to specific circumstances.

[0110] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, 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 invention.

[0111] Reference Figure 3 , shows a structural block diagram of a system for processing control device events according to an embodiment of the present invention. The system for processing control device events may specifically include the following modules.

[0112] A capture state detection module 31 is used to detect the capture state of a control device for a target object in a target operating system;

[0113] A capture simulation release module 32, used to perform a capture and release simulation operation of the control device according to the capture state of the control device;

[0114] The distribution mechanism adjustment module 33 is used to adjust the event distribution mechanism of the control device so that the control device events are transmitted to other objects.

[0115] In an exemplary embodiment of the present invention, the capture state detection module 31 is used to determine the capture state of the control device by monitoring the control device event flow at the system level or querying the state of the target object.

[0116] In an exemplary embodiment of the present invention, the capture simulation release module 32 is used to perform the capture release simulation operation when the capture state of the control device indicates that the target object has captured the control device and the target object is about to release the control device.

[0117] In an exemplary embodiment of the present invention, the capture simulation release module 32 is used to call the input control function of the graphical user interface system to perform the capture release simulation operation.

[0118] In an exemplary embodiment of the present invention, the distribution mechanism adjustment module 33 includes:

[0119] An event clearing module, used for clearing the control device event pointing to the target object in the control device event queue;

[0120] The event allocation module is used to reallocate other control device events in the control device event queue to the other objects.

[0121] In an exemplary embodiment of the present invention, the distribution mechanism adjustment module 33 is used to switch the current rule of the control device event filter to the default event rule for the other objects, and set the priority of the other objects to receive the control device events so that the other objects receive the control device events preferentially.

[0122] In an exemplary embodiment of the present invention, the distribution mechanism adjustment module 33 includes:

[0123] A location information acquisition module, used to acquire the current location information of the control device;

[0124] A position relationship determination module, used to determine the position relationship between the control device and the other object according to the current position information;

[0125] A processing flow adjustment module, used for adjusting the event processing flow of the control device by using the position relationship;

[0126] The event processing flow includes analysis of the mouse event, response operation and exception handling.

[0127] As for the system 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.

[0128] 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.

[0129] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0130] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks 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 generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0131] These computer program instructions may also be stored in a computer readable memory capable of directing 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, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0132] 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 a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0133] Although the preferred embodiments of the present invention 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 invention.

[0134] 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.

[0135] The above is a detailed introduction to a method for processing device events and a system for processing device events provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for processing a control device event, characterized in that: The method comprises: Detecting the capture status of the control device for the target object in the target operating system; Execute a capture and release simulation operation of the control device according to the capture state of the control device; Adjusting the event distribution mechanism of the control device so that the control device events are delivered to other objects; The event distribution mechanism is a mechanism for controlling the transmission of the control device events in the target operating system and distributing them to different objects.

2. The method according to claim 1, characterized in that The detecting the capture state of the control device for the target object in the target operating system includes: The capture state of the control device is determined by monitoring the control device event stream at the system level or querying the state of the target object.

3. The method according to claim 1, characterized in that The performing a capture and release simulation operation of the control device according to the capture state of the control device comprises: When the control device capture state indicates that the target object has captured the control device and the target object is about to release the control device, the capture and release simulation operation is performed.

4. The method according to claim 3, characterized in that The performing of the capture and release simulation operation comprises: The input control function of the graphical user interface system is called to execute the capture and release simulation operation.

5. The method according to claim 1, characterized in that The adjusting the event distribution mechanism of the control device comprises: In a control device event queue, clearing the control device event pointing to the target object; The other control device events in the control device event queue are reallocated to the other objects.

6. The method according to claim 1, characterized in that The adjusting the event distribution mechanism of the control device comprises: The current rule of the control device event filter is switched to be the default event rule for the other objects, and the priority of the other objects in receiving the control device event is set so that the other objects receive the control device event preferentially.

7. The method according to claim 1, characterized in that The adjusting the event distribution mechanism of the control device comprises: Acquire current location information of the control device; Determine the positional relationship between the control device and the other objects according to the current position information; adjusting an event processing flow of the control device using the positional relationship; The event processing flow includes analysis of the mouse event, response operation and exception handling.

8. A system for processing control device events, characterized in that: The system comprises: A capture state detection module, used to detect the capture state of a control device for a target object in a target operating system; A capture simulation release module, used to perform a capture and release simulation operation of the control device according to the capture state of the control device; The distribution mechanism adjustment module is used to adjust the event distribution mechanism of the control device so that the control device events are transmitted to other objects.

9. An electronic device, characterized in that: include: one or more processors; and One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, enable the electronic device to execute the method for processing device events as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer program stored therein enables the processor to execute the method for processing control device events as described in any one of claims 1 to 7.