Response method and device of input operation, electronic equipment and storage medium

CN117899450BActive Publication Date: 2026-09-29NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311753939.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-19
Publication Date
2026-09-29
Estimated Expiration
2043-12-19

AI Technical Summary

Technical Problem

[0003]现有的输入操作响应技术一般是直接在输入设备返回的按键信息基础上开发对应的业务功能,这种方式开发费时费力,通用性差,难以应用到不同的应用程序中

Benefits of technology

[0010]上述输入操作的响应方法、装置、电子设备和存储介质,响应于输入设备至少一个输入键的操作,确定预先与所述至少一个输入键绑定的目标输入事件;判断图形用户界面中显示的至少一个焦点图层是否注册所述目标输入事件;其中,所述焦点图层用于指示可触发输入事件的图层;若任一目标焦点图层注册所述目标输入事件,则触发所述目标输入事件,执行所述目标输入事件对应的事件逻辑。该方式中,不同输入键的不同操作对应不同的输入事件,而不同的图层可以注册不同的输入事件,当可触发输入事件的图层注册有所操作输入键对应的目标输入事件时,即可执行目标输入事件对应的事件逻辑,使得输入操作可以简便地在不同图层触发,通用于不同应用程序的开发。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117899450B_ABST
    Figure CN117899450B_ABST
Patent Text Reader

Abstract

The present disclosure provides a response method, device, electronic equipment and storage medium of input operation; wherein the method comprises: in response to the operation of at least one input key of an input device, determining a target input event previously bound to the at least one input key; judging whether at least one focus layer displayed in a graphical user interface registers the target input event; the focus layer is used to indicate a layer that can trigger an input event; if any target focus layer registers the target input event, triggering the target input event and executing event logic corresponding to the target input event. In this way, different operations of different input keys correspond to different input events, and different layers can register different input events. When the layer that can trigger the input event registers the target input event corresponding to the operated input key, the event logic corresponding to the target input event can be executed, so that the input operation can be triggered in different layers simply, and is applicable to the development of different application programs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and storage medium for responding to input operations. Background Technology

[0002] The core of input technology lies in the processing of input events. Input events refer to various operations performed on input devices, such as pressing a key, releasing a key, moving the mouse, or shaking a gamepad joystick. Input operation response technology is particularly important in games, where players need to perform various actions, such as moving their character, attacking enemies, and using items. These actions typically require input through input devices (such as keyboards, mice, and gamepads). After parsing and processing, the input events are translated into corresponding functions within the game. For example, when a player presses the W key, it is translated into a forward action, causing the character to move forward.

[0003] Existing input operation response technologies generally develop corresponding business functions based on the key information returned by the input device. This approach is time-consuming and labor-intensive, has poor versatility, and is difficult to apply to different applications. Summary of the Invention

[0004] In view of this, the purpose of this disclosure is to provide a method, apparatus, electronic device and storage medium for responding to input operations, so as to improve the versatility of input operation responses.

[0005] In a first aspect, embodiments of this disclosure provide a method for responding to an input operation, the method comprising: in response to an operation of at least one input key of an input device, determining a target input event pre-bound to the at least one input key; determining whether at least one focus layer displayed in a graphical user interface has registered the target input event; wherein the focus layer is used to indicate a layer that can trigger an input event; if any target focus layer has registered the target input event, then the target input event is triggered, and event logic corresponding to the target input event is executed.

[0006] Secondly, embodiments of this disclosure provide an input operation response device, the device comprising: a determining module, configured to determine a target input event pre-bound to the at least one input key in response to an operation of an input device; a judging module, configured to judge whether at least one focus layer displayed in a graphical user interface has registered the target input event; wherein the focus layer includes an interface element in a focus state; and an execution module, configured to trigger the target input event and execute the event logic corresponding to the target input event if any target focus layer has registered the target input event.

[0007] Thirdly, embodiments of this disclosure provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described response method for input operations.

[0008] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the above-described response method for the input operation.

[0009] The embodiments disclosed herein bring the following beneficial effects:

[0010] The aforementioned input operation response method, apparatus, electronic device, and storage medium, in response to an operation of at least one input key on an input device, determine a target input event pre-bound to the at least one input key; determine whether at least one focus layer displayed in a graphical user interface has registered the target input event; wherein the focus layer is used to indicate the layer that can trigger the input event; if any target focus layer registers the target input event, the target input event is triggered, and the event logic corresponding to the target input event is executed. In this approach, different operations of different input keys correspond to different input events, and different layers can register different input events. When a layer that can trigger an input event registers a target input event corresponding to an operated input key, the event logic corresponding to the target input event can be executed, making input operations easily triggered on different layers and applicable to the development of different applications.

[0011] Other features and advantages of this disclosure will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the disclosure. The objects and other advantages of this disclosure are realized and obtained through the structures particularly pointed out in the description, claims and drawings.

[0012] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0013] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0014] Figure 1This is a flowchart of one embodiment of the response method for input operations in this disclosure;

[0015] Figure 2 This is a flowchart of another embodiment of the response method for input operations in this disclosure;

[0016] Figure 3 A schematic diagram of an input operation response device provided in an embodiment of this disclosure;

[0017] Figure 4 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0019] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in this disclosure, claims, and accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” or “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0020] For ease of understanding, the specific process of the embodiments of this disclosure is described below. Please refer to [link / reference]. Figure 1 One embodiment of the response method for input operations in this disclosure includes:

[0021] Step S10: In response to the operation of at least one input key on the input device, determine the target input event that is pre-bound to at least one input key;

[0022] Input devices can be any apparatus or tool used to input external information into a computer or other electronic device, including but not limited to keyboards, mice, touchscreens, (game) controllers, touch gloves, motion trackers, etc. Input keys can be any physical key and / or any virtual key on the input device, such as keyboard buttons, mouse scroll wheels, game controller joysticks, mobile phone screen controls, etc., without specific limitations here. Players or users can simultaneously operate at least one input key on the input device. For example, in a virtual game, a player can press the W key on the keyboard to control the character to move forward, or simultaneously press the W key and the Shift key to control the character to accelerate forward. The operation of a single input key or a combination of multiple input keys can correspond to the execution of different event logics, depending on the application design, without limitations here.

[0023] In this embodiment, different input keys can be pre-mapped to different input events. When a single or combination of input keys bound to an input event is triggered / operated, the corresponding event logic can be executed by triggering the bound input event. For example, pressing the W key, releasing the P key, holding down the Shift key, pressing the W key and Shift key simultaneously, moving the mouse, moving the joystick on the controller, and pressing the "OK" button on the controller can all be input events, and no specific limitation is made here. It is understood that different input devices will convert the operation of the input keys into different operation information. By parsing the operation information, the input key being operated and the type of operation (e.g., pressed, released, held down, etc.) can be determined. Therefore, in one embodiment, by parsing the operation of each input key, the operation information corresponding to each input key is obtained. Based on the operation information corresponding to all input keys, the target input event pre-bound to at least one input key is determined.

[0024] It should be noted that if more than one input key is used, it is considered a combination key operation. For combination key operations, the combination keys must be pre-bound to input events; that is, all the operated input keys must be bound to the same input event to determine the target input event. For example, suppose an input event is "pressing the W key and the Shift key simultaneously." Then, only if the input keys pressed simultaneously are the W key and the Shift key can this input event be determined as the target input event. If only the W key is pressed, or if the input keys pressed simultaneously are the W key, the Shift key, and the E key, this input event cannot be determined as the target input event. It can be any other input event, or it may not be an input event at all; there are no specific restrictions here.

[0025] Step S20: Determine whether at least one focus layer displayed in the graphical user interface has registered a target input event; wherein, the focus layer is used to indicate the layer that can trigger the input event;

[0026] A Graphical User Interface (GUI) is a computer user interface displayed graphically, serving as a display format for human-computer communication. In this embodiment, the GUI displays the screen of an application, such as a game scene in a virtual game. The application screen displayed in the GUI can consist of at least one layer (also called a sub-interface). Different layers can contain different interface elements. For example, in a virtual game, controls displayed at fixed positions on the screen can be classified as interface elements of the same layer; controls / animations appearing at fixed positions in the game scene can be classified as interface elements of the same layer; the interface waiting for the game to load can also be a layer, and so on. Specific details are not limited here.

[0027] A focused layer refers to the layer that is in focus in a graphical user interface. Whether a layer is in focus can be determined in one implementation through the operating system or application interface. It is understood that there can be more than one focused layer (i.e., a focused layer). A focused layer can also be called an active layer. When a layer is active, or when an interface element within a layer is active, that layer is considered active. Different layers can pre-register / bind different input events. When a layer is in focus / active state, and the focused layer has pre-registered / bound a target input event, the target input event is triggered, and the event logic corresponding to the target input event is executed. For example, if layer A pre-registers input event 1, and layer B pre-registers input event 2, and the input key operation in step S10 corresponds to input event 1 (i.e., input event 1 is the target input event), then if layer A is in focus / active state, input event 1 will be triggered, and the event logic corresponding to input event 1 will be executed. However, if layer A is not in focus / inactive state, input event 1 will not be triggered, and the event logic corresponding to input event 1 will not be executed. This implementation method, by dividing the interface into layers and determining the focus state of the layers, can more quickly determine whether an input event has been triggered without having to traverse all layers or all interface elements. This improves the efficiency of input operation response and also enhances applicability.

[0028] It is understandable that a focus layer typically refers to the layer at the highest layer level. To more flexibly control layers and input events, and to define and set the relationship between layer levels and input events more flexibly, in one implementation, different layer types can be predefined to indicate whether the layer can trigger input events, the layer level at which the layer can trigger input events, and / or the mutual shielding relationship of input events between layer types. For example, a first layer type might indicate a layer that can trigger input events when at the highest layer level, a second layer type might indicate a layer that can trigger input events at any layer level, a third layer type might indicate a layer that cannot trigger input events at any layer level, and so on. Specific details are not limited here. Based on this, when performing this step, it can be determined whether there is at least one focus layer that can trigger input events among all displayed layers based on the layer types and / or layer levels of all displayed layers in the graphical user interface. If so, it is then determined whether each focus layer has registered a target input event, thereby improving the response efficiency of input events.

[0029] Step S30: If any target focus layer registers a target input event, the target input event is triggered, and the event logic corresponding to the target input event is executed.

[0030] In this embodiment, if a layer is in a focused / active state, and the focused layer has pre-registered / bound a target input event, then the target input event registered / bound by the target focused layer is triggered, and the event logic corresponding to the target input event of the target focused layer is executed. For example, in a virtual game, a layer for grabbing red envelopes is in a focused state, i.e., a focused layer. This focused layer has pre-registered an input event 1 for "pressing the U key and the space key simultaneously." If the U key and the space key of the input device are pressed simultaneously, then input event 1 is determined as the target input event, and input event 1 is triggered. If the event logic corresponding to input event 1 in this focused layer is "grabbing red envelopes," then after triggering input event 1, the event logic for "grabbing red envelopes" is executed. It should be noted that different layers can pre-register the same input event, and the same input event can correspond to different event logics in different layers. For example, the above-mentioned input event 1 can correspond to event logic other than "grabbing red envelopes" in other layers. Specific details are not limited here.

[0031] The input operation response method provided in the above embodiments allows different input events to be corresponding to different operations of different input keys, and different layers can register different input events. When a layer that can trigger an input event registers a target input event corresponding to an operation input key, the event logic corresponding to the target input event can be executed, so that input operations can be easily triggered on different layers and is applicable to the development of different applications.

[0032] Please see Figure 2 Another embodiment of the response method for input operations in this disclosure includes:

[0033] Step S201: In response to the operation of at least one input key on the input device, an event identifier corresponding to the type of at least one input key and the operation is obtained according to a preset input key mapping relationship; the input key mapping relationship reflects the mapping relationship between the type of at least one specified input key and the specified operation and the event identifier;

[0034] In this embodiment, the type of operation can be divided according to the different actions performed on the input keys. For example, the type of operation can be divided into pressing, long pressing, lifting, sliding, scrolling, and shaking (handheld joystick), etc. Sliding, scrolling, and shaking can be further subdivided into operations with direction and / or amplitude, etc., without specific limitations here. Furthermore, the type of operation can be further subdivided based on the number of input keys. For example, pressing can be further subdivided into single-key pressing and combination key (two or more input keys) pressing; long pressing can be further subdivided into single-key long pressing and combination key long pressing, without specific limitations here. As an example, and not a limitation, the type of operation can be divided into the various types of operations shown in Table 1 below:

[0035] Table 1

[0036] Press quickly (triggers immediately upon pressing) Press (triggered when released) Press and hold Press and release Press and release Press the combination key Press and hold the combination key Release the combination key Scroll wheel (unique to keyboard and mouse) Joystick (unique to gamepads)

[0037] In this embodiment, a pre-defined mapping relationship is established between different (single / combined) input keys and specified operation types, and different event identifiers. This results in a preset input key mapping relationship. From this mapping relationship, the event identifiers corresponding to all input keys and operation types can be retrieved, allowing for quick determination of the target input event to be triggered by the input operation. As an example, and not a limitation, the mapping relationship between the three operation types of the F key and the event identifiers can be defined separately. For example, pressing the F key corresponds to event identifier 101, holding down the F key corresponds to event identifier 102, and releasing the F key corresponds to event identifier 103. Combination operations of the F key with other keys can also be defined; for example, pressing the F key and the space bar simultaneously could correspond to event identifier 104. Specific details are not limited here. These mapping relationships can be recorded in a table in the preset input key mapping relationship, as shown in Table 2 below.

[0038] Table 2

[0039] 101 F Press 102 F Long press 103 F Lift 104 F, Space Press

[0040] This implementation establishes a mapping relationship between different input keys, different operation types and event identifiers, which simplifies the representation of complex input keys and operation types. When a corresponding input event needs to be triggered, it can be done simply through the event identifier or the input event bound to the event identifier. This can be reused in different applications, enhancing versatility.

[0041] In one embodiment, step S201 includes: in response to an operation of at least one input key on an input device, obtaining a key code corresponding to each input key or a key identifier corresponding to the function type of each input key, based on the type of the input device, to obtain at least one key identifier; and obtaining an event identifier corresponding to the at least one key identifier and the type of operation, based on a preset input key mapping relationship. It is understood that due to the wide variety of input devices, different types of input devices have different methods for parsing input keys and operation types, resulting in diverse operation information parsed from input keys on different input devices. For example, different game controllers define different input keys; the "OK" key on one game controller may be parsed as a "Select" key or an "A" key on another game controller. Therefore, this embodiment first converts each input key into a key identifier based on the type of input device, and then obtains the corresponding event identifier from the input key mapping relationship based on the key identifier and the type of operation.

[0042] When converting each input key into a key identifier, for the type of input device with a unified key encoding standard, the corresponding key identifier can be obtained through the key code of each input key. For example, the input key operations of keyboards and mice can be converted into unified and standard key codes according to the American Standard Code for Information Interchange (ASCII). Therefore, for this type of input device, a mapping relationship between key codes and key identifiers can be established in advance, or the key code can be directly used as the key identifier to identify the input key operated. For example, the key identifier corresponding to the F key on the keyboard can be the ASCII code "70", or it can be a custom "VK_F", etc., which is not limited here.

[0043] For input devices lacking a unified key coding standard, the corresponding key identifier can be obtained based on the function type of each input key. For example, game controllers, touch gloves, and motion trackers currently do not parse input keys according to a unified key coding standard. The operation information parsed by these input devices from different brands may vary significantly. For instance, the "OK" key on one game controller may be parsed as the "Select" key or the "A" key on another game controller. Therefore, for input devices without a unified key coding standard, a mapping relationship between the function type of the input key and the key identifier can be pre-established to identify the operated input key. For example, the "OK," "Select," and "A" keys on a game controller can all be defined as "OK type," and the key identifier corresponding to "OK type" could be "GamePad_Button_confirm," though the specific definition is not limited here.

[0044] In this embodiment, the mapping relationship between different key identifiers and different operation types and event identifiers can be recorded in a preset input key mapping relationship in the form of a table to accurately and quickly identify input keys, as shown in Table 3:

[0045] Table 3

[0046] 101 VK_F Press 102 VK_F Long press 103 VK_F Lift 201 GamePad_Button_confirm Press

[0047] Specifically, the above-mentioned response to an operation of at least one input key on an input device, based on the type of the input device, involves obtaining the key code of each input key or the key identifier corresponding to the function type of each input key to obtain at least one key identifier. This includes: responding to an operation of at least one input key on the input device, obtaining operation information for each input key; if the type of the input device is a first preset type, determining the function type of each input key based on the operation information; obtaining the key identifier corresponding to the function type of each input key based on a preset function identifier mapping relationship to obtain at least one key identifier; if the type of the input device is a second preset type, determining the key code of each input key based on the operation information; and obtaining the key identifier corresponding to the key code of each input key based on a preset code identifier mapping relationship to obtain at least one key identifier. The first preset type can be a type of input device with a unified key code standard, such as a keyboard or mouse; the second preset type can be a type of input device without a unified key code standard, such as a (game) controller, touch gloves, motion trackers, or touchscreens.

[0048] In one embodiment, the above-mentioned method of obtaining an event identifier corresponding to at least one key identifier and the type of operation based on a preset input key mapping relationship includes: determining whether the preset input key mapping relationship contains at least one key identifier; if the preset input key mapping relationship contains at least one key identifier, calculating the duration of the operation and determining whether the type of operation is a continuous operation based on the duration; if the type of operation is a continuous operation, obtaining an event identifier corresponding to at least one key identifier and the type of continuous operation; if the type of operation is a non-continuous operation, obtaining an event identifier corresponding to at least one key identifier and the type of operation.

[0049] In this embodiment, it is first determined whether the preset input key mapping relationship contains a mapping relationship common to all key identifiers. If it does not contain such a mapping relationship, it means that at least one input key of the operation is not pre-bound to an input event, and all processes end. If it does contain such a mapping relationship, it means that at least one input key of the operation is pre-bound to an input event, and subsequent processes can proceed to obtain the event identifier. In this embodiment, the type of continuous operation in the operation type can be determined by the duration of the operation. The type of continuous operation can be long press, single key long press, combination key long press, etc. After calculating the duration of the operation, it can be determined whether the duration is greater than the preset duration. If it is greater, the operation type is determined to be a continuous operation type; otherwise, the operation type is determined to be a non-continuous operation type. If the operation type is a continuous operation type, the event identifier common to all key identifiers and the continuous operation type is obtained from the preset input key mapping relationship. If the operation type is a non-continuous operation type, the event identifier common to all key identifiers and the operation type is obtained from the preset input key mapping relationship for the specific operation type.

[0050] Step S202: Determine the input event that has been pre-bound to the event identifier as the target input event;

[0051] In this embodiment, based on the event identifier, the pre-bound input event can be determined as the target input event. The mapping relationship between the event identifier and the input event can also be recorded in a preset input key mapping relationship table, such as Table 2. Table 2 can also record input events, as shown in Table 4.

[0052] Table 4

[0053] 101 F Press press_F 102 F Long press long_press_F 103 F Lift release_F 104 F, Space Press press_F&space

[0054] Step S203: Determine whether at least one focus layer displayed in the graphical user interface has registered a target input event; wherein, the focus layer is used to indicate the layer that can trigger the input event;

[0055] In one implementation, step S202 includes: determining at least one focus layer among all display layers based on the layer type and / or layer level of all display layers in the graphical user interface; determining whether any interface element in each focus layer is bound to an event identifier; if an interface element in a focus layer is bound to an event identifier, then the interface element bound to the event identifier is taken as the target interface element, the focus layer containing the target interface element is taken as the target focus layer, and the target focus layer is determined to register a target input event. It is understood that at least one layer displaying the target application in the graphical user interface is called a display layer. Each display layer corresponds to a layer type and a layer level. Based on the layer type and layer level corresponding to each layer, at least one focus layer among all display layers can be determined. Since the higher the layer level, the higher the probability that the layer is the focus layer, the layer type of all display layers can be traversed starting from the highest layer level to quickly determine the focus layer. It should be noted that layer types can be defined according to specific needs. For example, layer types can be simply divided into types that can trigger input events and types that cannot, based on whether input events can be triggered. Alternatively, they can be divided into types that can trigger input events when at the highest layer, types that can trigger input events at any layer, and types that cannot trigger input events at any layer. Furthermore, layer types can be further divided into the layer types shown in Table 5 based on the mutual shielding relationship between input events between layer types. No specific restrictions are imposed here.

[0056] Table 5

[0057]

[0058] In this embodiment, after determining the focus layer, if any interface element in any target focus layer has a pre-bound event identifier, then the target input event corresponding to the registered event identifier of the target focus layer can be determined.

[0059] Furthermore, determining at least one focus layer among all displayed layers based on the layer type and / or layer level of all displayed layers in the graphical user interface includes: determining whether the display layer with the highest layer level among all displayed layers is an exclusive layer type based on the layer type and / or layer level of all displayed layers in the graphical user interface; wherein, an exclusive layer type is a layer type that can trigger input events and blocks input events of other layers; if the display layer with the highest layer level is an exclusive layer type, then the display layer with the highest layer level is determined as the focus layer, thus obtaining at least one focus layer among all displayed layers; if the display layer with the highest layer level is not an exclusive layer type, then based on the layer type, the layer type of each displayed layer is traversed sequentially, and layers that can trigger input events are extracted from all displayed layers, thus obtaining at least one focus layer among all displayed layers.

[0060] In this implementation, a layer type with the highest priority—the exclusive layer type—can be pre-defined. When the exclusive layer type is at the highest layer level, input events from other layers are blocked. Therefore, the system first determines whether the display layer at the highest layer level among all displayed layers is an exclusive layer type. If it is, there is no need to determine the layer types of other display layers; the display layer at the highest layer level can be directly identified as the focus layer. If not, it is necessary to iterate through the layer types of each display layer to determine at least one focus layer that can trigger input events. As shown in Table 5 above, the "Focus_Only" layer type is an exclusive layer type, but the specific type is not limited here.

[0061] Step S204: If any target focus layer registers a target input event, the target input event is triggered, and the event logic corresponding to the target input event is executed.

[0062] In one implementation, step S204 includes: if a target interface element in the target focus layer is bound to an event identifier, then the event logic function pre-bound to the event identifier is triggered to execute the event logic corresponding to the target input event. In this implementation, if any target interface element in any target focus layer is bound to an event identifier, it indicates that the target focus layer has registered a target input event. Therefore, the event logic function bound to the event identifier in the target focus layer is triggered, thus executing the event logic corresponding to the target input event. The event logic function is a callback function; when the target input event is triggered, the registered callback function is automatically called to execute the event logic corresponding to the target input event. The callback function mechanism effectively decouples the logic for handling events from the logic triggered by the event, improving code flexibility and maintainability.

[0063] The input operation response method provided in the above embodiments allows different input keys to correspond to different event identifiers, which are then bound to different input events. Different layers can register different input events. When a layer that can trigger an input event registers a target input event corresponding to an input key, the event logic corresponding to the target input event can be executed. This makes it easy to trigger input operations on different layers and is applicable to the development of different applications.

[0064] For the corresponding method embodiments described above, see [link to relevant documentation]. Figure 3 The diagram illustrates a response device for an input operation. The device includes: a determining module 32, configured to determine a target input event pre-bound to the at least one input key in response to an operation of the input device; a judging module 34, configured to judge whether at least one focus layer displayed in a graphical user interface has registered the target input event; wherein the focus layer includes interface elements in a focus state; and an execution module 36, configured to trigger the target input event and execute the event logic corresponding to the target input event if any target focus layer has registered the target input event.

[0065] The above-mentioned input operation response device allows different input events to be corresponding to different operations of different input keys, and different layers can register different input events. When a layer that can trigger an input event registers a target input event corresponding to an operation input key, the event logic corresponding to the target input event can be executed, making it easy to trigger input operations on different layers and applicable to the development of different applications.

[0066] Optionally, the determining module 32 includes: a response submodule, configured to, in response to an operation of at least one input key of the input device, obtain an event identifier corresponding to the type of the at least one input key and the operation according to a preset input key mapping relationship; the input key mapping relationship reflects the mapping relationship between the type of at least one specified input key and the specified operation and the event identifier; and a determining submodule, configured to determine an input event pre-bound to the event identifier as a target input event.

[0067] Optionally, the above response submodule includes: a response unit, configured to respond to an operation of at least one input key of an input device, and obtain, according to the type of the input device, a key code corresponding to each input key or a key identifier corresponding to the function type of each input key, to obtain at least one key identifier; and an acquisition unit, configured to obtain an event identifier corresponding to the at least one key identifier and the type of the operation according to a preset input key mapping relationship.

[0068] Optionally, the above-mentioned response unit is specifically used for: responding to the operation of at least one input key of the input device, obtaining operation information of each input key; if the type of the input device is a first preset type, determining the function type of each input key according to the operation information; obtaining the key identifier corresponding to the function type of each input key according to a preset function identifier mapping relationship, thereby obtaining at least one key identifier; if the type of the input device is a second preset type, determining the key code of each input key according to the operation information; obtaining the key identifier corresponding to the key code of each input key according to a preset code identifier mapping relationship, thereby obtaining at least one key identifier.

[0069] Optionally, the acquisition unit is specifically used to: determine whether the preset input key mapping relationship contains at least one key identifier; if the preset input key mapping relationship contains at least one key identifier, calculate the duration of the operation, and determine whether the type of the operation is a continuous operation based on the duration; if the type of the operation is a continuous operation, acquire an event identifier corresponding to the at least one key identifier and the type of the continuous operation; if the type of the operation is a non-continuous operation, acquire an event identifier corresponding to the at least one key identifier and the type of the operation.

[0070] Optionally, the aforementioned determination module 34 includes: a determination unit, configured to determine at least one focus layer among all display layers based on the layer type and / or layer level of all display layers in the graphical user interface; a determination unit, configured to determine whether any interface element in each focus layer is bound to the event identifier; and a binding unit, configured to, if an interface element in a focus layer is bound to the event identifier, take the interface element bound to the event identifier as the target interface element, take the focus layer containing the target interface element as the target focus layer, and determine that the target focus layer registers the target input event.

[0071] Optionally, the aforementioned determining unit is specifically used to: determine whether the display layer with the highest layer level among all display layers is an exclusive layer type based on the layer type and / or layer level of all display layers in the graphical user interface; wherein, the exclusive layer type is a layer type that can trigger input events and blocks input events of other layers; if the display layer with the highest layer level is an exclusive layer type, then the display layer with the highest layer level is determined as the focus layer, thus obtaining at least one focus layer among all display layers; if the display layer with the highest layer level is not an exclusive layer type, then based on the layer type, the layer type of each display layer is traversed sequentially, and layers that can trigger input events are extracted from all display layers, thus obtaining at least one focus layer among all display layers.

[0072] Optionally, the execution module 36 is specifically used to: if the target interface element in the target focus layer is bound to the event identifier, trigger the event logic function pre-bound to the event identifier and execute the event logic corresponding to the target input event.

[0073] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described response method for input operations. This electronic device can be a server or a terminal device.

[0074] See Figure 4 As shown, the electronic device includes a processor 400 and a memory 401. The memory 401 stores machine-executable instructions that can be executed by the processor 400. The processor 400 executes the machine-executable instructions to implement the above-described response method for the input operation.

[0075] Furthermore, Figure 4 The electronic device shown also includes a bus 402 and a communication interface 403. The processor 400, the communication interface 403 and the memory 401 are connected via the bus 402.

[0076] The memory 401 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 403 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 402 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0077] The processor 400 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 400 or by instructions in software form. The processor 400 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this disclosure. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this disclosure can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 401. The processor 400 reads information from memory 401 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments, for example:

[0078] In response to an operation of at least one input key on an input device, a target input event pre-bound to at least one input key is determined; it is determined whether at least one focus layer displayed in the graphical user interface has registered the target input event; wherein, the focus layer is used to indicate the layer that can trigger the input event; if any target focus layer has registered the target input event, the target input event is triggered, and the event logic corresponding to the target input event is executed.

[0079] In this approach, different operations of different input keys correspond to different input events, and different layers can register different input events. When a layer that can trigger an input event registers a target input event corresponding to an operation input key, the event logic corresponding to the target input event can be executed, making it easy to trigger input operations on different layers and applicable to the development of different applications.

[0080] Optionally, in response to an operation of at least one input key on the input device, determining a target input event pre-bound to at least one input key includes: in response to an operation of at least one input key on the input device, obtaining an event identifier corresponding to the type of at least one input key and operation according to a preset input key mapping relationship; the input key mapping relationship reflects the mapping relationship between the type of at least one specified input key and specified operation and the event identifier; and determining the input event pre-bound to the event identifier as the target input event.

[0081] Optionally, in response to an operation of at least one input key on the input device, an event identifier corresponding to the at least one input key and the type of operation is obtained according to a preset input key mapping relationship, including: in response to an operation of at least one input key on the input device, obtaining a key identifier corresponding to the key code of each input key or the function type of each input key according to the type of the input device, to obtain at least one key identifier; and obtaining an event identifier corresponding to the at least one key identifier and the type of operation according to a preset input key mapping relationship.

[0082] Optionally, in response to an operation of at least one input key on the input device, based on the type of the input device, the key code of each input key or the key identifier corresponding to the function type of each input key is obtained to obtain at least one key identifier. This includes: in response to an operation of at least one input key on the input device, obtaining operation information for each input key; if the type of the input device is a first preset type, determining the function type of each input key based on the operation information; obtaining the key identifier corresponding to the function type of each input key according to a preset function identifier mapping relationship to obtain at least one key identifier; if the type of the input device is a second preset type, determining the key code of each input key based on the operation information; obtaining the key identifier corresponding to the key code of each input key according to a preset code identifier mapping relationship to obtain at least one key identifier.

[0083] Optionally, based on a preset input key mapping relationship, an event identifier corresponding to at least one key identifier and the type of operation is obtained, including: determining whether the preset input key mapping relationship contains at least one key identifier; if the preset input key mapping relationship contains at least one key identifier, calculating the duration of the operation, and determining whether the type of operation is a continuous operation based on the duration; if the type of operation is a continuous operation, obtaining an event identifier corresponding to at least one key identifier and the type of continuous operation; if the type of operation is a non-continuous operation, obtaining an event identifier corresponding to at least one key identifier and the type of operation.

[0084] Optionally, determining whether at least one focus layer displayed in the graphical user interface has registered a target input event includes: determining at least one focus layer among all display layers based on the layer type and / or layer level of all display layers in the graphical user interface; determining whether any interface element in each focus layer is bound to an event identifier; if an interface element in a focus layer is bound to an event identifier, then the interface element bound to the event identifier is taken as the target interface element, the focus layer containing the target interface element is taken as the target focus layer, and determining that the target focus layer has registered a target input event.

[0085] Optionally, based on the layer type and / or layer level of all displayed layers in the graphical user interface, determine at least one focus layer among all displayed layers, including: determining whether the display layer with the highest layer level among all displayed layers is an exclusive layer type; wherein, an exclusive layer type is a layer type that can trigger input events and blocks input events of other layers; if the display layer with the highest layer level is an exclusive layer type, then the display layer with the highest layer level is determined as the focus layer, thus obtaining at least one focus layer among all displayed layers; if the display layer with the highest layer level is not an exclusive layer type, then based on the layer type, traverse the layer type of each displayed layer in turn, extract the layers that can trigger input events from all displayed layers, thus obtaining at least one focus layer among all displayed layers.

[0086] Optionally, if any target focus layer registers a target input event, the target input event is triggered, and the event logic corresponding to the target input event is executed, including: if the target interface element in the target focus layer is bound to an event identifier, the event logic function pre-bound to the event identifier is triggered, and the event logic corresponding to the target input event is executed.

[0087] This embodiment also provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are invoked and executed by a processor, they cause the processor to implement the response method for the aforementioned input operation, for example:

[0088] In response to an operation of at least one input key on an input device, a target input event pre-bound to at least one input key is determined; it is determined whether at least one focus layer displayed in the graphical user interface has registered the target input event; wherein, the focus layer is used to indicate the layer that can trigger the input event; if any target focus layer has registered the target input event, the target input event is triggered, and the event logic corresponding to the target input event is executed.

[0089] In this approach, different operations of different input keys correspond to different input events, and different layers can register different input events. When a layer that can trigger an input event registers a target input event corresponding to an operation input key, the event logic corresponding to the target input event can be executed, making it easy to trigger input operations on different layers and applicable to the development of different applications.

[0090] Optionally, in response to an operation of at least one input key on the input device, determining a target input event pre-bound to at least one input key includes: in response to an operation of at least one input key on the input device, obtaining an event identifier corresponding to the type of at least one input key and operation according to a preset input key mapping relationship; the input key mapping relationship reflects the mapping relationship between the type of at least one specified input key and specified operation and the event identifier; and determining the input event pre-bound to the event identifier as the target input event.

[0091] Optionally, in response to an operation of at least one input key on the input device, an event identifier corresponding to the at least one input key and the type of operation is obtained according to a preset input key mapping relationship, including: in response to an operation of at least one input key on the input device, obtaining a key identifier corresponding to the key code of each input key or the function type of each input key according to the type of the input device, to obtain at least one key identifier; and obtaining an event identifier corresponding to the at least one key identifier and the type of operation according to a preset input key mapping relationship.

[0092] Optionally, in response to an operation of at least one input key on the input device, based on the type of the input device, the key code of each input key or the key identifier corresponding to the function type of each input key is obtained to obtain at least one key identifier. This includes: in response to an operation of at least one input key on the input device, obtaining operation information for each input key; if the type of the input device is a first preset type, determining the function type of each input key based on the operation information; obtaining the key identifier corresponding to the function type of each input key according to a preset function identifier mapping relationship to obtain at least one key identifier; if the type of the input device is a second preset type, determining the key code of each input key based on the operation information; obtaining the key identifier corresponding to the key code of each input key according to a preset code identifier mapping relationship to obtain at least one key identifier.

[0093] Optionally, based on a preset input key mapping relationship, an event identifier corresponding to at least one key identifier and the type of operation is obtained, including: determining whether the preset input key mapping relationship contains at least one key identifier; if the preset input key mapping relationship contains at least one key identifier, calculating the duration of the operation, and determining whether the type of operation is a continuous operation based on the duration; if the type of operation is a continuous operation, obtaining an event identifier corresponding to at least one key identifier and the type of continuous operation; if the type of operation is a non-continuous operation, obtaining an event identifier corresponding to at least one key identifier and the type of operation.

[0094] Optionally, determining whether at least one focus layer displayed in the graphical user interface has registered a target input event includes: determining at least one focus layer among all display layers based on the layer type and / or layer level of all display layers in the graphical user interface; determining whether any interface element in each focus layer is bound to an event identifier; if an interface element in a focus layer is bound to an event identifier, then the interface element bound to the event identifier is taken as the target interface element, the focus layer containing the target interface element is taken as the target focus layer, and determining that the target focus layer has registered a target input event.

[0095] Optionally, based on the layer type and / or layer level of all displayed layers in the graphical user interface, determine at least one focus layer among all displayed layers, including: determining whether the display layer with the highest layer level among all displayed layers is an exclusive layer type; wherein, an exclusive layer type is a layer type that can trigger input events and blocks input events of other layers; if the display layer with the highest layer level is an exclusive layer type, then the display layer with the highest layer level is determined as the focus layer, thus obtaining at least one focus layer among all displayed layers; if the display layer with the highest layer level is not an exclusive layer type, then based on the layer type, traverse the layer type of each displayed layer in turn, extract the layers that can trigger input events from all displayed layers, thus obtaining at least one focus layer among all displayed layers.

[0096] Optionally, if any target focus layer registers a target input event, the target input event is triggered, and the event logic corresponding to the target input event is executed, including: if the target interface element in the target focus layer is bound to an event identifier, the event logic function pre-bound to the event identifier is triggered, and the event logic corresponding to the target input event is executed.

[0097] The computer program products of the input operation response method, apparatus, electronic device and storage medium provided in the embodiments of this disclosure include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0098] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0099] Furthermore, in the description of the embodiments of this disclosure, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this disclosure based on the specific circumstances.

[0100] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0101] In the description of this disclosure, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this disclosure and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this disclosure. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0102] Finally, it should be noted that the above embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A method for responding to an input operation, characterized in that, The method includes: In response to an operation of at least one input key on an input device, a target input event pre-bound to the at least one input key is determined; at least one specified input key and the type of specified operation are both bound to an event identifier. Determine whether at least one focused layer displayed in the graphical user interface has registered the target input event; wherein the focused layer is used to indicate the layer that can trigger the input event; If any target focus layer registers the target input event, the target input event is triggered, and the event logic corresponding to the target input event is executed. Registering the target input event by the target focus layer means that the interface element in the target focus layer is bound to the event identifier.

2. The method according to claim 1, characterized in that, The step of determining a target input event pre-bound to the at least one input key in response to an operation of an input device includes: In response to an operation of at least one input key on an input device, an event identifier corresponding to the type of the at least one input key and the operation is obtained according to a preset input key mapping relationship; the input key mapping relationship reflects the mapping relationship between the type of at least one specified input key and the specified operation and the event identifier; The input event that is pre-bound to the event identifier is identified as the target input event.

3. The method according to claim 2, characterized in that, The operation in response to at least one input key on the input device, according to a preset input key mapping relationship, obtains an event identifier corresponding to the at least one input key and the type of the operation, including: In response to an operation of at least one input key of an input device, based on the type of the input device, a key code corresponding to each input key or a key identifier corresponding to the function type of each input key is obtained to obtain at least one key identifier; Based on a preset input key mapping relationship, obtain an event identifier corresponding to the at least one key identifier and the type of operation.

4. The method according to claim 3, characterized in that, In response to an operation of at least one input key on an input device, based on the type of the input device, a key code corresponding to each input key or a key identifier corresponding to the function type of each input key is obtained to obtain at least one key identifier, including: In response to an operation of at least one input key on an input device, acquire operation information for each input key; If the type of the input device is a first preset type, then the function type of each input key is determined according to the operation information; Based on the preset function identifier mapping relationship, obtain the key identifier corresponding to the function type of each input key to obtain at least one key identifier; If the type of the input device is a second preset type, then the key code of each input key is determined according to the operation information; Based on the preset encoding and identifier mapping relationship, obtain the key identifier corresponding to the key code of each input key, and obtain at least one key identifier.

5. The method according to claim 3, characterized in that, The step of obtaining an event identifier corresponding to the at least one key identifier and the type of operation according to a preset input key mapping relationship includes: Determine whether the preset input key mapping relationship contains at least one key identifier; If the preset input key mapping relationship includes at least one key identifier, then the duration of the operation is calculated, and based on the duration, it is determined whether the type of the operation is a continuous operation. If the operation type is a continuous operation type, then obtain the event identifier corresponding to the at least one key identifier and the continuous operation type; If the operation type is a non-continuous operation type, then obtain the event identifier corresponding to the at least one key identifier and the operation type.

6. The method according to claim 2, characterized in that, The step of determining whether at least one focused layer displayed in the graphical user interface has registered the target input event includes: Based on the layer type and / or layer level of all displayed layers in the graphical user interface, determine at least one focus layer among all displayed layers; Determine whether the interface element in each of the focused layers is bound to the event identifier; If an interface element in the focus layer is bound to the event identifier, then the interface element bound to the event identifier is taken as the target interface element, the focus layer containing the target interface element is taken as the target focus layer, and the target focus layer is determined to register the target input event.

7. The method according to claim 6, characterized in that, Determining at least one focus layer among all displayed layers based on the layer type and / or layer level of all displayed layers in the graphical user interface includes: Based on the layer type and / or layer level of all displayed layers in the graphical user interface, determine whether the display layer with the highest layer level among all displayed layers is an exclusive layer type; wherein, the exclusive layer type is a layer type that can trigger input events and blocks input events of other layers; If the highest-level display layer is an exclusive layer type, then the highest-level display layer is determined as the focus layer, thus obtaining at least one focus layer among all display layers; If the highest-level display layer is not an exclusive layer type, then according to the layer type, the layer type of each display layer is traversed in turn, and the layer that can trigger the input event is extracted from all display layers to obtain at least one focus layer among all display layers.

8. The method according to claim 6, characterized in that, If any target focus layer registers the target input event, then the target input event is triggered, and the event logic corresponding to the target input event is executed, including: If the target interface element in the target focus layer is bound to the event identifier, the event logic function pre-bound to the event identifier is triggered, and the event logic corresponding to the target input event is executed.

9. A response device for an input operation, characterized in that, The device includes: A determination module is configured to determine a target input event pre-bound to the at least one input key in response to an operation of an input device; at least one specified input key and the type of specified operation are both bound to an event identifier; A determination module is used to determine whether at least one focus layer displayed in the graphical user interface has registered the target input event; wherein, the focus layer is used to indicate the layer that can trigger the input event; The execution module is used to trigger the target input event and execute the event logic corresponding to the target input event if any target focus layer registers the target input event. Registering the target input event by the target focus layer means that the interface element in the target focus layer is bound to the event identifier.

10. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the response method for an input operation as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the response method for an input operation as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Control method and control device

    CN103888799A

  • Operation method and device of vehicle machine map, equipment and readable storage medium

    CN111666029A