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