inaban.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // Copyright 2019 Haelwenn (lanodan) Monnier
  2. // Distributed under the terms of the BSD License
  3. // Based on wlroots's TinyWL which is distributed under CC0
  4. #ifndef INABAN_H
  5. #define INABAN_H
  6. #include <stdbool.h>
  7. #include <wayland-server.h>
  8. #include <wlr/backend.h>
  9. #include <wlr/render/wlr_renderer.h>
  10. #include <wlr/types/wlr_compositor.h>
  11. #include <wlr/types/wlr_cursor.h>
  12. #include <wlr/types/wlr_data_device.h>
  13. #include <wlr/types/wlr_input_device.h>
  14. #include <wlr/types/wlr_keyboard.h>
  15. #include <wlr/types/wlr_matrix.h>
  16. #include <wlr/types/wlr_output.h>
  17. #include <wlr/types/wlr_output_layout.h>
  18. #include <wlr/types/wlr_pointer.h>
  19. #include <wlr/types/wlr_seat.h>
  20. #include <wlr/types/wlr_xcursor_manager.h>
  21. #include <wlr/types/wlr_xdg_shell.h>
  22. #include <wlr/types/wlr_xdg_decoration_v1.h>
  23. #include <wlr/util/log.h>
  24. #include <xkbcommon/xkbcommon.h>
  25. struct inaban_server
  26. {
  27. struct wl_display *wl_display;
  28. struct wlr_backend *backend;
  29. struct wlr_renderer *renderer;
  30. struct wlr_xdg_shell *xdg_shell;
  31. struct wl_listener new_xdg_surface;
  32. struct wl_list views;
  33. struct wl_listener xdg_toplevel_decoration;
  34. struct wlr_cursor *cursor;
  35. struct wlr_xcursor_manager *cursor_mgr;
  36. struct wl_listener cursor_motion;
  37. struct wl_listener cursor_motion_absolute;
  38. struct wl_listener cursor_button;
  39. struct wl_listener cursor_axis;
  40. struct wl_listener cursor_frame;
  41. struct wlr_seat *seat;
  42. struct wl_listener new_input;
  43. struct wl_listener request_cursor;
  44. struct wl_list keyboards;
  45. struct wlr_output_layout *output_layout;
  46. struct wl_list outputs;
  47. struct wl_listener new_output;
  48. };
  49. struct inaban_output
  50. {
  51. struct wl_list link;
  52. struct inaban_server *server;
  53. struct wlr_output *wlr_output;
  54. struct wl_listener frame;
  55. };
  56. struct inaban_view
  57. {
  58. struct wl_list link;
  59. struct inaban_server *server;
  60. struct wlr_xdg_surface *xdg_surface;
  61. struct wl_listener map;
  62. struct wl_listener unmap;
  63. struct wl_listener destroy;
  64. struct wl_listener request_move;
  65. struct wl_listener request_resize;
  66. bool mapped;
  67. int x, y;
  68. };
  69. struct inaban_keyboard
  70. {
  71. struct wl_list link;
  72. struct inaban_server *server;
  73. struct wlr_input_device *device;
  74. struct wl_listener modifiers;
  75. struct wl_listener key;
  76. };
  77. /* Used to move all of the data necessary to render a surface from the top-level
  78. * frame handler to the per-surface render function. */
  79. struct render_data
  80. {
  81. struct wlr_output *output;
  82. struct wlr_renderer *renderer;
  83. struct inaban_view *view;
  84. struct timespec *when;
  85. };
  86. typedef union {
  87. int i;
  88. unsigned int ui;
  89. float f;
  90. const void *v;
  91. } Arg;
  92. typedef struct
  93. {
  94. uint32_t mod;
  95. xkb_keysym_t keysym;
  96. void (*func)(const Arg *);
  97. const Arg arg;
  98. } Shortcut;
  99. void spawn(const Arg *arg);
  100. void quit(const Arg *arg);
  101. #endif /* INABAN_H */