Atlas - wl_platform.h

Home / ext / glfw / src Lines: 1 | Size: 35040 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1//======================================================================== 2// GLFW 3.5 Wayland - www.glfw.org 3//------------------------------------------------------------------------ 4// Copyright (c) 2014 Jonas Ã…dahl <[email protected]> 5// 6// This software is provided 'as-is', without any express or implied 7// warranty. In no event will the authors be held liable for any damages 8// arising from the use of this software. 9// 10// Permission is granted to anyone to use this software for any purpose, 11// including commercial applications, and to alter it and redistribute it 12// freely, subject to the following restrictions: 13// 14// 1. The origin of this software must not be misrepresented; you must not 15// claim that you wrote the original software. If you use this software 16// in a product, an acknowledgment in the product documentation would 17// be appreciated but is not required. 18// 19// 2. Altered source versions must be plainly marked as such, and must not 20// be misrepresented as being the original software. 21// 22// 3. This notice may not be removed or altered from any source 23// distribution. 24// 25//======================================================================== 26 27#include <wayland-client-core.h> 28#include <xkbcommon/xkbcommon.h> 29#include <xkbcommon/xkbcommon-compose.h> 30 31typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; 32 33typedef struct VkWaylandSurfaceCreateInfoKHR 34{ 35 VkStructureType sType; 36 const void* pNext; 37 VkWaylandSurfaceCreateFlagsKHR flags; 38 struct wl_display* display; 39 struct wl_surface* surface; 40} VkWaylandSurfaceCreateInfoKHR; 41 42typedef VkResult (APIENTRY *PFN_vkCreateWaylandSurfaceKHR)(VkInstance,const VkWaylandSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); 43typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice,uint32_t,struct wl_display*); 44 45#include "posix_poll.h" 46 47typedef int (* PFN_wl_display_flush)(struct wl_display* display); 48typedef void (* PFN_wl_display_cancel_read)(struct wl_display* display); 49typedef int (* PFN_wl_display_dispatch_pending)(struct wl_display* display); 50typedef int (* PFN_wl_display_read_events)(struct wl_display* display); 51typedef struct wl_display* (* PFN_wl_display_connect)(const char*); 52typedef void (* PFN_wl_display_disconnect)(struct wl_display*); 53typedef int (* PFN_wl_display_roundtrip)(struct wl_display*); 54typedef int (* PFN_wl_display_get_fd)(struct wl_display*); 55typedef int (* PFN_wl_display_prepare_read)(struct wl_display*); 56typedef void (* PFN_wl_proxy_marshal)(struct wl_proxy*,uint32_t,...); 57typedef int (* PFN_wl_proxy_add_listener)(struct wl_proxy*,void(**)(void),void*); 58typedef void (* PFN_wl_proxy_destroy)(struct wl_proxy*); 59typedef struct wl_proxy* (* PFN_wl_proxy_marshal_constructor)(struct wl_proxy*,uint32_t,const struct wl_interface*,...); 60typedef struct wl_proxy* (* PFN_wl_proxy_marshal_constructor_versioned)(struct wl_proxy*,uint32_t,const struct wl_interface*,uint32_t,...); 61typedef void* (* PFN_wl_proxy_get_user_data)(struct wl_proxy*); 62typedef void (* PFN_wl_proxy_set_user_data)(struct wl_proxy*,void*); 63typedef void (* PFN_wl_proxy_set_tag)(struct wl_proxy*,const char*const*); 64typedef const char* const* (* PFN_wl_proxy_get_tag)(struct wl_proxy*); 65typedef uint32_t (* PFN_wl_proxy_get_version)(struct wl_proxy*); 66typedef struct wl_proxy* (* PFN_wl_proxy_marshal_flags)(struct wl_proxy*,uint32_t,const struct wl_interface*,uint32_t,uint32_t,...); 67#define wl_display_flush _glfw.wl.client.display_flush 68#define wl_display_cancel_read _glfw.wl.client.display_cancel_read 69#define wl_display_dispatch_pending _glfw.wl.client.display_dispatch_pending 70#define wl_display_read_events _glfw.wl.client.display_read_events 71#define wl_display_disconnect _glfw.wl.client.display_disconnect 72#define wl_display_roundtrip _glfw.wl.client.display_roundtrip 73#define wl_display_get_fd _glfw.wl.client.display_get_fd 74#define wl_display_prepare_read _glfw.wl.client.display_prepare_read 75#define wl_proxy_marshal _glfw.wl.client.proxy_marshal 76#define wl_proxy_add_listener _glfw.wl.client.proxy_add_listener 77#define wl_proxy_destroy _glfw.wl.client.proxy_destroy 78#define wl_proxy_marshal_constructor _glfw.wl.client.proxy_marshal_constructor 79#define wl_proxy_marshal_constructor_versioned _glfw.wl.client.proxy_marshal_constructor_versioned 80#define wl_proxy_get_user_data _glfw.wl.client.proxy_get_user_data 81#define wl_proxy_set_user_data _glfw.wl.client.proxy_set_user_data 82#define wl_proxy_get_tag _glfw.wl.client.proxy_get_tag 83#define wl_proxy_set_tag _glfw.wl.client.proxy_set_tag 84#define wl_proxy_get_version _glfw.wl.client.proxy_get_version 85#define wl_proxy_marshal_flags _glfw.wl.client.proxy_marshal_flags 86 87struct wl_shm; 88struct wl_output; 89 90#define wl_display_interface _glfw_wl_display_interface 91#define wl_subcompositor_interface _glfw_wl_subcompositor_interface 92#define wl_compositor_interface _glfw_wl_compositor_interface 93#define wl_shm_interface _glfw_wl_shm_interface 94#define wl_data_device_manager_interface _glfw_wl_data_device_manager_interface 95#define wl_shell_interface _glfw_wl_shell_interface 96#define wl_buffer_interface _glfw_wl_buffer_interface 97#define wl_callback_interface _glfw_wl_callback_interface 98#define wl_data_device_interface _glfw_wl_data_device_interface 99#define wl_data_offer_interface _glfw_wl_data_offer_interface 100#define wl_data_source_interface _glfw_wl_data_source_interface 101#define wl_keyboard_interface _glfw_wl_keyboard_interface 102#define wl_output_interface _glfw_wl_output_interface 103#define wl_pointer_interface _glfw_wl_pointer_interface 104#define wl_region_interface _glfw_wl_region_interface 105#define wl_registry_interface _glfw_wl_registry_interface 106#define wl_seat_interface _glfw_wl_seat_interface 107#define wl_shell_surface_interface _glfw_wl_shell_surface_interface 108#define wl_shm_pool_interface _glfw_wl_shm_pool_interface 109#define wl_subsurface_interface _glfw_wl_subsurface_interface 110#define wl_surface_interface _glfw_wl_surface_interface 111#define wl_touch_interface _glfw_wl_touch_interface 112#define zwp_idle_inhibitor_v1_interface _glfw_zwp_idle_inhibitor_v1_interface 113#define zwp_idle_inhibit_manager_v1_interface _glfw_zwp_idle_inhibit_manager_v1_interface 114#define zwp_confined_pointer_v1_interface _glfw_zwp_confined_pointer_v1_interface 115#define zwp_locked_pointer_v1_interface _glfw_zwp_locked_pointer_v1_interface 116#define zwp_pointer_constraints_v1_interface _glfw_zwp_pointer_constraints_v1_interface 117#define zwp_relative_pointer_v1_interface _glfw_zwp_relative_pointer_v1_interface 118#define zwp_relative_pointer_manager_v1_interface _glfw_zwp_relative_pointer_manager_v1_interface 119#define wp_viewport_interface _glfw_wp_viewport_interface 120#define wp_viewporter_interface _glfw_wp_viewporter_interface 121#define xdg_toplevel_interface _glfw_xdg_toplevel_interface 122#define zxdg_toplevel_decoration_v1_interface _glfw_zxdg_toplevel_decoration_v1_interface 123#define zxdg_decoration_manager_v1_interface _glfw_zxdg_decoration_manager_v1_interface 124#define xdg_popup_interface _glfw_xdg_popup_interface 125#define xdg_positioner_interface _glfw_xdg_positioner_interface 126#define xdg_surface_interface _glfw_xdg_surface_interface 127#define xdg_toplevel_interface _glfw_xdg_toplevel_interface 128#define xdg_wm_base_interface _glfw_xdg_wm_base_interface 129#define xdg_activation_v1_interface _glfw_xdg_activation_v1_interface 130#define xdg_activation_token_v1_interface _glfw_xdg_activation_token_v1_interface 131#define wl_surface_interface _glfw_wl_surface_interface 132#define wp_fractional_scale_v1_interface _glfw_wp_fractional_scale_v1_interface 133 134#define GLFW_WAYLAND_WINDOW_STATE _GLFWwindowWayland wl; 135#define GLFW_WAYLAND_LIBRARY_WINDOW_STATE _GLFWlibraryWayland wl; 136#define GLFW_WAYLAND_MONITOR_STATE _GLFWmonitorWayland wl; 137#define GLFW_WAYLAND_CURSOR_STATE _GLFWcursorWayland wl; 138 139struct wl_cursor_image 140{ 141 uint32_t width; 142 uint32_t height; 143 uint32_t hotspot_x; 144 uint32_t hotspot_y; 145 uint32_t delay; 146}; 147 148struct wl_cursor 149{ 150 unsigned int image_count; 151 struct wl_cursor_image** images; 152 char* name; 153}; 154 155typedef struct wl_cursor_theme* (* PFN_wl_cursor_theme_load)(const char*, int, struct wl_shm*); 156typedef void (* PFN_wl_cursor_theme_destroy)(struct wl_cursor_theme*); 157typedef struct wl_cursor* (* PFN_wl_cursor_theme_get_cursor)(struct wl_cursor_theme*, const char*); 158typedef struct wl_buffer* (* PFN_wl_cursor_image_get_buffer)(struct wl_cursor_image*); 159#define wl_cursor_theme_load _glfw.wl.cursor.theme_load 160#define wl_cursor_theme_destroy _glfw.wl.cursor.theme_destroy 161#define wl_cursor_theme_get_cursor _glfw.wl.cursor.theme_get_cursor 162#define wl_cursor_image_get_buffer _glfw.wl.cursor.image_get_buffer 163 164typedef struct wl_egl_window* (* PFN_wl_egl_window_create)(struct wl_surface*, int, int); 165typedef void (* PFN_wl_egl_window_destroy)(struct wl_egl_window*); 166typedef void (* PFN_wl_egl_window_resize)(struct wl_egl_window*, int, int, int, int); 167#define wl_egl_window_create _glfw.wl.egl.window_create 168#define wl_egl_window_destroy _glfw.wl.egl.window_destroy 169#define wl_egl_window_resize _glfw.wl.egl.window_resize 170 171typedef struct xkb_context* (* PFN_xkb_context_new)(enum xkb_context_flags); 172typedef void (* PFN_xkb_context_unref)(struct xkb_context*); 173typedef struct xkb_keymap* (* PFN_xkb_keymap_new_from_string)(struct xkb_context*, const char*, enum xkb_keymap_format, enum xkb_keymap_compile_flags); 174typedef void (* PFN_xkb_keymap_unref)(struct xkb_keymap*); 175typedef xkb_mod_index_t (* PFN_xkb_keymap_mod_get_index)(struct xkb_keymap*, const char*); 176typedef int (* PFN_xkb_keymap_key_repeats)(struct xkb_keymap*, xkb_keycode_t); 177typedef int (* PFN_xkb_keymap_key_get_syms_by_level)(struct xkb_keymap*,xkb_keycode_t,xkb_layout_index_t,xkb_level_index_t,const xkb_keysym_t**); 178typedef struct xkb_state* (* PFN_xkb_state_new)(struct xkb_keymap*); 179typedef void (* PFN_xkb_state_unref)(struct xkb_state*); 180typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, const xkb_keysym_t**); 181typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t); 182typedef xkb_layout_index_t (* PFN_xkb_state_key_get_layout)(struct xkb_state*,xkb_keycode_t); 183typedef int (* PFN_xkb_state_mod_index_is_active)(struct xkb_state*,xkb_mod_index_t,enum xkb_state_component); 184typedef uint32_t (* PFN_xkb_keysym_to_utf32)(xkb_keysym_t); 185typedef int (* PFN_xkb_keysym_to_utf8)(xkb_keysym_t, char*, size_t); 186#define xkb_context_new _glfw.wl.xkb.context_new 187#define xkb_context_unref _glfw.wl.xkb.context_unref 188#define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string 189#define xkb_keymap_unref _glfw.wl.xkb.keymap_unref 190#define xkb_keymap_mod_get_index _glfw.wl.xkb.keymap_mod_get_index 191#define xkb_keymap_key_repeats _glfw.wl.xkb.keymap_key_repeats 192#define xkb_keymap_key_get_syms_by_level _glfw.wl.xkb.keymap_key_get_syms_by_level 193#define xkb_state_new _glfw.wl.xkb.state_new 194#define xkb_state_unref _glfw.wl.xkb.state_unref 195#define xkb_state_key_get_syms _glfw.wl.xkb.state_key_get_syms 196#define xkb_state_update_mask _glfw.wl.xkb.state_update_mask 197#define xkb_state_key_get_layout _glfw.wl.xkb.state_key_get_layout 198#define xkb_state_mod_index_is_active _glfw.wl.xkb.state_mod_index_is_active 199#define xkb_keysym_to_utf32 _glfw.wl.xkb.keysym_to_utf32 200#define xkb_keysym_to_utf8 _glfw.wl.xkb.keysym_to_utf8 201 202typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags); 203typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*); 204typedef struct xkb_compose_state* (* PFN_xkb_compose_state_new)(struct xkb_compose_table*, enum xkb_compose_state_flags); 205typedef void (* PFN_xkb_compose_state_unref)(struct xkb_compose_state*); 206typedef enum xkb_compose_feed_result (* PFN_xkb_compose_state_feed)(struct xkb_compose_state*, xkb_keysym_t); 207typedef enum xkb_compose_status (* PFN_xkb_compose_state_get_status)(struct xkb_compose_state*); 208typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_state*); 209#define xkb_compose_table_new_from_locale _glfw.wl.xkb.compose_table_new_from_locale 210#define xkb_compose_table_unref _glfw.wl.xkb.compose_table_unref 211#define xkb_compose_state_new _glfw.wl.xkb.compose_state_new 212#define xkb_compose_state_unref _glfw.wl.xkb.compose_state_unref 213#define xkb_compose_state_feed _glfw.wl.xkb.compose_state_feed 214#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status 215#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym 216 217struct libdecor; 218struct libdecor_frame; 219struct libdecor_state; 220struct libdecor_configuration; 221 222enum libdecor_error 223{ 224 LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE, 225 LIBDECOR_ERROR_INVALID_FRAME_CONFIGURATION, 226}; 227 228enum libdecor_window_state 229{ 230 LIBDECOR_WINDOW_STATE_NONE = 0, 231 LIBDECOR_WINDOW_STATE_ACTIVE = 1, 232 LIBDECOR_WINDOW_STATE_MAXIMIZED = 2, 233 LIBDECOR_WINDOW_STATE_FULLSCREEN = 4, 234 LIBDECOR_WINDOW_STATE_TILED_LEFT = 8, 235 LIBDECOR_WINDOW_STATE_TILED_RIGHT = 16, 236 LIBDECOR_WINDOW_STATE_TILED_TOP = 32, 237 LIBDECOR_WINDOW_STATE_TILED_BOTTOM = 64 238}; 239 240enum libdecor_capabilities 241{ 242 LIBDECOR_ACTION_MOVE = 1, 243 LIBDECOR_ACTION_RESIZE = 2, 244 LIBDECOR_ACTION_MINIMIZE = 4, 245 LIBDECOR_ACTION_FULLSCREEN = 8, 246 LIBDECOR_ACTION_CLOSE = 16 247}; 248 249struct libdecor_interface 250{ 251 void (* error)(struct libdecor*,enum libdecor_error,const char*); 252 void (* reserved0)(void); 253 void (* reserved1)(void); 254 void (* reserved2)(void); 255 void (* reserved3)(void); 256 void (* reserved4)(void); 257 void (* reserved5)(void); 258 void (* reserved6)(void); 259 void (* reserved7)(void); 260 void (* reserved8)(void); 261 void (* reserved9)(void); 262}; 263 264struct libdecor_frame_interface 265{ 266 void (* configure)(struct libdecor_frame*,struct libdecor_configuration*,void*); 267 void (* close)(struct libdecor_frame*,void*); 268 void (* commit)(struct libdecor_frame*,void*); 269 void (* dismiss_popup)(struct libdecor_frame*,const char*,void*); 270 void (* reserved0)(void); 271 void (* reserved1)(void); 272 void (* reserved2)(void); 273 void (* reserved3)(void); 274 void (* reserved4)(void); 275 void (* reserved5)(void); 276 void (* reserved6)(void); 277 void (* reserved7)(void); 278 void (* reserved8)(void); 279 void (* reserved9)(void); 280}; 281 282typedef struct libdecor* (* PFN_libdecor_new)(struct wl_display*,const struct libdecor_interface*); 283typedef void (* PFN_libdecor_unref)(struct libdecor*); 284typedef int (* PFN_libdecor_get_fd)(struct libdecor*); 285typedef int (* PFN_libdecor_dispatch)(struct libdecor*,int); 286typedef struct libdecor_frame* (* PFN_libdecor_decorate)(struct libdecor*,struct wl_surface*,const struct libdecor_frame_interface*,void*); 287typedef void (* PFN_libdecor_frame_unref)(struct libdecor_frame*); 288typedef void (* PFN_libdecor_frame_set_app_id)(struct libdecor_frame*,const char*); 289typedef void (* PFN_libdecor_frame_set_title)(struct libdecor_frame*,const char*); 290typedef void (* PFN_libdecor_frame_set_minimized)(struct libdecor_frame*); 291typedef void (* PFN_libdecor_frame_set_fullscreen)(struct libdecor_frame*,struct wl_output*); 292typedef void (* PFN_libdecor_frame_unset_fullscreen)(struct libdecor_frame*); 293typedef void (* PFN_libdecor_frame_map)(struct libdecor_frame*); 294typedef void (* PFN_libdecor_frame_commit)(struct libdecor_frame*,struct libdecor_state*,struct libdecor_configuration*); 295typedef void (* PFN_libdecor_frame_set_min_content_size)(struct libdecor_frame*,int,int); 296typedef void (* PFN_libdecor_frame_set_max_content_size)(struct libdecor_frame*,int,int); 297typedef void (* PFN_libdecor_frame_set_maximized)(struct libdecor_frame*); 298typedef void (* PFN_libdecor_frame_unset_maximized)(struct libdecor_frame*); 299typedef void (* PFN_libdecor_frame_set_capabilities)(struct libdecor_frame*,enum libdecor_capabilities); 300typedef void (* PFN_libdecor_frame_unset_capabilities)(struct libdecor_frame*,enum libdecor_capabilities); 301typedef void (* PFN_libdecor_frame_set_visibility)(struct libdecor_frame*,bool visible); 302typedef struct xdg_toplevel* (* PFN_libdecor_frame_get_xdg_toplevel)(struct libdecor_frame*); 303typedef bool (* PFN_libdecor_configuration_get_content_size)(struct libdecor_configuration*,struct libdecor_frame*,int*,int*); 304typedef bool (* PFN_libdecor_configuration_get_window_state)(struct libdecor_configuration*,enum libdecor_window_state*); 305typedef struct libdecor_state* (* PFN_libdecor_state_new)(int,int); 306typedef void (* PFN_libdecor_state_free)(struct libdecor_state*); 307#define libdecor_new _glfw.wl.libdecor.libdecor_new_ 308#define libdecor_unref _glfw.wl.libdecor.libdecor_unref_ 309#define libdecor_get_fd _glfw.wl.libdecor.libdecor_get_fd_ 310#define libdecor_dispatch _glfw.wl.libdecor.libdecor_dispatch_ 311#define libdecor_decorate _glfw.wl.libdecor.libdecor_decorate_ 312#define libdecor_frame_unref _glfw.wl.libdecor.libdecor_frame_unref_ 313#define libdecor_frame_set_app_id _glfw.wl.libdecor.libdecor_frame_set_app_id_ 314#define libdecor_frame_set_title _glfw.wl.libdecor.libdecor_frame_set_title_ 315#define libdecor_frame_set_minimized _glfw.wl.libdecor.libdecor_frame_set_minimized_ 316#define libdecor_frame_set_fullscreen _glfw.wl.libdecor.libdecor_frame_set_fullscreen_ 317#define libdecor_frame_unset_fullscreen _glfw.wl.libdecor.libdecor_frame_unset_fullscreen_ 318#define libdecor_frame_map _glfw.wl.libdecor.libdecor_frame_map_ 319#define libdecor_frame_commit _glfw.wl.libdecor.libdecor_frame_commit_ 320#define libdecor_frame_set_min_content_size _glfw.wl.libdecor.libdecor_frame_set_min_content_size_ 321#define libdecor_frame_set_max_content_size _glfw.wl.libdecor.libdecor_frame_set_max_content_size_ 322#define libdecor_frame_set_maximized _glfw.wl.libdecor.libdecor_frame_set_maximized_ 323#define libdecor_frame_unset_maximized _glfw.wl.libdecor.libdecor_frame_unset_maximized_ 324#define libdecor_frame_set_capabilities _glfw.wl.libdecor.libdecor_frame_set_capabilities_ 325#define libdecor_frame_unset_capabilities _glfw.wl.libdecor.libdecor_frame_unset_capabilities_ 326#define libdecor_frame_set_visibility _glfw.wl.libdecor.libdecor_frame_set_visibility_ 327#define libdecor_frame_get_xdg_toplevel _glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_ 328#define libdecor_configuration_get_content_size _glfw.wl.libdecor.libdecor_configuration_get_content_size_ 329#define libdecor_configuration_get_window_state _glfw.wl.libdecor.libdecor_configuration_get_window_state_ 330#define libdecor_state_new _glfw.wl.libdecor.libdecor_state_new_ 331#define libdecor_state_free _glfw.wl.libdecor.libdecor_state_free_ 332 333typedef struct _GLFWfallbackEdgeWayland 334{ 335 struct wl_surface* surface; 336 struct wl_subsurface* subsurface; 337 struct wp_viewport* viewport; 338} _GLFWfallbackEdgeWayland; 339 340typedef struct _GLFWofferWayland 341{ 342 struct wl_data_offer* offer; 343 GLFWbool text_plain_utf8; 344 GLFWbool text_uri_list; 345} _GLFWofferWayland; 346 347typedef struct _GLFWscaleWayland 348{ 349 struct wl_output* output; 350 int32_t factor; 351} _GLFWscaleWayland; 352 353// Wayland-specific per-window data 354// 355typedef struct _GLFWwindowWayland 356{ 357 int width, height; 358 int fbWidth, fbHeight; 359 GLFWbool visible; 360 GLFWbool maximized; 361 GLFWbool activated; 362 GLFWbool fullscreen; 363 GLFWbool hovered; 364 GLFWbool transparent; 365 GLFWbool scaleFramebuffer; 366 struct wl_surface* surface; 367 struct wl_callback* callback; 368 369 struct { 370 struct wl_egl_window* window; 371 } egl; 372 373 struct { 374 int width, height; 375 GLFWbool maximized; 376 GLFWbool iconified; 377 GLFWbool activated; 378 GLFWbool fullscreen; 379 } pending; 380 381 struct { 382 struct xdg_surface* surface; 383 struct xdg_toplevel* toplevel; 384 struct zxdg_toplevel_decoration_v1* decoration; 385 uint32_t decorationMode; 386 } xdg; 387 388 struct { 389 struct libdecor_frame* frame; 390 } libdecor; 391 392 _GLFWcursor* currentCursor; 393 double cursorPosX, cursorPosY; 394 395 char* appId; 396 397 // We need to track the monitors the window spans on to calculate the 398 // optimal scaling factor. 399 int32_t bufferScale; 400 _GLFWscaleWayland* outputScales; 401 size_t outputScaleCount; 402 size_t outputScaleSize; 403 404 struct wp_viewport* scalingViewport; 405 uint32_t scalingNumerator; 406 struct wp_fractional_scale_v1* fractionalScale; 407 408 struct zwp_relative_pointer_v1* relativePointer; 409 struct zwp_locked_pointer_v1* lockedPointer; 410 struct zwp_confined_pointer_v1* confinedPointer; 411 412 struct zwp_idle_inhibitor_v1* idleInhibitor; 413 struct xdg_activation_token_v1* activationToken; 414 415 struct { 416 GLFWbool decorations; 417 struct wl_buffer* buffer; 418 _GLFWfallbackEdgeWayland top, left, right, bottom; 419 struct wl_surface* focus; 420 wl_fixed_t pointerX, pointerY; 421 const char* cursorName; 422 } fallback; 423} _GLFWwindowWayland; 424 425// Wayland-specific global data 426// 427typedef struct _GLFWlibraryWayland 428{ 429 struct wl_display* display; 430 struct wl_registry* registry; 431 struct wl_compositor* compositor; 432 struct wl_subcompositor* subcompositor; 433 struct wl_shm* shm; 434 struct wl_seat* seat; 435 struct wl_pointer* pointer; 436 struct wl_keyboard* keyboard; 437 struct wl_data_device_manager* dataDeviceManager; 438 struct wl_data_device* dataDevice; 439 struct xdg_wm_base* wmBase; 440 struct zxdg_decoration_manager_v1* decorationManager; 441 struct wp_viewporter* viewporter; 442 struct zwp_relative_pointer_manager_v1* relativePointerManager; 443 struct zwp_pointer_constraints_v1* pointerConstraints; 444 struct zwp_idle_inhibit_manager_v1* idleInhibitManager; 445 struct xdg_activation_v1* activationManager; 446 struct wp_fractional_scale_manager_v1* fractionalScaleManager; 447 448 _GLFWofferWayland* offers; 449 unsigned int offerCount; 450 451 struct wl_data_offer* selectionOffer; 452 struct wl_data_source* selectionSource; 453 454 struct wl_data_offer* dragOffer; 455 _GLFWwindow* dragFocus; 456 uint32_t dragSerial; 457 458 const char* tag; 459 460 struct wl_cursor_theme* cursorTheme; 461 struct wl_cursor_theme* cursorThemeHiDPI; 462 struct wl_surface* cursorSurface; 463 int cursorTimerfd; 464 uint32_t serial; 465 uint32_t pointerEnterSerial; 466 467 int keyRepeatTimerfd; 468 int32_t keyRepeatRate; 469 int32_t keyRepeatDelay; 470 int keyRepeatScancode; 471 472 char* clipboardString; 473 short int keycodes[256]; 474 short int scancodes[GLFW_KEY_LAST + 1]; 475 char keynames[GLFW_KEY_LAST + 1][5]; 476 477 struct { 478 void* handle; 479 struct xkb_context* context; 480 struct xkb_keymap* keymap; 481 struct xkb_state* state; 482 483 struct xkb_compose_state* composeState; 484 485 xkb_mod_index_t controlIndex; 486 xkb_mod_index_t altIndex; 487 xkb_mod_index_t shiftIndex; 488 xkb_mod_index_t superIndex; 489 xkb_mod_index_t capsLockIndex; 490 xkb_mod_index_t numLockIndex; 491 unsigned int modifiers; 492 493 PFN_xkb_context_new context_new; 494 PFN_xkb_context_unref context_unref; 495 PFN_xkb_keymap_new_from_string keymap_new_from_string; 496 PFN_xkb_keymap_unref keymap_unref; 497 PFN_xkb_keymap_mod_get_index keymap_mod_get_index; 498 PFN_xkb_keymap_key_repeats keymap_key_repeats; 499 PFN_xkb_keymap_key_get_syms_by_level keymap_key_get_syms_by_level; 500 PFN_xkb_state_new state_new; 501 PFN_xkb_state_unref state_unref; 502 PFN_xkb_state_key_get_syms state_key_get_syms; 503 PFN_xkb_state_update_mask state_update_mask; 504 PFN_xkb_state_key_get_layout state_key_get_layout; 505 PFN_xkb_state_mod_index_is_active state_mod_index_is_active; 506 PFN_xkb_keysym_to_utf32 keysym_to_utf32; 507 PFN_xkb_keysym_to_utf8 keysym_to_utf8; 508 509 PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale; 510 PFN_xkb_compose_table_unref compose_table_unref; 511 PFN_xkb_compose_state_new compose_state_new; 512 PFN_xkb_compose_state_unref compose_state_unref; 513 PFN_xkb_compose_state_feed compose_state_feed; 514 PFN_xkb_compose_state_get_status compose_state_get_status; 515 PFN_xkb_compose_state_get_one_sym compose_state_get_one_sym; 516 } xkb; 517 518 _GLFWwindow* pointerFocus; 519 _GLFWwindow* keyboardFocus; 520 521 struct { 522 void* handle; 523 PFN_wl_display_flush display_flush; 524 PFN_wl_display_cancel_read display_cancel_read; 525 PFN_wl_display_dispatch_pending display_dispatch_pending; 526 PFN_wl_display_read_events display_read_events; 527 PFN_wl_display_disconnect display_disconnect; 528 PFN_wl_display_roundtrip display_roundtrip; 529 PFN_wl_display_get_fd display_get_fd; 530 PFN_wl_display_prepare_read display_prepare_read; 531 PFN_wl_proxy_marshal proxy_marshal; 532 PFN_wl_proxy_add_listener proxy_add_listener; 533 PFN_wl_proxy_destroy proxy_destroy; 534 PFN_wl_proxy_marshal_constructor proxy_marshal_constructor; 535 PFN_wl_proxy_marshal_constructor_versioned proxy_marshal_constructor_versioned; 536 PFN_wl_proxy_get_user_data proxy_get_user_data; 537 PFN_wl_proxy_set_user_data proxy_set_user_data; 538 PFN_wl_proxy_get_tag proxy_get_tag; 539 PFN_wl_proxy_set_tag proxy_set_tag; 540 PFN_wl_proxy_get_version proxy_get_version; 541 PFN_wl_proxy_marshal_flags proxy_marshal_flags; 542 } client; 543 544 struct { 545 void* handle; 546 547 PFN_wl_cursor_theme_load theme_load; 548 PFN_wl_cursor_theme_destroy theme_destroy; 549 PFN_wl_cursor_theme_get_cursor theme_get_cursor; 550 PFN_wl_cursor_image_get_buffer image_get_buffer; 551 } cursor; 552 553 struct { 554 void* handle; 555 556 PFN_wl_egl_window_create window_create; 557 PFN_wl_egl_window_destroy window_destroy; 558 PFN_wl_egl_window_resize window_resize; 559 } egl; 560 561 struct { 562 void* handle; 563 struct libdecor* context; 564 struct wl_callback* callback; 565 GLFWbool ready; 566 PFN_libdecor_new libdecor_new_; 567 PFN_libdecor_unref libdecor_unref_; 568 PFN_libdecor_get_fd libdecor_get_fd_; 569 PFN_libdecor_dispatch libdecor_dispatch_; 570 PFN_libdecor_decorate libdecor_decorate_; 571 PFN_libdecor_frame_unref libdecor_frame_unref_; 572 PFN_libdecor_frame_set_app_id libdecor_frame_set_app_id_; 573 PFN_libdecor_frame_set_title libdecor_frame_set_title_; 574 PFN_libdecor_frame_set_minimized libdecor_frame_set_minimized_; 575 PFN_libdecor_frame_set_fullscreen libdecor_frame_set_fullscreen_; 576 PFN_libdecor_frame_unset_fullscreen libdecor_frame_unset_fullscreen_; 577 PFN_libdecor_frame_map libdecor_frame_map_; 578 PFN_libdecor_frame_commit libdecor_frame_commit_; 579 PFN_libdecor_frame_set_min_content_size libdecor_frame_set_min_content_size_; 580 PFN_libdecor_frame_set_max_content_size libdecor_frame_set_max_content_size_; 581 PFN_libdecor_frame_set_maximized libdecor_frame_set_maximized_; 582 PFN_libdecor_frame_unset_maximized libdecor_frame_unset_maximized_; 583 PFN_libdecor_frame_set_capabilities libdecor_frame_set_capabilities_; 584 PFN_libdecor_frame_unset_capabilities libdecor_frame_unset_capabilities_; 585 PFN_libdecor_frame_set_visibility libdecor_frame_set_visibility_; 586 PFN_libdecor_frame_get_xdg_toplevel libdecor_frame_get_xdg_toplevel_; 587 PFN_libdecor_configuration_get_content_size libdecor_configuration_get_content_size_; 588 PFN_libdecor_configuration_get_window_state libdecor_configuration_get_window_state_; 589 PFN_libdecor_state_new libdecor_state_new_; 590 PFN_libdecor_state_free libdecor_state_free_; 591 } libdecor; 592} _GLFWlibraryWayland; 593 594// Wayland-specific per-monitor data 595// 596typedef struct _GLFWmonitorWayland 597{ 598 struct wl_output* output; 599 uint32_t name; 600 int currentMode; 601 602 int x; 603 int y; 604 int32_t scale; 605} _GLFWmonitorWayland; 606 607// Wayland-specific per-cursor data 608// 609typedef struct _GLFWcursorWayland 610{ 611 struct wl_cursor* cursor; 612 struct wl_cursor* cursorHiDPI; 613 struct wl_buffer* buffer; 614 int width, height; 615 int xhot, yhot; 616 int currentImage; 617} _GLFWcursorWayland; 618 619GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform); 620int _glfwInitWayland(void); 621void _glfwTerminateWayland(void); 622 623GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); 624void _glfwDestroyWindowWayland(_GLFWwindow* window); 625void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title); 626void _glfwSetWindowIconWayland(_GLFWwindow* window, int count, const GLFWimage* images); 627void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos); 628void _glfwSetWindowPosWayland(_GLFWwindow* window, int xpos, int ypos); 629void _glfwGetWindowSizeWayland(_GLFWwindow* window, int* width, int* height); 630void _glfwSetWindowSizeWayland(_GLFWwindow* window, int width, int height); 631void _glfwSetWindowSizeLimitsWayland(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); 632void _glfwSetWindowAspectRatioWayland(_GLFWwindow* window, int numer, int denom); 633void _glfwGetFramebufferSizeWayland(_GLFWwindow* window, int* width, int* height); 634void _glfwGetWindowFrameSizeWayland(_GLFWwindow* window, int* left, int* top, int* right, int* bottom); 635void _glfwGetWindowContentScaleWayland(_GLFWwindow* window, float* xscale, float* yscale); 636void _glfwIconifyWindowWayland(_GLFWwindow* window); 637void _glfwRestoreWindowWayland(_GLFWwindow* window); 638void _glfwMaximizeWindowWayland(_GLFWwindow* window); 639void _glfwShowWindowWayland(_GLFWwindow* window); 640void _glfwHideWindowWayland(_GLFWwindow* window); 641void _glfwRequestWindowAttentionWayland(_GLFWwindow* window); 642void _glfwFocusWindowWayland(_GLFWwindow* window); 643void _glfwSetWindowMonitorWayland(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); 644GLFWbool _glfwWindowFocusedWayland(_GLFWwindow* window); 645GLFWbool _glfwWindowIconifiedWayland(_GLFWwindow* window); 646GLFWbool _glfwWindowVisibleWayland(_GLFWwindow* window); 647GLFWbool _glfwWindowMaximizedWayland(_GLFWwindow* window); 648GLFWbool _glfwWindowHoveredWayland(_GLFWwindow* window); 649GLFWbool _glfwFramebufferTransparentWayland(_GLFWwindow* window); 650void _glfwSetWindowResizableWayland(_GLFWwindow* window, GLFWbool enabled); 651void _glfwSetWindowDecoratedWayland(_GLFWwindow* window, GLFWbool enabled); 652void _glfwSetWindowFloatingWayland(_GLFWwindow* window, GLFWbool enabled); 653float _glfwGetWindowOpacityWayland(_GLFWwindow* window); 654void _glfwSetWindowOpacityWayland(_GLFWwindow* window, float opacity); 655void _glfwSetWindowMousePassthroughWayland(_GLFWwindow* window, GLFWbool enabled); 656 657void _glfwSetRawMouseMotionWayland(_GLFWwindow* window, GLFWbool enabled); 658GLFWbool _glfwRawMouseMotionSupportedWayland(void); 659 660void _glfwPollEventsWayland(void); 661void _glfwWaitEventsWayland(void); 662void _glfwWaitEventsTimeoutWayland(double timeout); 663void _glfwPostEmptyEventWayland(void); 664 665void _glfwGetCursorPosWayland(_GLFWwindow* window, double* xpos, double* ypos); 666void _glfwSetCursorPosWayland(_GLFWwindow* window, double xpos, double ypos); 667void _glfwSetCursorModeWayland(_GLFWwindow* window, int mode); 668const char* _glfwGetScancodeNameWayland(int scancode); 669int _glfwGetKeyScancodeWayland(int key); 670GLFWbool _glfwCreateCursorWayland(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); 671GLFWbool _glfwCreateStandardCursorWayland(_GLFWcursor* cursor, int shape); 672void _glfwDestroyCursorWayland(_GLFWcursor* cursor); 673void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor); 674void _glfwSetClipboardStringWayland(const char* string); 675const char* _glfwGetClipboardStringWayland(void); 676 677EGLenum _glfwGetEGLPlatformWayland(EGLint** attribs); 678EGLNativeDisplayType _glfwGetEGLNativeDisplayWayland(void); 679EGLNativeWindowType _glfwGetEGLNativeWindowWayland(_GLFWwindow* window); 680 681void _glfwGetRequiredInstanceExtensionsWayland(char** extensions); 682GLFWbool _glfwGetPhysicalDevicePresentationSupportWayland(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); 683VkResult _glfwCreateWindowSurfaceWayland(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); 684 685void _glfwFreeMonitorWayland(_GLFWmonitor* monitor); 686void _glfwGetMonitorPosWayland(_GLFWmonitor* monitor, int* xpos, int* ypos); 687void _glfwGetMonitorContentScaleWayland(_GLFWmonitor* monitor, float* xscale, float* yscale); 688void _glfwGetMonitorWorkareaWayland(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); 689GLFWvidmode* _glfwGetVideoModesWayland(_GLFWmonitor* monitor, int* count); 690GLFWbool _glfwGetVideoModeWayland(_GLFWmonitor* monitor, GLFWvidmode* mode); 691GLFWbool _glfwGetGammaRampWayland(_GLFWmonitor* monitor, GLFWgammaramp* ramp); 692void _glfwSetGammaRampWayland(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); 693 694void _glfwAddOutputWayland(uint32_t name, uint32_t version); 695void _glfwUpdateBufferScaleFromOutputsWayland(_GLFWwindow* window); 696 697void _glfwAddSeatListenerWayland(struct wl_seat* seat); 698void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device); 699 700
[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.