Atlas - SDL_waylandvideo.h
Home / ext / SDL / src / video / wayland Lines: 1 | Size: 5617 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2026 Sam Lantinga <[email protected]> 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 2. Altered source versions must be plainly marked as such, and must not be 18 misrepresented as being the original software. 19 3. This notice may not be removed or altered from any source distribution. 20*/ 21 22#include "SDL_internal.h" 23 24#ifndef SDL_waylandvideo_h_ 25#define SDL_waylandvideo_h_ 26 27#include <EGL/egl.h> 28#include "wayland-util.h" 29 30#include "../SDL_sysvideo.h" 31#include "../../core/linux/SDL_dbus.h" 32#include "../../core/linux/SDL_ime.h" 33 34struct xkb_context; 35struct SDL_WaylandSeat; 36 37typedef struct 38{ 39 struct wl_cursor_theme *theme; 40 int size; 41} SDL_WaylandCursorTheme; 42 43typedef struct 44{ 45 struct wl_list link; 46 char wl_output_name[]; 47} SDL_WaylandConnectorName; 48 49struct SDL_VideoData 50{ 51 struct wl_display *display; 52 struct wl_registry *registry; 53 struct wl_compositor *compositor; 54 struct wl_shm *shm; 55 SDL_WaylandCursorTheme *cursor_themes; 56 int num_cursor_themes; 57 struct 58 { 59 struct xdg_wm_base *xdg; 60#ifdef HAVE_LIBDECOR_H 61 struct libdecor *libdecor; 62#endif 63 } shell; 64 struct wl_subcompositor *subcompositor; 65 struct zwp_relative_pointer_manager_v1 *relative_pointer_manager; 66 struct zwp_pointer_constraints_v1 *pointer_constraints; 67 struct wp_pointer_warp_v1 *wp_pointer_warp_v1; 68 struct wp_cursor_shape_manager_v1 *cursor_shape_manager; 69 struct wl_data_device_manager *data_device_manager; 70 struct zwp_primary_selection_device_manager_v1 *primary_selection_device_manager; 71 struct zxdg_decoration_manager_v1 *decoration_manager; 72 struct zwp_keyboard_shortcuts_inhibit_manager_v1 *key_inhibitor_manager; 73 struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager; 74 struct xdg_activation_v1 *activation_manager; 75 struct zwp_text_input_manager_v3 *text_input_manager; 76 struct zxdg_output_manager_v1 *xdg_output_manager; 77 struct wp_viewporter *viewporter; 78 struct wp_fractional_scale_manager_v1 *fractional_scale_manager; 79 struct zwp_input_timestamps_manager_v1 *input_timestamps_manager; 80 struct zxdg_exporter_v2 *zxdg_exporter_v2; 81 struct xdg_wm_dialog_v1 *xdg_wm_dialog_v1; 82 struct wp_alpha_modifier_v1 *wp_alpha_modifier_v1; 83 struct xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager_v1; 84 struct frog_color_management_factory_v1 *frog_color_management_factory_v1; 85 struct wp_color_manager_v1 *wp_color_manager_v1; 86 struct zwp_tablet_manager_v2 *tablet_manager; 87 struct wl_fixes *wl_fixes; 88 struct zwp_pointer_gestures_v1 *zwp_pointer_gestures; 89 struct wp_single_pixel_buffer_manager_v1 *single_pixel_buffer_manager; 90 91 struct xkb_context *xkb_context; 92 93 struct wl_list seat_list; 94 struct SDL_WaylandSeat *last_implicit_grab_seat; 95 struct SDL_WaylandSeat *last_incoming_data_offer_seat; 96 struct SDL_WaylandSeat *last_incoming_primary_selection_seat; 97 98 SDL_DisplayData **output_list; 99 int output_count; 100 int output_max; 101 102 bool initializing; 103 bool display_disconnected; 104 bool display_externally_owned; 105 bool scale_to_display_enabled; 106}; 107 108struct SDL_DisplayData 109{ 110 SDL_VideoData *videodata; 111 struct wl_output *output; 112 struct zxdg_output_v1 *xdg_output; 113 struct wp_color_management_output_v1 *wp_color_management_output; 114 struct Wayland_ColorInfoState *color_info_state; 115 char *wl_output_name; 116 double scale_factor; 117 Uint32 registry_id; 118 119 struct 120 { 121 int x; 122 int y; 123 int width; 124 int height; 125 } logical; 126 127 struct 128 { 129 int x; 130 int y; 131 int width; 132 int height; 133 } pixel; 134 135 struct 136 { 137 int width_mm; // Physical width in millimeters. 138 int height_mm; // Physical height in millimeters. 139 } physical; 140 141 int refresh; // Refresh in mHz 142 int transform; // wl_output_transform enum 143 SDL_DisplayOrientation orientation; 144 145 SDL_HDROutputProperties HDR; 146 147 SDL_DisplayID display; 148 SDL_VideoDisplay placeholder; 149 150 int wl_output_done_count; 151 bool has_logical_position; 152 bool has_logical_size; 153 bool geometry_changed; 154}; 155 156// Needed here to get wl_surface declaration, fixes GitHub#4594 157#include "SDL_waylanddyn.h" 158 159extern void SDL_WAYLAND_register_surface(struct wl_surface *surface); 160extern void SDL_WAYLAND_register_output(struct wl_output *output); 161extern bool SDL_WAYLAND_own_surface(struct wl_surface *surface); 162extern bool SDL_WAYLAND_own_output(struct wl_output *output); 163 164extern SDL_WindowData *Wayland_GetWindowDataForOwnedSurface(struct wl_surface *surface); 165void Wayland_AddWindowDataToExternalList(SDL_WindowData *data); 166void Wayland_RemoveWindowDataFromExternalList(SDL_WindowData *data); 167struct wl_event_queue *Wayland_DisplayCreateQueue(struct wl_display *display, const char *name); 168 169extern bool Wayland_LoadLibdecor(SDL_VideoData *data, bool ignore_xdg); 170 171extern bool Wayland_HandleDisplayDisconnected(SDL_VideoDevice *_this); 172 173#endif // SDL_waylandvideo_h_ 174[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.