User interface processing method, system, electronic device, medium, and program product
Patent Information
- Application Number
- CN202111624084.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2041-12-28
AI Technical Summary
然而,IMGUI不能很好地支持脚本语言作为开发语言;Electron虽然支持脚本语言,但更常用的场景是事件驱动的非帧刷新
[0044] Under the event loop mechanism, user interface events for the target application are periodically acquired, and a scripting language is used to process the user interface events acquired in each cycle, thereby realizing the frame loop design. It is evident that this application can achieve frame refreshing while supporting scripting languages. Furthermore, scripting languages are more lightweight and extensible than languages such as C++ and Java, thus improving code development efficiency.
Smart Images

Figure CN116360775B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a user interface processing method, system, electronic device, medium, and program product. Background Technology
[0002] Currently, UI (User Interface) frameworks capable of frame looping include IMGUI (a real-time rendered UI implemented in C / C++) and Electron. However, IMGUI does not support scripting languages well as a development language; while Electron supports scripting languages, it is more commonly used in event-driven, non-frame-refreshing scenarios. Therefore, there is a lack of a UI framework that can simultaneously support scripting languages and frame refresh. Summary of the Invention
[0003] To address the aforementioned technical problems, this application provides a user interface processing method, system, electronic device, medium, and program product.
[0004] According to a first aspect of this application, a user interface processing method is provided, comprising:
[0005] Based on the event loop mechanism, user interface events for the target application are periodically acquired;
[0006] Using a scripting language, user interface events acquired in each cycle are processed to refresh the user interface of the target application.
[0007] Optionally, processing the user interface events acquired in each cycle to refresh the user interface of the target application includes:
[0008] Semantic processing is performed on the user interface events acquired in each cycle to obtain target events that are independent of the operating system type;
[0009] The target event is processed to refresh the user interface of the target application.
[0010] Optionally, processing the user interface events acquired in each cycle includes:
[0011] For each cycle, if the number of user interface events received within the cycle is multiple, the user interface event is processed after each user interface event is received.
[0012] Optionally, the periodic acquisition of user interface events for the target application includes:
[0013] When the timer's timing period arrives, user interface events for the target application are acquired, wherein the next timing period is determined based on the processing duration of the user interface events in the previous timing period.
[0014] Optionally, processing the user interface events acquired in each cycle includes:
[0015] Determine the event type of each individual user interface event acquired in each cycle;
[0016] The user interface events are processed using the processing method corresponding to the event type.
[0017] Optionally, the event types include: window type and non-window type;
[0018] The process of handling the user interface event using a processing method corresponding to the event type includes:
[0019] If the event type of a single user interface event is window type, the user interface event is processed through the event system;
[0020] If the event type of a single user interface event is a non-window type, the user interface event is processed by the entity corresponding to the user interface event.
[0021] Optionally, the method further includes:
[0022] Retrieves one or more target user interface events of the operating system type;
[0023] Personalize the target user interface events for one or more types of operating systems.
[0024] Optionally, the event loop mechanism may include a Node.js-based event loop mechanism or an application development framework-based event loop mechanism.
[0025] According to a second aspect of this application, a user interface processing system is provided, comprising: an operating system module, a platform module, and a script module supporting a scripting language;
[0026] The platform module is used to periodically obtain user interface events for the target application from the operating system module based on an event loop mechanism, and distribute the user interface events obtained in each period to the script module.
[0027] The script module is used to process the received user interface events using a scripting language in order to refresh the user interface of the target application.
[0028] Optionally, the platform module is also used to perform semantic processing on the user interface events acquired in each cycle to obtain target events that are independent of the type of operating system;
[0029] The platform module is specifically used to distribute the target event to the script module;
[0030] The script module is specifically used to process the received target event in order to refresh the user interface of the target application.
[0031] Optionally, for each cycle, if the number of user interface events received by the script module within the cycle is multiple, the script module is specifically used to process the user interface event after receiving each user interface event.
[0032] Optionally, the platform module is specifically used to acquire user interface events for the target application when the timer's timing period arrives, wherein the next timing period is determined based on the processing duration corresponding to the user interface events in the previous timing period.
[0033] Optionally, the platform module is specifically used to distribute the single user interface event to the processing unit in the script module corresponding to the event type, based on the event type of the single user interface event obtained in each cycle.
[0034] The script module is specifically used to process the user interface events through a processing unit corresponding to the event type.
[0035] Optionally, the event types include: window type and non-window type;
[0036] The script module is specifically used to process user interface events through the event system in the script module if the event type of a single user interface event is window type.
[0037] If the event type of a single user interface event is a non-window type, the user interface event is processed by the entity corresponding to the user interface event in the script module.
[0038] Optionally, the platform module includes a personalization unit corresponding to one or more types of operating systems, wherein the personalization unit is used to acquire target user interface events of the corresponding type of operating system and perform personalized processing on the target user interface events.
[0039] Optionally, the event loop mechanism may include a Node.js-based event loop mechanism or an application development framework-based event loop mechanism.
[0040] According to a third aspect of this application, an electronic device is provided, comprising: a processor configured to execute a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the method described in the first aspect.
[0041] According to a fourth aspect of this application, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0042] According to a fifth aspect of this application, a computer program product is provided that, when the computer program product is run on a computer, causes the computer to perform the method described in the first aspect.
[0043] The technical solution provided in this application has the following advantages compared with the prior art:
[0044] Under the event loop mechanism, user interface events for the target application are periodically acquired, and a scripting language is used to process the user interface events acquired in each cycle, thereby realizing the frame loop design. It is evident that this application can achieve frame refreshing while supporting scripting languages. Furthermore, scripting languages are more lightweight and extensible than languages such as C++ and Java, thus improving code development efficiency. Attached Figure Description
[0045] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0046] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 This is a schematic diagram of a frame loop implemented based on an event loop in an embodiment of this application;
[0048] Figure 2 This is an overall flowchart of the frame loop implementation in the embodiments of this application;
[0049] Figure 3 This is a flowchart of a user interface processing method in an embodiment of this application;
[0050] Figure 4 This is a schematic diagram of the architecture of a user interface processing system in an embodiment of this application;
[0051] Figure 5This is a schematic diagram of user interface event transmission in an embodiment of this application;
[0052] Figure 6 This is a schematic diagram of user interface event distribution in an embodiment of this application;
[0053] Figure 7 This is a schematic diagram of a platform module in an embodiment of this application;
[0054] Figure 8 This is a schematic diagram of the structure of an electronic device in an embodiment of this application. Detailed Implementation
[0055] To better understand the above-mentioned objectives, features, and advantages of this application, the solution of this application will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0056] Many specific details are set forth in the following description in order to provide a full understanding of this application, but this application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some embodiments of this application, and not all embodiments.
[0057] See Figure 1 , Figure 1 This is a schematic diagram illustrating a frame loop implementation based on an event loop in an embodiment of this application. For example... Figure 1 As shown, the existing event loop mechanism can be used to implement the frame loop of the UI framework. The event loop refers to the continuous acquisition and processing of user-triggered user interface events within the UI framework. It can be understood that the event loop can continue as long as the target application is active, and ends when the target application exits. Under the event loop mechanism, the frame loop of the UI framework is achieved by periodically acquiring and processing user interface events.
[0058] See Figure 2 , Figure 2 This is a flowchart illustrating the overall process of implementing frame looping in the embodiments of this application. Figure 1 The flowchart corresponding to APP.update shows that after the timer expires, the process begins and executes the following steps in sequence:
[0059] Step S202: Determine whether the target application has exited. If the target application has exited, exit directly; otherwise, proceed to step S204 below.
[0060] Step S204: Obtain user interface events.
[0061] Step S206 involves processing user interface events to refresh the frame. Step S202 is then re-executed when the next cycle arrives. This process achieves frame cycling.
[0062] See Figure 3 , Figure 3 This is a flowchart of a user interface processing method in an embodiment of this application, which may include the following steps:
[0063] Step S210: Based on the event loop mechanism, periodically acquire user interface events for the target application.
[0064] Step S220: Using a scripting language, process the user interface events acquired in each cycle to refresh the user interface of the target application.
[0065] The user interface processing method of this application, under an event loop mechanism, periodically acquires user interface events for the target application and processes the user interface events acquired in each cycle using a scripting language, thereby realizing a frame loop design. It is evident that the user interface processing method of this application can achieve frame refreshing while supporting scripting languages. Furthermore, scripting languages are more lightweight and extensible than languages such as C++ and Java, thus improving code development efficiency.
[0066] The user interface processing method of the embodiments of this application will be described in more detail below.
[0067] In step S210, user interface events for the target application are periodically acquired based on the event loop mechanism.
[0068] In the UI framework, user actions on the target application generate corresponding user interface events. This application can maintain a message queue; upon receiving an action on the target application, the corresponding user interface event can be placed in the message queue, and other actions can continue to be received. Furthermore, user interface events can be retrieved from the message queue and processed. When the target application exits, no new user interface events will occur, and the event loop ends. Optionally, the event loop mechanism can include a Node.js-based event loop mechanism or an application development framework-based event loop mechanism.
[0069] In this embodiment, a timer can be started to periodically acquire user interface events for the target application. When the timer's interval expires, the user interface event for the target application is acquired. For example, if the timer interval is 30 milliseconds, the timer can trigger once every 30 milliseconds, thus acquiring the user interface event for the target application once every 30 milliseconds.
[0070] If the time consumed in processing user interface events is less than the timer period, the timer period remains unchanged, ensuring the stability of the entire frame. For example, each timer period is 30 milliseconds. However, in reality, the time consumed in processing user interface events may be greater than the timer period, such as 40 milliseconds. In this case, when the timer period arrives, the processing of user interface events is not yet complete, and it is impossible to trigger the retrieval of new user interface events.
[0071] Therefore, in some embodiments, the next timing period can be determined based on the processing time of the user interface events in the previous timing period. For example, if the timing period is 30 milliseconds and the processing time for the user interface events is 40 milliseconds, then the next timing period can be adjusted to 20 milliseconds to compensate for the time difference, thereby ensuring that the entire frame is stable.
[0072] In step S220, the user interface events acquired in each cycle are processed using a scripting language to refresh the user interface of the target application.
[0073] The UI framework of this application can support scripting languages. Scripting languages are more lightweight and extensible than other languages (such as C and JAVA). Therefore, using scripting languages to handle user interface events can improve the efficiency of code development.
[0074] In some embodiments, semantic processing can be performed on the user interface events acquired in each cycle to obtain target events that are independent of the operating system type. These target events are then processed to refresh the user interface of the target application. In this way, by building a cross-platform UI framework, developers can obtain platform-compliant UI results on different platforms simply by writing a single script, without needing to be aware of the operating system type.
[0075] A user may trigger multiple actions on the target application within a given time period, each corresponding to a user interface event. In related technologies, user interface events are processed only after all events have been received. However, user interface events for some actions are continuously generated. For example, when a user zooms on the screen, they are constantly scrolling the mouse, making it impossible to receive and process user interface events.
[0076] Therefore, for each cycle, if multiple user interface events are received within that cycle, the user interface events are processed immediately after each event is received. That is, each user interface event is processed as soon as it is received, rather than processing all user interface events after all events have been received within each time period, thus avoiding the problem of not being able to refresh the frame.
[0077] In a UI framework, user interface events can include different event types. Different event types require different handling methods. You can first determine the event type of each individual user interface event acquired in each cycle, and then process the user interface event using the corresponding handling method.
[0078] In some embodiments, event types include window type and non-window type. If the event type of a single user interface event is window type, such as mouse events, keyboard events, scroll events, etc., the user interface event can be processed through the event system. Here, the event system refers to a system used to process window type user interface events. If the event type of a single user interface event is non-window type, such as color dialog box events, file dialog box events, application events, etc., the user interface event can be processed through the entity corresponding to the user interface event.
[0079] The UI framework of this application, in addition to enabling cross-platform compatibility, can also personalize functions specific to different operating systems. In some embodiments, target user interface events of one or more types of operating systems can be acquired, and these target user interface events can be personalized. Here, target user interface events refer to events used for personalization, and may be pre-set user interface events.
[0080] For example, target user interface events obtained from the Windows operating system and target user interface events obtained from the MAC operating system can be processed differently, even if the two target user interface events are the same.
[0081] The user interface processing method of this application, under the event loop mechanism, can perform semantic processing on user interface events after periodically acquiring them for the target application. This makes the processed target events independent of the operating system type. Developers do not need to be aware of the operating system type; they can obtain UI results that conform to platform interaction by writing a single script on different platforms, thus achieving cross-platform UI framework. Therefore, the user interface processing method of this application can support scripting languages while implementing frame loops and cross-platform compatibility, thereby improving development efficiency.
[0082] Figure 4 This is a schematic diagram of the architecture of a user interface processing system in an embodiment of this application. Figure 4As shown, the user interface processing system 300 includes: an operating system module 310, a platform module 320, and a script module 330 that supports scripting languages.
[0083] Operating system module 310 refers to a module that interacts directly with the operating system. When the user operates on the user interface of the target application, operating system module 310 can generate corresponding user interface events.
[0084] Platform module 320 is an abstract module that can encapsulate the acquired user interface events and send them to script module 330.
[0085] Script module 330 supports scripting languages and can handle user interface events. Developers can develop script module 230 using scripting languages. Because scripting languages are more lightweight and extensible than languages like C++ and Java, they are easier for developers to learn. After receiving user interface events, script module 330 can handle these events through its internal event handling functions.
[0086] In the user interface processing system 300:
[0087] Platform module 320 is used to periodically obtain user interface events for the target application from operating system module 310 based on an event loop mechanism, and send the user interface events obtained in each cycle to script module 330.
[0088] Script module 330 is used to process received user interface events using a scripting language in order to refresh the user interface of the target application.
[0089] The user interface processing system of this application, under an event loop mechanism, periodically acquires user interface events for the target application and processes these events through a script module that supports scripting languages, thereby achieving a frame loop design. It is evident that the user interface processing system of this application can achieve frame refreshing while supporting scripting languages. Furthermore, scripting languages are more lightweight and extensible than languages such as C++ and Java, thus improving code development efficiency.
[0090] The user interface processing system in the embodiments of this application will be described in more detail below.
[0091] Platform module 320 is used to periodically obtain user interface events for the target application from operating system module 310 based on an event loop mechanism, and send the user interface events obtained in each cycle to script module 330.
[0092] In this embodiment, the event loop mechanism may include a Node.js-based event loop mechanism or an application development framework-based event loop mechanism. Node.js is a JavaScript runtime environment based on the Chrome V8 engine, using an event-driven, non-blocking I / O (input / output) model. Node.js supports scripting languages such as js / ts / tsx2.
[0093] Platform module 320 can periodically retrieve user interface events for the target application from operating system module 310 based on an event loop mechanism. For example, platform module 320 can retrieve user interface events for the target application from operating system module 310 every 30 milliseconds. After retrieving the user interface events, platform module 320 can send the user interface events to script module 330 for processing.
[0094] Optionally, a timer can be used to periodically retrieve user interface events for the target application from the operating system module 310. Specifically, the platform module 320 retrieves user interface events for the target application when the timer's interval expires. For example, if the timer's interval is set to 30 milliseconds, the user interface events for the target application will be retrieved every 30 milliseconds.
[0095] Understandably, if the time consumed in processing user interface events is less than the timer period, the timer period can remain unchanged. For example, each timer period could be 30 milliseconds. However, in reality, the time consumed in processing user interface events may be greater than the timer period, such as 40 milliseconds. In this case, when the timer period expires, the processing of user interface events may not be complete, and new user interface events cannot be triggered.
[0096] To address this issue, the next timing period can be determined based on the processing time of user interface events within the previous timing period. For example, if the timing period is 30 milliseconds and the processing time for user interface events is 40 milliseconds, then the next timing period can be 20 milliseconds to compensate for this time difference, thereby ensuring the stability of the entire frame.
[0097] Script module 330 is used to process received user interface events using a scripting language in order to refresh the user interface of the target application.
[0098] It's understandable that a user might trigger multiple actions within a given time period, each corresponding to a user interface event. In related technologies, user interface events are processed only after all events have been received. However, some actions continuously generate user interface events. For example, when a user zooms on the screen, they are constantly scrolling the mouse, making it impossible to receive and process user interface events.
[0099] Therefore, for each cycle, if the script module 330 receives multiple user interface events within that cycle, the script module 330 is specifically used to process each user interface event after it is received. That is, each user interface event is processed as soon as it is received, instead of processing the user interface events only after all user interface events have been received in each timed cycle, thus avoiding the problem of not being able to refresh the frame.
[0100] See Figure 5 , Figure 5 This is a schematic diagram illustrating the transmission of user interface events in an embodiment of this application. As mentioned earlier, when the timer expires, App.update can be triggered. For App.update, the script module 330's update function is first invoked, and then the platform module 320's update function is invoked. The user interface event is obtained from the operating system module's event dispatch unit through the process function of the platform module 320. It should be noted that user interface events can be obtained from the event dispatch unit of different types of operating systems. For example, for a Windows operating system, user interface events can be obtained from the Windows operating system's event dispatch unit; for a MAC operating system, user interface events can be obtained from the MAC operating system's event dispatch unit.
[0101] In this embodiment, the platform module 320 is further configured to perform semantic processing on the user interface events acquired in each cycle to obtain target events independent of the operating system type. The script module 330 is specifically configured to process the received target events to refresh the user interface of the target application. That is, by building a cross-platform UI framework, developers can obtain UI results that conform to platform interactions on different platforms without needing to be aware of the operating system type, simply by writing a script. Figure 5 As shown, the handleEvent of the event dispatch unit of platform module 320 can perform semantic processing on user interface events, so that the processed target events conform to the events of the UI framework.
[0102] For example, the origin coordinates of the Windows operating system are at the top left corner of the screen, while the origin coordinates of the macOS operating system are at the bottom left corner. It's clear that there's a defined region to the left of the origin in the two operating systems, and consequently, the same mouse position on the screen will correspond to different coordinates. To unify the two different operating systems, coordinate transformation can be used to convert the two different coordinates to the same coordinate system. For example, coordinate transformation can unify the origin coordinates in both operating systems to the center of the screen. Developers only need to know that the center of the screen is the origin coordinate, and can develop accordingly, without needing to develop differently for each operating system.
[0103] Subsequently, platform module 320 sends the target event to script module 330. Platform module 320, specifically, is used to send a single user interface event to the processing unit corresponding to the event type in script module 330, based on the event type of the single user interface event acquired in each cycle. Script module 330, specifically, is used to process the user interface event through the processing unit corresponding to the event type.
[0104] Optionally, the event types include: window type and non-window type; the script module 330 is specifically used to process the user interface event through the event system in the script module 330 if the event type of a single user interface event is window type; and to process the user interface event through the entity corresponding to the user interface event in the script module 330 if the event type of a single user interface event is non-window type.
[0105] See Figure 6 , Figure 6 This is a schematic diagram of user interface event distribution in an embodiment of this application. The handleEvent of the operating system module 310 can obtain different user interface events, such as mouse events, keyboard types, scrolling events, color dialog box events, file dialog box events, application events, etc.
[0106] The window entity contains many UI controls drawn by scripts. For user interface events of the window type (such as mouse events, keyboard events, scroll events, etc.), user interface events can be sent to the event system in script module 330. The event system further sends the user interface events to the corresponding UI elements, and the UI elements process the user interface events.
[0107] For events such as color dialog box events, file dialog box events, and application events, since there are no UI controls drawn by scripts on the window entity, the user interface events can be directly sent to the corresponding entity in script module 330, and the user interface events can be processed by the entity.
[0108] In this embodiment, in addition to performing semantic processing on user interface events of various operating systems, the platform module 320 can also personalize functions specific to different operating systems. Optionally, the platform module 320 includes a personalization unit corresponding to one or more types of operating systems. The personalization unit is used to acquire target user interface events of the corresponding type of operating system and perform personalized processing on the target user interface events.
[0109] See Figure 7 , Figure 7 This is a schematic diagram of a platform module in an embodiment of this application. The platform module 320 may include a platform unit 321, a Windows personalization unit 322, and a MAC personalization unit 323. Assuming that the platform unit 321 can perform semantic processing on user interface events of different operating systems—that is, the platform unit 321 implements a cross-platform UI framework—then the Windows personalization unit 322 and the MAC personalization unit 323 can integrate all the features of the platform unit 321, and may also have more unique features of their own. It is understood that the platform module 320 can contain as many personalization units as there are types of operating systems. It should be noted that each personalization unit is detachable; for example, if you want to uninstall Windows functions, you can simply delete the Windows personalization unit 322.
[0110] The user interface processing system of this application, under the event loop mechanism, allows the platform module to periodically acquire user interface events for the target application. After semantic processing of these events, the processed target events become independent of the operating system type. Developers do not need to be aware of the operating system type; they can obtain UI results conforming to platform interactions by writing a single script, thus achieving cross-platform UI framework compatibility. The platform module can also distribute user interface events to different entities in the script module based on their type, allowing different entities to process the user interface events. Therefore, the user interface processing system of this application can support scripting languages while implementing frame loops and cross-platform compatibility, thereby improving development efficiency.
[0111] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0112] In an exemplary embodiment of this application, an electronic device is also provided, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the user interface processing method described in this exemplary embodiment.
[0113] Figure 8 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. It should be noted that... Figure 8 The electronic device 800 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0114] like Figure 8 As shown, the electronic device 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage section 808 into a random access memory (RAM) 803. The RAM 803 also stores various programs and data required for system operation. The CPU 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0115] The following components are connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a local area network (LAN) card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 810 as needed so that computer programs read from it can be installed into storage section 808 as needed.
[0116] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit 801, it performs various functions defined in the system of this application.
[0117] In this embodiment of the application, a computer-readable storage medium is also provided, on which a computer program is stored, and when the computer program is executed by a processor, it implements the above-described user interface processing method.
[0118] It should be noted that the computer-readable storage medium shown in this application can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, radio frequency, etc., or any suitable combination thereof.
[0119] In this embodiment of the application, a computer program product is also provided, which, when run on a computer, causes the computer to execute the above-described user interface processing method.
[0120] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0121] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A user interface processing method, characterized in that, The method includes: Based on the event loop mechanism, user interface events for the target application are periodically acquired; the periodic acquisition of user interface events for the target application includes: acquiring user interface events for the target application when the timer's timing period arrives, wherein the next timing period is determined based on the processing duration corresponding to the user interface events in the previous timing period, and when the processing duration is longer than the timing period, the next timing period is obtained by compensating for the time difference between the processing duration and the timing period; Using a scripting language, user interface events acquired in each cycle are processed to refresh the user interface of the target application.
2. The method according to claim 1, characterized in that, The process of processing the user interface events acquired in each cycle to refresh the user interface of the target application includes: Semantic processing is performed on the user interface events acquired in each cycle to obtain target events that are independent of the operating system type; The target event is processed to refresh the user interface of the target application.
3. The method according to claim 1, characterized in that, The processing of user interface events acquired in each cycle includes: For each cycle, if the number of user interface events received within the cycle is multiple, the user interface event is processed after each user interface event is received.
4. The method according to claim 1, characterized in that, The processing of user interface events acquired in each cycle includes: Determine the event type of each individual user interface event acquired in each cycle; The user interface events are processed using the processing method corresponding to the event type.
5. The method according to claim 4, characterized in that, The event types include: window type and non-window type; The process of handling the user interface event using a processing method corresponding to the event type includes: If the event type of a single user interface event is window type, the user interface event is processed through the event system; If the event type of a single user interface event is a non-window type, the user interface event is processed by the entity corresponding to the user interface event.
6. The method according to claim 1, characterized in that, The method further includes: Retrieves one or more target user interface events of the operating system type; Personalize the target user interface events for one or more types of operating systems.
7. The method according to any one of claims 1-6, characterized in that, The event loop mechanism includes an event loop mechanism based on Node.js or an event loop mechanism based on an application development framework.
8. A user interface processing system, characterized in that, include: Operating system module, platform module, and script module that supports scripting languages; The platform module is configured to periodically obtain user interface events for the target application from the operating system module based on an event loop mechanism, and distribute the user interface events obtained in each cycle to the script module; wherein, the periodic acquisition of user interface events for the target application from the operating system module includes: acquiring user interface events for the target application from the operating system module when the timer's timing period arrives, wherein the next timing period is determined based on the processing duration corresponding to the user interface events in the previous timing period, and when the processing duration is longer than the timing period, the next timing period is obtained by compensating for the time difference between the processing duration and the timing period; The script module is used to process the received user interface events using a scripting language in order to refresh the user interface of the target application.
9. An electronic device, characterized in that, include: A processor for executing a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the steps of the user interface processing method according to any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the user interface processing method according to any one of claims 1-7.
11. A computer program product, characterized in that, When the computer program product is run on a computer, it causes the computer to perform the steps of the user interface processing method according to any one of claims 1-7.
Citation Information
Patent Citations
User interface rendering method and device
CN108572818A
Latency adjustment of user input devices
US20200278758A1