Patent Description:
A computing device typically includes a user interface that may be used to interact with the computing device. The user interface may include a display and/or input devices such as a keyboard, mice, and touch-sensitive surfaces for interacting with various aspects of the user interface. In some devices with a touch-sensitive surface as an input device, a first set of touch-based gestures (e.g., two or more of: tap, double tap, horizontal swipe, vertical swipe, pinch, depinch, two finger swipe) are recognized as proper inputs in a particular context (e.g., in a particular mode of a first application), and other, different sets of touch-based gestures are recognized as proper inputs in other contexts (e.g., different applications and/or different modes or contexts within the first application). As a result, the software and logic required for recognizing and responding to touch-based gestures can become complex, and can require revision each time an application is updated or a new application is added to the computing device. These and similar issues may arise in user interfaces that utilize input sources other than touch-based gestures.

Thus, it would be desirable to have a comprehensive framework or mechanism for recognizing touch-based gestures and events, as well as gestures and events from other input sources, that is easily adaptable to virtually all contexts or modes of all application programs on a computing device, and that requires little or no revision when an application is updated or a new application is added to the computing device. <CIT> discloses customized procedures to manipulate and control objects in graphic implementations. A customized procedure is executed at various "trigger" points including: the expiration of a specified period of time; the opening or closing of a window; or, when input from a mouse input device is received. There are several different types of mouse events: mouse button down; mouse move with button down; mouse move with no button down; and mouse button up. A graphic object associated with a customized procedure that is triggered by a mouse event is called a "button object. " The customized procedure associated with a button object has four parameters: buttonobj, hitobj, win, and eventinfo. The buttonobj parameter refers to the graphic object having a button procedure that is currently being executed. The hitobj parameter refers to the graphic object that was selected triggering the mouse event. The present invention provides a tree-like organization for grouping its graphic objects. If the selected object does not have an associated button procedure, the tree-like structure is traversed upward to find an object that does have an associated button procedure. The win parameter identifies the window that the mouse event occurred in. The eventinfo parameter points to a record containing information pertaining to the mouse event that triggered the procedure execution. A customized procedure driven by a mouse event transforms a graphic object into a "button" object.

To address the aforementioned drawbacks, the present invention provides a method as set out in the claims appended hereto, to which the reader's attention is now drawn.

In some embodiments, an apparatus is provided that comprises one or more processors, memory, and one or more programs stored in the memory, which are configured to manage execution of one or more programmatic layers of a programmatic hierarchy with a plurality of programmatic layers. The one or more programs include one or more software elements, each software element being associated with a particular programmatic layer, wherein each particular programmatic layer includes one or more event recognizers. The event recognizers have an event definition based on one or more sub-events, and an event handler, wherein the event handler specifies an action for a target and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to the event definition. The apparatus also includes an event delivery program, which, when executed by the one or more processors of the apparatus, cause the apparatus to detect a sequence of one or more sub-events; identify one of the programmatic layers of the programmatic hierarchy as a hit layer, wherein the hit layer establishes which programmatic layers in the programmatic hierarchy are actively involved programmatic layers; and deliver a respective sub-event to event recognizers for each actively involved programmatic layer within the programmatic hierarchy, wherein each event recognizer for actively involved layers in the programmatic hierarchy processes the respective sub-event prior to processing a next sub-event in the sequence of sub-events.

Like reference numerals refer to corresponding parts throughout the drawings.

In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to one of ordinary skill in the art that the present invention may be practiced without these specific details.

For example, a first contact could be termed a second contact, and, similarly, a second contact could be termed a first contact. The first contact and the second contact are both contacts, but they are not the same contact.

The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only. As used in the description of the invention and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

As used herein, the term "if" may be construed to mean "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [a stated condition or event] is detected" may be construed to mean "upon determining" or "in response to determining" or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)," depending on the context.

As noted above, in some devices with a touch-sensitive surface as an input device, a first set of touch-based gestures (e.g., two or more of: tap, double tap, horizontal swipe, vertical swipe) are recognized as proper inputs in a particular context (e.g., in a particular mode of a first application), and other, different sets of touch-based gestures are recognized as proper inputs in other contexts (e.g., different applications and/or different modes or contexts within the first application). As a result, the software and logic required for recognizing and responding to touch-based gestures can become complex, and can require revision each time an application is updated or a new application is added to the computing device.

Touch-based gestures are events. Upon recognition of a predefined event, e.g., an event that corresponds to a proper input in the current context of an application, information concerning the event is delivered to the application. In the context of this document, all touch-based gestures correspond to events. Furthermore, each respective event is defined as a sequence of sub-events. In devices that have a multi-touch display device (often herein called "screens") or other multi-touch sensitive surface, and that accept multi-touch-based gestures, the sub-events that define a multi-touched based event may include multi-touch sub-events (requiring two or more fingers to be simultaneously in contact with the device's touch-sensitive surface). For example, in a device having a multi-touch sensitive display, a respective multi-touch sequence of sub-events may begin when a user's finger first touches the screen. Additional sub-events may occur when one or more additional fingers subsequently or concurrently touch the screen, and yet other sub-events may occur when all of the fingers touching the screen move across the screen. The sequence ends when the last of the user's fingers is lifted from the screen.

When using touch-based gestures to control an application running in a device having a touch-sensitive surface, touches have both temporal and spatial aspects. The temporal aspect, called a phase, indicates when a touch has just begun, whether it is moving or stationary, and when it ends-that is, when the finger is lifted from the screen. A spatial aspect of a touch is the set of views or user interface windows in which the touch occurs. The views or windows in which a touch is detected may correspond to programmatic levels within a programmatic or view hierarchy. The lowest level view in which a touch is detected is called the hit view, and the set of events that are recognized as proper inputs may be determined based, at least in part, on the hit view of the initial touch that begins a touch-based gesture.

<FIG> are block diagrams illustrating electronic devices <NUM> and <NUM>, according to some embodiments. The electronic devices <NUM> and <NUM> may be any electronic device including, but not limited to, a desktop computer system, a laptop computer system, mobile phone, a smart phone, a personal digital assistant, or a navigation system. The electronic device may also be a portable electronic device with a touch screen display (e.g., display <NUM>, <FIG>) configured to present a user interface, a computer with a touch screen display configured to present a user interface, a computer with a touch sensitive surface and a display configured to present a user interface, or any other form of computing device, including without limitation, consumer electronic devices, mobile telephones, video game systems, electronic music players, tablet PCs, electronic book reading systems, e-books, PDAs, electronic organizers, email devices, laptops or other computers, kiosk computers, vending machines, smart appliances, etc. The electronic devices <NUM> and <NUM> may include user interfaces <NUM>-A and <NUM>-B, respectively.

In some embodiments, the electronic devices <NUM> and <NUM> include a touch screen display. In these embodiments, the user interface <NUM> (i.e., <NUM>-A or <NUM>-B) may include an on-screen keyboard (not depicted) that is used by a user to interact with the electronic devices <NUM> and <NUM>. Alternatively, a keyboard may be separate and distinct from the electronic devices <NUM> and <NUM>. For example, a keyboard may be a wired or wireless keyboard coupled to the electronic devices <NUM> or <NUM>.

In some embodiments, the electronic device <NUM> includes a display <NUM> and one or more input devices <NUM>-A (e.g., keyboard, mouse, trackball, microphone, physical button(s), touchpad, etc.) that are coupled to the electronic device <NUM>. In these embodiments, one or more of the input devices <NUM>-A may optionally be separate and distinct from the electronic device <NUM>. For example, the one or more input devices may include one or more of: a keyboard, a mouse, a trackpad, a trackball, and an electronic pen, any of which may optionally be separate from the electronic device. Optionally, the device <NUM> or <NUM> may include one or more sensors <NUM>, such as one or more accelerometers, gyroscopes, GPS systems, speakers, infrared (IR) sensors, biometric sensors, cameras, etc. It is noted that the description above of various exemplary devices as input devices <NUM> or as sensors <NUM> is of no significance to the operation of the embodiments described herein, and that any input or sensor device herein described as an input device may equally well be described as a sensor, and vice versa. In some embodiments, signals produced by the one or more sensors <NUM> are used as input sources for detecting events.

In some embodiments, the electronic device <NUM> includes a touch-sensitive display <NUM> (i.e., a display having a touch-sensitive surface) and one or more input devices <NUM>-B that are coupled to the electronic device <NUM>. In some embodiments, the touch-sensitive display <NUM> has the ability to detect two or more distinct, concurrent (or partially concurrent) touches, and in these embodiments, the display <NUM> is sometimes herein called a multitouch display or multitouch-sensitive display.

In some embodiments of the electronic device <NUM> or <NUM> discussed herein, the input devices <NUM> are disposed in the electronic device <NUM> or <NUM>. In other embodiments, one or more of the input devices <NUM> is separate and distinct from the electronic device <NUM> or <NUM>; for example, one or more of the input devices <NUM> may be coupled to the electronic device <NUM> or <NUM> by a cable (e.g., USB cable) or wireless connection (e.g., Bluetooth connection).

When using the input devices <NUM>, or when performing a touch-based gesture on the touch-sensitive display <NUM> of an electronic device <NUM> or <NUM>, respectively, the user generates a sequence of sub-events that are processed by one or more CPUs <NUM> of the electronic device <NUM> or <NUM>. In some embodiments, the one or more CPUs <NUM> of the electronic device <NUM> or <NUM> process the sequence of sub-events to recognize events.

The electronic device <NUM> or <NUM> typically includes one or more single- or multi-core processing units ("CPU" or "CPUs") <NUM> as well as one or more network or other communications interfaces <NUM>, respectively. The electronic device <NUM> or <NUM> includes memory <NUM> and one or more communication buses <NUM>, respectively, for interconnecting these components. The communication buses <NUM> may include circuitry (sometimes called a chipset) that interconnects and controls communications between system components (not depicted herein). As discussed briefly above, the electronic devices <NUM> and <NUM> optionally include user interfaces <NUM> that include a display <NUM> and multitouch display <NUM>, respectively. Further, the electronic devices <NUM> and <NUM> typically include input devices <NUM> (e.g., keyboard, mouse, touch screens, touch sensitive surfaces, multitouch screens, keypads, etc.). In some embodiments, the input devices include an on-screen input device (e.g., a touch-sensitive surface of a display device). Memory <NUM> may include high-speed random access memory, such as DRAM, SRAM, DDR RAM or other random access solid state memory devices; and may include non-volatile memory, such as one or more magnetic disk storage devices, optical disk storage devices, flash memory devices, or other non-volatile solid state storage devices. Memory <NUM> may optionally include one or more storage devices remotely located from the CPU(s) <NUM>. Memory <NUM>, or alternately the non-volatile memory device(s) within memory <NUM>, comprise a computer readable storage medium. In some embodiments, memory <NUM> stores the following programs, modules and data structures, or a subset thereof:.

Each of the above identified elements may be stored in one or more of the previously mentioned memory devices, and corresponds to a set of instructions for performing functions described herein. The set of instructions can be executed by one or more processors (e.g., the one or more CPUs <NUM>). The above identified modules or programs (i.e., sets of instructions) need not be implemented as separate software programs, procedures or modules, and thus various subsets of these modules may be combined or otherwise rearranged in various embodiments. In some embodiments, memory <NUM> may store a subset of the modules and data structures identified above. Furthermore, memory <NUM> may store additional modules and data structures not described above.

<FIG> is a diagram of an input/output processing stack <NUM> of an exemplary electronic device or apparatus (e.g., device <NUM> or <NUM>) according to some embodiments of the invention. The hardware (e.g., electronic circuitry) <NUM> of the device is at the base level of the input/output processing stack <NUM>. Hardware <NUM> can include various hardware interface components, such as the components depicted in <FIG> and/or 1B. Hardware <NUM> can also include one or more of the above mentioned sensors <NUM>. All the other elements (<NUM>-<NUM>) of the input/output processing stack <NUM> are software procedures, or portions of software procedures, that process inputs received from the hardware <NUM> and generate various outputs that are presented through a hardware user interface (e.g., one or more of a display, speakers, device vibration actuator).

A driver or a set of drivers <NUM> communicates with the hardware <NUM>. The drivers <NUM> can receive and process input data received from the hardware <NUM>. A core Operating System ("OS") <NUM> can communicate with the driver(s) <NUM>. The core OS <NUM> can process raw input data received from the driver(s) <NUM>. In some embodiments, the drivers <NUM> can be considered to be a part of the core OS <NUM>.

A set of OS application programming interfaces ("OS APIs") <NUM>, are software procedures that communicate with the core OS <NUM>. In some embodiments, the APIs <NUM> are included in the device's operating system, but at a level above the core OS <NUM>. The APIs <NUM> are designed for use by applications running on the electronic devices or apparatuses discussed herein. User interface (UI) APIs <NUM> can utilize the OS APIs <NUM>. Application software ("applications") <NUM> running on the device can utilize the UI APIs <NUM> in order to communicate with the user. The UI APIs <NUM> can, in turn, communicate with lower level elements, ultimately communicating with various user interface hardware, e.g., multitouch display <NUM>.

While each layer input/output processing stack <NUM> can utilize the layer underneath it, that is not always required. For example, in some embodiments, applications <NUM> can occasionally communicate with OS APIs <NUM>. In general, layers at or above the OS API layer <NUM> may not directly access the Core OS <NUM>, driver(s) <NUM>, or hardware <NUM>, as these layers are considered private. Applications in layer <NUM> and the UI API <NUM> usually direct calls to the OS API <NUM>, which in turn, accesses the layers Core OS <NUM>, driver(s) <NUM>, and hardware <NUM>.

Stated in another way, one or more hardware elements <NUM> of the electronic device <NUM> or <NUM>, and software running on the device, such as, for example, drivers <NUM> (depicted in <FIG>), core OS (operating system) <NUM> (depicted in <FIG>), operating system API software <NUM> (depicted in <FIG>), and Application and User Interface API software <NUM> (depicted in <FIG>) detect input events (which may correspond to sub-events in a gesture) at one or more of the input device(s) <NUM> and/or a touch-sensitive display <NUM> and generate or update various data structures (stored in memory of the device <NUM> or <NUM>) used by a set of currently active event recognizers to determine whether and when the input events correspond to an event to be delivered to an application <NUM>. Embodiments of event recognition methodologies, apparatus and computer program products are described in more detail below.

<FIG> depicts an exemplary view hierarchy <NUM>, which in this example is a search program displayed in outermost view <NUM>. Outermost view <NUM> generally encompasses the entire user interface a user may directly interact with, and includes subordinate views, e.g.,.

In this example, each subordinate view includes lower-level subordinate views. In other examples, the number of view levels in the hierarchy <NUM> may differ in different branches of the hierarchy, with one or more subordinate views having lower-level subordinate views, and one or more other subordinate views not have any such lower-level subordinate views. Continuing with the example shown in <FIG>, search results panel <NUM> contains separate subordinate views <NUM> (subordinate to the panel <NUM>) for each search result. Here, this example shows one search result in a subordinate view called the maps view <NUM>. Search field <NUM> includes a subordinate view herein called the clear contents icon view <NUM>, which clears the contents of the search field when a user performs a particular action (e.g., a single touch or tap gesture) on the clear contents icon in the view <NUM>. Home row <NUM> includes subordinate views <NUM>-<NUM>, <NUM>-<NUM>, <NUM>-<NUM>, and <NUM>-<NUM>, which respectively correspond to a contacts application, an email application, a web browser, and an iPod music interface.

A touch sub-event <NUM>-<NUM> is represented in outermost view <NUM>. Given the location of touch sub-event <NUM>-<NUM> over both the search results panel <NUM>, and maps view <NUM>, the touch sub-event is also represented over those views as <NUM>-<NUM> and <NUM>-<NUM>, respectively. Actively involved views of the touch sub-event include the views search results panel <NUM>, maps view <NUM> and outermost view <NUM>. Additional information regarding sub-event delivery and actively involved views is provided below with reference to <FIG> and <FIG>.

Views (and corresponding programmatic levels) can be nested. In other words, a view can include other views. Consequently, the software element(s) (e.g., event recognizers) associated with a first view can include or be linked to one or more software elements associated with views within the first view. While some views can be associated with applications, others can be associated with high level OS elements, such as graphical user interfaces, window managers, etc..

To simplify subsequent discussion, reference will generally be made only to views and the view hierarchy, but it must be understood that in some embodiments, the method may operate with a programmatic hierarchy with a plurality of programmatic layers, and/or a view hierarchy.

<FIG> and <FIG> depict exemplary methods and structures related to event recognizers. <FIG> depicts methods and data structures for event handling when event handlers are associated with particular views within a hierarchy of views. <FIG> depicts methods and data structures for event handling when event handlers are associated with particular levels within a hierarchy of programmatic levels. Event recognizer global methods <NUM> and <NUM> include hit view and hit level determination modules <NUM> and <NUM>, respectively, active event recognizer determination modules <NUM> and <NUM>, and sub-event delivery modules <NUM> and <NUM>.

Hit view and hit level determination modules, <NUM> and <NUM>, respectively, provide software procedures for determining where a sub-event has taken place within one or more views, e.g., the exemplary view hierarchy <NUM> depicted in <FIG>, which has three main branches.

The hit view determination module <NUM> of <FIG>, receives information related to a sub-event, e.g., a user touch represented as <NUM>-<NUM> on the outermost view <NUM>, on a search result (map view <NUM>) and the search results panel view <NUM>. The hit view determination module <NUM> identifies a hit-view as the lowest view in the hierarchy which should handle the sub-event. The hit view is the lowest level view in which an initiating sub-event (i.e., the first sub-event in the sequence of sub-events that form an event or potential event) occurs. Once the hit-view is identified, it will receive all sub-events related to the same touch or input source for which the hit view was identified.

In some embodiments, the hit level determination module <NUM> of <FIG> may utilize an analogous process.

Active event recognizer determination modules <NUM> and <NUM> of event recognizer global methods <NUM> and <NUM>, respectively, determine which view or views within a view hierarchy should receive a particular sequence of sub-events. <FIG> depicts an exemplary set of active views, <NUM>, <NUM> and <NUM>, that receive the sub-event <NUM>. In the example of <FIG>, the active event recognizer determination module <NUM> would determine that the top level view <NUM>, search results panel <NUM> and maps view <NUM> are actively involved views because these views include the physical location of the touch represented by sub-event <NUM>. It is noted that even if touch sub-event <NUM> were entirely confined to the area associated with map view <NUM>, search results panel <NUM> and top level view <NUM> would still remain in the actively involved views since the search results panel <NUM> and the top level view <NUM> are ancestors of map view <NUM>.

In some embodiments, active event recognizer determination modules <NUM> and <NUM> utilize analogous processes.

Sub-event delivery module <NUM> delivers sub-events to event recognizers for actively involved views. Using the example of <FIG>, a user's touch is represented in different views of the hierarchy by touch marks <NUM>-<NUM>, <NUM>-<NUM>, and <NUM>-<NUM>. In some embodiments, sub-event data representing this user's touch is delivered by the sub-event delivery module <NUM> to event recognizers at the actively involved views, i.e., top level view <NUM>, search results panel <NUM> and maps view <NUM>. Further, the event recognizers of a view can receive subsequent sub-events of an event that starts within the view (e.g., when an initial sub-event occurs within the view). Stated in another way, a view can receive sub-events associated with user interactions beginning in the view, even if it continues outside of the view.

In some embodiments, sub-event delivery module <NUM> delivers sub-events to event recognizers for actively involved programmatic levels in a process analogous to that used by sub-event delivery module <NUM>.

In some embodiments, a separate event recognizer structure <NUM> or <NUM> is generated and stored in memory of the device for each actively involved event recognizer. Event recognizer structures <NUM> and <NUM> typically include an event recognizer state <NUM>, <NUM>, respectively (discussed in greater detail below when referring to <FIG> and <FIG>), and event recognizer specific code <NUM>, <NUM>, respectively, having state machines <NUM>, <NUM>, respectively. Event recognizer structure <NUM> also includes a view hierarchy reference <NUM>, while event recognizer structure <NUM> includes a programmatic hierarchy reference <NUM>. Each instance of a particular event recognizer references exactly one view or programmatic level. View hierarchy reference <NUM> or programmatic hierarchy reference <NUM> (for a particular event recognizer) are used to establish which view or programmatic level is logically coupled to the respective event recognizer.

View metadata <NUM> and level metadata <NUM> may include data regarding a view or level, respectively. View or level metadata may include at least the following properties that may influence sub-event delivery to event recognizers:.

Event recognizer structures <NUM> and <NUM> may include metadata <NUM>, <NUM>, respectively. In some embodiments, the metadata <NUM>, <NUM> includes configurable properties, flags, and lists that indicate how the event delivery system should perform sub-event delivery to actively involved event recognizers. In some embodiments, metadata <NUM>, <NUM> may include configurable properties, flags, and lists that indicate how event recognizers may interact with one another. In some embodiments, metadata <NUM>, <NUM> may include configurable properties, flags, and lists that indicate whether sub-events are delivered to varying levels in the view or programmatic hierarchy. In some embodiments, the combination of event recognizer metadata <NUM>, <NUM> and view or level metadata (<NUM>, <NUM>, respectively) are both be used to configure the event delivery system to: a) perform sub-event delivery to actively involved event recognizers, b) indicate how event recognizers may interact with one another, and c) indicate whether and when sub-events are delivered to various levels in the view or programmatic hierarchy.

It is noted that, in some embodiments, a respective event recognizer sends an event recognition action <NUM>, <NUM> to its respective target <NUM>, <NUM>, as specified by fields of the event recognizer's structure <NUM>, <NUM>. Sending an action to a target is distinct from sending (and deferred sending) sub-events to a respective hit view or level.

The metadata properties stored in a respective event recognizer structure <NUM>, <NUM> of a corresponding event recognizer includes at least:.

In some embodiments, the exception list <NUM>, <NUM> can also be used by non-exclusive event recognizers. In particular, when a non-exclusive event recognizer recognizes an event, subsequent sub-events are not delivered to the exclusive event recognizers associated with the currently active views, except for those exclusive event recognizers listed in the exception list <NUM>, <NUM> of the event recognizer that recognized the event.

In some embodiments, event recognizers may be configured to utilize the touch cancellation flag in conjunction with the delay touch end flag to prevent unwanted sub-events from being delivered to the hit view. For example, the definition of a single tap gesture and the first half of a double tap gesture are identical. Once a single tap event recognizer successfully recognizes a single tap, an undesired action could take place. If the delay touch end flag is set, the single tap event recognizer is prevented from sending sub-events to the hit view until a single tap event is recognized. In addition, the wait-for list of the single tap event recognizer may identify the double-tap event recognizer, thereby preventing the single tap event recognizer from recognizing a single tap until the double-tap event recognizer has entered the event impossible state. The use of the wait-for list avoids the execution of actions associated with a single tap when a double tap gesture is performed. Instead, only actions associated with a double tap will be executed, in response to recognition of the double tap event.

Turning in particular to forms of user touches on touch-sensitive surfaces, as noted above, touches and user gestures may include an act that need not be instantaneous, e.g., a touch can include an act of moving or holding a finger against a display for a period of time. A touch data structure, however, defines the state of a touch (or, more generally, the state of any input source) at a particular time. Therefore, the values stored in a touch data structure may change over the course of a single touch, enabling the state of the single touch at different points in time to be conveyed to an application.

Each touch data structure can comprise various fields. In some embodiments, touch data structures may include data corresponding to at least the touch-specific fields <NUM> in <FIG> or input source specific fields <NUM> in <FIG>.

For example, a "first touch for view" field <NUM> in <FIG> (<NUM> for "first touch for level" in <FIG>) can indicate whether the touch data structure defines the first touch for the particular view (since the software element implementing the view was instantiated). A "time stamp" field <NUM>, <NUM> can indicate the particular time to which the touch data structure relates.

Optionally, an "info" field <NUM>, <NUM> can be used to indicate if a touch is a rudimentary gesture. For example, the "info" field <NUM>, <NUM> can indicate whether the touch is a swipe and, if so, in which direction the swipe is oriented. A swipe is a quick drag of one or more fingers in a straight direction. API implementations (discussed below) can determine if a touch is a swipe and pass that information to the application through the "info" field <NUM>, <NUM>, thus alleviating the application of some data processing that would have been necessary if the touch were a swipe.

Optionally, a "tap count" field <NUM> in <FIG> ("event count" field <NUM> in <FIG>) can indicate how many taps have been sequentially performed at the position of the initial touch. A tap can be defined as a quick pressing and lifting of a finger against a touch-sensitive panel at a particular position. Multiple sequential taps can occur if the finger is again pressed and released in quick succession at the same position of the panel. An event delivery system <NUM> can count taps and relay this information to an application through the "tap count" field <NUM>. Multiple taps at the same location are sometimes considered to be a useful and easy to remember command for touch enabled interfaces. Thus, by counting taps, the event delivery system <NUM> can again alleviate some data processing from the application.

A "phase" field <NUM>, <NUM> can indicate a particular phase the touch-based gesture is currently in. The phase field <NUM>, <NUM> can have various values, such as "touch phase began" which can indicate that the touch data structure defines a new touch that has not been referenced by previous touch data structures. A "touch phase moved" value can indicate that the touch being defined has moved from a prior position. A "touch phase stationary" value can indicate that the touch has stayed in the same position. A "touch phase ended" value can indicate that the touch has ended (e.g., the user has lifted his/her finger from the surface of a multi touch display). A "touch phase cancelled" value can indicate that the touch has been cancelled by the device. A cancelled touch can be a touch that is not necessarily ended by a user, but which the device has determined to ignore. For example, the device can determine that the touch is being generated inadvertently (i.e., as a result of placing a portable multi touch enabled device in one's pocket) and ignore the touch for that reason. Each value of the "phase field" <NUM>, <NUM> can be a integer number.

Thus, each touch data structure can define what is happening with a touch (or other input source) at a particular time (e.g., whether the touch is stationary, being moved, etc.) as well as other information associated with the touch (such as position). Accordingly, each touch data structure can define the state of a particular touch at a particular moment in time. One or more touch data structures referencing the same time can be added in a touch event data structure that can define the states of all touches a particular view is receiving at a moment in time (as noted above, some touch data structures may also reference touches that have ended and are no longer being received). Multiple touch event data structures can be sent to the software implementing a view as time passes, in order to provide the software with continuous information describing the touches that are happening in the view.

The ability to handle complex touch-based gestures, optionally including multi-touch gestures, can add complexity to the various software elements. In some cases, such additional complexity can be necessary to implement advanced and desirable interface features. For example, a game may require the ability to handle multiple simultaneous touches that occur in different views, as games often require the pressing of multiple buttons at the same time, or combining accelerometer data with touches on a touch-sensitive surface. However, some simpler applications and/or views (and their associated software elements) need not require advanced interface features. For example, a simple soft button (i.e., a button that is displayed on a touch-sensitive display) may operate satisfactorily with single touches, rather than multi-touch functionality. In these cases, the underlying OS may send unnecessary or excessive touch data (e.g., multi-touch data) to a software element associated with a view that is intended to be operable by single touches only (e.g., a single touch or tap on a soft button). Because the software element may need to process this data, it may need to feature all the complexity of a software element that handles multiple touches, even though it is associated with a view for which only single touches are relevant. This can increase the cost of development of software for the device, because software elements that have been traditionally easy to program in a mouse interface environment (i.e., various buttons, etc.) may be much more complex in a multi-touch environment.

It shall be understood, however, that the foregoing discussion regarding the complexity of evaluating and processing user touches on touch-sensitive surfaces also applies to all forms of user inputs to operate electronic devices <NUM> and <NUM> with input-devices, <NUM> and <NUM>, respectively, not all of which are initiated on touch screens, e.g., coordinating mouse movement and mouse button presses with or without single or multiple keyboard presses or holds, user movements taps, drags, scrolls, etc., on touch-pads, pen stylus inputs, oral instructions, detected eye movements, biometric inputs, detected physiological change in a user, and/or any combination thereof, which may be utilized as inputs corresponding to sub-events which define an event to be recognized.

<FIG> depicts an event recognizer state machine <NUM> containing four states. By managing state transitions in event recognizer state machine <NUM> based on received sub-events, an event recognizer effectively expresses an event definition. For example, a tap gesture may be effectively defined by a sequence of two, or optionally, three sub-events. First, a touch should be detected, and this will be sub-event <NUM>. For example, the touch sub-event may be a user's finger touching a touch-sensitive surface in a view that includes the event recognizer having state machine <NUM>. Second, an optional measured delay where the touch does not substantially move in any given direction (e.g., any movement of the touch position is less than a predefined threshold, which may be measured as a distance (e.g., <NUM>) or as a number of pixels (e.g., <NUM> pixels) on the display), and the delay is sufficiently short, would serve as sub-event <NUM>. Finally, termination of the touch (e.g., liftoff of the user's finger from the touch-sensitive surface) will serve as sub-event <NUM>. By coding the event recognizer state machine <NUM> to transition between states based upon receiving these sub-events, the event recognizer state machine <NUM> effectively expresses a tap gesture event definition.

Regardless of event type, the event recognizer state machine <NUM> begins in an event recognition begins state <NUM>, and may progress to any of the remaining states depending on what sub-event is received. To facilitate discussion of the event recognizer state machine <NUM>, the direct paths from the event recognition begins state <NUM> to the event recognized state <NUM>, the event possible state <NUM>, and event impossible state <NUM> will be discussed, followed by a description of the paths leading from the event possible state <NUM>.

Starting from event recognition begins state <NUM>, if a sub-event is received that, by itself comprises the event definition for an event, the event recognizer state machine <NUM> will transition to event recognized state <NUM>.

Starting from state event recognition begins <NUM>, if a sub-event is received that is not the first sub-event in an event definition, the event recognizer state machine <NUM> will transition to event impossible state <NUM>.

Starting from event recognition begins state <NUM>, if a sub-event is received that is the first and not final sub-event in a given event definition, the event recognizer state machine <NUM> will transition to event possible state <NUM>. If the next sub-event received is a second sub-event, but not the final sub-event in the given event definition, the event recognizer state machine <NUM> will remain in state event possible <NUM>. The event recognizer state machine <NUM> can remain in state event possible <NUM> for as long as the sequence of received sub-events continues to be part of the event definition. If, at any time the event recognizer state machine <NUM> is in event possible state <NUM>, and the event recognizer state machine <NUM> receives a sub-event that is not part of the event definition, it will transition to state event impossible <NUM>, thereby determining that the current event (if any) is not the type of event that corresponds to this event recognizer (i.e., the event recognizer corresponding to state <NUM>). If, on the other hand, the event recognizer state machine <NUM> is in the event possible state <NUM>, and the event recognizer state machine <NUM> receives the last sub-event in an event definition, it will transition to the event recognized state <NUM>, thereby completing a successful event recognition.

<FIG> depicts an embodiment of an input source handling process <NUM>, having a finite state machine representing how views receive information about a respective input. It is noted that when there are multiple touches on the touch-sensitive surface of a device, each of the touches is a separate input source having its own finite state machine. In this embodiment, input source handling process <NUM> includes four states: input sequence begin <NUM>, input sequence continues <NUM>, input sequence ended <NUM>, and input sequence cancelled <NUM>. Input source handling process <NUM> may be used by a respective event recognizer, for example, when input is to be delivered to an application, but only after the completion of an input sequence is detected. Input source handling process <NUM> can be used with an application that is incapable of canceling or undoing changes made in response to an input sequence delivered to the application.

Starting from input sequence begin <NUM>, if an input is received that, by itself completes an input sequence, input source handling process <NUM> will transition to input sequence ended <NUM>.

Starting from input sequence begin <NUM>, if an input is received that indicates the input sequence terminated, input source handling process <NUM> will transition to input sequence cancelled <NUM>.

Starting from input sequence begin <NUM>, if an input is received that is the first and not final input in a input sequence, input source handling process <NUM> will transition to state input sequence continues <NUM>. If the next input received is the second input in an input sequence, the input handling process <NUM> will remain in state input sequence continues <NUM>. Input source handling process <NUM> can remain in state input sequence continues <NUM> for as long as the sequence of sub-events being delivered continue to be part of a given input sequence. If, at any time input source handling process <NUM> is in state input sequence continues <NUM>, and input source handling process <NUM> receives an input that is not part of the input sequence, it will transition to state input sequence cancelled <NUM>. If, on the other hand, input source handling process <NUM> is in input sequence continues <NUM>, and the input handling process <NUM> receives the last input in a given input definition, it will transition to the input sequence ended <NUM>, thereby successfully receiving a group of sub-events.

In some embodiments, input source handling process <NUM> may be implemented for particular views or programmatic levels. In that case, certain sequences of sub-events may result in transitioning to state input cancelled <NUM>.

As an example, consider <FIG>, which supposes an actively involved view, represented only by actively involved view input source handler <NUM> (hereafter "view <NUM>"). View <NUM> includes a vertical swipe event recognizer, represented only by vertical swipe event recognizer <NUM> (hereafter "recognizer <NUM>") as one of its event recognizers. In this case, the recognizer <NUM> may require as part of its definition detecting: <NUM>) a finger down <NUM>-<NUM>; <NUM>) an optional short delay <NUM>-<NUM>; <NUM>), vertical swiping of at least N pixels <NUM>-<NUM>; and <NUM>) a finger liftoff <NUM>-<NUM>.

For this example, the recognizer <NUM> also has its delay touch began flag <NUM> and touch cancellation flag <NUM> set. Now consider delivery of the following sequence of sub-events to recognizer <NUM>, as well as the view <NUM>:.

Here, recognizer <NUM> would successfully recognize sub-events <NUM> and <NUM> as part of its event definition, and accordingly, would be in state event possible <NUM> immediately prior to the delivery of sub-event <NUM>. Since recognizer <NUM> has its delay touch began flag <NUM> set, the initial touch sub-event is not sent to the hit view. Correspondingly, the view <NUM>'s input source handling process <NUM> would still be in state input sequence begin immediately prior to the delivery of sub-event <NUM>.

Once delivery of sub-event <NUM> to recognizer <NUM> is complete, recognizer <NUM>'s state transitions to event impossible <NUM>, and importantly, the recognizer <NUM> has now determined that the sequence of sub-events does not correspond to its specific vertical swipe gesture event type (i.e., it has decided the event is not a vertical swipe. In other words, recognition <NUM> as a vertical swipe does not occur in this example. The input source handling system <NUM> for view input source handler <NUM> will also update its state. In some embodiments, the state of the view input source handler <NUM> would proceed from the input sequence begins state <NUM> to the input sequence continues state <NUM> when the event recognizer sends status information indicating that it has begun recognizing an event. The view input source handler <NUM> proceeds to the input sequence cancelled state <NUM> when the touch or input ends without an event being recognized because the touch cancellation flag <NUM> of the event recognizer has been set. Alternately, if the touch cancellation flag <NUM> of the event recognizer had not been set, the view input source handler <NUM> proceeds to the input sequence ended state <NUM> when the touch of input ends.

Since event recognizer <NUM>'s touch cancellation flag <NUM> is set, when the event recognizer <NUM> transitions to the event impossible state <NUM>, the recognizer will send a touch cancellation sub-event or message to the hit view corresponding to the event recognizer. As a result, the view input source handler <NUM> will transition to the state input sequence cancelled <NUM>.

In some embodiments, delivery of sub-event <NUM>-<NUM> is not germane to any event recognition decisions made by recognizer <NUM>, though view input source handler <NUM>'s other event recognizers, if any, may continue to analyze the sequence of sub-events.

The following table presents in summarized tabular format the processing of this exemplary sub-event sequence <NUM> as related to the state of event recognizer <NUM> described above, along with the state of view input source handler <NUM>. In this example, the state of the view input source handler <NUM> proceeds from input sequence begin <NUM> to input sequence cancelled <NUM> because recognizer <NUM>'s touch cancellation flag <NUM> was set:.

Turning to <FIG>, attention is directed to an example of a sub-event sequence <NUM>, which is being received by a view that includes a plurality of event recognizers. For this example, two event recognizers are depicted in <FIG>, scrolling event recognizer <NUM> and tap event recognizer <NUM>. For purposes of illustration, the view search results panel <NUM> in <FIG> will be related to the reception of the sub-event sequence <NUM>, and the state transitions in scrolling event recognizer <NUM> and tap event recognizer <NUM>. Note that in this example, the sequence of sub-events <NUM> defines a tap finger gesture on a touch-sensitive display or trackpad, but the same event recognition technique could be applied in myriad contexts, e.g., detecting a mouse button press, and/or in embodiments utilizing programmatic hierarchies of programmatic levels.

Before the first sub-event is delivered to view search results panel <NUM>, event recognizers <NUM> and <NUM> are in the event recognition begins states <NUM> and <NUM>, respectively. Following touch <NUM>, which is delivered as sub-event detect finger down <NUM>-<NUM> to actively involved event recognizers for view search results panel <NUM> as touch sub-event <NUM>-<NUM> (as well as to actively involved event recognizers for map view <NUM> as touch sub-event <NUM>-<NUM>), scrolling event recognizer <NUM> transitions to state event possible <NUM>, and similarly, tap event recognizer <NUM> transitions to state event possible <NUM>. This is because the event definition of a tap and a scroll both begin with a touch such as detecting a finger down on a touch-sensitive surface.

Some definitions of tap and scroll gestures may optionally include a delay between an initial touch and any next step in the event definition. In all examples discussed here, the exemplar event definitions for both tap and scroll gestures recognize a delay sub-event following the first touch sub-event (detect finger down).

Accordingly, as sub-event measure delay <NUM>-<NUM> is delivered to event recognizers <NUM> and <NUM>, both remain in the event possible states <NUM> and <NUM>, respectively.

Finally, sub-event detect finger liftoff <NUM>-<NUM> is delivered to event recognizers <NUM> and <NUM>. In this case, the state transitions for event recognizers <NUM> and <NUM> are different, because the event definitions for tap and scroll are different. In the case of scrolling event recognizer <NUM>, the next sub-event to remain in state event possible would be to detect movement. Since the sub-event delivered is detect finger liftoff <NUM>-<NUM>, however, the scrolling event recognizer <NUM> transitions to state event impossible <NUM>. A tap event definition concludes with a finger liftoff sub-event though. Accordingly, tap event recognizer <NUM> transitions to state event recognized <NUM> after sub-event detect finger liftoff <NUM>-<NUM> is delivered.

Note that in some embodiments, as discussed above with respect to <FIG> and <FIG>, the input source handling process <NUM> discussed in <FIG> may be used for various purposes at the view level. The following table presents in summarized tabular format the delivery of sub-event sequence <NUM> as related to event recognizers <NUM>, <NUM>, and input source handling process <NUM>:.

Turning to <FIG>, attention is directed to another example of a sub-event sequence <NUM>, which is being received by a view that includes a plurality of event recognizers. For this example, two event recognizers are depicted in <FIG>, scrolling event recognizer <NUM> and tap event recognizer <NUM>. For purposes of illustration, the view search results panel <NUM> in <FIG> will be related to the reception of the sub-event sequence <NUM>, and the state transitions in scrolling event recognizer <NUM> and tap event recognizer <NUM>. Note that in this example, the sequence of sub-events <NUM> defines a scroll finger gesture on a touch-sensitive display, but the same event recognition technique could be applied in myriad contexts, e.g., detecting a mouse button press, mouse movement, and mouse button release, and/or in embodiments utilizing programmatic hierarchies of programmatic levels.

Before the first sub-event is delivered to actively involved event recognizers for view search results panel <NUM>, event recognizers <NUM> and <NUM> are in the event recognition begins states <NUM> and <NUM>, respectively. Following delivery of sub-events corresponding to touch <NUM> (as discussed above), scrolling event recognizer <NUM> transitions to state event possible <NUM>, and similarly, tap event recognizer <NUM> transitions to state event possible <NUM>.

As sub-event measure delay <NUM>-<NUM> is delivered to event recognizers <NUM> and <NUM>, both transition to the event possible states <NUM> and <NUM>, respectively.

Next, sub-event detect finger movement <NUM>-<NUM> is delivered to event recognizers <NUM> and <NUM>. In this case, the state transitions for event recognizers <NUM> and <NUM> are different because the event definitions for tap and scroll are different. In the case of scrolling event recognizer <NUM>, the next sub-event to remain in state event possible is to detect movement, so the scrolling event recognizer <NUM> remains in the event possible state <NUM> when it receives sub-event detect finger movement <NUM>-<NUM>. As discussed above, however, the definition for a tap concludes with a finger liftoff sub-event, so tap event recognizer <NUM> transitions to the state event impossible <NUM>.

Finally, sub-event detect finger liftoff <NUM>-<NUM> is delivered to event recognizers <NUM> and <NUM>. Tap event recognizer is already in the event impossible state <NUM>, and no state transition occurs. Scrolling event recognizer <NUM>'s event definition concludes with detecting a finger liftoff. Since the sub-event delivered is detect finger liftoff <NUM>-<NUM>, the scrolling event recognizer <NUM> transitions to state event recognized <NUM>. It is noted that a finger movement on a touch sensitive surface may generate multiple movement sub-events, and therefore a scroll may be recognized before liftoff and continue until liftoff.

The following table presents in summarized tabular format the delivery of sub-event sequence <NUM> as related to event recognizers <NUM>, <NUM>, and input source handling process <NUM>:.

Turning to <FIG>, attention is directed to another example of a sub-event sequence <NUM>, which is being received by a view that includes a plurality of event recognizers. For this example, two event recognizers are depicted in <FIG>, double tap event recognizer <NUM> and tap event recognizer <NUM>. For purposes of illustration, the map view <NUM> in <FIG> will be related to the reception of the sub-event sequence <NUM>, and the state transitions in double tap event recognizer <NUM> and tap event recognizer <NUM>. Note that in this example, the sequence of sub-events <NUM> defines a double tap gesture on a touch-sensitive display, but the same event recognition technique could be applied in myriad contexts, e.g., detecting a mouse double click, and/or in embodiments utilizing programmatic hierarchies of programmatic levels.

Before the first sub-event is delivered to actively involved event recognizers for map view <NUM>, event recognizers <NUM> and <NUM> are in the event recognition begins states <NUM> and <NUM>, respectively. Following delivery of sub-events related to touch sub-event <NUM> to map view <NUM> (as described above), double tap event recognizer <NUM> and tap event recognizer <NUM> transition to states event possible <NUM> and <NUM>, respectively. This is because the event definition of a tap and a double tap both begin with a touch such as detecting a finger down on a touch-sensitive surface.

As sub-event measure delay <NUM>-<NUM> is delivered to event recognizers <NUM> and <NUM>, both remain in states event possible <NUM> and <NUM>, respectively.

Next, sub-event detect finger liftoff <NUM>-<NUM> is delivered to event recognizers <NUM> and <NUM>. In this case, the state transitions for event recognizers <NUM> and <NUM> are different because the exemplar event definitions for tap and double tap are different. In the case of tap event recognizer <NUM>, the final sub-event in the event definition is to detect finger liftoff, so the tap event recognizer <NUM> transitions to the event recognized state <NUM>.

Double tap recognizer <NUM> remains in state event possible <NUM>, however, since a delay has begun, regardless of what the user may ultimately do. The complete event recognition definition for a double tap requires another delay, followed by a complete tap sub-event sequence though. This creates an ambiguous situation as between the tap event recognizer <NUM>, which is already in state event recognized <NUM>, and the double tap recognizer <NUM>, which is still in state event possible <NUM>.

Accordingly, in some embodiments, event recognizers may implement exclusivity flags and exclusivity exception lists as discussed above with respect to <FIG> and <FIG>. Here, the exclusivity flag <NUM> for tap event recognizer <NUM> would be set, and additionally, exclusivity exception list <NUM> for tap event recognizer <NUM> would be configured to continue permitting delivery of sub-events to some event recognizers (such as double tap event recognizer <NUM>) after tap event recognizer <NUM> enters the state event recognized <NUM>.

While tap event recognizer <NUM> remains in state event recognized <NUM>, sub-event sequence <NUM> continues to be delivered to double tap event recognizer <NUM>, where sub-events measure delay <NUM>-<NUM>, detect finger down <NUM>-<NUM>, and measure delay <NUM>-<NUM>, keep the double tap event recognizer <NUM> in the state event possible <NUM>; delivery of the final sub-event of sequence <NUM>, detect finger liftoff <NUM>-<NUM> transitions double tap event recognizer <NUM> to state event recognized <NUM>.

At this point, the map view <NUM> takes the event double tap as recognized by event recognizer <NUM>, rather than the single tap event recognized by tap event recognizer <NUM>. The decision to take the double tap event is made in light of the combination of the tap event recognizer <NUM>'s exclusivity flag <NUM> being set, the tap event recognizer <NUM>'s exclusivity exception list <NUM> including a double tap event, and the fact that both the tap event recognizer <NUM> and the double tap event recognizer <NUM> both successfully recognized their respective event types.

The following table presents in summarized tabular format the delivery of sub-event sequence <NUM> as related to event recognizers <NUM> and <NUM>, and sub-event handling process <NUM>:.

In another embodiment, in the event scenario of <FIG>, the single tap gesture is not recognized, because the single tap event recognizer has a wait-for list that identifies the double tap event recognizer. As a result, a single tap gesture is not recognized until (if ever) the double tap event recognizer enters the event impossible state. In this example, in which a double tap gesture is recognized, the single tap event recognizer would remain in the event possible state until the double tap gesture is recognized, at which point the single tap event recognizer would transition to the event impossible state.

Attention is now directed to <FIG> and <FIG>, which are flow diagrams illustrating an event recognition method in accordance with the invention. The method <NUM> is performed at an electronic device, which in some embodiments, may be an electronic device <NUM> or <NUM>, as discussed above. In some embodiments, the electronic device may include a touch sensitive surface configured to detect multi-touch gestures. Alternatively, the electronic device may include a touch screen configured to detect multi-touch gestures.

The method <NUM> is configured to execute software that includes a view hierarchy with a plurality of views. The method <NUM> displays <NUM> one or more views of the view hierarchy, and executes <NUM> one or more software elements. Each software element is associated with a particular view, and each particular view includes one or more event recognizers, such as those described in <FIG> and <FIG> as event recognizer structures <NUM> and <NUM>, respectively.

Each event recognizer includes an event definition based on one or more sub-events, where the event definition may be implemented as a state machine, see e.g., <FIG> state machine <NUM>. Event recognizers also include an event handler, which specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to the event definition.

In some embodiments, at least one of the plurality of event recognizers is a gesture recognizer having a gesture definition and a gesture handler as noted in step <NUM> of <FIG>.

In some embodiments, the event definition defines a user gesture as noted in step <NUM> of <FIG>.

Alternatively, event recognizers have a set of event recognition states <NUM>. These event recognition states may include at least an event possible state, an event impossible state, and an event recognized state.

In some embodiments, the event handler initiates preparation <NUM> of its corresponding action for delivery to the target if the event recognizer enters the event possible state. As discussed above with respect to <FIG> and the examples in <FIG>, the state machines implemented for each event recognizer generally include an initial state, e.g., state event recognition begins <NUM>. Receiving a sub-event that forms the initial part of an event definition triggers a state change to the event possible state <NUM>. Accordingly, in some embodiments, as an event recognizer transitions from the state event recognition begins <NUM> to the state event possible <NUM>, the event recognizer's event handler may begin preparing its particular action to deliver to the event recognizer's target after an event is successfully recognized.

On the other hand, in some embodiments, the event handler may terminate preparation <NUM> of its corresponding action if the event recognizer enters the state event impossible <NUM>. In some embodiments, terminating the corresponding action includes canceling any preparation of the event handler's corresponding action.

The example of <FIG> is informative for this embodiment since tap event recognizer <NUM> may have initiated preparation <NUM> of its action, but then, once the sub-event detect finger movement <NUM>-<NUM> is delivered to the tap event recognizer <NUM>, the recognizer <NUM> will transition to the event impossible state <NUM>, <NUM>. At that point, tap event recognizer <NUM> may terminate preparation <NUM> of the action for which it had initiated preparation <NUM>.

In some embodiments, the event handler completes preparation <NUM> of its corresponding action for delivery to the target if the event recognizer enters the event recognized state. The example of <FIG> illustrates this embodiment since a double tap is recognized by actively involved event recognizers for the map view <NUM>, which in some implementations, would be the event bound to selecting and/or executing the search result depicted by map view <NUM>. Here, after the double tap event recognizer <NUM> successfully recognizes the double tap event comprised of the sub-event sequence <NUM>, map view <NUM>'s event handler completes preparation <NUM> of its action, namely, indicating that it has received an activation command.

In some embodiments, the event handler delivers <NUM> its corresponding action to the target associated with the event recognizer. Continuing with the example of <FIG>, the action prepared, i.e. the activation command of the map view <NUM>, would be delivered to the specific target associated with the map view <NUM>, which is any suitable programmatic method or object.

Alternatively, the plurality of event recognizers may independently process <NUM> the sequence of one or more sub-events in parallel.

In some embodiments, one or more event recognizers may be configured as exclusive event recognizers <NUM>, as discussed above with respect to <FIG> and <FIG>'s exclusivity flags <NUM> and <NUM>, respectively. When an event recognizer is configured as an exclusive event recognizer, the event delivery system prevents any other event recognizers for actively involved views (except those listed in the exception list <NUM>, <NUM> of the event recognizer that recognizes the event) in the view hierarchy from receiving subsequent sub-events (of the same sequence of sub-events) after the exclusive event recognizer recognizes an event. Furthermore, when a non-exclusive event recognizer recognizes an event, the event delivery system prevents any exclusive event recognizers for actively involved views in the view hierarchy from receiving subsequent sub-events, except for those (if any) listed in the exception list <NUM>, <NUM> of the event recognizer that recognizes the event.

In some embodiments, exclusive event recognizers may include <NUM> an event exception list, as discussed above with respect to <FIG> and <FIG>'s exclusivity exception lists <NUM> and <NUM>, respectively. As noted in the discussion of <FIG> above, an event recognizer's exclusivity exception list can be used to permit event recognizers to continue with event recognition even when the sequence of sub-events making up their respective event definitions overlap. Accordingly, in some embodiments, the event exception list includes events whose corresponding event definitions have repetitive sub-events <NUM>, such as the single tap/double tap event example of <FIG>.

Alternately, the event definition may define a user input operation <NUM>.

In some embodiments, one or more event recognizers may be adapted to delay delivering every sub-event of the sequence of sub-events until after the event is recognized.

The method <NUM> detects <NUM> a sequence of one or more sub-events, and in some embodiments, the sequence of one or more sub-events may include primitive touch events <NUM>. Primitive touch events may include, without limitation, basic components of a touch-based gesture on a touch-sensitive surface, such as data related to an initial finger or stylus touch down, data related to initiation of multi-finger or stylus movement across a touch-sensitive surface, dual finger movements in opposing directions, stylus lift off from a touch-sensitive surface, etc..

Sub-events in the sequence of one or more sub-events can include many forms, including without limitation, key presses, key press holds, key press releases, button presses, button press holds, button press releases, joystick movements, mouse movements, mouse button presses, mouse button releases, pen stylus touches, pen stylus movements, pen stylus releases, oral instructions, detected eye movements, biometric inputs, and detected physiological changes in a user, among others.

The method <NUM> identifies <NUM> one of the views of the view hierarchy as a hit view. The hit view establishes which views in the view hierarchy are actively involved views. An example is depicted in <FIG>, where the actively involved views <NUM> include search results panel <NUM>, and maps view <NUM> because touch sub-event <NUM> contacted the area associated with the maps view <NUM>.

In some embodiments, a first actively involved view within the view hierarchy may be configured <NUM> to prevent delivery of the respective sub-event to event recognizers associated with that first actively involved view. This behavior can implement the skip property discussed above with respect to <FIG> and <FIG> (<NUM> and <NUM>, respectively). When the skip property is set for an event recognizer, delivery of the respective sub-event is still performed for event recognizers associated with other actively involved views in the view hierarchy.

Alternately, a first actively involved view within the view hierarchy may be configured <NUM> to prevent delivery of the respective sub-event to event recognizers associated with that first actively involved view unless the first actively involved view is the hit view. This behavior can implement the conditional skip property discussed above with respect to <FIG> and <FIG> (<NUM> and <NUM>, respectively).

In some embodiments, a second actively involved view within the view hierarchy is configured <NUM> to prevent delivery of the respective sub-event to event recognizers associated with the second actively involved view and to event recognizers associated with ancestors of the second actively involved view. This behavior can implement the stop property discussed above with respect to <FIG> and <FIG> (<NUM> and <NUM>, respectively).

The method <NUM> delivers <NUM> a respective sub-event to event recognizers for each actively involved view within the view hierarchy. Event recognizers for actively involved views in the view hierarchy process the respective sub-event prior to processing a next sub-event in the sequence of sub-events. Alternately, event recognizers for the actively involved views in the view hierarchy make their sub-event recognition decisions while processing the respective sub-event.

Event recognizers for actively involved views in the view hierarchy process the sequence of one or more sub-events concurrently <NUM>. Alternatively in some examples, event recognizers for actively involved views in the view hierarchy may process the sequence of one or more sub-events in parallel.

In some embodiments, one or more event recognizers may be adapted to delay delivering <NUM> one or more sub-events of the sequence of sub-events until after the event recognizer recognizes the event. This behavior reflects a delayed event. For example, consider a single tap gesture in a view for which multiple tap gestures are possible. In that case, a tap event becomes a "tap + delay" recognizer. In essence, when an event recognizer implements this behavior, the event recognizer will delay event recognition until it is certain that the sequence of sub-events does in fact correspond to its event definition. This behavior may be appropriate when a recipient view is incapable of appropriately responding to cancelled events. In some embodiments, an event recognizer will delay updating its event recognition status to its respective actively involved view until the event recognizer is certain that the sequence of sub-events does not correspond to its event definition. As discussed above with respect to <FIG> and <FIG>, delay touch began flag <NUM>, <NUM>, delay touch end flag <NUM>, <NUM>, and touch cancellation flag <NUM>, <NUM> are provided to tailor sub-event delivery techniques, as well as event recognizer and view status information updates to specific needs.

Claim 1:
A method for processing user inputs, comprising:
at an electronic device configured to execute software that includes a view hierarchy with a plurality of views:
displaying a plurality of views of the view hierarchy;
executing a plurality of software elements, each software element being associated with a particular view, wherein each particular view includes one or more input event recognizers, each input event recognizer having:
an input event definition based on one or more input sub-events; and
an input event handler, wherein the input event handler:
specifies an action for a target, wherein the target comprises an object or an application executed by the electronic device; and
is configured to send the action to the target in response to the input event recognizer detecting an input event, corresponding to a user input, that corresponds to the input event definition;
detecting a sequence of one or more sub-events of an input event corresponding to a user input;
identifying one of the views of the view hierarchy, that is a lowest level view in the view hierarchy in which a first sub-event in the sequence of one or more sub-events of the input event occurs, as a hit view, wherein the hit view establishes multiple views in the view hierarchy as actively involved views in which the first sub-event is detected, wherein the actively involved views comprise the hit view;
delivering a respective sub-event of the input event to input event recognizers for each view of the multiple actively involved views within the view hierarchy; and
at the input event recognizers for the actively involved views in the view hierarchy, concurrently processing the respective sub-event prior to concurrently processing a next sub-event in the sequence of sub-events of the input event at the input event recognizers for each actively involved view in the view hierarchy.