input.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) 2009 Openmoko Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef WL_EVENT_H
  18. #define WL_EVENT_H
  19. #include <stdbool.h>
  20. #define WL_KEY_NLS 7
  21. #define WL_KEY_BACKSPACE 8
  22. #define WL_KEY_RETURN 13
  23. #define WL_KEY_ESC 27
  24. #define WL_KEY_SPACE 32
  25. #define WL_KEY_HASH 35
  26. #define WL_KEY_PLUS 43
  27. #define WL_KEY_MINUS 45
  28. #define WL_KEY_UP 65
  29. #define WL_KEY_DOWN 66
  30. enum {
  31. WL_INPUT_KEY_SEARCH = 0x1000,
  32. WL_INPUT_KEY_HISTORY = 0x1001,
  33. WL_INPUT_KEY_RANDOM = 0x1002,
  34. WL_INPUT_KEY_POWER = 0x1003,
  35. };
  36. enum {
  37. WL_INPUT_EV_TYPE_KEYBOARD = 0,
  38. WL_INPUT_EV_TYPE_TOUCH,
  39. WL_INPUT_EV_TYPE_SYSTEM,
  40. WL_INPUT_EV_TYPE_CURSOR
  41. };
  42. enum {
  43. WL_INPUT_KEY_CURSOR_UP = 0,
  44. WL_INPUT_KEY_CURSOR_DOWN
  45. };
  46. enum {
  47. WL_INPUT_TOUCH_UP = 0,
  48. WL_INPUT_TOUCH_DOWN,
  49. WL_INPUT_TOUCH_NONE
  50. };
  51. struct wl_input_event {
  52. int type;
  53. union {
  54. struct {
  55. int keycode;
  56. int value;
  57. } key_event;
  58. struct {
  59. int x, y;
  60. int value;
  61. unsigned long ticks;
  62. } touch_event;
  63. }; /* union */
  64. };
  65. bool wl_input_event_pending(void);
  66. void wl_input_wait(struct wl_input_event *ev, int sleep);
  67. #endif /* WL_INPUT_H */