Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 1 | //======================================================================== |
Camilla Berglund | 53fafad | 2016-08-18 23:42:15 +0200 | [diff] [blame] | 2 | // GLFW 3.3 Wayland - www.glfw.org |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 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 | |
Camilla Berglund | 22095d1 | 2014-03-19 13:21:19 +0100 | [diff] [blame] | 27 | #include <wayland-client.h> |
Jonas Ådahl | 9ac854b | 2014-06-29 23:09:21 +0200 | [diff] [blame] | 28 | #include <xkbcommon/xkbcommon.h> |
Emmanuel Gil Peyrot | d184313 | 2017-11-16 16:42:11 +0000 | [diff] [blame] | 29 | #ifdef HAVE_XKBCOMMON_COMPOSE_H |
Emmanuel Gil Peyrot | 046d281 | 2016-10-11 00:02:15 +0100 | [diff] [blame] | 30 | #include <xkbcommon/xkbcommon-compose.h> |
Emmanuel Gil Peyrot | d184313 | 2017-11-16 16:42:11 +0000 | [diff] [blame] | 31 | #endif |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 32 | #include <dlfcn.h> |
| 33 | |
| 34 | typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; |
| 35 | |
| 36 | typedef struct VkWaylandSurfaceCreateInfoKHR |
| 37 | { |
| 38 | VkStructureType sType; |
| 39 | const void* pNext; |
| 40 | VkWaylandSurfaceCreateFlagsKHR flags; |
| 41 | struct wl_display* display; |
| 42 | struct wl_surface* surface; |
| 43 | } VkWaylandSurfaceCreateInfoKHR; |
| 44 | |
| 45 | typedef VkResult (APIENTRY *PFN_vkCreateWaylandSurfaceKHR)(VkInstance,const VkWaylandSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); |
| 46 | typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice,uint32_t,struct wl_display*); |
Camilla Berglund | 22095d1 | 2014-03-19 13:21:19 +0100 | [diff] [blame] | 47 | |
Camilla Löwy | a3007b9 | 2017-05-25 19:25:47 +0200 | [diff] [blame] | 48 | #include "posix_thread.h" |
Camilla Berglund | 38ae319 | 2015-05-27 15:06:52 +0200 | [diff] [blame] | 49 | #include "posix_time.h" |
Greg V | 0a3c4f5 | 2018-03-19 22:08:22 +0300 | [diff] [blame] | 50 | #ifdef __linux__ |
Camilla Berglund | 38ae319 | 2015-05-27 15:06:52 +0200 | [diff] [blame] | 51 | #include "linux_joystick.h" |
Greg V | 0a3c4f5 | 2018-03-19 22:08:22 +0300 | [diff] [blame] | 52 | #else |
| 53 | #include "null_joystick.h" |
| 54 | #endif |
Camilla Berglund | 38ae319 | 2015-05-27 15:06:52 +0200 | [diff] [blame] | 55 | #include "xkb_unicode.h" |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 56 | #include "egl_context.h" |
Emmanuel Gil Peyrot | 0e0862c | 2017-03-03 17:51:40 +0000 | [diff] [blame] | 57 | #include "osmesa_context.h" |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 58 | |
Emmanuel Gil Peyrot | 73567ae | 2017-12-03 03:59:12 +0100 | [diff] [blame] | 59 | #include "wayland-xdg-shell-client-protocol.h" |
Emmanuel Gil Peyrot | dcd2a19 | 2018-10-01 15:05:55 +0200 | [diff] [blame] | 60 | #include "wayland-xdg-decoration-client-protocol.h" |
Emmanuel Gil Peyrot | 79e16ba | 2017-12-19 19:04:28 +0100 | [diff] [blame] | 61 | #include "wayland-viewporter-client-protocol.h" |
Jonas Ådahl | cb08dc5 | 2015-12-09 15:29:37 +0800 | [diff] [blame] | 62 | #include "wayland-relative-pointer-unstable-v1-client-protocol.h" |
| 63 | #include "wayland-pointer-constraints-unstable-v1-client-protocol.h" |
Emmanuel Gil Peyrot | 6516685 | 2017-02-17 15:52:50 +0000 | [diff] [blame] | 64 | #include "wayland-idle-inhibit-unstable-v1-client-protocol.h" |
Jonas Ådahl | cb08dc5 | 2015-12-09 15:29:37 +0800 | [diff] [blame] | 65 | |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 66 | #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) |
| 67 | #define _glfw_dlclose(handle) dlclose(handle) |
| 68 | #define _glfw_dlsym(handle, name) dlsym(handle, name) |
| 69 | |
Camilla Berglund | 02fdd64 | 2015-12-02 23:53:50 +0100 | [diff] [blame] | 70 | #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->wl.native) |
| 71 | #define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.wl.display) |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 72 | |
Camilla Berglund | ede7a58 | 2014-03-19 16:20:32 +0100 | [diff] [blame] | 73 | #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWayland wl |
| 74 | #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWayland wl |
| 75 | #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWayland wl |
Camilla Berglund | 7a4623e | 2014-03-27 17:29:22 +0100 | [diff] [blame] | 76 | #define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWayland wl |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 77 | |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 78 | #define _GLFW_PLATFORM_CONTEXT_STATE |
| 79 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE |
| 80 | |
Emmanuel Gil Peyrot | 407a3e2 | 2018-01-05 21:58:10 +0100 | [diff] [blame] | 81 | struct wl_cursor_image { |
| 82 | uint32_t width; |
| 83 | uint32_t height; |
| 84 | uint32_t hotspot_x; |
| 85 | uint32_t hotspot_y; |
| 86 | uint32_t delay; |
| 87 | }; |
| 88 | struct wl_cursor { |
| 89 | unsigned int image_count; |
| 90 | struct wl_cursor_image** images; |
| 91 | char* name; |
| 92 | }; |
| 93 | typedef struct wl_cursor_theme* (* PFN_wl_cursor_theme_load)(const char*, int, struct wl_shm*); |
| 94 | typedef void (* PFN_wl_cursor_theme_destroy)(struct wl_cursor_theme*); |
| 95 | typedef struct wl_cursor* (* PFN_wl_cursor_theme_get_cursor)(struct wl_cursor_theme*, const char*); |
| 96 | typedef struct wl_buffer* (* PFN_wl_cursor_image_get_buffer)(struct wl_cursor_image*); |
| 97 | #define wl_cursor_theme_load _glfw.wl.cursor.theme_load |
| 98 | #define wl_cursor_theme_destroy _glfw.wl.cursor.theme_destroy |
| 99 | #define wl_cursor_theme_get_cursor _glfw.wl.cursor.theme_get_cursor |
| 100 | #define wl_cursor_image_get_buffer _glfw.wl.cursor.image_get_buffer |
| 101 | |
Emmanuel Gil Peyrot | 5fbf4dd | 2018-01-05 21:33:40 +0100 | [diff] [blame] | 102 | typedef struct wl_egl_window* (* PFN_wl_egl_window_create)(struct wl_surface*, int, int); |
| 103 | typedef void (* PFN_wl_egl_window_destroy)(struct wl_egl_window*); |
| 104 | typedef void (* PFN_wl_egl_window_resize)(struct wl_egl_window*, int, int, int, int); |
| 105 | #define wl_egl_window_create _glfw.wl.egl.window_create |
| 106 | #define wl_egl_window_destroy _glfw.wl.egl.window_destroy |
| 107 | #define wl_egl_window_resize _glfw.wl.egl.window_resize |
| 108 | |
Emmanuel Gil Peyrot | a7a70cf | 2017-08-26 19:25:24 +0100 | [diff] [blame] | 109 | typedef struct xkb_context* (* PFN_xkb_context_new)(enum xkb_context_flags); |
| 110 | typedef void (* PFN_xkb_context_unref)(struct xkb_context*); |
| 111 | typedef struct xkb_keymap* (* PFN_xkb_keymap_new_from_string)(struct xkb_context*, const char*, enum xkb_keymap_format, enum xkb_keymap_compile_flags); |
| 112 | typedef void (* PFN_xkb_keymap_unref)(struct xkb_keymap*); |
| 113 | typedef xkb_mod_index_t (* PFN_xkb_keymap_mod_get_index)(struct xkb_keymap*, const char*); |
Emmanuel Gil Peyrot | 8bc0c5c | 2018-02-12 09:32:13 +0100 | [diff] [blame] | 114 | typedef int (* PFN_xkb_keymap_key_repeats)(struct xkb_keymap*, xkb_keycode_t); |
Emmanuel Gil Peyrot | a7a70cf | 2017-08-26 19:25:24 +0100 | [diff] [blame] | 115 | typedef struct xkb_state* (* PFN_xkb_state_new)(struct xkb_keymap*); |
| 116 | typedef void (* PFN_xkb_state_unref)(struct xkb_state*); |
| 117 | typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, const xkb_keysym_t**); |
| 118 | typedef 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); |
| 119 | typedef xkb_mod_mask_t (* PFN_xkb_state_serialize_mods)(struct xkb_state*, enum xkb_state_component); |
Emmanuel Gil Peyrot | a7a70cf | 2017-08-26 19:25:24 +0100 | [diff] [blame] | 120 | #define xkb_context_new _glfw.wl.xkb.context_new |
| 121 | #define xkb_context_unref _glfw.wl.xkb.context_unref |
| 122 | #define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string |
| 123 | #define xkb_keymap_unref _glfw.wl.xkb.keymap_unref |
| 124 | #define xkb_keymap_mod_get_index _glfw.wl.xkb.keymap_mod_get_index |
Emmanuel Gil Peyrot | 8bc0c5c | 2018-02-12 09:32:13 +0100 | [diff] [blame] | 125 | #define xkb_keymap_key_repeats _glfw.wl.xkb.keymap_key_repeats |
Emmanuel Gil Peyrot | a7a70cf | 2017-08-26 19:25:24 +0100 | [diff] [blame] | 126 | #define xkb_state_new _glfw.wl.xkb.state_new |
| 127 | #define xkb_state_unref _glfw.wl.xkb.state_unref |
| 128 | #define xkb_state_key_get_syms _glfw.wl.xkb.state_key_get_syms |
| 129 | #define xkb_state_update_mask _glfw.wl.xkb.state_update_mask |
| 130 | #define xkb_state_serialize_mods _glfw.wl.xkb.state_serialize_mods |
Emmanuel Gil Peyrot | d184313 | 2017-11-16 16:42:11 +0000 | [diff] [blame] | 131 | |
| 132 | #ifdef HAVE_XKBCOMMON_COMPOSE_H |
| 133 | typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags); |
| 134 | typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*); |
| 135 | typedef struct xkb_compose_state* (* PFN_xkb_compose_state_new)(struct xkb_compose_table*, enum xkb_compose_state_flags); |
| 136 | typedef void (* PFN_xkb_compose_state_unref)(struct xkb_compose_state*); |
| 137 | typedef enum xkb_compose_feed_result (* PFN_xkb_compose_state_feed)(struct xkb_compose_state*, xkb_keysym_t); |
| 138 | typedef enum xkb_compose_status (* PFN_xkb_compose_state_get_status)(struct xkb_compose_state*); |
| 139 | typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_state*); |
Emmanuel Gil Peyrot | a7a70cf | 2017-08-26 19:25:24 +0100 | [diff] [blame] | 140 | #define xkb_compose_table_new_from_locale _glfw.wl.xkb.compose_table_new_from_locale |
| 141 | #define xkb_compose_table_unref _glfw.wl.xkb.compose_table_unref |
| 142 | #define xkb_compose_state_new _glfw.wl.xkb.compose_state_new |
| 143 | #define xkb_compose_state_unref _glfw.wl.xkb.compose_state_unref |
| 144 | #define xkb_compose_state_feed _glfw.wl.xkb.compose_state_feed |
| 145 | #define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status |
| 146 | #define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym |
Emmanuel Gil Peyrot | d184313 | 2017-11-16 16:42:11 +0000 | [diff] [blame] | 147 | #endif |
Emmanuel Gil Peyrot | a7a70cf | 2017-08-26 19:25:24 +0100 | [diff] [blame] | 148 | |
Emmanuel Gil Peyrot | 9f7ec6b | 2017-12-19 20:58:03 +0100 | [diff] [blame] | 149 | #define _GLFW_DECORATION_WIDTH 4 |
| 150 | #define _GLFW_DECORATION_TOP 24 |
Emmanuel Gil Peyrot | 60e82ba | 2017-12-22 18:22:36 +0100 | [diff] [blame] | 151 | #define _GLFW_DECORATION_VERTICAL (_GLFW_DECORATION_TOP + _GLFW_DECORATION_WIDTH) |
| 152 | #define _GLFW_DECORATION_HORIZONTAL (2 * _GLFW_DECORATION_WIDTH) |
Emmanuel Gil Peyrot | 9f7ec6b | 2017-12-19 20:58:03 +0100 | [diff] [blame] | 153 | |
| 154 | typedef enum _GLFWdecorationSideWayland |
| 155 | { |
| 156 | mainWindow, |
| 157 | topDecoration, |
| 158 | leftDecoration, |
| 159 | rightDecoration, |
| 160 | bottomDecoration, |
| 161 | |
| 162 | } _GLFWdecorationSideWayland; |
| 163 | |
| 164 | typedef struct _GLFWdecorationWayland |
| 165 | { |
| 166 | struct wl_surface* surface; |
| 167 | struct wl_subsurface* subsurface; |
| 168 | struct wp_viewport* viewport; |
| 169 | |
| 170 | } _GLFWdecorationWayland; |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 171 | |
Camilla Berglund | f8d80a9 | 2014-09-02 19:42:43 +0200 | [diff] [blame] | 172 | // Wayland-specific per-window data |
| 173 | // |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 174 | typedef struct _GLFWwindowWayland |
| 175 | { |
| 176 | int width, height; |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 177 | GLFWbool visible; |
Emmanuel Gil Peyrot | e673bdc | 2016-04-09 00:54:23 +0100 | [diff] [blame] | 178 | GLFWbool maximized; |
Camilla Löwy | ee9dffc | 2018-01-04 13:50:58 +0100 | [diff] [blame] | 179 | GLFWbool hovered; |
Emmanuel Gil Peyrot | 95e282d | 2017-10-01 01:38:00 +0100 | [diff] [blame] | 180 | GLFWbool transparent; |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 181 | struct wl_surface* surface; |
| 182 | struct wl_egl_window* native; |
Emmanuel Gil Peyrot | a49601b | 2016-10-01 20:05:29 +0100 | [diff] [blame] | 183 | struct wl_shell_surface* shellSurface; |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 184 | struct wl_callback* callback; |
Emmanuel Gil Peyrot | 06479ba | 2015-10-10 16:35:06 +0100 | [diff] [blame] | 185 | |
Emmanuel Gil Peyrot | 73567ae | 2017-12-03 03:59:12 +0100 | [diff] [blame] | 186 | struct { |
| 187 | struct xdg_surface* surface; |
| 188 | struct xdg_toplevel* toplevel; |
Emmanuel Gil Peyrot | dcd2a19 | 2018-10-01 15:05:55 +0200 | [diff] [blame] | 189 | struct zxdg_toplevel_decoration_v1* decoration; |
Emmanuel Gil Peyrot | 73567ae | 2017-12-03 03:59:12 +0100 | [diff] [blame] | 190 | } xdg; |
| 191 | |
Ricardo Vieira | 25204b1 | 2014-09-09 16:37:55 +0200 | [diff] [blame] | 192 | _GLFWcursor* currentCursor; |
Emmanuel Gil Peyrot | e253bea | 2015-04-15 18:18:42 +0200 | [diff] [blame] | 193 | double cursorPosX, cursorPosY; |
Emmanuel Gil Peyrot | 06479ba | 2015-10-10 16:35:06 +0100 | [diff] [blame] | 194 | |
Emmanuel Gil Peyrot | 5034c6c | 2016-04-09 00:51:48 +0100 | [diff] [blame] | 195 | char* title; |
| 196 | |
Emmanuel Gil Peyrot | 06479ba | 2015-10-10 16:35:06 +0100 | [diff] [blame] | 197 | // We need to track the monitors the window spans on to calculate the |
| 198 | // optimal scaling factor. |
| 199 | int scale; |
| 200 | _GLFWmonitor** monitors; |
| 201 | int monitorsCount; |
| 202 | int monitorsSize; |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 203 | |
Jonas Ådahl | cb08dc5 | 2015-12-09 15:29:37 +0800 | [diff] [blame] | 204 | struct { |
| 205 | struct zwp_relative_pointer_v1* relativePointer; |
| 206 | struct zwp_locked_pointer_v1* lockedPointer; |
| 207 | } pointerLock; |
Emmanuel Gil Peyrot | 6516685 | 2017-02-17 15:52:50 +0000 | [diff] [blame] | 208 | |
| 209 | struct zwp_idle_inhibitor_v1* idleInhibitor; |
| 210 | |
Emmanuel Gil Peyrot | 45bd991 | 2019-02-15 18:12:06 +0100 | [diff] [blame] | 211 | GLFWbool wasFullscreen; |
Emmanuel Gil Peyrot | eb7c999 | 2018-01-19 00:24:57 +0100 | [diff] [blame] | 212 | |
Emmanuel Gil Peyrot | 9f7ec6b | 2017-12-19 20:58:03 +0100 | [diff] [blame] | 213 | struct { |
Emmanuel Gil Peyrot | dcd2a19 | 2018-10-01 15:05:55 +0200 | [diff] [blame] | 214 | GLFWbool serverSide; |
Emmanuel Gil Peyrot | 9f7ec6b | 2017-12-19 20:58:03 +0100 | [diff] [blame] | 215 | struct wl_buffer* buffer; |
| 216 | _GLFWdecorationWayland top, left, right, bottom; |
| 217 | int focus; |
| 218 | } decorations; |
| 219 | |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 220 | } _GLFWwindowWayland; |
| 221 | |
Camilla Berglund | f8d80a9 | 2014-09-02 19:42:43 +0200 | [diff] [blame] | 222 | // Wayland-specific global data |
| 223 | // |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 224 | typedef struct _GLFWlibraryWayland |
| 225 | { |
| 226 | struct wl_display* display; |
| 227 | struct wl_registry* registry; |
| 228 | struct wl_compositor* compositor; |
Emmanuel Gil Peyrot | 552e40a | 2017-12-19 19:04:52 +0100 | [diff] [blame] | 229 | struct wl_subcompositor* subcompositor; |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 230 | struct wl_shell* shell; |
Ricardo Vieira | 25204b1 | 2014-09-09 16:37:55 +0200 | [diff] [blame] | 231 | struct wl_shm* shm; |
Jonas Ådahl | a75cf5a | 2014-06-29 12:29:00 +0200 | [diff] [blame] | 232 | struct wl_seat* seat; |
| 233 | struct wl_pointer* pointer; |
| 234 | struct wl_keyboard* keyboard; |
Emmanuel Gil Peyrot | 3c4b9a7 | 2018-10-10 19:06:11 +0200 | [diff] [blame] | 235 | struct wl_data_device_manager* dataDeviceManager; |
| 236 | struct wl_data_device* dataDevice; |
| 237 | struct wl_data_offer* dataOffer; |
Emmanuel Gil Peyrot | c08abff | 2018-10-10 20:31:26 +0200 | [diff] [blame] | 238 | struct wl_data_source* dataSource; |
Emmanuel Gil Peyrot | 73567ae | 2017-12-03 03:59:12 +0100 | [diff] [blame] | 239 | struct xdg_wm_base* wmBase; |
Emmanuel Gil Peyrot | dcd2a19 | 2018-10-01 15:05:55 +0200 | [diff] [blame] | 240 | struct zxdg_decoration_manager_v1* decorationManager; |
Emmanuel Gil Peyrot | 79e16ba | 2017-12-19 19:04:28 +0100 | [diff] [blame] | 241 | struct wp_viewporter* viewporter; |
Jonas Ådahl | cb08dc5 | 2015-12-09 15:29:37 +0800 | [diff] [blame] | 242 | struct zwp_relative_pointer_manager_v1* relativePointerManager; |
| 243 | struct zwp_pointer_constraints_v1* pointerConstraints; |
Emmanuel Gil Peyrot | 6516685 | 2017-02-17 15:52:50 +0000 | [diff] [blame] | 244 | struct zwp_idle_inhibit_manager_v1* idleInhibitManager; |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 245 | |
Emmanuel Gil Peyrot | a49601b | 2016-10-01 20:05:29 +0100 | [diff] [blame] | 246 | int compositorVersion; |
Emmanuel Gil Peyrot | c14a35e | 2017-11-17 01:24:01 +0000 | [diff] [blame] | 247 | int seatVersion; |
Jonas Ådahl | cf6c11c | 2015-12-27 10:42:45 +0800 | [diff] [blame] | 248 | |
Ricardo Vieira | 25204b1 | 2014-09-09 16:37:55 +0200 | [diff] [blame] | 249 | struct wl_cursor_theme* cursorTheme; |
Emmanuel Gil Peyrot | 3210628 | 2018-09-11 14:18:52 +0200 | [diff] [blame] | 250 | struct wl_cursor_theme* cursorThemeHiDPI; |
Ricardo Vieira | 25204b1 | 2014-09-09 16:37:55 +0200 | [diff] [blame] | 251 | struct wl_surface* cursorSurface; |
Emmanuel Gil Peyrot | dede6d6 | 2018-09-08 20:01:04 +0200 | [diff] [blame] | 252 | int cursorTimerfd; |
Ricardo Vieira | 92b3fd0 | 2014-09-23 18:24:33 +0100 | [diff] [blame] | 253 | uint32_t serial; |
Ricardo Vieira | 25204b1 | 2014-09-09 16:37:55 +0200 | [diff] [blame] | 254 | |
Emmanuel Gil Peyrot | c14a35e | 2017-11-17 01:24:01 +0000 | [diff] [blame] | 255 | int32_t keyboardRepeatRate; |
| 256 | int32_t keyboardRepeatDelay; |
Emmanuel Gil Peyrot | 90f5edc | 2018-01-30 16:22:25 +0100 | [diff] [blame] | 257 | int keyboardLastKey; |
| 258 | int keyboardLastScancode; |
Emmanuel Gil Peyrot | 8b54e28 | 2018-10-10 19:21:26 +0200 | [diff] [blame] | 259 | char* clipboardString; |
| 260 | size_t clipboardSize; |
Emmanuel Gil Peyrot | c08abff | 2018-10-10 20:31:26 +0200 | [diff] [blame] | 261 | char* clipboardSendString; |
| 262 | size_t clipboardSendSize; |
Emmanuel Gil Peyrot | 90f5edc | 2018-01-30 16:22:25 +0100 | [diff] [blame] | 263 | int timerfd; |
Camilla Berglund | e6a32db | 2016-09-07 15:43:39 +0200 | [diff] [blame] | 264 | short int keycodes[256]; |
| 265 | short int scancodes[GLFW_KEY_LAST + 1]; |
Camilla Berglund | 580c7da | 2015-11-12 15:06:46 +0100 | [diff] [blame] | 266 | |
Jonas Ådahl | 9ac854b | 2014-06-29 23:09:21 +0200 | [diff] [blame] | 267 | struct { |
Emmanuel Gil Peyrot | a7a70cf | 2017-08-26 19:25:24 +0100 | [diff] [blame] | 268 | void* handle; |
Jonas Ådahl | 9ac854b | 2014-06-29 23:09:21 +0200 | [diff] [blame] | 269 | struct xkb_context* context; |
| 270 | struct xkb_keymap* keymap; |
| 271 | struct xkb_state* state; |
Emmanuel Gil Peyrot | d184313 | 2017-11-16 16:42:11 +0000 | [diff] [blame] | 272 | |
| 273 | #ifdef HAVE_XKBCOMMON_COMPOSE_H |
Emmanuel Gil Peyrot | 046d281 | 2016-10-11 00:02:15 +0100 | [diff] [blame] | 274 | struct xkb_compose_state* composeState; |
Emmanuel Gil Peyrot | d184313 | 2017-11-16 16:42:11 +0000 | [diff] [blame] | 275 | #endif |
| 276 | |
Emmanuel Gil Peyrot | a49601b | 2016-10-01 20:05:29 +0100 | [diff] [blame] | 277 | xkb_mod_mask_t controlMask; |
| 278 | xkb_mod_mask_t altMask; |
| 279 | xkb_mod_mask_t shiftMask; |
| 280 | xkb_mod_mask_t superMask; |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 281 | xkb_mod_mask_t capsLockMask; |
| 282 | xkb_mod_mask_t numLockMask; |
Jonas Ådahl | 9ac854b | 2014-06-29 23:09:21 +0200 | [diff] [blame] | 283 | unsigned int modifiers; |
Emmanuel Gil Peyrot | a7a70cf | 2017-08-26 19:25:24 +0100 | [diff] [blame] | 284 | |
| 285 | PFN_xkb_context_new context_new; |
| 286 | PFN_xkb_context_unref context_unref; |
| 287 | PFN_xkb_keymap_new_from_string keymap_new_from_string; |
| 288 | PFN_xkb_keymap_unref keymap_unref; |
| 289 | PFN_xkb_keymap_mod_get_index keymap_mod_get_index; |
Emmanuel Gil Peyrot | 8bc0c5c | 2018-02-12 09:32:13 +0100 | [diff] [blame] | 290 | PFN_xkb_keymap_key_repeats keymap_key_repeats; |
Emmanuel Gil Peyrot | a7a70cf | 2017-08-26 19:25:24 +0100 | [diff] [blame] | 291 | PFN_xkb_state_new state_new; |
| 292 | PFN_xkb_state_unref state_unref; |
| 293 | PFN_xkb_state_key_get_syms state_key_get_syms; |
| 294 | PFN_xkb_state_update_mask state_update_mask; |
| 295 | PFN_xkb_state_serialize_mods state_serialize_mods; |
Emmanuel Gil Peyrot | d184313 | 2017-11-16 16:42:11 +0000 | [diff] [blame] | 296 | |
| 297 | #ifdef HAVE_XKBCOMMON_COMPOSE_H |
Emmanuel Gil Peyrot | a7a70cf | 2017-08-26 19:25:24 +0100 | [diff] [blame] | 298 | PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale; |
| 299 | PFN_xkb_compose_table_unref compose_table_unref; |
| 300 | PFN_xkb_compose_state_new compose_state_new; |
| 301 | PFN_xkb_compose_state_unref compose_state_unref; |
| 302 | PFN_xkb_compose_state_feed compose_state_feed; |
| 303 | PFN_xkb_compose_state_get_status compose_state_get_status; |
| 304 | PFN_xkb_compose_state_get_one_sym compose_state_get_one_sym; |
Emmanuel Gil Peyrot | d184313 | 2017-11-16 16:42:11 +0000 | [diff] [blame] | 305 | #endif |
Jonas Ådahl | 9ac854b | 2014-06-29 23:09:21 +0200 | [diff] [blame] | 306 | } xkb; |
| 307 | |
Jonas Ådahl | a75cf5a | 2014-06-29 12:29:00 +0200 | [diff] [blame] | 308 | _GLFWwindow* pointerFocus; |
| 309 | _GLFWwindow* keyboardFocus; |
Camilla Berglund | f8d80a9 | 2014-09-02 19:42:43 +0200 | [diff] [blame] | 310 | |
Emmanuel Gil Peyrot | 5fbf4dd | 2018-01-05 21:33:40 +0100 | [diff] [blame] | 311 | struct { |
| 312 | void* handle; |
| 313 | |
Emmanuel Gil Peyrot | 407a3e2 | 2018-01-05 21:58:10 +0100 | [diff] [blame] | 314 | PFN_wl_cursor_theme_load theme_load; |
| 315 | PFN_wl_cursor_theme_destroy theme_destroy; |
| 316 | PFN_wl_cursor_theme_get_cursor theme_get_cursor; |
| 317 | PFN_wl_cursor_image_get_buffer image_get_buffer; |
| 318 | } cursor; |
| 319 | |
| 320 | struct { |
| 321 | void* handle; |
| 322 | |
Emmanuel Gil Peyrot | 5fbf4dd | 2018-01-05 21:33:40 +0100 | [diff] [blame] | 323 | PFN_wl_egl_window_create window_create; |
| 324 | PFN_wl_egl_window_destroy window_destroy; |
| 325 | PFN_wl_egl_window_resize window_resize; |
| 326 | } egl; |
| 327 | |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 328 | } _GLFWlibraryWayland; |
| 329 | |
Camilla Berglund | f8d80a9 | 2014-09-02 19:42:43 +0200 | [diff] [blame] | 330 | // Wayland-specific per-monitor data |
| 331 | // |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 332 | typedef struct _GLFWmonitorWayland |
| 333 | { |
| 334 | struct wl_output* output; |
Emmanuel Gil Peyrot | d6b9d00 | 2018-02-24 22:18:39 +0100 | [diff] [blame] | 335 | int name; |
Camilla Löwy | 04f559e | 2016-12-05 01:19:48 +0100 | [diff] [blame] | 336 | int currentMode; |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 337 | |
| 338 | int x; |
| 339 | int y; |
Emmanuel Gil Peyrot | 06479ba | 2015-10-10 16:35:06 +0100 | [diff] [blame] | 340 | int scale; |
Camilla Löwy | 04f559e | 2016-12-05 01:19:48 +0100 | [diff] [blame] | 341 | |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 342 | } _GLFWmonitorWayland; |
| 343 | |
Camilla Berglund | f8d80a9 | 2014-09-02 19:42:43 +0200 | [diff] [blame] | 344 | // Wayland-specific per-cursor data |
| 345 | // |
Camilla Berglund | 7a4623e | 2014-03-27 17:29:22 +0100 | [diff] [blame] | 346 | typedef struct _GLFWcursorWayland |
| 347 | { |
Emmanuel Gil Peyrot | 5ea6e6c | 2018-09-08 20:05:40 +0200 | [diff] [blame] | 348 | struct wl_cursor* cursor; |
Emmanuel Gil Peyrot | 15cad02 | 2018-09-11 14:24:43 +0200 | [diff] [blame] | 349 | struct wl_cursor* cursorHiDPI; |
Ricardo Vieira | 25204b1 | 2014-09-09 16:37:55 +0200 | [diff] [blame] | 350 | struct wl_buffer* buffer; |
| 351 | int width, height; |
| 352 | int xhot, yhot; |
Emmanuel Gil Peyrot | 5ea6e6c | 2018-09-08 20:05:40 +0200 | [diff] [blame] | 353 | int currentImage; |
Camilla Berglund | 7a4623e | 2014-03-27 17:29:22 +0100 | [diff] [blame] | 354 | } _GLFWcursorWayland; |
| 355 | |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 356 | |
Camilla Berglund | 12b6c56 | 2015-12-03 18:16:46 +0100 | [diff] [blame] | 357 | void _glfwAddOutputWayland(uint32_t name, uint32_t version); |
Jonas Ådahl | 8e99996 | 2014-03-17 22:53:43 +0100 | [diff] [blame] | 358 | |