input.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826
  1. // copied from <https://android.googlesource.com/platform/frameworks/native/+/master/include/android/input.h>
  2. // blob 08299899b6305a0fe74d7d2b8471b7cd0af49dc7
  3. // (and modified)
  4. /*
  5. * Copyright (C) 2010 The Android Open Source Project
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. */
  19. #ifndef _ANDROID_INPUT_H
  20. #define _ANDROID_INPUT_H
  21. /**
  22. * Meta key / modifer state.
  23. */
  24. enum AndroidMetastate {
  25. /** No meta keys are pressed. */
  26. AMETA_NONE = 0,
  27. /** This mask is used to check whether one of the ALT meta keys is pressed. */
  28. AMETA_ALT_ON = 0x02,
  29. /** This mask is used to check whether the left ALT meta key is pressed. */
  30. AMETA_ALT_LEFT_ON = 0x10,
  31. /** This mask is used to check whether the right ALT meta key is pressed. */
  32. AMETA_ALT_RIGHT_ON = 0x20,
  33. /** This mask is used to check whether one of the SHIFT meta keys is pressed. */
  34. AMETA_SHIFT_ON = 0x01,
  35. /** This mask is used to check whether the left SHIFT meta key is pressed. */
  36. AMETA_SHIFT_LEFT_ON = 0x40,
  37. /** This mask is used to check whether the right SHIFT meta key is pressed. */
  38. AMETA_SHIFT_RIGHT_ON = 0x80,
  39. /** This mask is used to check whether the SYM meta key is pressed. */
  40. AMETA_SYM_ON = 0x04,
  41. /** This mask is used to check whether the FUNCTION meta key is pressed. */
  42. AMETA_FUNCTION_ON = 0x08,
  43. /** This mask is used to check whether one of the CTRL meta keys is pressed. */
  44. AMETA_CTRL_ON = 0x1000,
  45. /** This mask is used to check whether the left CTRL meta key is pressed. */
  46. AMETA_CTRL_LEFT_ON = 0x2000,
  47. /** This mask is used to check whether the right CTRL meta key is pressed. */
  48. AMETA_CTRL_RIGHT_ON = 0x4000,
  49. /** This mask is used to check whether one of the META meta keys is pressed. */
  50. AMETA_META_ON = 0x10000,
  51. /** This mask is used to check whether the left META meta key is pressed. */
  52. AMETA_META_LEFT_ON = 0x20000,
  53. /** This mask is used to check whether the right META meta key is pressed. */
  54. AMETA_META_RIGHT_ON = 0x40000,
  55. /** This mask is used to check whether the CAPS LOCK meta key is on. */
  56. AMETA_CAPS_LOCK_ON = 0x100000,
  57. /** This mask is used to check whether the NUM LOCK meta key is on. */
  58. AMETA_NUM_LOCK_ON = 0x200000,
  59. /** This mask is used to check whether the SCROLL LOCK meta key is on. */
  60. AMETA_SCROLL_LOCK_ON = 0x400000,
  61. };
  62. /**
  63. * Input event types.
  64. */
  65. enum AndroidInputEventType {
  66. /** Indicates that the input event is a key event. */
  67. AINPUT_EVENT_TYPE_KEY = 1,
  68. /** Indicates that the input event is a motion event. */
  69. AINPUT_EVENT_TYPE_MOTION = 2
  70. };
  71. /**
  72. * Key event actions.
  73. */
  74. enum AndroidKeyeventAction {
  75. /** The key has been pressed down. */
  76. AKEY_EVENT_ACTION_DOWN = 0,
  77. /** The key has been released. */
  78. AKEY_EVENT_ACTION_UP = 1,
  79. /**
  80. * Multiple duplicate key events have occurred in a row, or a
  81. * complex string is being delivered. The repeat_count property
  82. * of the key event contains the number of times the given key
  83. * code should be executed.
  84. */
  85. AKEY_EVENT_ACTION_MULTIPLE = 2
  86. };
  87. /**
  88. * Key event flags.
  89. */
  90. enum AndroidKeyeventFlags {
  91. /** This mask is set if the device woke because of this key event. */
  92. AKEY_EVENT_FLAG_WOKE_HERE = 0x1,
  93. /** This mask is set if the key event was generated by a software keyboard. */
  94. AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2,
  95. /** This mask is set if we don't want the key event to cause us to leave touch mode. */
  96. AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4,
  97. /**
  98. * This mask is set if an event was known to come from a trusted
  99. * part of the system. That is, the event is known to come from
  100. * the user, and could not have been spoofed by a third party
  101. * component.
  102. */
  103. AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8,
  104. /**
  105. * This mask is used for compatibility, to identify enter keys that are
  106. * coming from an IME whose enter key has been auto-labelled "next" or
  107. * "done". This allows TextView to dispatch these as normal enter keys
  108. * for old applications, but still do the appropriate action when
  109. * receiving them.
  110. */
  111. AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10,
  112. /**
  113. * When associated with up key events, this indicates that the key press
  114. * has been canceled. Typically this is used with virtual touch screen
  115. * keys, where the user can slide from the virtual key area on to the
  116. * display: in that case, the application will receive a canceled up
  117. * event and should not perform the action normally associated with the
  118. * key. Note that for this to work, the application can not perform an
  119. * action for a key until it receives an up or the long press timeout has
  120. * expired.
  121. */
  122. AKEY_EVENT_FLAG_CANCELED = 0x20,
  123. /**
  124. * This key event was generated by a virtual (on-screen) hard key area.
  125. * Typically this is an area of the touchscreen, outside of the regular
  126. * display, dedicated to "hardware" buttons.
  127. */
  128. AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40,
  129. /**
  130. * This flag is set for the first key repeat that occurs after the
  131. * long press timeout.
  132. */
  133. AKEY_EVENT_FLAG_LONG_PRESS = 0x80,
  134. /**
  135. * Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long
  136. * press action was executed while it was down.
  137. */
  138. AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100,
  139. /**
  140. * Set for AKEY_EVENT_ACTION_UP when this event's key code is still being
  141. * tracked from its initial down. That is, somebody requested that tracking
  142. * started on the key down and a long press has not caused
  143. * the tracking to be canceled.
  144. */
  145. AKEY_EVENT_FLAG_TRACKING = 0x200,
  146. /**
  147. * Set when a key event has been synthesized to implement default behavior
  148. * for an event that the application did not handle.
  149. * Fallback key events are generated by unhandled trackball motions
  150. * (to emulate a directional keypad) and by certain unhandled key presses
  151. * that are declared in the key map (such as special function numeric keypad
  152. * keys when numlock is off).
  153. */
  154. AKEY_EVENT_FLAG_FALLBACK = 0x400,
  155. };
  156. /**
  157. * Bit shift for the action bits holding the pointer index as
  158. * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.
  159. */
  160. #define AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8
  161. /** Motion event actions */
  162. enum AndroidMotioneventAction {
  163. /** Bit mask of the parts of the action code that are the action itself. */
  164. AMOTION_EVENT_ACTION_MASK = 0xff,
  165. /**
  166. * Bits in the action code that represent a pointer index, used with
  167. * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting
  168. * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
  169. * index where the data for the pointer going up or down can be found.
  170. */
  171. AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00,
  172. /** A pressed gesture has started, the motion contains the initial starting location. */
  173. AMOTION_EVENT_ACTION_DOWN = 0,
  174. /**
  175. * A pressed gesture has finished, the motion contains the final release location
  176. * as well as any intermediate points since the last down or move event.
  177. */
  178. AMOTION_EVENT_ACTION_UP = 1,
  179. /**
  180. * A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and
  181. * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as
  182. * any intermediate points since the last down or move event.
  183. */
  184. AMOTION_EVENT_ACTION_MOVE = 2,
  185. /**
  186. * The current gesture has been aborted.
  187. * You will not receive any more points in it. You should treat this as
  188. * an up event, but not perform any action that you normally would.
  189. */
  190. AMOTION_EVENT_ACTION_CANCEL = 3,
  191. /**
  192. * A movement has happened outside of the normal bounds of the UI element.
  193. * This does not provide a full gesture, but only the initial location of the movement/touch.
  194. */
  195. AMOTION_EVENT_ACTION_OUTSIDE = 4,
  196. /**
  197. * A non-primary pointer has gone down.
  198. * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
  199. */
  200. AMOTION_EVENT_ACTION_POINTER_DOWN = 5,
  201. /**
  202. * A non-primary pointer has gone up.
  203. * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
  204. */
  205. AMOTION_EVENT_ACTION_POINTER_UP = 6,
  206. /**
  207. * A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE).
  208. * The motion contains the most recent point, as well as any intermediate points since
  209. * the last hover move event.
  210. */
  211. AMOTION_EVENT_ACTION_HOVER_MOVE = 7,
  212. /**
  213. * The motion event contains relative vertical and/or horizontal scroll offsets.
  214. * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL
  215. * and AMOTION_EVENT_AXIS_HSCROLL.
  216. * The pointer may or may not be down when this event is dispatched.
  217. * This action is always delivered to the winder under the pointer, which
  218. * may not be the window currently touched.
  219. */
  220. AMOTION_EVENT_ACTION_SCROLL = 8,
  221. /** The pointer is not down but has entered the boundaries of a window or view. */
  222. AMOTION_EVENT_ACTION_HOVER_ENTER = 9,
  223. /** The pointer is not down but has exited the boundaries of a window or view. */
  224. AMOTION_EVENT_ACTION_HOVER_EXIT = 10,
  225. /* One or more buttons have been pressed. */
  226. AMOTION_EVENT_ACTION_BUTTON_PRESS = 11,
  227. /* One or more buttons have been released. */
  228. AMOTION_EVENT_ACTION_BUTTON_RELEASE = 12,
  229. };
  230. /**
  231. * Motion event flags.
  232. */
  233. enum AndroidMotioneventFlags {
  234. /**
  235. * This flag indicates that the window that received this motion event is partly
  236. * or wholly obscured by another visible window above it. This flag is set to true
  237. * even if the event did not directly pass through the obscured area.
  238. * A security sensitive application can check this flag to identify situations in which
  239. * a malicious application may have covered up part of its content for the purpose
  240. * of misleading the user or hijacking touches. An appropriate response might be
  241. * to drop the suspect touches or to take additional precautions to confirm the user's
  242. * actual intent.
  243. */
  244. AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1,
  245. };
  246. /**
  247. * Motion event edge touch flags.
  248. */
  249. enum AndroidMotioneventEdgeTouchTlags {
  250. /** No edges intersected. */
  251. AMOTION_EVENT_EDGE_FLAG_NONE = 0,
  252. /** Flag indicating the motion event intersected the top edge of the screen. */
  253. AMOTION_EVENT_EDGE_FLAG_TOP = 0x01,
  254. /** Flag indicating the motion event intersected the bottom edge of the screen. */
  255. AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02,
  256. /** Flag indicating the motion event intersected the left edge of the screen. */
  257. AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04,
  258. /** Flag indicating the motion event intersected the right edge of the screen. */
  259. AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08
  260. };
  261. /**
  262. * Constants that identify each individual axis of a motion event.
  263. * @anchor AMOTION_EVENT_AXIS
  264. */
  265. enum AndroidMotioneventAxis {
  266. /**
  267. * Axis constant: X axis of a motion event.
  268. *
  269. * - For a touch screen, reports the absolute X screen position of the center of
  270. * the touch contact area. The units are display pixels.
  271. * - For a touch pad, reports the absolute X surface position of the center of the touch
  272. * contact area. The units are device-dependent.
  273. * - For a mouse, reports the absolute X screen position of the mouse pointer.
  274. * The units are display pixels.
  275. * - For a trackball, reports the relative horizontal displacement of the trackball.
  276. * The value is normalized to a range from -1.0 (left) to 1.0 (right).
  277. * - For a joystick, reports the absolute X position of the joystick.
  278. * The value is normalized to a range from -1.0 (left) to 1.0 (right).
  279. */
  280. AMOTION_EVENT_AXIS_X = 0,
  281. /**
  282. * Axis constant: Y axis of a motion event.
  283. *
  284. * - For a touch screen, reports the absolute Y screen position of the center of
  285. * the touch contact area. The units are display pixels.
  286. * - For a touch pad, reports the absolute Y surface position of the center of the touch
  287. * contact area. The units are device-dependent.
  288. * - For a mouse, reports the absolute Y screen position of the mouse pointer.
  289. * The units are display pixels.
  290. * - For a trackball, reports the relative vertical displacement of the trackball.
  291. * The value is normalized to a range from -1.0 (up) to 1.0 (down).
  292. * - For a joystick, reports the absolute Y position of the joystick.
  293. * The value is normalized to a range from -1.0 (up or far) to 1.0 (down or near).
  294. */
  295. AMOTION_EVENT_AXIS_Y = 1,
  296. /**
  297. * Axis constant: Pressure axis of a motion event.
  298. *
  299. * - For a touch screen or touch pad, reports the approximate pressure applied to the surface
  300. * by a finger or other tool. The value is normalized to a range from
  301. * 0 (no pressure at all) to 1 (normal pressure), although values higher than 1
  302. * may be generated depending on the calibration of the input device.
  303. * - For a trackball, the value is set to 1 if the trackball button is pressed
  304. * or 0 otherwise.
  305. * - For a mouse, the value is set to 1 if the primary mouse button is pressed
  306. * or 0 otherwise.
  307. */
  308. AMOTION_EVENT_AXIS_PRESSURE = 2,
  309. /**
  310. * Axis constant: Size axis of a motion event.
  311. *
  312. * - For a touch screen or touch pad, reports the approximate size of the contact area in
  313. * relation to the maximum detectable size for the device. The value is normalized
  314. * to a range from 0 (smallest detectable size) to 1 (largest detectable size),
  315. * although it is not a linear scale. This value is of limited use.
  316. * To obtain calibrated size information, see
  317. * {@link AMOTION_EVENT_AXIS_TOUCH_MAJOR} or {@link AMOTION_EVENT_AXIS_TOOL_MAJOR}.
  318. */
  319. AMOTION_EVENT_AXIS_SIZE = 3,
  320. /**
  321. * Axis constant: TouchMajor axis of a motion event.
  322. *
  323. * - For a touch screen, reports the length of the major axis of an ellipse that
  324. * represents the touch area at the point of contact.
  325. * The units are display pixels.
  326. * - For a touch pad, reports the length of the major axis of an ellipse that
  327. * represents the touch area at the point of contact.
  328. * The units are device-dependent.
  329. */
  330. AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4,
  331. /**
  332. * Axis constant: TouchMinor axis of a motion event.
  333. *
  334. * - For a touch screen, reports the length of the minor axis of an ellipse that
  335. * represents the touch area at the point of contact.
  336. * The units are display pixels.
  337. * - For a touch pad, reports the length of the minor axis of an ellipse that
  338. * represents the touch area at the point of contact.
  339. * The units are device-dependent.
  340. *
  341. * When the touch is circular, the major and minor axis lengths will be equal to one another.
  342. */
  343. AMOTION_EVENT_AXIS_TOUCH_MINOR = 5,
  344. /**
  345. * Axis constant: ToolMajor axis of a motion event.
  346. *
  347. * - For a touch screen, reports the length of the major axis of an ellipse that
  348. * represents the size of the approaching finger or tool used to make contact.
  349. * - For a touch pad, reports the length of the major axis of an ellipse that
  350. * represents the size of the approaching finger or tool used to make contact.
  351. * The units are device-dependent.
  352. *
  353. * When the touch is circular, the major and minor axis lengths will be equal to one another.
  354. *
  355. * The tool size may be larger than the touch size since the tool may not be fully
  356. * in contact with the touch sensor.
  357. */
  358. AMOTION_EVENT_AXIS_TOOL_MAJOR = 6,
  359. /**
  360. * Axis constant: ToolMinor axis of a motion event.
  361. *
  362. * - For a touch screen, reports the length of the minor axis of an ellipse that
  363. * represents the size of the approaching finger or tool used to make contact.
  364. * - For a touch pad, reports the length of the minor axis of an ellipse that
  365. * represents the size of the approaching finger or tool used to make contact.
  366. * The units are device-dependent.
  367. *
  368. * When the touch is circular, the major and minor axis lengths will be equal to one another.
  369. *
  370. * The tool size may be larger than the touch size since the tool may not be fully
  371. * in contact with the touch sensor.
  372. */
  373. AMOTION_EVENT_AXIS_TOOL_MINOR = 7,
  374. /**
  375. * Axis constant: Orientation axis of a motion event.
  376. *
  377. * - For a touch screen or touch pad, reports the orientation of the finger
  378. * or tool in radians relative to the vertical plane of the device.
  379. * An angle of 0 radians indicates that the major axis of contact is oriented
  380. * upwards, is perfectly circular or is of unknown orientation. A positive angle
  381. * indicates that the major axis of contact is oriented to the right. A negative angle
  382. * indicates that the major axis of contact is oriented to the left.
  383. * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
  384. * (finger pointing fully right).
  385. * - For a stylus, the orientation indicates the direction in which the stylus
  386. * is pointing in relation to the vertical axis of the current orientation of the screen.
  387. * The range is from -PI radians to PI radians, where 0 is pointing up,
  388. * -PI/2 radians is pointing left, -PI or PI radians is pointing down, and PI/2 radians
  389. * is pointing right. See also {@link AMOTION_EVENT_AXIS_TILT}.
  390. */
  391. AMOTION_EVENT_AXIS_ORIENTATION = 8,
  392. /**
  393. * Axis constant: Vertical Scroll axis of a motion event.
  394. *
  395. * - For a mouse, reports the relative movement of the vertical scroll wheel.
  396. * The value is normalized to a range from -1.0 (down) to 1.0 (up).
  397. *
  398. * This axis should be used to scroll views vertically.
  399. */
  400. AMOTION_EVENT_AXIS_VSCROLL = 9,
  401. /**
  402. * Axis constant: Horizontal Scroll axis of a motion event.
  403. *
  404. * - For a mouse, reports the relative movement of the horizontal scroll wheel.
  405. * The value is normalized to a range from -1.0 (left) to 1.0 (right).
  406. *
  407. * This axis should be used to scroll views horizontally.
  408. */
  409. AMOTION_EVENT_AXIS_HSCROLL = 10,
  410. /**
  411. * Axis constant: Z axis of a motion event.
  412. *
  413. * - For a joystick, reports the absolute Z position of the joystick.
  414. * The value is normalized to a range from -1.0 (high) to 1.0 (low).
  415. * <em>On game pads with two analog joysticks, this axis is often reinterpreted
  416. * to report the absolute X position of the second joystick instead.</em>
  417. */
  418. AMOTION_EVENT_AXIS_Z = 11,
  419. /**
  420. * Axis constant: X Rotation axis of a motion event.
  421. *
  422. * - For a joystick, reports the absolute rotation angle about the X axis.
  423. * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
  424. */
  425. AMOTION_EVENT_AXIS_RX = 12,
  426. /**
  427. * Axis constant: Y Rotation axis of a motion event.
  428. *
  429. * - For a joystick, reports the absolute rotation angle about the Y axis.
  430. * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
  431. */
  432. AMOTION_EVENT_AXIS_RY = 13,
  433. /**
  434. * Axis constant: Z Rotation axis of a motion event.
  435. *
  436. * - For a joystick, reports the absolute rotation angle about the Z axis.
  437. * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
  438. * On game pads with two analog joysticks, this axis is often reinterpreted
  439. * to report the absolute Y position of the second joystick instead.
  440. */
  441. AMOTION_EVENT_AXIS_RZ = 14,
  442. /**
  443. * Axis constant: Hat X axis of a motion event.
  444. *
  445. * - For a joystick, reports the absolute X position of the directional hat control.
  446. * The value is normalized to a range from -1.0 (left) to 1.0 (right).
  447. */
  448. AMOTION_EVENT_AXIS_HAT_X = 15,
  449. /**
  450. * Axis constant: Hat Y axis of a motion event.
  451. *
  452. * - For a joystick, reports the absolute Y position of the directional hat control.
  453. * The value is normalized to a range from -1.0 (up) to 1.0 (down).
  454. */
  455. AMOTION_EVENT_AXIS_HAT_Y = 16,
  456. /**
  457. * Axis constant: Left Trigger axis of a motion event.
  458. *
  459. * - For a joystick, reports the absolute position of the left trigger control.
  460. * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
  461. */
  462. AMOTION_EVENT_AXIS_LTRIGGER = 17,
  463. /**
  464. * Axis constant: Right Trigger axis of a motion event.
  465. *
  466. * - For a joystick, reports the absolute position of the right trigger control.
  467. * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
  468. */
  469. AMOTION_EVENT_AXIS_RTRIGGER = 18,
  470. /**
  471. * Axis constant: Throttle axis of a motion event.
  472. *
  473. * - For a joystick, reports the absolute position of the throttle control.
  474. * The value is normalized to a range from 0.0 (fully open) to 1.0 (fully closed).
  475. */
  476. AMOTION_EVENT_AXIS_THROTTLE = 19,
  477. /**
  478. * Axis constant: Rudder axis of a motion event.
  479. *
  480. * - For a joystick, reports the absolute position of the rudder control.
  481. * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
  482. */
  483. AMOTION_EVENT_AXIS_RUDDER = 20,
  484. /**
  485. * Axis constant: Wheel axis of a motion event.
  486. *
  487. * - For a joystick, reports the absolute position of the steering wheel control.
  488. * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
  489. */
  490. AMOTION_EVENT_AXIS_WHEEL = 21,
  491. /**
  492. * Axis constant: Gas axis of a motion event.
  493. *
  494. * - For a joystick, reports the absolute position of the gas (accelerator) control.
  495. * The value is normalized to a range from 0.0 (no acceleration)
  496. * to 1.0 (maximum acceleration).
  497. */
  498. AMOTION_EVENT_AXIS_GAS = 22,
  499. /**
  500. * Axis constant: Brake axis of a motion event.
  501. *
  502. * - For a joystick, reports the absolute position of the brake control.
  503. * The value is normalized to a range from 0.0 (no braking) to 1.0 (maximum braking).
  504. */
  505. AMOTION_EVENT_AXIS_BRAKE = 23,
  506. /**
  507. * Axis constant: Distance axis of a motion event.
  508. *
  509. * - For a stylus, reports the distance of the stylus from the screen.
  510. * A value of 0.0 indicates direct contact and larger values indicate increasing
  511. * distance from the surface.
  512. */
  513. AMOTION_EVENT_AXIS_DISTANCE = 24,
  514. /**
  515. * Axis constant: Tilt axis of a motion event.
  516. *
  517. * - For a stylus, reports the tilt angle of the stylus in radians where
  518. * 0 radians indicates that the stylus is being held perpendicular to the
  519. * surface, and PI/2 radians indicates that the stylus is being held flat
  520. * against the surface.
  521. */
  522. AMOTION_EVENT_AXIS_TILT = 25,
  523. /**
  524. * Axis constant: Generic scroll axis of a motion event.
  525. *
  526. * - This is used for scroll axis motion events that can't be classified as strictly
  527. * vertical or horizontal. The movement of a rotating scroller is an example of this.
  528. */
  529. AMOTION_EVENT_AXIS_SCROLL = 26,
  530. /**
  531. * Axis constant: The movement of x position of a motion event.
  532. *
  533. * - For a mouse, reports a difference of x position between the previous position.
  534. * This is useful when pointer is captured, in that case the mouse pointer doesn't
  535. * change the location but this axis reports the difference which allows the app
  536. * to see how the mouse is moved.
  537. */
  538. AMOTION_EVENT_AXIS_RELATIVE_X = 27,
  539. /**
  540. * Axis constant: The movement of y position of a motion event.
  541. *
  542. * Same as {@link RELATIVE_X}, but for y position.
  543. */
  544. AMOTION_EVENT_AXIS_RELATIVE_Y = 28,
  545. /**
  546. * Axis constant: Generic 1 axis of a motion event.
  547. * The interpretation of a generic axis is device-specific.
  548. */
  549. AMOTION_EVENT_AXIS_GENERIC_1 = 32,
  550. /**
  551. * Axis constant: Generic 2 axis of a motion event.
  552. * The interpretation of a generic axis is device-specific.
  553. */
  554. AMOTION_EVENT_AXIS_GENERIC_2 = 33,
  555. /**
  556. * Axis constant: Generic 3 axis of a motion event.
  557. * The interpretation of a generic axis is device-specific.
  558. */
  559. AMOTION_EVENT_AXIS_GENERIC_3 = 34,
  560. /**
  561. * Axis constant: Generic 4 axis of a motion event.
  562. * The interpretation of a generic axis is device-specific.
  563. */
  564. AMOTION_EVENT_AXIS_GENERIC_4 = 35,
  565. /**
  566. * Axis constant: Generic 5 axis of a motion event.
  567. * The interpretation of a generic axis is device-specific.
  568. */
  569. AMOTION_EVENT_AXIS_GENERIC_5 = 36,
  570. /**
  571. * Axis constant: Generic 6 axis of a motion event.
  572. * The interpretation of a generic axis is device-specific.
  573. */
  574. AMOTION_EVENT_AXIS_GENERIC_6 = 37,
  575. /**
  576. * Axis constant: Generic 7 axis of a motion event.
  577. * The interpretation of a generic axis is device-specific.
  578. */
  579. AMOTION_EVENT_AXIS_GENERIC_7 = 38,
  580. /**
  581. * Axis constant: Generic 8 axis of a motion event.
  582. * The interpretation of a generic axis is device-specific.
  583. */
  584. AMOTION_EVENT_AXIS_GENERIC_8 = 39,
  585. /**
  586. * Axis constant: Generic 9 axis of a motion event.
  587. * The interpretation of a generic axis is device-specific.
  588. */
  589. AMOTION_EVENT_AXIS_GENERIC_9 = 40,
  590. /**
  591. * Axis constant: Generic 10 axis of a motion event.
  592. * The interpretation of a generic axis is device-specific.
  593. */
  594. AMOTION_EVENT_AXIS_GENERIC_10 = 41,
  595. /**
  596. * Axis constant: Generic 11 axis of a motion event.
  597. * The interpretation of a generic axis is device-specific.
  598. */
  599. AMOTION_EVENT_AXIS_GENERIC_11 = 42,
  600. /**
  601. * Axis constant: Generic 12 axis of a motion event.
  602. * The interpretation of a generic axis is device-specific.
  603. */
  604. AMOTION_EVENT_AXIS_GENERIC_12 = 43,
  605. /**
  606. * Axis constant: Generic 13 axis of a motion event.
  607. * The interpretation of a generic axis is device-specific.
  608. */
  609. AMOTION_EVENT_AXIS_GENERIC_13 = 44,
  610. /**
  611. * Axis constant: Generic 14 axis of a motion event.
  612. * The interpretation of a generic axis is device-specific.
  613. */
  614. AMOTION_EVENT_AXIS_GENERIC_14 = 45,
  615. /**
  616. * Axis constant: Generic 15 axis of a motion event.
  617. * The interpretation of a generic axis is device-specific.
  618. */
  619. AMOTION_EVENT_AXIS_GENERIC_15 = 46,
  620. /**
  621. * Axis constant: Generic 16 axis of a motion event.
  622. * The interpretation of a generic axis is device-specific.
  623. */
  624. AMOTION_EVENT_AXIS_GENERIC_16 = 47,
  625. // NOTE: If you add a new axis here you must also add it to several other files.
  626. // Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list.
  627. };
  628. /**
  629. * Constants that identify buttons that are associated with motion events.
  630. * Refer to the documentation on the MotionEvent class for descriptions of each button.
  631. */
  632. enum AndroidMotioneventButtons {
  633. /** primary */
  634. AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0,
  635. /** secondary */
  636. AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1,
  637. /** tertiary */
  638. AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2,
  639. /** back */
  640. AMOTION_EVENT_BUTTON_BACK = 1 << 3,
  641. /** forward */
  642. AMOTION_EVENT_BUTTON_FORWARD = 1 << 4,
  643. AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 1 << 5,
  644. AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 1 << 6,
  645. };
  646. /**
  647. * Constants that identify tool types.
  648. * Refer to the documentation on the MotionEvent class for descriptions of each tool type.
  649. */
  650. enum AndroidMotioneventToolType {
  651. /** unknown */
  652. AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0,
  653. /** finger */
  654. AMOTION_EVENT_TOOL_TYPE_FINGER = 1,
  655. /** stylus */
  656. AMOTION_EVENT_TOOL_TYPE_STYLUS = 2,
  657. /** mouse */
  658. AMOTION_EVENT_TOOL_TYPE_MOUSE = 3,
  659. /** eraser */
  660. AMOTION_EVENT_TOOL_TYPE_ERASER = 4,
  661. };
  662. /**
  663. * Input source masks.
  664. *
  665. * Refer to the documentation on android.view.InputDevice for more details about input sources
  666. * and their correct interpretation.
  667. */
  668. enum AndroidInputSourceClass {
  669. /** mask */
  670. AINPUT_SOURCE_CLASS_MASK = 0x000000ff,
  671. /** none */
  672. AINPUT_SOURCE_CLASS_NONE = 0x00000000,
  673. /** button */
  674. AINPUT_SOURCE_CLASS_BUTTON = 0x00000001,
  675. /** pointer */
  676. AINPUT_SOURCE_CLASS_POINTER = 0x00000002,
  677. /** navigation */
  678. AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004,
  679. /** position */
  680. AINPUT_SOURCE_CLASS_POSITION = 0x00000008,
  681. /** joystick */
  682. AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010,
  683. };
  684. /**
  685. * Input sources.
  686. */
  687. enum AndroidInputSource {
  688. /** unknown */
  689. AINPUT_SOURCE_UNKNOWN = 0x00000000,
  690. /** keyboard */
  691. AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON,
  692. /** dpad */
  693. AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON,
  694. /** gamepad */
  695. AINPUT_SOURCE_GAMEPAD = 0x00000400 | AINPUT_SOURCE_CLASS_BUTTON,
  696. /** touchscreen */
  697. AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER,
  698. /** mouse */
  699. AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER,
  700. /** stylus */
  701. AINPUT_SOURCE_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER,
  702. /** bluetooth stylus */
  703. AINPUT_SOURCE_BLUETOOTH_STYLUS = 0x00008000 | AINPUT_SOURCE_STYLUS,
  704. /** trackball */
  705. AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION,
  706. /** mouse relative */
  707. AINPUT_SOURCE_MOUSE_RELATIVE = 0x00020000 | AINPUT_SOURCE_CLASS_NAVIGATION,
  708. /** touchpad */
  709. AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION,
  710. /** navigation */
  711. AINPUT_SOURCE_TOUCH_NAVIGATION = 0x00200000 | AINPUT_SOURCE_CLASS_NONE,
  712. /** joystick */
  713. AINPUT_SOURCE_JOYSTICK = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK,
  714. /** rotary encoder */
  715. AINPUT_SOURCE_ROTARY_ENCODER = 0x00400000 | AINPUT_SOURCE_CLASS_NONE,
  716. };
  717. /**
  718. * Keyboard types.
  719. *
  720. * Refer to the documentation on android.view.InputDevice for more details.
  721. */
  722. enum AndroidKeyboardType {
  723. /** none */
  724. AINPUT_KEYBOARD_TYPE_NONE = 0,
  725. /** non alphabetic */
  726. AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1,
  727. /** alphabetic */
  728. AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2,
  729. };
  730. /**
  731. * Constants used to retrieve information about the range of motion for a particular
  732. * coordinate of a motion event.
  733. *
  734. * Refer to the documentation on android.view.InputDevice for more details about input sources
  735. * and their correct interpretation.
  736. *
  737. * @deprecated These constants are deprecated. Use {@link AMOTION_EVENT_AXIS AMOTION_EVENT_AXIS_*} constants instead.
  738. */
  739. enum AndroidMotionRange {
  740. /** x */
  741. AINPUT_MOTION_RANGE_X = AMOTION_EVENT_AXIS_X,
  742. /** y */
  743. AINPUT_MOTION_RANGE_Y = AMOTION_EVENT_AXIS_Y,
  744. /** pressure */
  745. AINPUT_MOTION_RANGE_PRESSURE = AMOTION_EVENT_AXIS_PRESSURE,
  746. /** size */
  747. AINPUT_MOTION_RANGE_SIZE = AMOTION_EVENT_AXIS_SIZE,
  748. /** touch major */
  749. AINPUT_MOTION_RANGE_TOUCH_MAJOR = AMOTION_EVENT_AXIS_TOUCH_MAJOR,
  750. /** touch minor */
  751. AINPUT_MOTION_RANGE_TOUCH_MINOR = AMOTION_EVENT_AXIS_TOUCH_MINOR,
  752. /** tool major */
  753. AINPUT_MOTION_RANGE_TOOL_MAJOR = AMOTION_EVENT_AXIS_TOOL_MAJOR,
  754. /** tool minor */
  755. AINPUT_MOTION_RANGE_TOOL_MINOR = AMOTION_EVENT_AXIS_TOOL_MINOR,
  756. /** orientation */
  757. AINPUT_MOTION_RANGE_ORIENTATION = AMOTION_EVENT_AXIS_ORIENTATION,
  758. };
  759. #endif // _ANDROID_INPUT_H