SDL_waylandvideo.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #include "SDL_internal.h"
  19. #ifndef SDL_waylandvideo_h_
  20. #define SDL_waylandvideo_h_
  21. #include <EGL/egl.h>
  22. #include "wayland-util.h"
  23. #include "../SDL_sysvideo.h"
  24. #include "../../core/linux/SDL_dbus.h"
  25. #include "../../core/linux/SDL_ime.h"
  26. struct xkb_context;
  27. struct SDL_WaylandInput;
  28. typedef struct
  29. {
  30. struct wl_cursor_theme *theme;
  31. int size;
  32. } SDL_WaylandCursorTheme;
  33. typedef struct
  34. {
  35. struct wl_list link;
  36. char wl_output_name[];
  37. } SDL_WaylandConnectorName;
  38. struct SDL_VideoData
  39. {
  40. bool initializing;
  41. struct wl_display *display;
  42. int display_disconnected;
  43. struct wl_registry *registry;
  44. struct wl_compositor *compositor;
  45. struct wl_shm *shm;
  46. SDL_WaylandCursorTheme *cursor_themes;
  47. int num_cursor_themes;
  48. struct wl_pointer *pointer;
  49. struct
  50. {
  51. struct xdg_wm_base *xdg;
  52. #ifdef HAVE_LIBDECOR_H
  53. struct libdecor *libdecor;
  54. #endif
  55. } shell;
  56. struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
  57. struct zwp_pointer_constraints_v1 *pointer_constraints;
  58. struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
  59. struct wl_data_device_manager *data_device_manager;
  60. struct zwp_primary_selection_device_manager_v1 *primary_selection_device_manager;
  61. struct zxdg_decoration_manager_v1 *decoration_manager;
  62. struct zwp_keyboard_shortcuts_inhibit_manager_v1 *key_inhibitor_manager;
  63. struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager;
  64. struct xdg_activation_v1 *activation_manager;
  65. struct zwp_text_input_manager_v3 *text_input_manager;
  66. struct zxdg_output_manager_v1 *xdg_output_manager;
  67. struct wp_viewporter *viewporter;
  68. struct wp_fractional_scale_manager_v1 *fractional_scale_manager;
  69. struct zwp_input_timestamps_manager_v1 *input_timestamps_manager;
  70. struct zxdg_exporter_v2 *zxdg_exporter_v2;
  71. struct xdg_wm_dialog_v1 *xdg_wm_dialog_v1;
  72. struct wp_alpha_modifier_v1 *wp_alpha_modifier_v1;
  73. struct xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager_v1;
  74. struct frog_color_management_factory_v1 *frog_color_management_factory_v1;
  75. struct wp_color_manager_v1 *wp_color_manager_v1;
  76. struct zwp_tablet_manager_v2 *tablet_manager;
  77. struct xkb_context *xkb_context;
  78. struct SDL_WaylandInput *input;
  79. SDL_DisplayData **output_list;
  80. int output_count;
  81. int output_max;
  82. int relative_mouse_mode;
  83. bool display_externally_owned;
  84. bool scale_to_display_enabled;
  85. };
  86. struct SDL_DisplayData
  87. {
  88. SDL_VideoData *videodata;
  89. struct wl_output *output;
  90. struct zxdg_output_v1 *xdg_output;
  91. struct wp_color_management_output_v1 *wp_color_management_output;
  92. char *wl_output_name;
  93. double scale_factor;
  94. uint32_t registry_id;
  95. int logical_width, logical_height;
  96. int pixel_width, pixel_height;
  97. int x, y, refresh, transform;
  98. SDL_DisplayOrientation orientation;
  99. int physical_width_mm, physical_height_mm;
  100. bool has_logical_position, has_logical_size;
  101. bool running_colorspace_event_queue;
  102. SDL_HDROutputProperties HDR;
  103. SDL_DisplayID display;
  104. SDL_VideoDisplay placeholder;
  105. int wl_output_done_count;
  106. };
  107. // Needed here to get wl_surface declaration, fixes GitHub#4594
  108. #include "SDL_waylanddyn.h"
  109. extern void SDL_WAYLAND_register_surface(struct wl_surface *surface);
  110. extern void SDL_WAYLAND_register_output(struct wl_output *output);
  111. extern bool SDL_WAYLAND_own_surface(struct wl_surface *surface);
  112. extern bool SDL_WAYLAND_own_output(struct wl_output *output);
  113. extern SDL_WindowData *Wayland_GetWindowDataForOwnedSurface(struct wl_surface *surface);
  114. void Wayland_AddWindowDataToExternalList(SDL_WindowData *data);
  115. void Wayland_RemoveWindowDataFromExternalList(SDL_WindowData *data);
  116. extern bool Wayland_LoadLibdecor(SDL_VideoData *data, bool ignore_xdg);
  117. extern bool Wayland_VideoReconnect(SDL_VideoDevice *_this);
  118. #endif // SDL_waylandvideo_h_