Atlas - SDL_waylandwindow.h
Home / ext / SDL / src / video / wayland Lines: 1 | Size: 9559 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2025 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_waylandwindow_h_ 25#define SDL_waylandwindow_h_ 26 27#include "../SDL_sysvideo.h" 28#include "../../events/SDL_touch_c.h" 29 30#include "SDL_waylandvideo.h" 31#include "SDL_waylandshmbuffer.h" 32 33struct SDL_WindowData 34{ 35 SDL_Window *sdlwindow; 36 SDL_VideoData *waylandData; 37 struct wl_surface *surface; 38 struct wl_callback *gles_swap_frame_callback; 39 struct wl_event_queue *gles_swap_frame_event_queue; 40 struct wl_surface *gles_swap_frame_surface_wrapper; 41 struct wl_callback *surface_frame_callback; 42 43 union 44 { 45#ifdef HAVE_LIBDECOR_H 46 struct 47 { 48 struct libdecor_frame *frame; 49 } libdecor; 50#endif 51 struct 52 { 53 struct xdg_surface *surface; 54 union 55 { 56 struct 57 { 58 struct xdg_toplevel *xdg_toplevel; 59 } toplevel; 60 struct 61 { 62 struct xdg_popup *xdg_popup; 63 struct xdg_positioner *xdg_positioner; 64 } popup; 65 }; 66 67 Uint32 serial; 68 } xdg; 69 } shell_surface; 70 enum 71 { 72 WAYLAND_SHELL_SURFACE_TYPE_UNKNOWN = 0, 73 WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL, 74 WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP, 75 WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR, 76 WAYLAND_SHELL_SURFACE_TYPE_CUSTOM 77 } shell_surface_type; 78 enum 79 { 80 WAYLAND_SHELL_SURFACE_STATUS_HIDDEN = 0, 81 WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE, 82 WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME, 83 WAYLAND_SHELL_SURFACE_STATUS_SHOW_PENDING, 84 WAYLAND_SHELL_SURFACE_STATUS_SHOWN 85 } shell_surface_status; 86 enum 87 { 88 WAYLAND_WM_CAPS_WINDOW_MENU = 0x01, 89 WAYLAND_WM_CAPS_MAXIMIZE = 0x02, 90 WAYLAND_WM_CAPS_FULLSCREEN = 0x04, 91 WAYLAND_WM_CAPS_MINIMIZE = 0x08, 92 93 WAYLAND_WM_CAPS_ALL = WAYLAND_WM_CAPS_WINDOW_MENU | 94 WAYLAND_WM_CAPS_MAXIMIZE | 95 WAYLAND_WM_CAPS_FULLSCREEN | 96 WAYLAND_WM_CAPS_MINIMIZE 97 } wm_caps; 98 enum 99 { 100 WAYLAND_TOPLEVEL_CONSTRAINED_LEFT = 0x01, 101 WAYLAND_TOPLEVEL_CONSTRAINED_RIGHT = 0x02, 102 WAYLAND_TOPLEVEL_CONSTRAINED_TOP = 0x04, 103 WAYLAND_TOPLEVEL_CONSTRAINED_BOTTOM = 0x08 104 } toplevel_constraints; 105 106 struct wl_egl_window *egl_window; 107#ifdef SDL_VIDEO_OPENGL_EGL 108 EGLSurface egl_surface; 109#endif 110 struct zxdg_toplevel_decoration_v1 *server_decoration; 111 struct zwp_idle_inhibitor_v1 *idle_inhibitor; 112 struct xdg_activation_token_v1 *activation_token; 113 struct wp_viewport *viewport; 114 struct wp_fractional_scale_v1 *fractional_scale; 115 struct zxdg_exported_v2 *exported; 116 struct xdg_dialog_v1 *xdg_dialog_v1; 117 struct wp_alpha_modifier_surface_v1 *wp_alpha_modifier_surface_v1; 118 struct xdg_toplevel_icon_v1 *xdg_toplevel_icon_v1; 119 struct frog_color_managed_surface *frog_color_managed_surface; 120 struct wp_color_management_surface_feedback_v1 *wp_color_management_surface_feedback; 121 122 struct Wayland_ColorInfoState *color_info_state; 123 124 SDL_AtomicInt swap_interval_ready; 125 126 SDL_DisplayData **outputs; 127 int num_outputs; 128 129 char *app_id; 130 double scale_factor; 131 132 struct wl_buffer **icon_buffers; 133 int icon_buffer_count; 134 135 // Keyboard, pointer, and touch focus refcount. 136 int keyboard_focus_count; 137 int pointer_focus_count; 138 int active_touch_count; 139 140 struct 141 { 142 double x; 143 double y; 144 } pointer_scale; 145 146 // The in-flight window size request. 147 struct 148 { 149 // The requested logical window size. 150 int logical_width; 151 int logical_height; 152 153 // The size of the window in pixels, when using screen space scaling. 154 int pixel_width; 155 int pixel_height; 156 } requested; 157 158 // The current size of the window and drawable backing store. 159 struct 160 { 161 // The size of the underlying window. 162 int logical_width; 163 int logical_height; 164 165 // The size of the window backbuffer in pixels. 166 int pixel_width; 167 int pixel_height; 168 } current; 169 170 // The last compositor requested parameters; used for deduplication of window geometry configuration. 171 struct 172 { 173 int width; 174 int height; 175 } last_configure; 176 177 // System enforced window size limits. 178 struct 179 { 180 // Minimum allowed logical window size. 181 int min_width; 182 int min_height; 183 } system_limits; 184 185 struct 186 { 187 int width; 188 int height; 189 } toplevel_bounds; 190 191 struct 192 { 193 int hint; 194 int purpose; 195 bool active; 196 } text_input_props; 197 198 SDL_DisplayID last_displayID; 199 int fullscreen_deadline_count; 200 int maximized_restored_deadline_count; 201 Uint64 last_focus_event_time_ns; 202 int icc_fd; 203 Uint32 icc_size; 204 bool floating; 205 bool suspended; 206 bool resizing; 207 bool active; 208 bool pending_config_ack; 209 bool is_fullscreen; 210 bool fullscreen_exclusive; 211 bool drop_fullscreen_requests; 212 bool showing_window; 213 bool fullscreen_was_positioned; 214 bool show_hide_sync_required; 215 bool scale_to_display; 216 bool reparenting_required; 217 bool double_buffer; 218 219 SDL_HitTestResult hit_test_result; 220 221 struct wl_list external_window_list_link; 222}; 223 224extern void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window); 225extern void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window); 226extern void Wayland_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window); 227extern SDL_FullscreenResult Wayland_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *_display, SDL_FullscreenOp fullscreen); 228extern void Wayland_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window); 229extern void Wayland_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window); 230extern bool Wayland_SetWindowMouseRect(SDL_VideoDevice *_this, SDL_Window *window); 231extern bool Wayland_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, bool grabbed); 232extern bool Wayland_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, bool grabbed); 233extern void Wayland_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window); 234extern void Wayland_SetWindowBordered(SDL_VideoDevice *_this, SDL_Window *window, bool bordered); 235extern void Wayland_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, bool resizable); 236extern bool Wayland_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props); 237extern bool Wayland_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window); 238extern void Wayland_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window); 239extern void Wayland_SetWindowMinimumSize(SDL_VideoDevice *_this, SDL_Window *window); 240extern void Wayland_SetWindowMaximumSize(SDL_VideoDevice *_this, SDL_Window *window); 241extern void Wayland_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h); 242extern SDL_DisplayID Wayland_GetDisplayForWindow(SDL_VideoDevice *_this, SDL_Window *window); 243extern bool Wayland_SetWindowParent(SDL_VideoDevice *_this, SDL_Window *window, SDL_Window *parent_window); 244extern bool Wayland_SetWindowModal(SDL_VideoDevice *_this, SDL_Window *window, bool modal); 245extern bool Wayland_SetWindowOpacity(SDL_VideoDevice *_this, SDL_Window *window, float opacity); 246extern void Wayland_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window); 247extern void Wayland_ShowWindowSystemMenu(SDL_Window *window, int x, int y); 248extern void Wayland_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window); 249extern bool Wayland_SuspendScreenSaver(SDL_VideoDevice *_this); 250extern bool Wayland_SetWindowIcon(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface *icon); 251extern bool Wayland_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, bool focusable); 252extern float Wayland_GetWindowContentScale(SDL_VideoDevice *_this, SDL_Window *window); 253extern void *Wayland_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window, size_t *size); 254 255extern bool Wayland_SetWindowHitTest(SDL_Window *window, bool enabled); 256extern bool Wayland_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation); 257extern bool Wayland_SyncWindow(SDL_VideoDevice *_this, SDL_Window *window); 258extern bool Wayland_ReconfigureWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_WindowFlags flags); 259 260extern void Wayland_RemoveOutputFromWindow(SDL_WindowData *window, SDL_DisplayData *display_data); 261 262#endif // SDL_waylandwindow_h_ 263[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.