Input device control right switching method, apparatus, and medium
Patent Information
- Application Number
- CN202611068639.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-17
- Publication Date
- 2026-10-27
AI Technical Summary
现有技术主要采用三类方案:一是基于屏幕边缘热区的位置触发方案,光标进入即触发切换,但仅依赖空间位置单一维度,误触发率高,且无法处理边缘精确操作需求;二是基于特定手势或按键组合的显式切换方案,虽可降低误触发,但操作步骤繁琐、学习成本高;三是基于时间阈值的位置触发方案,在热区基础上增加停留时长判定,虽部分解决快速划过误触发问题,但仍无法区分边缘精确操作中的长时间停留与切换意图这一两可场景
[0019]基于上述技术方案可知,本申请的输入设备控制权切换方法、装置和介质,相对于现有技术,至少具备如下有益效果之一:
Smart Images

Figure CN122985010A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of input device management technology, and in particular relates to methods, apparatus and media for switching control of input devices. Background Technology
[0002] In the field of virtualization technology, users often need to share input devices such as touchpads between the host operating system and the virtualization environment. The switching of control is a key technical aspect for achieving a smooth user experience. Existing technologies mainly adopt three types of solutions: First, a position-triggered solution based on the hot zone of the screen edge, where the cursor enters and triggers the switch. However, it relies on only a single dimension of spatial position, resulting in a high false trigger rate and failing to handle the needs of precise edge operations. Second, an explicit switching solution based on specific gestures or button combinations, which can reduce false triggers, but the operation steps are cumbersome and the learning cost is high. Third, a position-triggered solution based on time thresholds, which adds a dwell time judgment to the hot zone. Although it partially solves the problem of false triggers when quickly swiping, it still cannot distinguish between the ambiguous scenario of long dwell time and switching intention in precise edge operations.
[0003] In summary, existing technologies determine user intent from only a single dimension and lack comprehensive analysis of user behavior characteristics, which makes precise edge operations easily misjudged as switching intents, seriously affecting user experience. Summary of the Invention
[0004] This application aims to at least partially solve one of the technical problems in the related art. To this end, the input device control switching method, apparatus, and medium provided by this application, after detecting that the cursor has entered a preset area, simultaneously extracts the duration of dwell time and motion behavior characteristics, and analyzes the stability or change characteristics of the cursor's movement within the preset area, which can accurately distinguish between the user's "precise operation behavior" and "waiting to switch behavior".
[0005] To achieve the above objectives, this application provides a method for switching control of an input device, the method comprising: In response to the cursor of the input device entering a preset area at the edge of the screen under the current first operating system, the operation behavior characteristics of the cursor in the preset area are collected, and the operation behavior characteristics are used to characterize the interaction intention of the cursor operator; In response to the operation behavior characteristics satisfying the preset switching conditions, the control of the input device is switched from the first operating system to the second operating system, where the second operating system is another operating system running on the device to which the first operating system belongs.
[0006] Preferably, the operation behavior features include the duration of the cursor's stay within the preset area and the movement behavior features, wherein the movement behavior features are used to characterize the movement trend of the cursor within the preset area.
[0007] Preferably, the motion behavior characteristics include at least one of the following: the cumulative displacement distance of the cursor within the preset area, the velocity change parameter, and the motion direction consistency parameter; wherein the motion direction consistency parameter is determined based on the degree of dispersion of the cursor's motion direction change per unit time.
[0008] Preferably, the velocity change parameter includes at least one of the instantaneous velocity amplitude parameter of the cursor within the preset area, velocity fluctuation parameter, and acceleration change parameter; wherein the velocity fluctuation parameter includes velocity variance.
[0009] Preferably, the operation behavior characteristics satisfying the preset switching conditions include: the continuous dwell time is greater than a first threshold, and the motion behavior characteristic value is greater than a second threshold; The motion behavior feature value is calculated based on the motion behavior feature and is used to characterize the stability of the cursor within a preset area.
[0010] Preferably, the operation behavior characteristics satisfying the preset switching conditions include: the comprehensive score value is greater than the preset score threshold; The comprehensive score is obtained by weighted summation of the duration of stay and the characteristics of movement behavior.
[0011] Preferably, the operation behavior feature satisfies the preset switching conditions, including: the probability value of the interaction intention is greater than a preset probability threshold; The probability value of the interaction intent is generated based on the operation behavior features by a machine learning classification model. The machine learning classification model is trained by historical operation behavior feature data, which includes at least the duration of dwell time, movement behavior features, and corresponding interaction intent labels.
[0012] Preferably, the method further includes: In response to the cursor entering a preset area under the current first operating system, the finite state machine is switched from the first state to the second state; In response to the operation behavior characteristics satisfying the preset switching conditions, the finite state machine is switched from the second state to the third state; In response to the control release event of the first operating system, the finite state machine is switched from the third state to the fourth state; Wherein, the first state indicates a normal working state in which the cursor is not in the preset area; The second state indicates that the cursor is in the preset area and is in the process of collecting operational behavior features; The third state indicates that a switching operation has been triggered and control release is being performed. The fourth state indicates that the switching operation has been completed and the system is in the anti-shake protection period.
[0013] Preferably, the method further includes: In response to the cursor leaving the preset area and reaching a preset distance, the finite state machine is transitioned from the fourth state to the first state.
[0014] Preferably, after switching control of the input device from the first operating system to the second operating system, the method further includes: Set the target flag to a valid state, the valid state being used to indicate that the switching of control of the input device from the first operating system to the second operating system is triggered based on the interaction intent; The method further includes: in response to detecting a window of the first operating system gaining focus and the target flag being in a valid state, switching control of the input device from the second operating system to the first operating system.
[0015] Preferably, after the operation of switching control of the input device from the first operating system to the second operating system, the method further includes: In response to the absence of an input event from the second operating system within a preset time period, control of the input device is switched from the second operating system to the first operating system.
[0016] The trigger area can be any one of the following shapes: rectangle, triangle, sector, irregular polygon, or circle. Secondly, this application provides an input device control switching device, applied to a computing device including a first operating system and a second operating system, the device comprising: The feature acquisition module, in response to the cursor of the input device entering a preset area at the edge of the screen under the current first operating system, acquires the operation behavior features of the cursor within the preset area, and the operation behavior features are used to characterize the interaction intention of the cursor operator; The intent determination module is used to determine whether the operation behavior characteristics meet the preset switching conditions; The switching execution module, in response to the operation behavior characteristics meeting preset switching conditions, switches the control of the input device from the first operating system to the second operating system.
[0017] Thirdly, this application provides a computing device including a processor and a memory, wherein the memory stores computer program instructions, and when the processor executes the computer program instructions, it implements the input device control switching method as described in any of the preceding claims.
[0018] Fourthly, this application provides a computer-readable storage medium, characterized in that the storage medium stores computer program instructions, which, when executed by a processor, implement the input device control switching method as described in any of the preceding claims.
[0019] Based on the above technical solutions, it can be seen that the input device control switching method, apparatus, and medium of this application have at least one of the following beneficial effects compared with the prior art: 1. This application monitors the cursor's movement within a preset area at the screen edge, collecting cursor operation characteristics that represent the user's interaction intent. When these characteristics meet preset switching conditions, it completes the switching of input device control between two operating systems within the device. This solution no longer relies solely on cursor position to trigger switching; instead, it uses operation characteristics that reflect the user's true interaction intent as the basis for switching decisions. This effectively distinguishes between different usage scenarios: unintentional swiping across the edge, fine-grained edge operations, and active system switching. It significantly reduces the probability of erroneous switching caused by relying solely on screen edge triggers, achieving intelligent and precise switching of input device control across operating systems and improving the smoothness of operation when multiple systems share an input device.
[0020] 2. This application designs a four-state finite state machine management switching process including a first state, a second state, a third state, and a fourth state, and introduces a departure confirmation distance mechanism, which only allows state rollback after the cursor leaves the preset area and reaches the preset distance, effectively preventing repeated switching caused by the cursor oscillating near the threshold boundary, ensuring the stability and reliability of state transitions, and improving the smooth user experience.
[0021] 3. This application sets a target flag to an active state during the control switching operation, and automatically switches control back from the second operating system to the first operating system when the first operating system window gains focus and the flag is set. Simultaneously, a timer is started, and a rollback operation is performed if no input event response is detected from the second operating system within a preset time, preventing loss of control due to system anomalies. This escape-recovery closed-loop mechanism allows users to return to the virtualized environment without additional operation, providing a seamless and natural switching experience. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1This is a flowchart of the input device control switching method provided in this application; Figure 2 This is a detailed flowchart illustrating the input device control switching method provided in this application; Figure 3 This is a schematic diagram of the state transitions of the finite state machine provided in this application; Figure 4 This is a schematic diagram of the preset area provided in this application; Figure 5 This is a schematic diagram of the input device control switching device based on behavioral characteristics provided in this application. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0025] The terms “first,” “second,” “third,” “fourth,” “fifth,” “sixth,” “seventh,” and “eighth,” etc. (if present), in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein.
[0026] Furthermore, the terms “comprising” and “having”, and any variations thereof, are intended to cover non-exclusive inclusion, such that a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or apparatus.
[0027] In the field of virtualization technology, users often need to share input devices between the host operating system and the virtualization environment. As a high-precision pointing device, the control switching of the touchpad is a key technical aspect for achieving a smooth user experience. Existing technologies mainly employ the following three types of solutions to achieve control switching: I. Location-based triggering based on hot zones This approach sets a fixed area at the edge of the screen, triggering a preset action when the cursor enters it. Representative implementations include macOS's Hot Corners feature and Windows' Edge Gestures feature. However, this approach has obvious drawbacks: (1) it relies solely on a single dimension of spatial location and cannot distinguish between users who unintentionally pass by and those who intentionally linger; (2) it has a high false trigger rate, averaging 10-20% in the industry; and (3) it cannot handle the precise operation requirements of edge areas, such as drawing and adjusting control sizes.
[0028] II. Gesture-based explicit switching This solution requires users to actively trigger the switch by performing specific gestures or key combinations, such as three-finger swipes or shortcut key combinations. Although it can reduce the false trigger rate, it has the following problems: (1) users need to memorize specific operation methods, which has a high learning cost; (2) the operation steps are cumbersome, requiring an average of 2-3 steps; (3) it interrupts the user's operation flow and does not conform to the principle of natural human-computer interaction.
[0029] III. Location Triggering Based on Time Threshold This solution adds a time threshold to the hot zone, triggering the cursor after it stays in a specific area for a certain period of time. Although this solution solves the problem of accidental triggering when the cursor is quickly swiped, it still has key defects: (1) It cannot solve the problem of accidental triggering when the cursor is precisely swiping at the edge - when the user makes precise adjustments at the edge, the cursor will also stay for a long time, resulting in ambiguous scenarios; (2) It lacks a sound state management mechanism, which is prone to boundary jitter.
[0030] A common shortcoming of existing technologies is that they determine user intent based on only a single dimension (spatial location or time), lacking a comprehensive analysis of user behavioral characteristics. This single-dimensional approach cannot accurately distinguish the user's true intent, especially in complex operational scenarios in peripheral areas.
[0031] The core technical problem faced by this application is how to distinguish between precise edge operations and switching intentions. Existing technologies cannot solve this ambiguous scenario (long-term dwell time combined with large-scale movement), which leads to precise edge operations being misjudged as switching intentions, seriously affecting the user experience.
[0032] To address the aforementioned technical issues, this invention introduces a multi-dimensional behavioral feature analysis mechanism. Specifically, after detecting that the cursor has entered a preset area, it simultaneously extracts the duration of the stay and the characteristics of the movement behavior. By analyzing the stability or change characteristics of the cursor's movement within the preset area, it distinguishes between the user's "precise operation behavior" and "waiting to switch behavior," thereby solving the technical problem that existing technologies cannot distinguish between ambiguous scenarios.
[0033] Example 1 like Figure 1 As shown in the figure, this application provides a method for switching control of an input device, the method including: Step S11: In response to the cursor of the input device entering a preset area at the edge of the screen under the current first operating system, the operation behavior characteristics of the cursor in the preset area are collected, and the operation behavior characteristics are used to characterize the interaction intention of the cursor operator; Step S12: In response to the operation behavior characteristics satisfying the preset switching conditions, the control of the input device is switched from the first operating system to the second operating system, where the second operating system is another operating system running on the device to which the first operating system belongs.
[0034] The first operating system mentioned above refers to the operating system environment that currently exclusively uses the input device, such as a virtualization environment like an Android emulator, virtual machine, or remote desktop. The second operating system refers to the host operating system, such as a Linux system, Windows system, or macOS system. Input devices include, but are not limited to, pointing devices such as touchpads, mice, and trackballs. Control refers to the permission status of the input device's event input being exclusively accessed by a specific operating system. It should be noted that this application applies to any multi-operating system environment that supports exclusive access to input devices, including but not limited to virtualization platforms, container environments, and remote desktop systems based on Linux, Windows, and macOS.
[0035] The core concept of this application is: unlike the traditional solution that only relies on the position of the edge area to trigger the switching, it no longer directly triggers the switching based on whether the cursor enters the area, but introduces the operation behavior characteristics that can represent the user's interaction intention as the judgment basis. It can distinguish different scenarios such as unintentional swipe, fine operation, and active switching, reduce the probability of accidental switching, and realize intelligent switching of input device control between multiple systems.
[0036] By introducing the dimension of operational behavior features, it is possible to accurately distinguish between precise edge operation behavior and switching waiting behavior, solving ambiguous scenarios that existing technologies cannot handle. For example, when a user makes detailed adjustments to the drawing at the edge of the screen, although the dwell time is relatively long, the cursor moves continuously and significantly. The motion behavior features effectively characterize this operation state, and the system will not mistakenly trigger a switch. On the other hand, when the user waits still at the edge, the dwell time is long and the motion behavior features are highly stable, and the system correctly triggers a switch.
[0037] In one possible implementation, the operational behavior features include the cursor's duration of stay within the preset area and its motion behavior features, wherein the motion behavior features characterize the cursor's movement trend within the preset area. By collecting the duration of stay and the movement trend characterizing the cursor within the preset area in a tiered manner to quantify the degree of motion stability, it is possible to accurately distinguish between two easily confused scenarios: fine-grained operations during prolonged stays and static waiting for switching, further reducing the probability of misjudgment.
[0038] In one possible implementation, the motion behavior features include at least one of the following: cumulative displacement distance of the cursor within a preset area, velocity change parameter, and motion direction consistency parameter; wherein, the motion direction consistency parameter is used to characterize the dispersion of the cursor's motion direction change per unit time, with smaller changes indicating higher direction consistency. The cumulative displacement distance refers to the total path length traversed by the cursor during its stay in the preset area, measured in pixels; the velocity change parameter characterizes the magnitude of velocity fluctuations during the cursor's stay in the preset area.
[0039] By introducing multidimensional motion behavior features, the system's adaptability to complex operational scenarios can be improved, further enhancing the accuracy and robustness of intent determination. In practical applications, depending on the sensor configuration and performance requirements of the computing device, any one or any combination of the aforementioned motion behavior features can be selected for intent determination, without being limited to a specific combination.
[0040] Preferably, the velocity change parameter includes at least one of the instantaneous velocity amplitude parameter of the cursor within the preset area, velocity fluctuation parameter, and acceleration change parameter; wherein the velocity fluctuation parameter includes velocity variance.
[0041] The smaller the cumulative displacement distance, the smaller the velocity change parameter, or the smaller the motion direction consistency parameter (i.e., the degree of dispersion of the cursor's motion direction change per unit time), the more stable the cursor's movement trend is within the preset area. This means the user is more likely to be stationary and waiting at the edge of the preset area rather than performing precise operations. It should be noted that the cumulative displacement distance, velocity change parameter, and motion direction consistency parameter can be used individually or in combination; all these methods can effectively reflect the cursor's motion stability and are not limited to any single method.
[0042] When a user performs precise operations within a preset area, such as adjusting window boundaries or drawing edge details, the finger continuously fine-tunes on the touchpad, resulting in a large cumulative displacement distance and noticeable speed fluctuations for the cursor, indicating an unstable movement trend. Conversely, when a user intends to switch operating systems and remains stationary at the edge of the preset area, the finger remains almost motionless, the cumulative displacement distance is minimal, the speed change is gradual, and the movement trend tends to be stable. By quantifying the stability of the movement trend into calculable motion behavior characteristics, an effective behavioral dimension is provided for subsequent intent determination.
[0043] In one possible implementation, the dwell time is the duration the cursor remains within a preset area, calculated as: T_stay = t_current - t_enter, where T_stay is the dwell time, t_enter is the moment the cursor enters the preset area, and t_current is the current time. Dwell time is measured in milliseconds. The dwell time reflects the user's willingness to remain at the edge of the preset area; the longer the dwell time, the higher the likelihood of the user intending to switch. t_enter is obtained as follows: when the cursor's position coordinates first fall within the preset area, the system records the current system timestamp as the entry time. t_current is the system timestamp of the intention determination execution time. The preset area refers to the screen edge area defined to delineate the intention detection range; the system only initiates the behavior feature collection process after the cursor enters the preset area.
[0044] In one possible implementation, the operation behavior characteristics satisfying preset switching conditions include: the continuous dwell time being greater than a first threshold, and the motion behavior feature value being greater than a second threshold; wherein, the motion behavior feature value is calculated based on the motion behavior characteristics and is used to characterize the stability of the cursor within a preset area. The first threshold is a time-based threshold, and the second threshold is a motion stability-based threshold. Specific parameters can be configured as follows: the first threshold is 500 milliseconds, and the second threshold is 0.8, thereby effectively distinguishing between static waiting and fine-tuning operations. When a dwell time greater than 500 milliseconds and a motion stability greater than 0.8 are detected, it indicates that the user has a sufficiently long dwell intention in the edge area and remains highly still, indicating a clear switching intention.
[0045] It should be noted that the first and second thresholds are not limited to the values mentioned above, and can be adaptively adjusted based on user operating habits, historical false trigger rates, or application scenario requirements. For example, when frequent false triggers are detected, the first threshold can be automatically increased to 800 milliseconds or the second threshold can be increased to 0.85 to further reduce the false trigger rate; when the user is in a quick operation scenario, the threshold can be appropriately reduced to improve response speed.
[0046] In one possible implementation, the formula for calculating the motion behavior feature value S is: S = 1 / (1 + α) D_cumulative + β (V_variance). Here, D_cumulative is the cumulative displacement distance of the cursor during its stay within the preset area, in pixels; V_variance is the velocity variance, in pixels squared per square second; α is the weighting coefficient for displacement distance; and β is the weighting coefficient for velocity variance. The cumulative displacement distance D_cumulative is calculated by summing the absolute values of the cursor displacement increments at each sampling moment during the stay. The velocity variance V_variance is calculated by statistically analyzing the variance of the instantaneous velocity at each sampling moment during the stay. The weighting coefficients α and β are used to adjust the contribution of displacement and velocity fluctuations to the stability calculation, respectively.
[0047] As an example configuration, the value of α can range from 0.001 to 0.1, and the value of β can range from 0.01 to 1.0. This range is set based on the need to ensure that, within common touchpad operation displacements (e.g., 0 to 200 pixels) and speed variance ranges, the value of the motion stability feature S can vary within a reasonable range and has effective discriminative power.
[0048] In a feasible scenario, α can be configured to be 0.01 and β to be 0.1. When the user is in a stationary waiting state, with a cumulative displacement of 5 pixels and a very small velocity variance, the calculated S-value is approximately 0.95, close to 1, indicating highly stable motion. When the user is in a precise operation state at the edge of a preset area, with a cumulative displacement of 120 pixels, the calculated S-value drops to approximately 0.45, indicating lower motion stability. This value configuration can clearly and effectively distinguish between the two behavior modes of stationary waiting and precise operation.
[0049] It is understood that those skilled in the art can adjust and optimize the values of α and β within the above-mentioned recommended range based on factors such as the actual application scenario, the hardware sensitivity of the touchpad, the screen resolution, and the user's tolerance for false triggering rate, in order to achieve a balance between response speed and false triggering rate. These adjustments do not deviate from the protection concept of this solution.
[0050] When calculating the motion behavior feature value S, the quantitative indicators involved in the calculation are not limited to the aforementioned cumulative displacement distance and velocity variance parameters. All motion-related quantitative parameters, such as cumulative displacement distance, velocity change parameters (instantaneous velocity amplitude parameters, velocity fluctuation parameters, and acceleration change parameters), and motion direction consistency parameters, can be flexibly introduced to participate in the modeling calculation, depending on the recognition accuracy requirements. All parameters can be uniformly normalized and then configured with appropriate weight coefficients for inclusion in the calculation. For different usage scenarios, some indicators can be removed and their corresponding weights adjusted, retaining only features with high distinguishability of user switching intentions for feature value solving. This approach can adapt to the lightweight computing needs of low-computing-power embedded devices and also improve the accuracy of interactive intent recognition on high-performance terminals through multi-dimensional parameter fusion.
[0051] In one possible implementation, the operation behavior characteristics satisfying the preset switching conditions include: the comprehensive score value is greater than the preset score threshold; wherein, the comprehensive score value is obtained by weighted summation of the continuous dwell time and the movement behavior characteristics; when the comprehensive score value is greater than the preset score threshold, it is determined that the user has the intention to switch.
[0052] In one possible implementation, the motion behavior characteristics also include the average movement speed of the cursor during its stay within a preset area. The formula for calculating the comprehensive score I is: I = w1 × T_stay + w2 × D_cumulative + w3 × V_mean + w4 × C dir Where T_stay is the dwell time in milliseconds, D_cumulative is the cumulative displacement distance of the cursor during its stay within the preset area in pixels, V_mean is the average velocity of the cursor during its stay within the preset area in pixels per second, and C... dir This is a parameter for consistency of motion direction.
[0053] All feature parameters are normalized before being substituted into the formula, mapping them to the 0~1 interval to eliminate dimensional differences. T_stay is positively correlated with the switching intention, and the weight w1 takes a positive value; D_cumulative, V_mean, C dir The larger the value, the more likely the cursor is to be continuously adjusted in small increments, indicating a scenario of fine-grained edge operations and a weaker switching intent. The corresponding weights w2, w3, and w4 are configured as negative values, which lowers the overall score.
[0054] Motion direction consistency parameter C dir The following steps are used to quantify the discreteness of the cursor movement direction change per unit time: Step 1: Collect cursor coordinates at a fixed sampling period and calculate the direction angle θ of cursor movement between adjacent sampling points frame by frame; Step 2: Within the preset sliding time window, collect all direction angle samples and calculate the direction angle variance; the larger the direction angle variance, the more frequently the cursor turns and the higher the operation dispersion. Step 3: Convert the direction angle variance into a C value in the interval of 0 to 1 using a normalized mapping function. dir The larger the variance of the direction angle, the more C dir When the value is closer to 1; and the cursor shows almost no movement and its direction is stable, C dir The value approaches 0; This parameter requires no physical unit and serves only as a dimensionless feature characterizing the degree of randomness in cursor movement. Together with parameters such as cumulative displacement, average velocity, and velocity variance, it participates in the comprehensive scoring weighting calculation as the original motion feature.
[0055] The motion features used in the weighted calculation are not limited to the parameters listed in this example; other motion behavior features such as velocity variance and acceleration variation parameters can also be incorporated for combination calculations. The preset scoring threshold can be calibrated based on historical accuracy data. This solution, by adjusting the weighting coefficients, can achieve a balance between response speed and false trigger rate, making it suitable for the performance requirements of different application scenarios.
[0056] It should be noted that, since the duration of dwell time differs from various motion behavior characteristics in terms of physical meaning and numerical range, each characteristic parameter can be normalized before weighted summation. This normalization maps the parameters to a uniform numerical range (e.g., 0 to 1 or 0 to 100) to eliminate the influence of dimensions and ensure comparability of the characteristic parameters in the weighted calculation. Normalization methods include, but are not limited to, maximum and minimum value normalization, Z-score standardization, or nonlinear mapping using a preset mapping function. For example, the duration of dwell time can be normalized to the 0 to 1 range by dividing the actual dwell time (in milliseconds) by a preset maximum consideration duration (e.g., 2000 milliseconds).
[0057] Similarly, as an example of normalization, a maximum reference speed V_max can be preset (e.g., 500 pixels / second, which can be calibrated according to the hardware sampling rate of the touchpad and the typical user operation speed), and the actual average motion speed is divided by V_max to normalize it to the range of 0 to 1.
[0058] In one possible implementation, the operation behavior feature satisfies the preset switching condition including: the probability value of the interaction intention is greater than a preset probability threshold; The probability value of the interaction intent is generated based on the operation behavior features by a machine learning classification model. The machine learning classification model is trained by historical operation behavior feature data, which includes at least the duration of dwell time, movement behavior features, and corresponding interaction intent labels.
[0059] User intent tags refer to the intent classification labels annotated for each historical behavioral feature data, such as "switching intent" or "non-switching intent," which can be automatically labeled through user-initiated corrective actions (such as manually returning immediately after switching) or system log analysis. Machine learning classification models include, but are not limited to, support vector machine models, decision tree models, or neural network models.
[0060] The preset probability threshold can be adjusted according to the emphasis on precision and recall in the actual application scenario. It can also automatically learn the judgment boundary based on individual user operating habits to achieve personalized intent recognition, and continuously improve the judgment accuracy as usage data accumulates. Training data can come from the historical operation records of a single user or from cloud-aggregated data from multiple users, and is not limited to a single data source.
[0061] like Figure 2 The diagram shows the complete execution flow of the input device control switching method of this application. The steps and branch jump logic are broken down and explained according to the process number as follows: The process starts and proceeds to step S101, where the cursor position is monitored. The system continuously collects and monitors the cursor coordinates on the screen in real time. Step S102: Determine whether the cursor has entered the preset area. If the determination result is negative, the process will directly revert to step S101 and continue to monitor the cursor position in a loop. If the determination result is yes, proceed to step S103: collect operational behavior characteristics, including duration of dwell time and motion behavior characteristics; Step S104: Determine the user's operation intention and verify whether the system's preset switching conditions have been met (e.g., the continuous dwell time is greater than the first threshold and the motion behavior characteristics are greater than the second threshold). If the verification result is negative, the process jumps back to step S101 and re-enters the cursor position monitoring stage. If the verification result is yes, proceed to step S105 and subsequent steps; Step S105: Release the exclusive access of the first operating system to the input device: The system call ioctl (input / output control) sends an exclusive release command to the input device driver (e.g., via the EVIOCGRAB command, with the parameter value 0 indicating the release of exclusive access), thereby releasing the exclusive lock of the first system on the input device.
[0062] Step S106: Forward the input device input event to the second operating system to complete the cross-system transfer of input control.
[0063] Step S107: The user performs regular operations under the second operating system.
[0064] Step S108: When it is necessary to regain control, the corresponding interactive window of the first operating system obtains system focus and triggers the switchback process.
[0065] In step S109, control of the input device is switched back to the first operating system. The system sends an exclusive acquisition command again through the ioctl system call (such as the EVIOCGRAB command, with the parameter value 1 passed to indicate exclusive access), re-establishing exclusive access to the input device, so that the first system can regain exclusive access to the input device.
[0066] In step S110, the system environment automatically returns to the initial monitoring state, and the process eventually jumps back to the starting step S101 to start a new round of cursor position cyclic monitoring, forming a closed-loop operation logic of "cross-system switching - automatic back-switch - continuous monitoring".
[0067] The overall process achieves a complete closed loop for control switching: Step S101 continuous monitoring serves as the basic process. After the cursor enters the preset area, the operation behavior characteristics are collected and the switching intention is verified. If the conditions are met, the exclusive release of the device, input routing forwarding, and cross-system user interaction are executed layer by layer. After the window focus changes, the permission is automatically revoked and the system environment is restored. Finally, the process returns to the initial monitoring process, realizing an automated switching mechanism for input device control that can be triggered, rolled back, and reused in the dual operating systems.
[0068] In one possible implementation, this application manages the switching process through a finite state machine, which includes at least the following states: a first state, indicating a normal working state where the cursor is not in the preset area; a second state, indicating a state where the cursor is in the preset area and operation behavior feature acquisition is in progress; a third state, indicating a state where a switching operation has been triggered and control release is being executed; and a fourth state, indicating a state where the switching operation has been completed and the system is in the anti-jitter protection period.
[0069] A finite state machine (FSM) is a computational model with a finite number of states that transitions between states under certain conditions. It is used to manage the behavioral logic of each stage of the switching process. Specifically, the state transition conditions are as follows: when the cursor enters a preset area under the current first operating system, the FSM transitions from the first state to the second state; when the cursor leaves the preset area and the switching conditions are not yet met, the FSM transitions back from the second state to the first state; when the operation behavior characteristics meet the preset switching conditions, the FSM transitions from the second state to the third state; and when the control release operation is completed, the FSM transitions from the third state to the fourth state, entering the anti-jitter protection period.
[0070] The first state (NORMAL state) is the system's default operating state. In this state, the input device normally transmits input events to the first operating system, but no behavioral feature acquisition is performed. The second state (AT_EDGE state) is the system's monitoring state. At this state, the cursor has entered the preset area, and the system continuously calculates dwell time and motion behavior feature parameters. The third state (TRIGGERED state) is the system's execution state. At this state, the system is executing the release of exclusive device permissions through system calls such as ioctl (input / output control). The fourth state (ESCAPED state) is the system's protection state. At this state, the switch is complete, and the cursor can move freely in the second operating system.
[0071] In one possible implementation, in the fourth state, when the cursor leaves the preset area and reaches a preset distance, the finite state machine transitions from the fourth state to the first state. The preset distance is typically configured to 80-120 pixels, preferably 100 pixels. This preset distance is chosen because it is sufficient to confirm that the user genuinely intends to leave the edge area, rather than temporarily crossing the boundary due to positional jitter, while avoiding excessive distances that could prevent the system from re-entering the monitoring state for an extended period. By setting a departure confirmation distance mechanism, state rollback is only allowed when the cursor leaves the preset area by 80-120 pixels, effectively preventing repeated triggering caused by cursor oscillations near the threshold boundary. It should be noted that the preset distance can also be adjusted according to screen size and user habits, and is not limited to 100 pixels or 80-120 pixels.
[0072] In one possible implementation, after switching control of the input device from the first operating system to the second operating system, the method further includes: Set the target flag to a valid state, the valid state being used to indicate that the switch of control of the input device from the first operating system to the second operating system is triggered based on the interaction intent; The method further includes: in response to detecting a window of the first operating system gaining focus and the target flag being in a valid state, switching control of the input device from the second operating system to the first operating system.
[0073] The target flag is a status identifier used to indicate that this control switch was actively triggered by this method rather than caused by other reasons. It can be a Boolean variable, where a true value indicates the switch was triggered by this method, and a false value indicates other situations. Window focus refers to the currently active window in the operating system's window manager. This mechanism relies on the following: when a user's switching intention is detected, the system releases exclusive device permissions via an ioctl system call, switches the input event routing path from the first operating system to the second operating system, and simultaneously sets the target flag to true. Afterwards, when the user clicks on the first operating system window to gain focus, the system checks the target flag status. If it is true, it automatically regains exclusive device permissions via an ioctl system call, automatically switches back to the first operating system via the input event routing path, without requiring any additional user action. This dynamic routing reconfiguration mechanism implements an escape-recovery closed loop, providing a seamless and natural experience when switching between operating systems. Control recovery operations can also be implemented through other device control interfaces or driver layer mechanisms, not limited to ioctl.
[0074] like Figure 3 The diagram shows the state transition relationships of the finite state machine used in this application. The finite state machine includes four states: NORMAL state (first state S0): representing the normal working state when the cursor is not in the preset area. In this state, the input device normally transmits input events to the first operating system, and no behavioral feature acquisition is performed.
[0075] AT_EDGE state (second state S1): This indicates that the cursor has entered the preset area and is in the process of collecting operational behavior features. The diagram marks "entering the preset area" as the trigger condition for transitioning from the NORMAL state to the AT_EDGE state.
[0076] TRIGGERED state (third state S2): Indicates that a switching operation has been triggered and control release is in progress. The diagram marks "intent condition satisfied" as the trigger condition for transitioning from the AT_EDGE state to the TRIGGERED state.
[0077] ESCAPED state (fourth state S3): Indicates that the switching operation has been completed and the system is in the anti-jitter protection period. The diagram marks "Release Complete" as the trigger condition for transitioning from TRIGGERED state to ESCAPED state.
[0078] The transitions between states also include: from the AT_EDGE state, when the cursor leaves the preset area (marked "Leaves the preset area" in the figure) and the switching conditions have not yet been met, the state reverts to the NORMAL state; from the ESCAPED state, when the cursor leaves the preset area and reaches a preset distance, the state transitions back to the NORMAL state to prevent the cursor from oscillating near the boundary and causing repeated triggering.
[0079] In one possible implementation, after switching control of the input device from the first operating system to the second operating system, the process further includes: starting a timer; if no input event response from the second operating system is detected within a preset time, then switching control of the input device back to the first operating system. The preset time can be 400-600 milliseconds, preferably 500 milliseconds. This preset time is chosen because, under normal switching scenarios, an input event (such as mouse movement) typically occurs in the second operating system within 200-300 milliseconds after the user releases control. A waiting time of 400-600 milliseconds covers normal operation delays and is short enough to avoid the user perceiving an interruption in operation after a failed switch. The timer can be a software timer or a hardware timer. An input event response refers to the event data processing signal generated by the second operating system for the input device. If, after releasing exclusive device permissions, the second operating system fails to take over the input device due to system abnormalities or driver failures, and no corresponding input event is detected within the preset time, the system automatically executes an ioctl call to reacquire exclusive permissions, preventing loss of control due to system abnormalities and ensuring the input device remains controllable. This failure rollback mechanism provides a safety guarantee for the switching operation.
[0080] In one possible implementation, the preset area includes one or more trigger areas located at the edge of the screen; the shape of the trigger area is any one of rectangle, triangle, sector, irregular polygon, or circle, and the shape, size, and number of trigger areas are set according to user operating habits and / or historical false trigger data.
[0081] Screen edges refer to the physical display boundaries of a display device, including the top edge, bottom edge, left edge, and right edge. One or more trigger areas can be distributed at any edge of the screen, for example, only in the bottom right corner for right-handed users, or only in the middle of the top edge to avoid conflict with the bottom taskbar. Different shapes of trigger areas adapt to different usage scenarios: rectangular areas are suitable for covering the entire edge or a segment of the edge, triangular areas are suitable for corner triggers, fan-shaped areas are suitable for corner-centered triggers, irregular polygonal areas are suitable for customizing to avoid interference with specific application window layouts, and circular areas are suitable for small-area triggers centered on a specific point. The shape, size, and number of trigger areas can be dynamically adjusted. For example, when the system analyzes historical false trigger data and finds that the user frequently triggers the screen in the middle of the right edge, it automatically shrinks the trigger area at that location or reconfigures the trigger area to other edge positions. Preset areas can also be customized by providing users with a manual configuration interface, not limited to automatic adjustment.
[0082] Figure 4 A preferred embodiment of the preset area is shown. For example... Figure 4 As shown, the screen displays the interfaces of a first system (such as a virtualization environment) and a second system (such as a host operating system). The touchpad cursor is positioned near the edge of the screen. A preset area is configured as a ring-shaped structure surrounding the four edges of the screen, with a width of 20 pixels, covering the top, bottom, left, and right edges. This ring-shaped area serves as a trigger area; when the cursor enters this 20-pixel-wide ring-shaped area, the system begins to collect operational behavior characteristics and determine the intent. By setting a continuously closed ring-shaped area, it is possible to detect switching intentions initiated by the user from any edge of the screen, avoiding blind spots caused by a single edge area, and improving the responsiveness and consistency of user experience when switching input device control in a multi-operating system environment.
[0083] like Figure 5 As shown, in one possible implementation, this application also provides an input device control switching device, applied to a computing device including a first operating system and a second operating system. The device includes: a feature acquisition module 100, which, in response to the cursor of the input device entering a preset area at the edge of the screen under the current first operating system, acquires the operation behavior features of the cursor within the preset area, the operation behavior features being used to characterize the interaction intent of the cursor operator; Intent determination module 200 is used to determine whether the operation behavior characteristics meet preset switching conditions; The switching execution module 300, in response to the operation behavior characteristics meeting the preset switching conditions, switches the control of the input device from the first operating system to the second operating system.
[0084] The feature acquisition module 100 further includes: a position monitoring unit 101, responsible for real-time monitoring of the cursor coordinate position, determining whether the cursor enters a preset area at the edge of the screen, and triggering subsequent acquisition processes upon entry; a motion analysis unit 102, used to calculate the cumulative displacement distance, velocity variance, average motion velocity, acceleration rate of change, and motion direction consistency of the cursor within the preset area; and a time recording unit 103, used to record the moment (t_enter) when the cursor enters the preset area and the current moment (t_current), thereby calculating the dwell time T_stay = t_current - t_enter.
[0085] The intent determination module 200 is used to determine intent based on the operational behavior characteristics. This module receives the duration of dwell time and motion behavior characteristics from the feature acquisition module, and uses methods such as threshold comparison, weighted scoring, or machine learning classification models to determine whether the user has a switching intent.
[0086] The switching execution module 300 is used to execute a switching operation from the first operating system to the second operating system of the input device when the intent determination result meets the preset switching conditions. The switching execution module 300 further includes: State management unit 301: used to manage the finite state machine (including four states: NORMAL, AT_EDGE, TRIGGERED, and ESCAPED) and control the state transitions of the switching process; Device control unit (routing reconfiguration) 302: Responsible for releasing and regaining control rights through the device exclusive control provided by the operating system (such as the ioctl EVIOCGRAB command in Linux), and dynamically reconfiguring the routing path of input events to realize the switching and automatic recovery between the first operating system and the second operating system.
[0087] The connection relationships and workflow between the modules are as follows: the output of the feature acquisition module 100 is coupled to the input of the intent determination module 200, and the output of the intent determination module 200 is coupled to the input of the switching execution module 300, forming a data-driven pipeline processing architecture. It should be noted that the module division method of this device is based on logical function; in actual implementation, some modules can be merged or further split, and it is not limited to the above division method.
[0088] In one possible implementation, this application also provides a computing device, including a processor and a memory. The memory stores computer program instructions, and when the processor executes the computer program instructions, it implements any of the above-described input device control switching methods. The computing device can be a personal computer, workstation, server, embedded device, or other electronic device with computing capabilities. The processor can be a central processing unit (CPU), graphics processing unit (GPU), neural network processing unit (NPU), or other processing unit with instruction execution capabilities. The memory can be random access memory (RAM), read-only memory (ROM), flash memory, or other non-transitory storage media.
[0089] In one possible implementation, this application also provides a computer-readable storage medium storing computer program instructions. When executed by a processor, the computer program instructions implement any of the above-described input device control switching methods. The computer-readable storage medium includes, but is not limited to, USB flash drives, portable hard drives, optical discs, disk storage media, or other permanent or non-permanent storage media capable of storing program code.
[0090] It should be noted that the values of all threshold parameters (including the first threshold, the second threshold, the preset distance, the preset time, the preset probability threshold, etc.) involved in the embodiments of this application can be adaptively adjusted according to the actual application scenario, user habits, or hardware platform characteristics, and are not limited to the typical values given in the embodiments. The weight coefficients in each formula can also be dynamically optimized based on experimental calibration or online learning results, and are not limited to a certain fixed combination of values.
Claims
1. A method for switching control of an input device, characterized in that, The method includes: In response to the cursor of the input device entering a preset area at the edge of the screen under the current first operating system, the operation behavior characteristics of the cursor in the preset area are collected, and the operation behavior characteristics are used to characterize the interaction intention of the cursor operator; In response to the operation behavior characteristics satisfying the preset switching conditions, the control of the input device is switched from the first operating system to the second operating system, where the second operating system is another operating system running on the device to which the first operating system belongs.
2. The input device control switching method according to claim 1, characterized in that, The operational behavior features include the duration of the cursor's stay within the preset area and its movement behavior features, wherein the movement behavior features are used to characterize the movement trend of the cursor within the preset area.
3. The input device control switching method according to claim 2, characterized in that, The motion behavior characteristics include at least one of the following: the cumulative displacement distance of the cursor within the preset area, the velocity change parameter, and the motion direction consistency parameter; wherein the motion direction consistency parameter is determined based on the degree of dispersion of the cursor's motion direction change per unit time.
4. The input device control switching method according to claim 3, characterized in that, The velocity change parameters include at least one of the following: instantaneous velocity amplitude parameter of the cursor within the preset area, velocity fluctuation parameter, and acceleration change parameter; wherein, the velocity fluctuation parameter includes velocity variance.
5. The input device control switching method according to any one of claims 2-4, characterized in that, The operation behavior characteristics satisfy the preset switching conditions, including: the continuous dwell time is greater than a first threshold, and the motion behavior characteristic value is greater than a second threshold; The motion behavior feature value is used to characterize the stability of the cursor within a preset area.
6. The input device control switching method according to any one of claims 2-4, characterized in that, The operational behavior characteristics that meet the preset switching conditions include: the comprehensive score value is greater than the preset score threshold; The comprehensive score is obtained by weighted summation of the duration of stay and the characteristics of movement behavior.
7. The input device control switching method according to any one of claims 2-4, characterized in that, The operation behavior characteristics satisfy the preset switching conditions, including: the probability value of the interaction intention is greater than the preset probability threshold; The probability value of the interaction intent is generated based on the operation behavior features by a machine learning classification model. The machine learning classification model is trained by historical operation behavior feature data, which includes at least the duration of dwell time, movement behavior features, and corresponding interaction intent labels.
8. The input device control switching method according to claim 1, characterized in that, The method further includes: In response to the cursor entering a preset area under the current first operating system, the finite state machine is switched from the first state to the second state; In response to the operation behavior characteristics satisfying the preset switching conditions, the finite state machine is switched from the second state to the third state; In response to the control release event of the first operating system, the finite state machine is switched from the third state to the fourth state; Wherein, the first state indicates a normal working state in which the cursor is not in the preset area; The second state indicates that the cursor is in the preset area and is in the process of collecting operational behavior features; The third state indicates that a switching operation has been triggered and control release is being performed. The fourth state indicates that the switching operation has been completed and the system is in the anti-shake protection period.
9. The input device control switching method according to claim 8, characterized in that, The method further includes: In response to the cursor leaving the preset area and reaching a preset distance, the finite state machine is transitioned from the fourth state to the first state.
10. The input device control switching method according to claim 1, characterized in that, After switching control of the input device from the first operating system to the second operating system, the method further includes: Set the target flag to a valid state, the valid state being used to indicate that the switching of control of the input device from the first operating system to the second operating system is triggered based on the interaction intent; The method further includes: in response to detecting a window of the first operating system gaining focus and the target flag being in a valid state, switching control of the input device from the second operating system to the first operating system.
11. The input device control switching method according to claim 1, characterized in that, After the operation of switching control of the input device from the first operating system to the second operating system, the method further includes: In response to the absence of an input event from the second operating system within a preset time period, control of the input device is switched from the second operating system to the first operating system.
12. The input device control switching method according to claim 1, characterized in that, The shape of the triggering area can be any one of rectangle, triangle, sector, irregular polygon, or circle.
13. An input device control switching device, applied to a computing device including a first operating system and a second operating system, characterized in that, The device includes: The feature acquisition module, in response to the cursor of the input device entering a preset area at the edge of the screen under the current first operating system, acquires the operation behavior features of the cursor within the preset area, and the operation behavior features are used to characterize the interaction intention of the cursor operator; The intent determination module is used to determine whether the operation behavior characteristics meet the preset switching conditions; The switching execution module, in response to the operation behavior characteristics meeting preset switching conditions, switches the control of the input device from the first operating system to the second operating system.
14. A computing device, characterized in that, The device includes a processor and a memory, wherein the memory stores computer program instructions, and when the processor executes the computer program instructions, it implements the input device control switching method as described in any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that, The storage medium stores computer program instructions, which, when executed by a processor, implement the input device control switching method as described in any one of claims 1 to 12.