Touch Event Processing Method, Device, Computer Device, and Readable Storage Medium

By distinguishing the press and lift event types in touch event processing, and performing point-discarding and filtering point processing, the touch event decoupling and driver are achieved, and complex problems of maintenance and improvement of touch event processing methods are solved, and the porting efficiency is improved.

CN114911461BActive Publication Date: 2025-07-04KINCO AUTOMATION (SHANGHAI) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210666989.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-13
Publication Date
2025-07-04
Estimated Expiration
2042-06-13

AI Technical Summary

Technical Problem

In the prior art, the maintenance and improvement of touch events are complex, and the modified processing methods are cumbersome when applied to new drivers, resulting in a complex program code transplantation process.

Method used

By determining the type of touch events and performing abandoned points and filtered points when pressing the event type, processing is performed according to the processing results when lifting the event type, decoupling of touch events and touch drivers is achieved, and maintenance and modification process is simplified.

Benefits of technology

It reduces the difficulty of maintaining and modifying touch event processing functions, improves the porting efficiency with new drivers, and simplifies the adjustment process of touch event processing functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114911461B_ABST
    Figure CN114911461B_ABST
Patent Text Reader

Abstract

The present invention discloses a touch event processing method, device, computer device and readable storage medium, relating to the field of signal processing. The method includes: when a touch event reported by a touch driver is received by a slave processor in a computer device, determining the type of the touch event; when the type is a press event type, processing the touch event according to a preset program code / module / interface and obtaining a processing result of the touch event; and when the type is a lift event type, correspondingly processing the lift event according to the processing result of the touch event of the press event type. Based on this, the embodiments of the present invention decouple the processing function of touch events from the touch driver, thereby reducing the difficulty of maintaining and modifying the processing function of touch events in the later stage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of signal processing, and in particular, to a method, apparatus, computer device, and readable storage medium for processing touch events. Background Art

[0002] The processing of touch events is implemented in a touch driver, making the maintenance and improvement of the processing method of touch events relatively complex. Moreover, after modifying the processing method of touch events, the modified processing method is often applied to a new driver, resulting in the need to transplant program code, and the transplanting process is very cumbersome. Summary of the Invention

[0003] In view of this, the present invention provides a method, apparatus, computer device, and readable storage medium for processing touch events, which are used to improve the complexity of maintaining and improving the processing method of touch events and the cumbersome situation that the processing method is applied to a new driver.

[0004] In a first aspect, an embodiment of the present invention provides a method for processing touch events, including:

[0005] When a touch event reported by a touch driver is obtained, determining the type of the touch event, where the type includes a press event type and a lift event type;

[0006] When the type is the press event type, processing the touch event to obtain a processing result;

[0007] When the type is the lift event type, processing the lift event according to the processing result.

[0008] Optionally, in a feasible manner provided by an embodiment of the present invention, the step of when the type is the press event type, processing the touch event to obtain a processing result includes:

[0009] When the type is the press event type, determining a first quantity of touch coordinate points corresponding to the touch event obtained in real time;

[0010] Storing the touch coordinate points obtained in real time into a first preset cache array until the first quantity is equal to a preset discard point quantity, and then performing a discard point process on all touch coordinate points in the first preset cache array by using a preset discard point algorithm;

[0011] Storing all touch coordinate points in the first preset cache array after the discard point process into a second preset cache array, storing the touch coordinate points obtained in real time into the second preset cache array, and recording a second quantity of touch coordinate points stored in the second preset cache array;

[0012] When the second quantity is equal to the preset filter point quantity, reset the second quantity to zero, and perform filter point processing on the touch coordinate points in the second preset cache array by using a preset filter point algorithm;

[0013] Send the second preset cache array after filter point processing and the generated press event reporting information to the corresponding processing module to obtain a processing result.

[0014] Optionally, in a feasible manner provided by an embodiment of the present invention, the method further includes:

[0015] Adjust at least one of the preset discard point quantity, the preset filter point quantity, the preset discard point algorithm, and the preset filter point algorithm according to the received adjustment instruction.

[0016] Optionally, in a feasible manner provided by an embodiment of the present invention, the step of sending the second preset cache array after filter point processing and the generated press event reporting information to the corresponding processing module to obtain a processing result includes:

[0017] Send the second preset cache array after filter point processing and the generated press event reporting information to the corresponding processing module, and set the identification bit corresponding to the processing result to a first preset value;

[0018] When the type is the lift event type, the step of processing the lift event according to the processing result includes:

[0019] When the type is the lift event type and the identification bit corresponding to the processing result is the first preset value, clear the first quantity and the second quantity, and set the identification bit corresponding to the processing result to a second preset value;

[0020] Generate lift event reporting event information, and report the lift event reporting event information to the corresponding processing module.

[0021] Optionally, in a feasible manner provided by an embodiment of the present invention, after storing the real-time obtained touch coordinate points into the first preset cache array until the first quantity is equal to the preset discard point quantity and then performing discard point processing on all the touch coordinate points in the first preset cache array by using a preset discard point algorithm, it further includes:

[0022] Set a preset discard point processing identifier to a first preset value;

[0023] The step of sending the second preset cache array after filter point processing and the generated press event reporting information to the corresponding processing module, and setting the identification bit corresponding to the processing result to a first preset value includes:

[0024] Send the second preset cache array processed by the filtering points and the generated press event reporting information to the corresponding processing module;

[0025] The storing all touch coordinate points in the first preset cache array processed by the discard point processing into the second preset cache array, storing the touch coordinate points obtained in real time into the second preset cache array, and recording the second quantity of the touch coordinate points stored in the second preset cache array includes:

[0026] If the discard point processing identifier is the first preset value, store all touch coordinate points in the first preset cache array processed by the discard point processing into the second preset cache array, store the touch coordinate points obtained in real time into the second preset cache array, and record the second quantity of the touch coordinate points stored in the second preset cache array;

[0027] When the type is the lift event type and the flag bit corresponding to the processing result is the first preset value, after clearing the first quantity and the second quantity and setting the flag bit corresponding to the processing result to the second preset value, further includes:

[0028] Set the discard point processing identifier to the second preset value.

[0029] In a second aspect, an embodiment of the present invention provides a touch event processing device, including:

[0030] An acquisition module, configured to determine the type of the touch event when acquiring the touch event reported by the touch driver, where the type includes a press event type and a lift event type;

[0031] A first processing module, configured to process the touch event to obtain a processing result when the type is the press event type;

[0032] A second processing module, configured to process the lift event according to the processing result when the type is the lift event type.

[0033] Optionally, in a feasible manner provided by the embodiment of the present invention, the first processing module includes:

[0034] A first quantity determination sub-module, configured to determine the first quantity of the touch coordinate points corresponding to the touch event obtained in real time when the type is the press event type;

[0035] A discard point processing sub-module, configured to store the touch coordinate points obtained in real time into the first preset cache array, and when the first quantity is equal to the preset discard quantity, perform discard point processing on all touch coordinate points in the first preset cache array by using a preset discard algorithm;

[0036] A second quantity recording sub-module, configured to store all touch coordinate points in a first preset cache array after discard point processing into a second preset cache array, store the touch coordinate points obtained in real time into the second preset cache array, and record a second quantity of the touch coordinate points stored in the second preset cache array;

[0037] A filter point processing sub-module, configured to, when the second quantity is equal to a preset filter point quantity, reset the second quantity to zero, and perform filter point processing on the touch coordinate points in the second preset cache array by using a preset filter point algorithm;

[0038] A reporting sub-module, configured to send the second preset cache array after filter point processing and the generated press event reporting information to a corresponding processing module to obtain a processing result.

[0039] Optionally, in a feasible manner provided by an embodiment of the present invention, the device further includes:

[0040] An adjustment module, configured to adjust at least one of the preset discard point quantity, the preset filter point quantity, the preset discard point algorithm, and the preset filter point algorithm according to a received adjustment instruction.

[0041] In a third aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the computer program runs on the processor, it executes any one of the touch event processing methods disclosed in the first aspect.

[0042] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program runs on a processor, it executes any one of the touch event processing methods disclosed in the first aspect.

[0043] In the touch event processing method provided by an embodiment of the present invention, when a touch event reported by a touch driver is received from a processor in a computer device, the type of the touch event will be determined; when the type is a press event type, the touch event will be processed according to a preset program code / module / interface to obtain a processing result of the touch event; and when the type is a lift event type, the lift event will be correspondingly processed according to the processing result of the touch event of the press event type.

[0044] Based on this, the embodiment of the present invention decouples the touch event processing function from the touch driver, thereby reducing the difficulty of later maintenance and modification of the touch event processing function; and because the touch event processing function is decoupled from the touch driver, when the touch event processing function needs to cooperate with a new driver, the transplantation of the touch event processing function can ignore the differences between the old and new drivers, thereby improving the transplantation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as limiting the protection scope of the present invention. In each drawing, similar components are denoted by similar reference numerals.

[0046] Figure 1 FIG. shows a schematic flowchart of the first touch event processing method provided by an embodiment of the present invention;

[0047] Figure 2 FIG. shows a schematic flowchart of the second touch event processing method provided by an embodiment of the present invention;

[0048] Figure 3 FIG. shows a schematic flowchart of the third touch event processing method provided by an embodiment of the present invention;

[0049] Figure 4 FIG. shows a schematic structural diagram of a touch event processing device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0050] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, but not all, embodiments of the present invention.

[0051] The components of the embodiments of the present invention generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations. Thus, the detailed description of the embodiments of the present invention provided herein is not intended to limit the scope of the claimed invention, but is merely representative of selected embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts fall within the protection scope of the present invention.

[0052] In the following text, the terms "comprising", "having" and their cognates used in various embodiments of the present invention are only intended to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be construed as precluding the existence or adding the possibility of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items first.

[0053] In addition, the terms "first", "second", "third", etc. are only used for descriptive distinction and should not be construed as indicating or implying relative importance.

[0054] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present invention pertain. The terms (such as those defined in a commonly used dictionary) will be interpreted as having the same meaning as their contextual meaning in the relevant technical field and will not be interpreted as having an idealized meaning or an overly formal meaning, unless clearly defined in various embodiments of the present invention.

[0055] Embodiment 1

[0056] Referring to Figure 1 , a flowchart diagram of the first touch event processing method provided by an embodiment of the present invention is shown. The touch event processing method provided by the embodiment of the present invention includes:

[0057] S110, when a touch event reported by a touch driver is obtained, determine the type of the touch event, where the type includes a press event type and a lift event type.

[0058] It should be noted that the touch driver in the embodiment of the present invention is only used to report the obtained touch event to the processor in the computer device and is not used to process the touch event. That is, the touch driver in the embodiment of the present invention is no longer used to process the obtained driver events such as press events and lift events.

[0059] It can be understood that the processing of touch events mostly involves three steps: touch coordinate point discarding, touch coordinate point filtering, and touch coordinate point reporting. The embodiment of the present invention implements the touch event processing function based on a pre-set program code / module / interface. Then, when the touch driver obtains a touch event, the touch driver sends the touch event and the corresponding coordinates of the touch event to the processor, and the processor completes the corresponding touch coordinate point discarding, touch coordinate point filtering, and touch coordinate point reporting according to the program code / module / interface.

[0060] S120, when the type is the press event type, process the touch event to obtain a processing result.

[0061] It can be understood that since a touch event of the lift event type, that is, a lift event, indicates that there is no longer an object such as a user's finger or a stylus touching the display screen / touch screen. In other words, before the lift event is triggered, there must be a touch event of the press event type, that is, the press event is triggered. Therefore, in the embodiment of the present invention, when the processing of the press event is completed, the processing result of the press event will be obtained so that when processing subsequent touch events, the touch events can be processed based on the processing result of the press event.

[0062] In addition, it can be understood that the specific processing flow of the press event can be set according to the actual situation.

[0063] S130. When the type is the lift event type, process the lift event according to the processing result.

[0064] It can be understood that if the press event is processed normally, that is, the processing result is normal, then the lift event will be able to be processed normally. And if the processing result of the press event is abnormal, or the press event is not processed completely and thus there is no processing result, then the processing of the lift event will not be able to be executed normally.

[0065] In addition, it can be understood that the specific processing flow of the lift event can also be set according to the actual situation.

[0066] In the touch event processing method provided by the embodiments of the present invention, when a touch event reported by a touch driver is received from a processor in a computer device, the type of the touch event will be determined; when the type is the press event type, the touch event will be processed according to a preset program code / module / interface, and a processing result of the touch event will be obtained; and when the type is the lift event type, the lift event will be processed correspondingly according to the processing result of the touch event of the press event type.

[0067] Based on this, the embodiments of the present invention decouple the processing function of the touch event from the touch driver, thereby reducing the difficulty of maintaining and modifying the processing function of the touch event in the later stage; and, because the processing function of the touch event is decoupled from the touch driver, when the processing function of the touch event needs to cooperate with a new driver, the transplantation of the processing function of the touch event can ignore the differences between the old and new drivers, thereby improving the transplantation efficiency.

[0068] Optionally, in a specific processing flow of a press event provided by the embodiments of the present invention, specifically refer to Figure 2 , which shows a schematic flowchart of a second touch event processing method provided by the embodiments of the present invention, and the S120 includes:

[0069] S121. When the type is the press event type, determine the first quantity of the touch coordinate points corresponding to the touch event obtained in real time.

[0070] S122. Store the touch coordinate points obtained in real time into a first preset cache array, and until the first quantity is equal to a preset discard point quantity, perform a discard point process on all the touch coordinate points in the first preset cache array by using a preset discard point algorithm.

[0071] S123. Store all the touch coordinate points in the first preset cache array after the discard point process into a second preset cache array, and store the touch coordinate points obtained in real time into the second preset cache array, and record the second quantity of the touch coordinate points stored in the second preset cache array.

[0072] S124, when the second quantity is equal to the preset filter point quantity, reset the second quantity to zero, and perform filter point processing on the touch coordinate points in the second preset cache array by using a preset filter point algorithm;

[0073] S125, send the second preset cache array after filter point processing and the generated press event reporting information to the corresponding processing module to obtain a processing result.

[0074] That is, when the touch drive obtains a press event, discard point processing and filter point processing will be performed on the touch coordinate points obtained in real time.

[0075] Among them, the discard point processing is to discard some invalid touch coordinate points within a period of time just after the press event is triggered, so as to ensure that subsequent other processing processes can be carried out with correct and valid touch coordinate points. It can be understood that when the user triggers a press event, mis-touching may occur, so the coordinate points mis-touched by the user, that is, the invalid coordinate points, need to be discarded.

[0076] The filter point processing is to discard the invalid coordinate points in the continuously obtained touch coordinate points after the press event has been triggered for a period of time. It can also be understood that during the triggering process of the press event, the user will more or less shake / move the finger or stylus, which may lead to mis-touching. Therefore, it is necessary to screen / filter the touch coordinate points generated during the triggering process of the press event to remove invalid / useless coordinate points, so as to ensure that subsequent other processing processes can be carried out with correct and valid touch coordinate points.

[0077] Further, when the first quantity, that is, the quantity of touch coordinate points generated after the press event is triggered, is less than or equal to the preset discard point quantity, it indicates that the quantity of currently generated touch coordinate points cannot meet the requirements of the preset discard point algorithm. Therefore, in the embodiment of the present invention, the touch coordinate points generated in real time are stored in the first preset cache array, and then when the first quantity is equal to the preset discard point quantity, the touch coordinate points stored in the first preset cache array are subjected to discard point processing by using the preset discard point algorithm.

[0078] During the discard point processing, in the embodiment of the present invention, the quantity of touch coordinate points generated after the press event is triggered, that is, the second quantity, is counted starting from the moment when the discard point processing is completed. At the same time, the touch coordinate points that have undergone discard point processing, that is, the touch coordinate points in the first preset cache array, are stored in a preset second preset cache array.

[0079] Exemplarily, taking time t0 and time t1 as examples, if a press event is triggered at time t0 and continuously generates touch coordinate points, and the number of touch coordinate points generated at time t1 is equal to the preset discard point number, then the number of touch coordinate points recorded from time t0 to time t1 is the first number, and the number of touch coordinate points recorded after time t1 and stored in the second preset cache array is the second number.

[0080] Similar to the foregoing discard point processing flow, when the second number is less than the preset filter point number, it indicates that the number of currently obtained touch coordinate points is insufficient to meet the requirements of the preset filter point algorithm. Therefore, the obtained touch coordinate points are stored in the second preset cache array. When the second number is equal to the preset filter point number, the preset filter point algorithm is used to perform filter point processing on the touch coordinate points in the second preset cache array, and the second number is reset to zero.

[0081] It can be understood that in the normal processing of each press event, the discard point processing in the embodiment of the present invention is only executed once, while the filter point processing is executed at least once. Therefore, after each filter point processing in the embodiment of the present invention, the second number is reset to zero, so that when the second number is equal to the preset filter point number next time, the touch coordinate points in the second preset cache array are filtered again.

[0082] It can also be understood that when the filter point processing has been executed once, it indicates that all the coordinate points that have undergone discard point processing and filter point processing at the current moment are relatively valid. Therefore, the embodiment of the present invention will send all the touch coordinate points in the second preset cache array that have undergone filter point processing to other processing modules for subsequent processing, and synchronously upload the press event reporting information to notify other processing modules.

[0083] In addition, it should be noted that the discard point processing and filter point processing in the embodiment of the present invention are based on the discard point algorithm and filter point algorithm in the prior art, so the specific processes of the discard point processing and filter point processing will not be described in detail.

[0084] Furthermore, it is also possible that since the embodiment of the present invention realizes the decoupling of touch drive and touch event processing, the embodiment of the present invention can also adjust various parameters / processing flows in touch event processing in a relatively simple manner. Therefore, in a feasible manner provided by the embodiment of the present invention, the method further includes:

[0085] According to the received adjustment instruction, at least one of the preset discard point number, the preset filter point number, the preset discard point algorithm, and the preset filter point algorithm is adjusted.

[0086] That is, due to the decoupling of touch driving and touch event processing in the embodiments of the present invention and the preset adjustment process, when an adjustment instruction is received, specific details in touch event processing can be correspondingly adjusted, such as adjusting one or more of the preset discard point quantity, preset filter point quantity, preset discard point algorithm, and preset filter point algorithm.

[0087] Furthermore, in a preferred manner provided by the embodiments of the present invention, the embodiments of the present invention configure multiple parameter values corresponding to different preset discard point quantities, different preset filter point quantities, different preset discard point algorithms, and different preset filter point algorithms respectively. Exemplarily, in a feasible manner, when the parameter value corresponding to the preset discard point quantity is 0, it means that the preset discard point quantity in the embodiments of the present invention adopts the default quantity, and when the parameter value corresponding to the preset discard point quantity is 1, it means that the value of the preset discard point quantity is the first preset quantity.

[0088] Based on this, due to the decoupling of touch driving and touch event processing in the embodiments of the present invention, one or more of the preset discard point quantity, preset filter point quantity, preset discard point algorithm, and preset filter point algorithm can be quickly adjusted, thereby improving the efficiency of later modification and maintenance.

[0089] Optionally, in a feasible manner provided by the embodiments of the present invention, specifically referring to Figure 3 , a flowchart of the third touch event processing method provided by the embodiments of the present invention is shown. That is, in this feasible manner, S125 includes:

[0090] S126, sending the second preset cache array after filter point processing and the generated press event reporting information to the corresponding processing module, and setting the identification bit corresponding to the processing result to the first preset value;

[0091] Furthermore, S130 includes:

[0092] S131, when the type is the lift event type and the identification bit corresponding to the processing result is the first preset value, clearing the first quantity and the second quantity, and setting the identification bit corresponding to the processing result to the second preset value;

[0093] S132, generating lift event reporting event information, and reporting the lift event reporting event information to the corresponding processing module.

[0094] That is, while the embodiments of the present invention complete filter point processing and press event reporting, they also set the identification bit corresponding to the processing result to the first preset value to indicate that discard point processing and filter point processing have been performed at the current moment.

[0095] It should be noted that the identification bit corresponding to the processing result in the embodiment of the present invention can be set to a first preset value and a second preset value. Among them, the first preset value indicates that the press event has been processed, and the second preset value indicates that the press event is being processed.

[0096] Further, when an object such as a user's finger or a stylus leaves the touch screen, that is, when it is lifted, the touch drive obtains the lift event and sends the lift event to the processor. When the processor receives the lift event and the identification bit corresponding to the processing result of the press event is the first preset value, it generates a lift event reporting event information and sends the lift event reporting event information to the corresponding processing module to complete the processing of the lift event.

[0097] When reporting, the embodiment of the present invention also clears the aforementioned first quantity and the aforementioned second quantity. It can be understood that since the triggering of the lift event indicates that the current press event has ended and a new press event will be triggered, it is necessary to clear the first quantity so that the discard point processing can be normally executed during the processing of the new press event.

[0098] Similarly, since the current second quantity belongs to the current press event, in order to enable the filtering point processing to be normally executed during the processing of the new press event, the second quantity is cleared.

[0099] Optionally, in a feasible manner provided by the embodiment of the present invention, after the S122, it further includes:

[0100] Set the preset discard point processing identifier to the first preset value;

[0101] Furthermore, the S123 includes:

[0102] If the discard point processing identifier is the first preset value, store all the touch coordinate points in the first preset cache array after discard point processing into the second preset cache array, store the touch coordinate points obtained in real time into the second preset cache array, and record the second quantity of the touch coordinate points stored in the second preset cache array;

[0103] After the S131, it further includes:

[0104] Set the discard point processing identifier to the second preset value.

[0105] That is to say, the embodiment of the present invention also sets a discard point processing identifier to avoid the situation where the discard point processing has not been completed but the filtered point coordinates have started to be collected. Therefore, the embodiment of the present invention sets the filtering point processing to start only when the discard point processing identifier is the first preset value, so as to ensure the reasonable progress of the press event.

[0106] Further, when the discard point processing identifier is the first preset value, it indicates that the discard point processing has been completed. Therefore, when the lift event processing ends, the discard point processing identifier needs to be adjusted to the second preset value to enable the normal progress of the discard point processing for the new press event. It can be understood that when the discard point processing identifier is the second preset value, it indicates that the discard point processing has not been completed.

[0107] Embodiment 2

[0108] Corresponding to the touch event processing method provided in Embodiment 1 of the present invention, Embodiment 2 of the present invention further provides a touch event processing device. Referring to Figure 4 , a schematic structural diagram of the touch event processing device provided in the embodiment of the present invention is shown. The touch event processing device 200 provided in the embodiment of the present invention includes:

[0109] An acquisition module 210, configured to determine the type of the touch event when obtaining the touch event reported by the touch driver, where the type includes a press event type and a lift event type;

[0110] A first processing module 220, configured to process the touch event to obtain a processing result when the type is the press event type;

[0111] A second processing module 230, configured to process the lift event according to the processing result when the type is the lift event type.

[0112] Optionally, in a feasible manner provided in the embodiment of the present invention, the first processing module includes:

[0113] A first quantity determination sub-module, configured to determine the first quantity of the touch coordinate points corresponding to the touch event obtained in real time when the type is the press event type;

[0114] A discard point processing sub-module, configured to store the touch coordinate points obtained in real time into a first preset cache array, and until the first quantity is equal to the preset discard quantity, perform discard point processing on all the touch coordinate points in the first preset cache array by using a preset discard point algorithm;

[0115] A second quantity recording sub-module, configured to store all the touch coordinate points in the first preset cache array after discard point processing into a second preset cache array, store the touch coordinate points obtained in real time into the second preset cache array, and record the second quantity of the touch coordinate points stored in the second preset cache array;

[0116] A filter point processing sub-module, configured to zero the second quantity when the second quantity is equal to the preset filter quantity, and perform filter point processing on the touch coordinate points in the second preset cache array by using a preset filter point algorithm;

[0117] The reporting sub-module is used to send the second preset cache array processed by the filter point and the generated press event reporting information to the corresponding processing module to obtain a processing result.

[0118] Optionally, in a feasible manner provided by an embodiment of the present invention, the device further includes:

[0119] An adjustment module is used to adjust at least one of the preset discard point quantity, the preset filter point quantity, the preset discard point algorithm, and the preset filter point algorithm according to the received adjustment instruction.

[0120] Optionally, in a feasible manner provided by an embodiment of the present invention, the filter point processing sub-module is further used to send the second preset cache array processed by the filter point and the generated press event reporting information to the corresponding processing module, and set the identification bit corresponding to the processing result to a first preset value;

[0121] The second processing module includes:

[0122] A clearing sub-module is used to clear the first quantity and the second quantity when the type is the lift event type and the identification bit corresponding to the processing result is the first preset value, and set the identification bit corresponding to the processing result to a second preset value;

[0123] An event reporting sub-module is used to generate lift event reporting event information and report the lift event reporting event information to the corresponding processing module.

[0124] Optionally, in a feasible manner provided by an embodiment of the present invention, the discard point processing sub-module further includes:

[0125] A first discard point processing identifier setting unit is used to set a preset discard point processing identifier to a first preset value;

[0126] The second quantity recording sub-module is further used to store all touch coordinate points in the first preset cache array processed by the discard point into the second preset cache array if the discard point processing identifier is the first preset value, store the touch coordinate points obtained in real time into the second preset cache array, and record the second quantity of the touch coordinate points stored in the second preset cache array;

[0127] The clearing sub-module further includes:

[0128] A second discard point processing identifier setting unit is used to set the discard point processing identifier to a second preset value.

[0129] The touch event processing device 200 provided by the embodiments of the present application can implement each process of the touch event processing method corresponding to Embodiment 1 and achieve the same technical effects. To avoid repetition, details are not described herein again.

[0130] An embodiment of the present invention further provides a computer device, including a memory and a processor. The memory stores a computer program, and when the computer program runs on the processor, it executes the touch event processing method corresponding to Embodiment 1.

[0131] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program runs on a processor, it executes the touch event processing method corresponding to Embodiment 1.

[0132] In several embodiments provided by the present application, it should be understood that the disclosed device and method can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architectures, functions, and operations of the device, method, and computer program product according to multiple embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the structure diagram and / or flowchart, as well as the combination of blocks in the structure diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0133] In addition, in each embodiment of the present invention, each functional module or unit may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0134] When the above-mentioned functions are implemented in the form of software function modules 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 the present invention, in essence, or the part that contributes to the prior art or a part of this 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 for causing a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.

[0135] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention.

Claims

1. A touch event processing method, characterized in that, Including: When a touch event reported by a touch driver is obtained, determine the type of the touch event, where the type includes a press event type and a lift event type; When the type is the press event type, process the touch event to obtain a processing result; When the type is the lift event type, process the lift event according to the processing result; The step of when the type is the press event type, process the touch event to obtain a processing result includes: When the type is the press event type, determine the first quantity of touch coordinate points corresponding to the touch event obtained in real time; Store the touch coordinate points obtained in real time into a first preset cache array, and until the first quantity is equal to a preset discard point quantity, perform a discard point process on all the touch coordinate points in the first preset cache array by using a preset discard point algorithm; Store all the touch coordinate points in the first preset cache array after the discard point process into a second preset cache array, store the touch coordinate points obtained in real time into the second preset cache array, and record the second quantity of the touch coordinate points stored in the second preset cache array; When the second quantity is equal to a preset filter point quantity, reset the second quantity to zero, and perform a filter point process on the touch coordinate points in the second preset cache array by using a preset filter point algorithm; Send the second preset cache array after the filter point process and the generated press event reporting information to a corresponding processing module to obtain a processing result; The step of sending the second preset cache array after the filter point process and the generated press event reporting information to a corresponding processing module to obtain a processing result includes: Send the second preset cache array after the filter point process and the generated press event reporting information to a corresponding processing module, and set the flag bit corresponding to the processing result to a first preset value; The step of when the type is the lift event type, process the lift event according to the processing result includes: When the type is the lift event type and the flag bit corresponding to the processing result is the first preset value, clear the first quantity and the second quantity, and set the flag bit corresponding to the processing result to a second preset value; Generate lift event reporting event information, and report the lift event reporting event information to a corresponding processing module; After storing the touch coordinate points obtained in real time into the first preset cache array, and until the first quantity is equal to the preset discard point quantity, performing a discard point process on all the touch coordinate points in the first preset cache array by using the preset discard point algorithm, further includes: Set a preset discard point process identifier to a first preset value; The step of storing all the touch coordinate points in the first preset cache array after the discard point process into the second preset cache array, storing the touch coordinate points obtained in real time into the second preset cache array, and recording the second quantity of the touch coordinate points stored in the second preset cache array includes: If the discard point processing identifier is the first preset value, store all touch coordinate points in the first preset cache array after discard point processing into the second preset cache array, store the touch coordinate points obtained in real time into the second preset cache array, and record the second quantity of the touch coordinate points stored in the second preset cache array; When the type is the lift event type and the flag bit corresponding to the processing result is the first preset value, after clearing the first quantity and the second quantity and setting the flag bit corresponding to the processing result to the second preset value, it further includes: Set the discard point processing identifier to the second preset value.

2. The touch event processing method according to claim 1, wherein The method further includes: According to the received adjustment instruction, adjust at least one of the preset discard point quantity, the preset filter point quantity, the preset discard point algorithm, and the preset filter point algorithm.

3. A touch event processing device, characterized in that, It includes: An acquisition module, configured to determine the type of the touch event when the touch event reported by the touch drive is acquired, where the type includes a press event type and a lift event type; A first processing module, configured to process the touch event to obtain a processing result when the type is the press event type; A second processing module, configured to process the lift event according to the processing result when the type is the lift event type; The first processing module includes: A first quantity determination sub-module, configured to determine the first quantity of the touch coordinate points corresponding to the touch event obtained in real time when the type is the press event type; A discard point processing sub-module, configured to store the touch coordinate points obtained in real time into the first preset cache array, and when the first quantity is equal to the preset discard point quantity, perform discard point processing on all touch coordinate points in the first preset cache array using the preset discard point algorithm; A second quantity recording sub-module, configured to store all touch coordinate points in the first preset cache array after discard point processing into the second preset cache array, store the touch coordinate points obtained in real time into the second preset cache array, and record the second quantity of the touch coordinate points stored in the second preset cache array; A filter point processing sub-module, configured to zero the second quantity when the second quantity is equal to the preset filter point quantity, and perform filter point processing on the touch coordinate points in the second preset cache array using the preset filter point algorithm; A reporting sub-module, configured to send the second preset cache array after filter point processing and the generated press event reporting information to the corresponding processing module to obtain a processing result; The filter point processing sub-module is further configured to send the second preset cache array after filter point processing and the generated press event reporting information to the corresponding processing module, and set the flag bit corresponding to the processing result to the first preset value; The second processing module includes: A clearing sub-module, configured to clear the first quantity and the second quantity and set the flag bit corresponding to the processing result to the second preset value when the type is the lift event type and the flag bit corresponding to the processing result is the first preset value; An event reporting sub-module, configured to generate event information for reporting a lift event, and report the event information for reporting the lift event to a corresponding processing module; The discard point processing sub-module further includes: A first discard point processing identifier setting unit, configured to set a preset discard point processing identifier to a first preset value; The second quantity recording sub-module is further configured to, if the discard point processing identifier is the first preset value, store all touch coordinate points in a first preset cache array that have undergone discard point processing into a second preset cache array, store the touch coordinate points obtained in real time into the second preset cache array, and record a second quantity of the touch coordinate points stored in the second preset cache array; The clearing sub-module further includes: A second discard point processing identifier setting unit, configured to set the discard point processing identifier to a second preset value.

4. The touch event processing device according to claim 3, wherein The device further includes: An adjustment module, configured to adjust at least one of the preset discard point quantity, the preset filter point quantity, the preset discard point algorithm, and the preset filter point algorithm according to an received adjustment instruction.

5. A computer device, characterized in that, It includes a memory and a processor, the memory stores a computer program, and when the computer program runs on the processor, it executes the touch event processing method according to any one of claims 1-2.

6. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program runs on the processor, it executes the touch event processing method according to any one of claims 1-2.

Citation Information

Patent Citations

  • Mobile terminal, input processing method and user equipment

    CN105487705A