| 1 | /* |
| 2 | * Copyright (C) 2013 Canonical Ltd |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | * |
| 16 | * Authored by: Thomas Voss <thomas.voss@canonical.com> |
| 17 | */ |
| 18 | |
| 19 | #ifndef INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_MOTION_H_ |
| 20 | #define INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_MOTION_H_ |
| 21 | |
| 22 | #ifdef __cplusplus |
| 23 | extern "C" { |
| 24 | #endif |
| 25 | |
| 26 | /* |
| 27 | * Motion event actions. |
| 28 | */ |
| 29 | |
| 30 | /* Bit shift for the action bits holding the pointer index as |
| 31 | * defined by ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_MASK. |
| 32 | */ |
| 33 | #define ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8 |
| 34 | |
| 35 | enum { |
| 36 | /* Bit mask of the parts of the action code that are the action itself. |
| 37 | */ |
| 38 | ISCL_MOTION_EVENT_ACTION_MASK = 0xff, |
| 39 | |
| 40 | /* Bits in the action code that represent a pointer index, used with |
| 41 | * ISCL_MOTION_EVENT_ACTION_POINTER_DOWN and ISCL_MOTION_EVENT_ACTION_POINTER_UP. Shifting |
| 42 | * down by ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer |
| 43 | * index where the data for the pointer going up or down can be found. |
| 44 | */ |
| 45 | ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00, |
| 46 | |
| 47 | /* A pressed gesture has started, the motion contains the initial starting location. |
| 48 | */ |
| 49 | ISCL_MOTION_EVENT_ACTION_DOWN = 0, |
| 50 | |
| 51 | /* A pressed gesture has finished, the motion contains the final release location |
| 52 | * as well as any intermediate points since the last down or move event. |
| 53 | */ |
| 54 | ISCL_MOTION_EVENT_ACTION_UP = 1, |
| 55 | |
| 56 | /* A change has happened during a press gesture (between ISCL_MOTION_EVENT_ACTION_DOWN and |
| 57 | * ISCL_MOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as |
| 58 | * any intermediate points since the last down or move event. |
| 59 | */ |
| 60 | ISCL_MOTION_EVENT_ACTION_MOVE = 2, |
| 61 | |
| 62 | /* The current gesture has been aborted. |
| 63 | * You will not receive any more points in it. You should treat this as |
| 64 | * an up event, but not perform any action that you normally would. |
| 65 | */ |
| 66 | ISCL_MOTION_EVENT_ACTION_CANCEL = 3, |
| 67 | |
| 68 | /* A movement has happened outside of the normal bounds of the UI element. |
| 69 | * This does not provide a full gesture, but only the initial location of the movement/touch. |
| 70 | */ |
| 71 | ISCL_MOTION_EVENT_ACTION_OUTSIDE = 4, |
| 72 | |
| 73 | /* A non-primary pointer has gone down. |
| 74 | * The bits in ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. |
| 75 | */ |
| 76 | ISCL_MOTION_EVENT_ACTION_POINTER_DOWN = 5, |
| 77 | |
| 78 | /* A non-primary pointer has gone up. |
| 79 | * The bits in ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. |
| 80 | */ |
| 81 | ISCL_MOTION_EVENT_ACTION_POINTER_UP = 6, |
| 82 | |
| 83 | /* A change happened but the pointer is not down (unlike ISCL_MOTION_EVENT_ACTION_MOVE). |
| 84 | * The motion contains the most recent point, as well as any intermediate points since |
| 85 | * the last hover move event. |
| 86 | */ |
| 87 | ISCL_MOTION_EVENT_ACTION_HOVER_MOVE = 7, |
| 88 | |
| 89 | /* The motion event contains relative vertical and/or horizontal scroll offsets. |
| 90 | * Use getAxisValue to retrieve the information from ISCL_MOTION_EVENT_AXIS_VSCROLL |
| 91 | * and ISCL_MOTION_EVENT_AXIS_HSCROLL. |
| 92 | * The pointer may or may not be down when this event is dispatched. |
| 93 | * This action is always delivered to the winder under the pointer, which |
| 94 | * may not be the window currently touched. |
| 95 | */ |
| 96 | ISCL_MOTION_EVENT_ACTION_SCROLL = 8, |
| 97 | |
| 98 | /* The pointer is not down but has entered the boundaries of a window or view. |
| 99 | */ |
| 100 | ISCL_MOTION_EVENT_ACTION_HOVER_ENTER = 9, |
| 101 | |
| 102 | /* The pointer is not down but has exited the boundaries of a window or view. |
| 103 | */ |
| 104 | ISCL_MOTION_EVENT_ACTION_HOVER_EXIT = 10, |
| 105 | }; |
| 106 | |
| 107 | /* |
| 108 | * Motion event flags. |
| 109 | */ |
| 110 | enum |
| 111 | { |
| 112 | /* This flag indicates that the window that received this motion event is partly |
| 113 | * or wholly obscured by another visible window above it. This flag is set to true |
| 114 | * even if the event did not directly pass through the obscured area. |
| 115 | * A security sensitive application can check this flag to identify situations in which |
| 116 | * a malicious application may have covered up part of its content for the purpose |
| 117 | * of misleading the user or hijacking touches. An appropriate response might be |
| 118 | * to drop the suspect touches or to take additional precautions to confirm the user's |
| 119 | * actual intent. |
| 120 | */ |
| 121 | ISCL_MOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1, |
| 122 | }; |
| 123 | |
| 124 | /* |
| 125 | * Motion event edge touch flags. |
| 126 | */ |
| 127 | enum |
| 128 | { |
| 129 | /* No edges intersected */ |
| 130 | ISCL_MOTION_EVENT_EDGE_FLAG_NONE = 0, |
| 131 | |
| 132 | /* Flag indicating the motion event intersected the top edge of the screen. */ |
| 133 | ISCL_MOTION_EVENT_EDGE_FLAG_TOP = 0x01, |
| 134 | |
| 135 | /* Flag indicating the motion event intersected the bottom edge of the screen. */ |
| 136 | ISCL_MOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02, |
| 137 | |
| 138 | /* Flag indicating the motion event intersected the left edge of the screen. */ |
| 139 | ISCL_MOTION_EVENT_EDGE_FLAG_LEFT = 0x04, |
| 140 | |
| 141 | /* Flag indicating the motion event intersected the right edge of the screen. */ |
| 142 | ISCL_MOTION_EVENT_EDGE_FLAG_RIGHT = 0x08 |
| 143 | }; |
| 144 | |
| 145 | #ifdef __cplusplus |
| 146 | } |
| 147 | #endif |
| 148 | |
| 149 | #endif // INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_MOTION_H_ |