Method and device for sharing physical input equipment, equipment and medium
By determining and generating identification information to confirm the target graphics window program by displaying services, the non-native input graphics window program and the native input graphics window program share physical input devices in the virtualized system, solving the problem of poor performance of virtual input devices and improving work efficiency.
Patent Information
- Application Number
- CN202510462538.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-14
- Publication Date
- 2025-07-25
AI Technical Summary
In a virtualized system, when a non-native input graphics window program shares the same physical input device with a native input graphics window program, the prior art cannot efficiently realize direct acquisition of input events, resulting in poor working performance of the virtual input device.
The target graphics window program currently activated is determined through the display service, and identification information is generated to confirm whether it is a native input graphics window program, so as to obtain input events directly from the physical input device, or obtain and distribute it from the display service to a non-native input graphics window program, discarding the input events of the native input graphics window program.
It realizes that the non-native input graphics window program and the native input graphics window program share the same physical input device in the virtualized system, which improves the working performance of the virtual input device, especially in the use scenarios of multiple input devices, which significantly improves efficiency.
Smart Images

Figure CN120371441A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of sharing physical input devices, and particularly relates to a method, device, equipment and medium for sharing physical input devices. Background Art
[0002] Generally, in a desktop operating system, a graphical window program does not directly obtain input events from a physical input device, but from a display service, because the display service has an input event management function. The display service distributes input events to the corresponding graphical windows according to the activation status of each graphical window. For example, when the mouse moves from graphical window A to graphical window B, the target of the display service for distributing input events will change from graphical window program A to graphical window program B. In this way, each graphical window program does not need to handle the distribution logic of input events when multiple graphical window programs share the same physical input device.
[0003] However, in some special scenarios, such as in a virtualization system scenario, in a host computer, in addition to running the above-mentioned graphical window programs (such graphical window programs can be called non-native input graphical window programs), it is also necessary to run a graphical window program that provides virtual input devices for virtual machines (this graphical window program can be called a native input graphical window program). In order to enable the virtual input device to have better working performance, the native input graphical window program needs to directly obtain input events from the physical input device, rather than from the display service.
[0004] Both the non-native input graphical window program and the native input graphical window program are displayed on the same touch screen. According to the principle of full-screen top-level display of one of them, the non-native input graphical window program and the native input graphical window program need to share the same physical input device.
[0005] In view of this, the present application is specifically proposed. Summary of the Invention
[0006] The following gives a brief overview of one or more aspects to provide a basic understanding of these aspects. This overview is not an exhaustive survey of all contemplated aspects, and is neither intended to identify key or decisive elements of all aspects nor to attempt to define the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description to follow.
[0007] This application provides a method, device, equipment and medium for sharing physical input devices, achieving the purpose of sharing the same physical input device between non-native input graphical window programs and native input graphical window programs.
[0008] In a first aspect, the present application provides a method for sharing a physical input device, which is applied to a display service. The display service is used to obtain input events from the physical input device and distribute the input events to corresponding non-native input graphics window programs, including the following steps:
[0009] Determine the currently activated target graphics window program;
[0010] In response to the target graphics window program being a native input graphics window program, generate identification information of the target graphics window program, so that the native input graphics window program can confirm whether the currently activated target graphics window program is itself according to the identification information. When the native input graphics window program confirms that the currently activated target graphics window program is itself according to the identification information, obtain input events from the physical input device and process the input events. The native input graphics window program is a graphics window program that directly obtains input events from the physical input device, and the non-native input graphics window program is a graphics window program that does not directly obtain input events from the physical input device but obtains input events from the display service.
[0011] Furthermore, it further includes:
[0012] Obtain input events from the physical input device;
[0013] In response to the target graphics window program being a non-native input graphics window program, distribute the input events to the target graphics window program;
[0014] In response to the target graphics window program being a native input graphics window program, discard the input events.
[0015] Furthermore, the determination of the currently activated target graphics window program includes:
[0016] Determine the window program with the input focus as the currently activated target graphics window program;
[0017] Alternatively, determine the currently activated target graphics window program according to the activation status flag bits of each graphics window program;
[0018] Alternatively, according to the window program stacking list, determine the graphics window program at the top layer as the currently activated target graphics window program;
[0019] Alternatively, determine the currently activated target graphics window program by calling a preset interface.
[0020] Furthermore, the identification information includes the unlocked or locked state of a specified file lock, or the state of a preset flag bit. The generation of the identification information of the target graphics window program includes:
[0021] Unlock the specified file lock;
[0022] Alternatively, set the preset flag bit.
[0023] In a second aspect, the present application also provides a method for sharing a physical input device, which is applied to a native input graphics window program. The native input graphics window program is a graphics window program that directly obtains input events from a physical input device, and includes:
[0024] Obtain input events from a physical input device;
[0025] Determine whether itself is the target graphics window program according to the identification information of the currently activated target graphics window program;
[0026] In response to determining that itself is the target graphics window program, process the input event;
[0027] In response to determining that itself is not the target graphics window program, discard the input event.
[0028] Further, the identification information includes the unlocked or locked state of the specified file lock, or the state of the preset flag bit; the determining whether itself is the target graphics window program according to the identification information of the currently activated target graphics window program includes:
[0029] In response to the specified file lock being in the unlocked state, determine that itself is the target graphics window program;
[0030] Alternatively, in response to the preset flag bit being in the set state, determine that itself is the target graphics window program.
[0031] Further, the processing of the input event includes:
[0032] Forward the input event to a virtual input device provided for a virtual machine.
[0033] In a third aspect, the present application also provides a system for sharing a physical input device, including:
[0034] A display service, a native input graphics window program, and a non-native input graphics window program; the native input graphics window program is a graphics window program that directly obtains input events from a physical input device, and the non-native input graphics window program is a graphics window program that does not directly obtain input events from a physical input device but obtains input events from the display service;
[0035] The display service is used to obtain input events from a physical input device, and determine the currently activated target graphical window program. In response to the target graphical window program being a native input graphical window program, it generates identification information of the target graphical window program and discards the input event. In response to the target graphical window program being a non-native input graphical window program, it distributes the input event to the target graphical window program;
[0036] The native input graphical window program is used to obtain input events from a physical input device, and determine whether itself is the target graphical window program according to the identification information of the currently activated target graphical window program. In response to determining that itself is the target graphical window program, it processes the input event. In response to determining that itself is not the target graphical window program, it discards the input event.
[0037] In a fourth aspect, the present application further provides an electronic device, which includes:
[0038] One or more processors;
[0039] A storage device for storing one or more programs;
[0040] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for sharing a physical input device as described above.
[0041] In a fifth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the method for sharing a physical input device as described above.
[0042] In the method for sharing a physical input device disclosed in the present application, on the one hand, the display service obtains input events from a physical input device and distributes the input events to the corresponding non-native input graphical window programs. On the other hand, when it is determined that the currently activated target graphical window program is a native input graphical window program, it generates identification information of the target graphical window program, so that the native input graphical window program can confirm whether the currently activated target graphical window program is itself according to the identification information. When the native input graphical window program confirms that the currently activated target graphical window program is itself according to the identification information, it obtains input events from the physical input device and processes the input events. The native input graphical window program is a graphical window program that directly obtains input events from a physical input device, and the non-native input graphical window program is a graphical window program that does not directly obtain input events from a physical input device but obtains input events from the display service. The purpose of sharing the same physical input device by non-native input graphical window programs and native input graphical window programs is achieved. Description of the Drawings
[0043] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0044] Figure 1 Flow schematic of a method for sharing a physical input device provided by an embodiment of the present application Figure 1 ;
[0045] Figure 2 Flow schematic of a method for sharing a physical input device provided by an embodiment of the present application Figure 2 ;
[0046] Figure 3 Structural schematic diagram of a virtualization system provided by an embodiment of the present application;
[0047] Figure 4 Flow schematic of a method for sharing a physical input device provided by an embodiment of the present application Figure 3 ;
[0048] Figure 5 Structural schematic diagram of an electronic device in an embodiment of the present application. Detailed implementation manners
[0049] The following will further elaborate on the present application in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the relevant invention and not to limit the invention. Additionally, it should be noted that for the convenience of description, only the parts related to the invention are shown in the accompanying drawings.
[0050] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The following will detail the present application with reference to the accompanying drawings and embodiments.
[0051] Generally, in a desktop operating system, a graphical window program does not directly obtain input events from a physical input device (from a technical implementation perspective, a graphical window program does not directly obtain input events from the input device node of a physical input device. An input device node is a special file or interface created by the operating system for various physical input devices connected to the system. Each physical input device has a corresponding input device node in the system, which is the underlying channel for the operating system to interact with the physical input device). Instead, the graphical window program obtains input events from the display service because the display service has an input event management function. The display service distributes input events to the corresponding graphical window according to the activation state of each graphical window. For example, when the mouse moves from graphical window A to graphical window B, the target for the display service to distribute the input event will change from graphical window program A to graphical window program B. In this way, each graphical window program does not need to handle the distribution logic of input events when multiple graphical window programs share the same physical input device. Among them, for the convenience of understanding and description, a graphical window program that does not directly obtain input events from a physical input device can be marked as a non-native input graphical window program. Or rather, a non-native input graphical window program indirectly obtains input events from the display service.
[0052] However, in some special scenarios, such as in a virtualization system scenario, in the host machine, in addition to running the above-mentioned non-native graphical window program, it is also necessary to run a graphical window program that provides virtual input devices for virtual machines (this graphical window program can be called a native input graphical window program). In order to enable the virtual input device to have better working performance, the native input graphical window program needs to directly obtain input events from the physical input device (that is, obtain input events from the device node of the physical input device), rather than obtaining input events from the display service.
[0053] Both the non-native input graphical window program and the native input graphical window program are displayed on the same touch screen. According to the principle of displaying one of them at the top of the full screen, the non-native input graphical window program and the native input graphical window program need to share the same physical input device.
[0054] In view of the above problems, this application proposes a method for sharing a physical input device, aiming to achieve the purpose of sharing the same physical input device by a non-native input graphical window program and a native input graphical window program, so as to obtain better working performance in special scenarios.
[0055] Figure 1 FIG. is a schematic flow chart of a method for sharing a physical input device proposed in this application. This method is applied to a display service, and the display service is used to obtain input events from a physical input device and distribute the input events to the corresponding non-native input graphical window program.
[0056] AsFigure 1 As shown, the method for sharing a physical input device includes the following steps:
[0057] S110. Determine the currently active target graphical window program.
[0058] Among them, the currently active target graphical window program can also be understood as the currently user-operated target graphical window, or rather, the currently active target graphical window program is the active window program. When multiple graphical window programs are simultaneously displayed on the desktop, the currently active target graphical window program is usually displayed at the top layer.
[0059] In some embodiments, determining the currently active target graphical window program includes:
[0060] According to the window program stacking list, determine the graphical window program at the top layer as the currently active target graphical window program. In some systems, the window manager maintains a window program stacking list, and the display service can judge which window program is at the top layer based on this list. The window program at the top layer is the currently active target graphical window program.
[0061] In some embodiments, determining the currently active target graphical window program includes:
[0062] Determine the window program with the input focus as the currently active target graphical window program. Generally, the operating system maintains a focus queue or focus stack to record the focus status of each window program. When the user clicks on a certain graphical window or switches to a certain window through keyboard shortcuts, etc., the operating system will assign the focus to this window program, and the display service determines the currently active window program with the input focus by querying the focus status of the operating system.
[0063] In some embodiments, determining the currently active target graphical window program includes:
[0064] Determine the currently active target graphical window program according to the activation status flag bits of each graphical window program. Each graphical window program has a corresponding window structure or object in the system, which contains a flag bit indicating whether the window is in the active state. When the window is activated, the system sets the flag bit of this window to true, and the display service determines whether it is the currently active target graphical window program by checking this flag bit of the window.
[0065] In some embodiments, the currently active target graphical window program can also be determined by calling a preset interface.
[0066] S120. In response to the target graphics window program being a native input graphics window program, generate identification information of the target graphics window program, so that the native input graphics window program can confirm whether the currently activated target graphics window program is itself according to the identification information. When the native input graphics window program confirms that the currently activated target graphics window program is itself according to the identification information, obtain an input event from the physical input device and process the input event.
[0067] The native input graphics window program is a graphics window program that directly obtains input events from a physical input device, and the non-native input graphics window program is a graphics window program that does not directly obtain input events from a physical input device but obtains input events from a display service.
[0068] More specifically, the native input graphics window program is a graphics window program that directly obtains input events from an input device node, and the non-native input graphics window program is a graphics window program that does not directly obtain input events from an input device node. An input device node is a special file or interface created by the operating system for various physical input devices connected to the system. Each physical input device has a corresponding input device node in the system, which is the underlying channel for the operating system to interact with the input device.
[0069] The physical input device includes but is not limited to: a mouse, a keyboard, and / or a touch screen.
[0070] When the display service determines that the target graphics window program is a native input graphics window program, generate identification information of the target graphics window program, so that the native input graphics window program can confirm whether the currently activated target graphics window program is itself according to the identification information. When the native input graphics window program confirms that the currently activated target graphics window program is itself according to the identification information, obtain an input event from the physical input device and process the input event. The purpose of sharing the same physical input device between the non-native input graphics window program and the native input graphics window program is achieved.
[0071] Further, the method further includes: obtaining an input event from a physical input device; in response to the target graphics window program being a non-native input graphics window program, distributing the input event to the target graphics window program; in response to the target graphics window program being a native input graphics window program, discarding the input event.
[0072] In some embodiments, the identification information includes the unlocked or locked state of a specified file lock, or the state of a preset flag bit. Generating the identification information of the target graphics window program includes: unlocking the specified file lock; or, setting the preset flag bit.
[0073] In cooperation with the above embodiments, Figure 2 A method for sharing a physical input device is shown. This method is applied to a native input graphics window program, which is a graphics window program that directly obtains input events from a physical input device, and includes the following steps:
[0074] S210. Obtain an input event from a physical input device.
[0075] Specifically, obtain the input event from the input device node of the physical input device. The input device node is a special file or interface created by the operating system for various physical input devices connected to the system. Each physical input device has a corresponding input device node in the system, which is the underlying channel for the operating system to interact with the input device.
[0076] S220. Determine whether itself is the target graphics window program according to the identification information of the currently activated target graphics window program.
[0077] The identification information includes the unlocked or locked state of a specified file lock, or the state of a preset flag bit; the determining whether itself is the target graphics window program according to the identification information of the currently activated target graphics window program includes:
[0078] In response to the specified file lock being in an unlocked state, determine that itself is the target graphics window program;
[0079] Or, in response to the preset flag bit being in a set state, determine that itself is the target graphics window program.
[0080] S230. In response to determining that itself is the target graphics window program, process the input event.
[0081] In a virtualization system scenario, such as Figure 3Schematic diagram of the structure of a virtualization system. In the host machine, in addition to running non-native graphical window programs, it is also necessary to run native graphical window programs that provide virtual input devices for virtual machines. In other words, the native graphical window program is a window program that provides virtual input devices for virtual machines. In such a scenario, processing the input event includes: forwarding the input event to the virtual input device provided for the virtual machine. By directly obtaining the input event from the physical input device, since the complex distribution management process in the display service is omitted, the virtual input device has better working performance, especially when multiple input devices are used simultaneously in a virtual machine. At the same time, the display service obtains the input event from the physical input device. When the target graphical window program is a non-native graphical window program, the display service distributes the input event to the target graphical window program. When the target graphical window program is a native graphical window program, the display service discards the input event and generates identification information of the target graphical window program, so that the native input graphical window program can confirm whether the currently activated target graphical window program is itself according to the identification information. When the native input graphical window program confirms that the currently activated target graphical window program is itself according to the identification information, it obtains the input event from the physical input device and processes the input event.
[0082] Furthermore, the display service is also responsible for other display-related logics such as sending the display content of each graphical window program (including native input graphical window programs and non-native input graphical window programs) for display.
[0083] S240. In response to determining that itself is not the target graphical window program, discard the input event.
[0084] A method for sharing a physical input device provided in this embodiment can, in a specific scenario, not only meet the extreme performance requirements of a certain program for the input device but also share the same input device with other ordinary graphical window programs.
[0085] In some embodiments, refer to Figure 4 Schematic diagram of the process of a method for sharing a physical input device as shown, including the following steps:
[0086] S1. Start the display service.
[0087] S2. The display service determines whether the current top-level display program is a native input graphical window program. If so, execute S3; otherwise, execute S4.
[0088] Specifically, the content displayed by the graphical window program will be sent for display through the display service. The display service can know which window program is currently on top for display. If the window program currently on top for display is the native input graphical window program, it jumps to step S3; otherwise, it jumps to step S4.
[0089] S3. Unlock the specified file lock.
[0090] Specifically, as long as the window program currently on top for display is the native input graphical window program, the specified file lock is in an unlocked state.
[0091] S4. Lock the specified file lock.
[0092] S5. The native input graphical window program directly reads the input device node.
[0093] S6. The native input graphical window program determines whether the specified file lock is locked. If it is locked, it does not process the current input event; otherwise, it processes the current input event.
[0094] By judging whether the specified file lock is in a locked state, the native input graphical window program can efficiently judge whether the window program currently on top for display is itself. If the specified file lock is in a locked state, it means that the window program currently on top for display is not itself, and the current input event is not processed. If the specified file lock is in an unlocked state, it means that the window program currently on top for display is itself, and the current input event is processed.
[0095] S7. Do not process the current input event.
[0096] S8. Process the current input event.
[0097] Based on the above embodiments, this embodiment provides a system for sharing a physical input device, including: a display service, a native input graphical window program, and a non-native input graphical window program; the native input graphical window program is a graphical window program that directly obtains input events from a physical input device, and the non-native input graphical window program is a graphical window program that does not directly obtain input events from a physical input device but obtains input events from the display service;
[0098] The display service is used to obtain input events from a physical input device, and determine the currently activated target graphical window program. In response to the target graphical window program being the native input graphical window program, generate the identification information of the target graphical window program and discard the input event. In response to the target graphical window program being a non-native input graphical window program, distribute the input event to the target graphical window program;
[0099] The native input graphics window program is used to obtain input events from a physical input device, and determine whether itself is the target graphics window program according to the identification information of the currently activated target graphics window program. In response to determining that itself is the target graphics window program, it processes the input events. In response to determining that itself is not the target graphics window program, it discards the input events.
[0100] Figure 5 This is a schematic structural diagram of an electronic device in an embodiment of the present disclosure. Specifically, refer to Figure 5 which shows a schematic structural diagram of an electronic device 500 suitable for implementing the present disclosure. Figure 5 The electronic device shown is only an example and should not impose any restrictions on the functions and usage scope of the embodiments of the present disclosure.
[0101] As Figure 5 shown, the electronic device 500 may include a processing device (such as a central processing unit, a graphics processing unit, etc.), which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage device 508 into a random access memory (RAM) to implement the method of the embodiments as described in the present disclosure. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. The I / O interface 505 is also connected to the bus 504. The input device 506, the output device 507, the storage device 508, and the communication device 509 are all connected to the I / O interface 505.
[0102] Specifically, according to the embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium. The computer program includes program codes for executing the method shown in the flowchart, so as to implement the method of sharing a physical input device as described above. In such an embodiment, the computer program can be downloaded and installed from a network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiments of the present disclosure are executed.
[0103] It should be noted that the computer-readable medium described above can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0104] The above computer-readable medium can be included in the above electronic device; or it can exist separately without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device is caused to execute the method steps in this application.
[0105] Optionally, when the one or more programs are executed by the electronic device, the electronic device can also execute the other steps described in the above embodiments.
[0106] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0107] The above description is only a preferred embodiment of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, the technical solutions formed by mutually replacing the above features with the (but not limited to) technical features having similar functions disclosed in the present disclosure.
[0108] Specific examples are used herein to elaborate on the principles and implementation manners of the present application. The description of the above embodiments is only for helping to understand the method and its core idea of the present application. The above are only the preferred implementation manners of the present application. It should be noted that due to the limited nature of written expression and objectively existing infinite specific structures, for those of ordinary skill in the art, without departing from the principle of the present application, several improvements, refinements, or changes can be made, or the above technical features can be combined in an appropriate manner; these improvements, refinements, changes, or combinations, or directly applying the inventive concept and technical solutions to other occasions without improvement, should all be regarded as the protection scope of the present application.
Claims
1. A method for sharing a physical input device, applied to a display service, where the display service is used to obtain input events from the physical input device and distribute the input events to corresponding non-native input graphics window programs, characterized in that, including: determine the currently activated target graphical window program; in response to the target graphical window program being a native input graphical window program, generate identification information of the target graphical window program, so that the native input graphical window program can confirm whether the currently activated target graphical window program is itself according to the identification information. When the native input graphical window program confirms that the currently activated target graphical window program is itself according to the identification information, obtain an input event from a physical input device and process the input event; wherein, the native input graphical window program is a graphical window program that directly obtains input events from a physical input device; the non-native input graphical window program is a graphical window program that does not directly obtain input events from a physical input device, but obtains input events from a display service.
2. The method for sharing a physical input device according to claim 1, wherein also including: obtain an input event from a physical input device; in response to the target graphical window program being a non-native input graphical window program, distribute the input event to the target graphical window program; in response to the target graphical window program being a native input graphical window program, discard the input event.
3. The method for sharing a physical input device according to claim 1, wherein The determination of the currently activated target graphical window program includes: determine the window program with the input focus as the currently activated target graphical window program; alternatively, determine the currently activated target graphical window program according to the activation status flag bits of each graphical window program; alternatively, according to the window program stack list, determine the graphical window program at the top layer as the currently activated target graphical window program; alternatively, determine the currently activated target graphical window program by calling a preset interface.
4. The method for sharing a physical input device according to claim 1, wherein The identification information includes the unlocked or locked state of a specified file lock, or the state of a preset flag bit. The generation of the identification information of the target graphical window program includes: unlock the specified file lock; alternatively, set the preset flag bit.
5. A method for sharing a physical input device, which is applied to a native input graphics window program. The native input graphics window program is a graphics window program that directly obtains input events from a physical input device, and is characterized in that, including: obtain an input event from a physical input device; determine whether itself is the target graphical window program according to the identification information of the currently activated target graphical window program; in response to determining that itself is the target graphical window program, process the input event; in response to determining that itself is not the target graphical window program, discard the input event.
6. The method for sharing a physical input device according to claim 1, wherein The identification information includes the unlocked or locked state of a specified file lock, or the state of a preset flag bit; The determination of whether itself is the target graphical window program according to the identification information of the currently activated target graphical window program includes: in response to the specified file lock being in the unlocked state, determine that itself is the target graphical window program; alternatively, in response to the preset flag bit being in the set state, determine that itself is the target graphical window program.
7. The method for sharing a physical input device according to claim 1, wherein The processing of the input event includes: forward the input event to a virtual input device provided for the virtual machine.
8. A system for sharing a physical input device, characterized in that, including: A display service, a native input graphics window program, and a non-native input graphics window program; the native input graphics window program is a graphics window program that directly obtains input events from a physical input device, and the non-native input graphics window program is a graphics window program that does not directly obtain input events from a physical input device but obtains input events from the display service; The display service is used to obtain input events from a physical input device, and determine the currently activated target graphics window program. In response to the target graphics window program being the native input graphics window program, generate identification information of the target graphics window program and discard the input event. In response to the target graphics window program being the non-native input graphics window program, distribute the input event to the target graphics window program; The native input graphics window program is used to obtain input events from a physical input device, and determine whether itself is the target graphics window program according to the identification information of the currently activated target graphics window program. In response to determining that itself is the target graphics window program, process the input event. In response to determining that itself is not the target graphics window program, discard the input event.
9. An electronic device, characterized in that, The electronic device includes: One or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for sharing a physical input device as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method for sharing a physical input device as described in any one of claims 1-7.