logo

inaban

Unnamed repository; edit this file 'description' to name the repository.

inaban.h (2675B)


  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_server_decoration.h>
  21. #include <wlr/types/wlr_xcursor_manager.h>
  22. #include <wlr/types/wlr_xdg_shell.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 wlr_cursor *cursor;
  34. struct wlr_xcursor_manager *cursor_mgr;
  35. struct wl_listener cursor_motion;
  36. struct wl_listener cursor_motion_absolute;
  37. struct wl_listener cursor_button;
  38. struct wl_listener cursor_axis;
  39. struct wl_listener cursor_frame;
  40. struct wlr_seat *seat;
  41. struct wl_listener new_input;
  42. struct wl_listener request_cursor;
  43. struct wl_list keyboards;
  44. struct wlr_output_layout *output_layout;
  45. struct wl_list outputs;
  46. struct wl_listener new_output;
  47. };
  48. struct inaban_output
  49. {
  50. struct wl_list link;
  51. struct inaban_server *server;
  52. struct wlr_output *wlr_output;
  53. struct wl_listener frame;
  54. };
  55. struct inaban_view
  56. {
  57. struct wl_list link;
  58. struct inaban_server *server;
  59. struct wlr_xdg_surface *xdg_surface;
  60. struct wl_listener map;
  61. struct wl_listener unmap;
  62. struct wl_listener destroy;
  63. struct wl_listener request_move;
  64. struct wl_listener request_resize;
  65. bool mapped;
  66. int x, y;
  67. };
  68. struct inaban_keyboard
  69. {
  70. struct wl_list link;
  71. struct inaban_server *server;
  72. struct wlr_input_device *device;
  73. struct wl_listener modifiers;
  74. struct wl_listener key;
  75. };
  76. /* Used to move all of the data necessary to render a surface from the top-level
  77. * frame handler to the per-surface render function. */
  78. struct render_data
  79. {
  80. struct wlr_output *output;
  81. struct wlr_renderer *renderer;
  82. struct inaban_view *view;
  83. struct timespec *when;
  84. };
  85. typedef union {
  86. int i;
  87. unsigned int ui;
  88. float f;
  89. const void *v;
  90. } Arg;
  91. typedef struct
  92. {
  93. uint32_t mod;
  94. xkb_keysym_t keysym;
  95. void (*func)(const Arg *);
  96. const Arg arg;
  97. } Shortcut;
  98. void spawn(const Arg *arg);
  99. void quit(const Arg *arg);
  100. #endif /* INABAN_H */