Commit9ada8581Recorded20 Sep 2026Repositorysigil-app

Vendor GLFW 3.5.1 and rebuild the host layer on it

Message

sokol_app is X11-only on Linux. GLFW 3.5.1, vendored as source under vendor/glfw (no local patches; VENDOR.md records the tag, the archive hash and the file list), builds both the Wayland and the X11 backend into one archive and picks one at glfwInit. Every platform library (libwayland-client, libxkbcommon, libdecor, libX11 and friends, EGL, GLX) is loaded at run time by GLFW, so the Linux link-flags are now empty: -lX11 -lXi -lXcursor are gone from the consumer's binary.

app.c drives the same Sigil API (app-run, frame-, mouse-, key-*, quit-requested?, request-quit; run-game and wait-frame are untouched) over a GLFW window with a GL 4.1 core context, vsync on, and the frame loop calling the Scheme frame callback then swapping. Key and mouse state keep the sokol model (down / pressed-this-frame / released-this-frame; a repeat is not a new press). frame-width and frame-height are framebuffer pixels; mouse-x and mouse-y are scaled from window units into the same pixels, so a scaled Wayland output keeps one coordinate system.

sokol-compat.c keeps the five symbols sigil-graphics links from this package (sapp_width, sapp_height, sapp_get_environment, sapp_get_swapchain, slog_func) so a consumer relocks and nothing else changes; sokol_app.h stays vendored for those declarations only.

The Wayland protocol code is pre-generated with wayland-scanner and checked in. package.sgl's compile step is procedural so the GLFW source list and defines follow the config's target (Linux, Windows, darwin file lists; the windows-amd64 config cross-builds and its objects link into a PE with kernel32/user32/shell32/gdi32).

SIGIL_APP_PLATFORM=wayland|x11 forces the platform (for tests under a private compositor or X server); SIGIL_APP_VERBOSE=1 prints the platform, window and framebuffer sizes and the content scale.

Changed
 package.sgl                                                                              |  140 ++-
 src/c/app-internal.h                                                                     |   50 +-
 src/c/app.c                                                                              |  389 ++++--
 src/c/sokol-app.c                                                                        |   13 -
 src/c/sokol-compat.c                                                                     |   57 +
 vendor/glfw/LICENSE.md                                                                   |   23 +
 vendor/glfw/VENDOR.md                                                                    |  180 +++
 vendor/glfw/deps/wayland/fractional-scale-v1.xml                                         |  102 ++
 vendor/glfw/deps/wayland/idle-inhibit-unstable-v1.xml                                    |   83 ++
 vendor/glfw/deps/wayland/pointer-constraints-unstable-v1.xml                             |  339 ++++++
 vendor/glfw/deps/wayland/relative-pointer-unstable-v1.xml                                |  136 +++
 vendor/glfw/deps/wayland/viewporter.xml                                                  |  180 +++
 vendor/glfw/deps/wayland/wayland.xml                                                     | 3151 +++++++++++++++++++++++++++++++++++++++++++++++++
 vendor/glfw/deps/wayland/xdg-activation-v1.xml                                           |  200 ++++
 vendor/glfw/deps/wayland/xdg-decoration-unstable-v1.xml                                  |  156 +++
 vendor/glfw/deps/wayland/xdg-shell.xml                                                   | 1370 ++++++++++++++++++++++
 vendor/glfw/include/GLFW/glfw3.h                                                         | 6577 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 vendor/glfw/include/GLFW/glfw3native.h                                                   |  709 +++++++++++
 vendor/glfw/src/cocoa_init.m                                                             |  662 +++++++++++
 vendor/glfw/src/cocoa_joystick.h                                                         |   49 +
 vendor/glfw/src/cocoa_joystick.m                                                         |  485 ++++++++
 vendor/glfw/src/cocoa_monitor.m                                                          |  646 ++++++++++
 vendor/glfw/src/cocoa_platform.h                                                         |  300 +++++
 vendor/glfw/src/cocoa_window.m                                                           | 2091 +++++++++++++++++++++++++++++++++
 vendor/glfw/src/context.c                                                                |  770 ++++++++++++
 vendor/glfw/src/egl_context.c                                                            |  988 ++++++++++++++++
 vendor/glfw/src/glx_context.c                                                            |  738 ++++++++++++
 vendor/glfw/src/init.c                                                                   |  528 +++++++++
 vendor/glfw/src/input.c                                                                  | 1519 ++++++++++++++++++++++++
 vendor/glfw/src/internal.h                                                               | 1023 ++++++++++++++++
 vendor/glfw/src/linux_joystick.c                                                         |  437 +++++++
 vendor/glfw/src/linux_joystick.h                                                         |   64 +
 vendor/glfw/src/macos_time.c                                                             |   57 +
 vendor/glfw/src/macos_time.h                                                             |   35 +
 vendor/glfw/src/mappings.h                                                               | 1001 ++++++++++++++++
 vendor/glfw/src/monitor.c                                                                |  556 +++++++++
 vendor/glfw/src/nsgl_context.m                                                           |  378 ++++++
 vendor/glfw/src/null_init.c                                                              |  265 +++++
 vendor/glfw/src/null_joystick.c                                                          |   56 +
 vendor/glfw/src/null_joystick.h                                                          |   32 +
 vendor/glfw/src/null_monitor.c                                                           |  160 +++
 vendor/glfw/src/null_platform.h                                                          |  282 +++++
 vendor/glfw/src/null_window.c                                                            |  749 ++++++++++++
 vendor/glfw/src/osmesa_context.c                                                         |  384 ++++++
 vendor/glfw/src/platform.c                                                               |  210 ++++
 vendor/glfw/src/platform.h                                                               |  213 ++++
 vendor/glfw/src/posix_module.c                                                           |   54 +
 vendor/glfw/src/posix_poll.c                                                             |   83 ++
 vendor/glfw/src/posix_poll.h                                                             |   30 +
 vendor/glfw/src/posix_thread.c                                                           |  107 ++
 vendor/glfw/src/posix_thread.h                                                           |   49 +
 vendor/glfw/src/posix_time.c                                                             |   65 +
 vendor/glfw/src/posix_time.h                                                             |   41 +
 vendor/glfw/src/vulkan.c                                                                 |  365 ++++++
 vendor/glfw/src/wayland-protocols/fractional-scale-v1-client-protocol-code.h             |   74 ++
 vendor/glfw/src/wayland-protocols/fractional-scale-v1-client-protocol.h                  |  264 +++++
 vendor/glfw/src/wayland-protocols/idle-inhibit-unstable-v1-client-protocol-code.h        |   69 ++
 vendor/glfw/src/wayland-protocols/idle-inhibit-unstable-v1-client-protocol.h             |  232 ++++
 vendor/glfw/src/wayland-protocols/pointer-constraints-unstable-v1-client-protocol-code.h |  109 ++
 vendor/glfw/src/wayland-protocols/pointer-constraints-unstable-v1-client-protocol.h      |  667 +++++++++++
 vendor/glfw/src/wayland-protocols/relative-pointer-unstable-v1-client-protocol-code.h    |   80 ++
 vendor/glfw/src/wayland-protocols/relative-pointer-unstable-v1-client-protocol.h         |  297 +++++
 vendor/glfw/src/wayland-protocols/viewporter-client-protocol-code.h                      |   75 ++
 vendor/glfw/src/wayland-protocols/viewporter-client-protocol.h                           |  398 +++++++
 vendor/glfw/src/wayland-protocols/wayland-client-protocol-code.h                         |  525 +++++++++
 vendor/glfw/src/wayland-protocols/wayland-client-protocol.h                              | 6236 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 vendor/glfw/src/wayland-protocols/xdg-activation-v1-client-protocol-code.h               |   85 ++
 vendor/glfw/src/wayland-protocols/xdg-activation-v1-client-protocol.h                    |  415 +++++++
 vendor/glfw/src/wayland-protocols/xdg-decoration-unstable-v1-client-protocol-code.h      |   76 ++
 vendor/glfw/src/wayland-protocols/xdg-decoration-unstable-v1-client-protocol.h           |  378 ++++++
 vendor/glfw/src/wayland-protocols/xdg-shell-client-protocol-code.h                       |  184 +++
 vendor/glfw/src/wayland-protocols/xdg-shell-client-protocol.h                            | 2307 ++++++++++++++++++++++++++++++++++++
 vendor/glfw/src/wgl_context.c                                                            |  786 +++++++++++++
 vendor/glfw/src/win32_init.c                                                             |  712 +++++++++++
 vendor/glfw/src/win32_joystick.c                                                         |  767 ++++++++++++
 vendor/glfw/src/win32_joystick.h                                                         |   51 +
 vendor/glfw/src/win32_module.c                                                           |   52 +
 vendor/glfw/src/win32_monitor.c                                                          |  574 +++++++++
 vendor/glfw/src/win32_platform.h                                                         |  567 +++++++++
 vendor/glfw/src/win32_thread.c                                                           |  100 ++
 vendor/glfw/src/win32_thread.h                                                           |   53 +
 vendor/glfw/src/win32_time.c                                                             |   54 +
 vendor/glfw/src/win32_time.h                                                             |   43 +
 vendor/glfw/src/win32_window.c                                                           | 2584 ++++++++++++++++++++++++++++++++++++++++
 vendor/glfw/src/window.c                                                                 | 1198 +++++++++++++++++++
 vendor/glfw/src/wl_init.c                                                                | 1019 ++++++++++++++++
 vendor/glfw/src/wl_monitor.c                                                             |  277 +++++
 vendor/glfw/src/wl_platform.h                                                            |  736 ++++++++++++
 vendor/glfw/src/wl_window.c                                                              | 3620 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 vendor/glfw/src/x11_init.c                                                               | 1621 +++++++++++++++++++++++++
 vendor/glfw/src/x11_monitor.c                                                            |  652 +++++++++++
 vendor/glfw/src/x11_platform.h                                                           | 1005 ++++++++++++++++
 vendor/glfw/src/x11_window.c                                                             | 3387 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 vendor/glfw/src/xkb_unicode.c                                                            |  943 +++++++++++++++
 94 files changed, 62441 insertions(+), 158 deletions(-)
Diff
package.sglmodified
@@ -1,13 +1,117 @@
−1
;;; sigil-app - Application framework for Sigil
+1
;;; sigil-app - Desktop host layer for Sigil
2
;;;
−3
;;; Provides windowing, input handling, and application lifecycle management
−4
;;; via sokol_app. This is the base package for interactive applications.
+3
;;; Window, GL context, input, frame clock and quit for interactive
+4
;;; applications, over GLFW (vendored under vendor/glfw). On Linux one
+5
;;; binary runs as a native Wayland client or under X11, picked at startup;
+6
;;; GLFW loads every platform library at runtime, so nothing
+7
;;; platform-specific is linked.
+8
+9
;; ---- GLFW source lists, per target OS -------------------------------
+10
;;
+11
;; The lists mirror vendor/glfw/src/CMakeLists.txt (see vendor/glfw/VENDOR.md
+12
;; for the pin and the file inventory). Compile-time defines pick the
+13
;; platform backends; on Linux both _GLFW_X11 and _GLFW_WAYLAND are built
+14
;; into the one archive and glfwInit picks one at startup.
+15
+16
(define glfw-common-sources
+17
'("vendor/glfw/src/context.c" "vendor/glfw/src/init.c"
+18
"vendor/glfw/src/input.c" "vendor/glfw/src/monitor.c"
+19
"vendor/glfw/src/platform.c" "vendor/glfw/src/vulkan.c"
+20
"vendor/glfw/src/window.c" "vendor/glfw/src/egl_context.c"
+21
"vendor/glfw/src/osmesa_context.c" "vendor/glfw/src/null_init.c"
+22
"vendor/glfw/src/null_monitor.c" "vendor/glfw/src/null_window.c"
+23
"vendor/glfw/src/null_joystick.c"))
+24
+25
(define glfw-linux-sources
+26
'("vendor/glfw/src/posix_module.c" "vendor/glfw/src/posix_time.c"
+27
"vendor/glfw/src/posix_thread.c" "vendor/glfw/src/posix_poll.c"
+28
"vendor/glfw/src/linux_joystick.c"
+29
;; X11
+30
"vendor/glfw/src/x11_init.c" "vendor/glfw/src/x11_monitor.c"
+31
"vendor/glfw/src/x11_window.c" "vendor/glfw/src/xkb_unicode.c"
+32
"vendor/glfw/src/glx_context.c"
+33
;; Wayland (protocol code pre-generated under src/wayland-protocols)
+34
"vendor/glfw/src/wl_init.c" "vendor/glfw/src/wl_monitor.c"
+35
"vendor/glfw/src/wl_window.c"))
+36
+37
(define glfw-windows-sources
+38
'("vendor/glfw/src/win32_module.c" "vendor/glfw/src/win32_time.c"
+39
"vendor/glfw/src/win32_thread.c" "vendor/glfw/src/win32_init.c"
+40
"vendor/glfw/src/win32_joystick.c" "vendor/glfw/src/win32_monitor.c"
+41
"vendor/glfw/src/win32_window.c" "vendor/glfw/src/wgl_context.c"))
+42
+43
;; Listed and vendored; compiled only on darwin. No macOS build has run yet.
+44
(define glfw-darwin-sources
+45
'("vendor/glfw/src/posix_module.c" "vendor/glfw/src/posix_thread.c"
+46
"vendor/glfw/src/macos_time.c"
+47
"vendor/glfw/src/cocoa_init.m" "vendor/glfw/src/cocoa_joystick.m"
+48
"vendor/glfw/src/cocoa_monitor.m" "vendor/glfw/src/cocoa_window.m"
+49
"vendor/glfw/src/nsgl_context.m"))
+50
+51
(define (glfw-sources os)
+52
(append glfw-common-sources
+53
(case os
+54
((linux) glfw-linux-sources)
+55
((windows) glfw-windows-sources)
+56
((darwin) glfw-darwin-sources)
+57
;; Other OSes: the null platform only (compiles; no window).
+58
(else '()))))
+59
+60
;; _DEFAULT_SOURCE: GLFW's own CMake adds it on Linux because -std=c99
+61
;; hides the POSIX 2008 declarations it uses. HAVE_MEMFD_CREATE: glibc
+62
;; has memfd_create; GLFW's CMake probes for it and defines the same.
+63
(define (glfw-defines os)
+64
(case os
+65
((linux) '("-D_GLFW_X11" "-D_GLFW_WAYLAND" "-D_DEFAULT_SOURCE" "-DHAVE_MEMFD_CREATE"))
+66
((windows) '("-D_GLFW_WIN32" "-DUNICODE" "-D_UNICODE"))
+67
((darwin) '("-D_GLFW_COCOA"))
+68
(else '())))
+69
+70
(define app-sources
+71
'("src/c/app.c" "src/c/sokol-compat.c"))
+72
+73
(define app-include-dirs
+74
'("vendor/glfw/include" "vendor/sokol" "src/c"))
+75
+76
(define app-flags
+77
'("-std=c99" "-D_GNU_SOURCE" "-Wno-unused-parameter"))
+78
+79
;; GLFW's own warning set is -Wall; its sources are compiled as they
+80
;; ship, with only the platform defines above (no local patches).
+81
;; -U_GNU_SOURCE: sigil's toolchain passes -D_GNU_SOURCE=1 to every C
+82
;; compile, and GLFW's posix_poll.c defines _GNU_SOURCE itself; the -U
+83
;; removes the toolchain's copy so the file compiles in the feature-macro
+84
;; environment upstream builds it in, without a redefinition warning.
+85
(define glfw-include-dirs
+86
'("vendor/glfw/include" "vendor/glfw/src/wayland-protocols"))
+87
+88
(define glfw-flags
+89
'("-std=c99" "-Wall" "-Wno-unused-parameter" "-U_GNU_SOURCE"))
+90
+91
;; The compile steps, procedural so the GLFW source list and the platform
+92
;; defines follow the config's target rather than the host (the same
+93
;; reason link-flags below is a lambda). Both steps register their
+94
;; objects on the context; create-static-library archives them all.
+95
(define (compile-app ctx)
+96
((compile-c-sources
+97
sources: app-sources
+98
include-dirs: app-include-dirs
+99
flags: (with-sigil-c-flags app-flags))
+100
ctx))
+101
+102
(define (compile-glfw ctx)
+103
(let ((os (target-os ctx)))
+104
((compile-c-sources
+105
sources: (glfw-sources os)
+106
include-dirs: glfw-include-dirs
+107
flags: (append glfw-flags (glfw-defines os)))
+108
ctx)))
109
110
(package
111
name: "sigil-app"
112
version: "0.9.0"
113
sigil: "0.20"
−10
description: "Application framework for Sigil (windowing, input, lifecycle)"
+114
description: "Desktop host layer for Sigil (window, GL context, input, frame clock) over GLFW"
115
url: "https://codeberg.org/sigil/sigil-app"
116
license: "BSD-3-Clause"
117
authors: (list "David Wilson <david@daviwil.com>")
@@ -43,10 +147,19 @@
147
libraries: (list
148
(library
149
name: 'sigil-app
−46
c-sources: '("src/c/sokol-app.c" "src/c/app.c")
−47
c-include-dirs: '("vendor/sokol" "src/c")
+150
;; The platform-independent files; the build task adds the GLFW
+151
;; backend files for the config's target OS.
+152
c-sources: '("src/c/app.c" "src/c/sokol-compat.c")
+153
c-include-dirs: '("vendor/glfw/include" "vendor/sokol" "src/c")
154
native-init: "sigil__init_sigil_app_module"
−49
;; Platform-specific linker flags for sokol_app.
+155
;; Platform linker flags.
+156
;;
+157
;; Linux: none. GLFW dlopens libwayland-client, libwayland-egl,
+158
;; libxkbcommon, libdecor, libX11 and friends, libGL/libEGL at
+159
;; runtime; dlopen and pthread are in libc on glibc 2.34+.
+160
;; Windows: the Win32 system libraries GLFW's win32 backend calls
+161
;; directly (DirectInput/XInput are loaded at runtime).
+162
;; Darwin: the frameworks GLFW's Cocoa backend needs.
163
;;
164
;; Procedural (lambda ctx) form so cross-compile configs evaluate
165
;; the right branch at link time. (case (host-os) ...) was evaluated
@@ -54,8 +167,9 @@
167
;; cross builds.
168
link-flags: (lambda (ctx)
169
(case (target-os ctx)
−57
((linux) '("-lX11" "-lXi" "-lXcursor"))
−58
((darwin) '("-framework" "Cocoa" "-framework" "QuartzCore"))
+170
((linux) '())
+171
((darwin) '("-framework" "Cocoa" "-framework" "IOKit"
+172
"-framework" "CoreFoundation" "-framework" "QuartzCore"))
173
((windows) '("-lkernel32" "-luser32" "-lshell32" "-lgdi32"))
174
(else '())))))
175
@@ -64,12 +178,8 @@
178
name: 'build
179
description: "Build sigil-app"
180
steps: (list
−67
(compile-c-sources
−68
sources: '("src/c/sokol-app.c" "src/c/app.c")
−69
include-dirs: '("vendor/sokol" "src/c")
−70
flags: (with-sigil-c-flags '("-std=c99" "-D_GNU_SOURCE"
−71
"-DSOKOL_NO_ENTRY" "-DSOKOL_GLCORE"
−72
"-Wno-unused-parameter")))
+181
compile-app
+182
compile-glfw
183
(create-static-library name: "sigil-app")
184
(compile-sigil-modules sources: "src/**/*.sgl"
185
output-dir: (config-output-subdir "lib"))))))
src/c/app-internal.hmodified
@@ -1,7 +1,10 @@
1
/*
−2
* app-internal.h - Internal header for Sigil App package
+2
* app-internal.h - Internal header for the Sigil desktop host layer
3
*
−4
* Provides application state for windowing, input, and app lifecycle.
+4
* Application state for the window, GL context, input, frame clock and
+5
* quit handling. The host is GLFW (vendored under vendor/glfw); the
+6
* platform (Wayland or X11 on Linux, Win32, Cocoa) is picked at startup
+7
* and every platform library is loaded at runtime by GLFW itself.
8
*/
9
10
#ifndef SIGIL_APP_INTERNAL_H
@@ -10,6 +13,13 @@
13
#include <sigil/sigil.h>
14
#include <stdbool.h>
15
+16
/* GLFW_KEY_LAST is 348; sokol_app's table was 512 and the key symbols
+17
* only ever map into the GLFW range, so the same size is kept. */
+18
#define SIGIL_APP_MAX_KEYS 512
+19
#define SIGIL_APP_MAX_MOUSE_BUTTONS 3
+20
+21
struct GLFWwindow;
+22
23
/*
24
* Application state
25
*/
@@ -21,20 +31,35 @@ typedef struct {
31
Value frame_callback;
32
Value cleanup_callback;
33
+34
/* The window and its GL context */
+35
struct GLFWwindow *window;
+36
+37
/* Sizes: the framebuffer in pixels (what GL draws into and what
+38
* frame-width/frame-height report), the window in screen units (what
+39
* GLFW reports cursor positions in). They differ on a scaled Wayland
+40
* output; framebuffer / window is the device pixel ratio. */
+41
int fb_width;
+42
int fb_height;
+43
int win_width;
+44
int win_height;
+45
46
/* Frame timing */
+47
double last_time; /* glfwGetTime() at the previous frame */
48
double frame_time; /* Seconds since last frame */
49
double time_elapsed; /* Seconds since app start */
50
51
/* Input state - current frame */
−29
bool keys_down[512];
−30
bool keys_pressed[512];
−31
bool keys_released[512];
+52
bool keys_down[SIGIL_APP_MAX_KEYS];
+53
bool keys_pressed[SIGIL_APP_MAX_KEYS];
+54
bool keys_released[SIGIL_APP_MAX_KEYS];
55
−33
bool mouse_buttons[3];
−34
bool mouse_pressed[3];
−35
bool mouse_released[3];
−36
float mouse_x;
−37
float mouse_y;
+56
bool mouse_buttons[SIGIL_APP_MAX_MOUSE_BUTTONS];
+57
bool mouse_pressed[SIGIL_APP_MAX_MOUSE_BUTTONS];
+58
bool mouse_released[SIGIL_APP_MAX_MOUSE_BUTTONS];
+59
/* Cursor position in window (screen) units as GLFW reports it;
+60
* mouse-x / mouse-y scale it into framebuffer pixels on read. */
+61
double cursor_x;
+62
double cursor_y;
63
64
/* Quit handling */
65
bool quit_requested;
@@ -51,4 +76,9 @@ void sigil_app_state_shutdown(void);
76
void sigil_app_clear_frame_input(void);
77
int sigil_app_key_code_from_symbol(SigilVM *vm, Value sym);
78
+79
/* Framebuffer size in pixels (1x1 before the window exists), for the
+80
* sokol_app compatibility shim in sokol-compat.c. */
+81
int sigil_app_framebuffer_width(void);
+82
int sigil_app_framebuffer_height(void);
+83
84
#endif /* SIGIL_APP_INTERNAL_H */
src/c/app.cmodified
@@ -1,16 +1,23 @@
1
/*
2
* app.c - Sigil App Module
3
*
−4
* Wraps sokol_app.h to provide windowing, input, and application lifecycle.
+4
* The desktop host layer: window, GL context, input, frame clock and quit,
+5
* over GLFW (vendored under vendor/glfw). One binary runs as a native
+6
* Wayland client or under X11 on Linux, picked at startup; GLFW loads the
+7
* platform libraries (libwayland-client, libxkbcommon, libX11, libGL/EGL,
+8
* ...) with dlopen, so nothing platform-specific is linked.
+9
*
+10
* The exported Sigil API is the one sokol_app provided before: app-run,
+11
* frame-*, mouse-*, key-*, quit-requested?, request-quit.
12
*/
13
14
#include "app-internal.h"
15
#include "sigil-internal.h"
16
−10
/* Sokol headers (implementation is in sokol.c) */
−11
#include "sokol_app.h"
−12
#include "sokol_time.h"
−13
#include "sokol_log.h"
+17
/* No GL header: this layer never calls GL itself; sokol_gfx (in
+18
* sigil-graphics) brings its own. */
+19
#define GLFW_INCLUDE_NONE
+20
#include <GLFW/glfw3.h>
21
22
#include <stdio.h>
23
#include <stdlib.h>
@@ -31,6 +38,10 @@ void sigil_app_state_init(SigilVM *vm)
38
g_app->init_callback = SIGIL_FALSE;
39
g_app->frame_callback = SIGIL_FALSE;
40
g_app->cleanup_callback = SIGIL_FALSE;
+41
g_app->fb_width = 1;
+42
g_app->fb_height = 1;
+43
g_app->win_width = 1;
+44
g_app->win_height = 1;
45
}
46
47
void sigil_app_state_shutdown(void)
@@ -53,46 +64,59 @@ void sigil_app_clear_frame_input(void)
64
memset(g_app->mouse_released, 0, sizeof(g_app->mouse_released));
65
}
66
+67
int sigil_app_framebuffer_width(void)
+68
{
+69
return (g_app && g_app->fb_width > 0) ? g_app->fb_width : 1;
+70
}
+71
+72
int sigil_app_framebuffer_height(void)
+73
{
+74
return (g_app && g_app->fb_height > 0) ? g_app->fb_height : 1;
+75
}
+76
77
/*
−57
* Convert Scheme key symbol to Sokol keycode
+78
* Convert Scheme key symbol to a GLFW key code (GLFW_KEY_UNKNOWN when the
+79
* symbol names no key). The symbol set is the one sokol_app had: letters,
+80
* digits, space, return/enter, escape/esc, tab, backspace, the arrows,
+81
* shift, ctrl/control, alt.
82
*/
83
int sigil_app_key_code_from_symbol(SigilVM *vm, Value sym)
84
{
85
(void)vm;
−62
if (!sigil_is_symbol(sym)) return SAPP_KEYCODE_INVALID;
+86
if (!sigil_is_symbol(sym)) return GLFW_KEY_UNKNOWN;
87
88
SigilSymbol *s = (SigilSymbol *)sigil_as_ptr(sym);
89
const char *name = s->name;
90
91
/* Letters */
92
if (s->length == 1 && name[0] >= 'a' && name[0] <= 'z') {
−69
return SAPP_KEYCODE_A + (name[0] - 'a');
+93
return GLFW_KEY_A + (name[0] - 'a');
94
}
95
96
/* Numbers */
97
if (s->length == 1 && name[0] >= '0' && name[0] <= '9') {
−74
return SAPP_KEYCODE_0 + (name[0] - '0');
+98
return GLFW_KEY_0 + (name[0] - '0');
99
}
100
101
/* Special keys */
−78
if (strcmp(name, "space") == 0) return SAPP_KEYCODE_SPACE;
−79
if (strcmp(name, "return") == 0 || strcmp(name, "enter") == 0) return SAPP_KEYCODE_ENTER;
−80
if (strcmp(name, "escape") == 0 || strcmp(name, "esc") == 0) return SAPP_KEYCODE_ESCAPE;
−81
if (strcmp(name, "tab") == 0) return SAPP_KEYCODE_TAB;
−82
if (strcmp(name, "backspace") == 0) return SAPP_KEYCODE_BACKSPACE;
+102
if (strcmp(name, "space") == 0) return GLFW_KEY_SPACE;
+103
if (strcmp(name, "return") == 0 || strcmp(name, "enter") == 0) return GLFW_KEY_ENTER;
+104
if (strcmp(name, "escape") == 0 || strcmp(name, "esc") == 0) return GLFW_KEY_ESCAPE;
+105
if (strcmp(name, "tab") == 0) return GLFW_KEY_TAB;
+106
if (strcmp(name, "backspace") == 0) return GLFW_KEY_BACKSPACE;
107
108
/* Arrow keys */
−85
if (strcmp(name, "left") == 0) return SAPP_KEYCODE_LEFT;
−86
if (strcmp(name, "right") == 0) return SAPP_KEYCODE_RIGHT;
−87
if (strcmp(name, "up") == 0) return SAPP_KEYCODE_UP;
−88
if (strcmp(name, "down") == 0) return SAPP_KEYCODE_DOWN;
+109
if (strcmp(name, "left") == 0) return GLFW_KEY_LEFT;
+110
if (strcmp(name, "right") == 0) return GLFW_KEY_RIGHT;
+111
if (strcmp(name, "up") == 0) return GLFW_KEY_UP;
+112
if (strcmp(name, "down") == 0) return GLFW_KEY_DOWN;
113
114
/* Modifiers */
−91
if (strcmp(name, "shift") == 0) return SAPP_KEYCODE_LEFT_SHIFT;
−92
if (strcmp(name, "ctrl") == 0 || strcmp(name, "control") == 0) return SAPP_KEYCODE_LEFT_CONTROL;
−93
if (strcmp(name, "alt") == 0) return SAPP_KEYCODE_LEFT_ALT;
+115
if (strcmp(name, "shift") == 0) return GLFW_KEY_LEFT_SHIFT;
+116
if (strcmp(name, "ctrl") == 0 || strcmp(name, "control") == 0) return GLFW_KEY_LEFT_CONTROL;
+117
if (strcmp(name, "alt") == 0) return GLFW_KEY_LEFT_ALT;
118
−95
return SAPP_KEYCODE_INVALID;
+119
return GLFW_KEY_UNKNOWN;
120
}
121
122
/*
@@ -106,19 +130,17 @@ static int mouse_button_from_symbol(SigilVM *vm, Value sym)
130
SigilSymbol *s = (SigilSymbol *)sigil_as_ptr(sym);
131
const char *name = s->name;
132
−109
if (strcmp(name, "left") == 0) return 0;
−110
if (strcmp(name, "right") == 0) return 1;
−111
if (strcmp(name, "middle") == 0) return 2;
+133
if (strcmp(name, "left") == 0) return GLFW_MOUSE_BUTTON_LEFT;
+134
if (strcmp(name, "right") == 0) return GLFW_MOUSE_BUTTON_RIGHT;
+135
if (strcmp(name, "middle") == 0) return GLFW_MOUSE_BUTTON_MIDDLE;
136
137
return -1;
138
}
139
140
/* ============================================================
−117
* SOKOL CALLBACKS
+141
* GLFW CALLBACKS
142
* ============================================================ */
143
−120
static uint64_t last_time = 0;
−121
144
/* Check for VM errors and print them */
145
static void check_vm_error(const char *context)
146
{
@@ -127,97 +149,234 @@ static void check_vm_error(const char *context)
149
if (err) {
150
fprintf(stderr, "Scheme error in %s: %s\n", context, err);
151
sigil_error_clear(g_app->vm);
−130
sapp_request_quit();
+152
if (g_app->window) glfwSetWindowShouldClose(g_app->window, GLFW_TRUE);
153
}
154
}
155
−134
static void app_init(void)
+156
static void glfw_error_callback(int code, const char *description)
157
{
−136
stm_setup();
−137
last_time = stm_now();
+158
fprintf(stderr, "sigil-app: GLFW error 0x%X: %s\n", code, description);
+159
}
160
−139
if (g_app && !sigil_is_false(g_app->init_callback)) {
−140
sigil_apply0(g_app->vm, g_app->init_callback);
−141
check_vm_error("init");
+161
static void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods)
+162
{
+163
(void)window; (void)scancode; (void)mods;
+164
if (!g_app) return;
+165
if (key < 0 || key >= SIGIL_APP_MAX_KEYS) return;
+166
+167
if (action == GLFW_PRESS || action == GLFW_REPEAT) {
+168
/* A repeat is a held key, not a new press: pressed? fires once. */
+169
if (!g_app->keys_down[key]) {
+170
g_app->keys_pressed[key] = true;
+171
}
+172
g_app->keys_down[key] = true;
+173
} else if (action == GLFW_RELEASE) {
+174
g_app->keys_down[key] = false;
+175
g_app->keys_released[key] = true;
176
}
177
}
178
−145
static void app_frame(void)
+179
static void mouse_button_callback(GLFWwindow *window, int button, int action, int mods)
180
{
−147
/* Calculate frame time */
−148
uint64_t now = stm_now();
−149
g_app->frame_time = stm_sec(stm_diff(now, last_time));
−150
g_app->time_elapsed += g_app->frame_time;
−151
last_time = now;
+181
(void)window; (void)mods;
+182
if (!g_app) return;
+183
if (button < 0 || button >= SIGIL_APP_MAX_MOUSE_BUTTONS) return;
184
−153
/* Call Scheme frame callback with delta time */
−154
if (g_app && !sigil_is_false(g_app->frame_callback)) {
−155
Value dt = sigil_flonum(g_app->frame_time);
−156
sigil_apply1(g_app->vm, g_app->frame_callback, dt);
−157
check_vm_error("frame");
+185
if (action == GLFW_PRESS) {
+186
if (!g_app->mouse_buttons[button]) {
+187
g_app->mouse_pressed[button] = true;
+188
}
+189
g_app->mouse_buttons[button] = true;
+190
} else if (action == GLFW_RELEASE) {
+191
g_app->mouse_buttons[button] = false;
+192
g_app->mouse_released[button] = true;
193
}
+194
}
195
−160
/* Clear per-frame input state for next frame */
−161
sigil_app_clear_frame_input();
+196
static void cursor_pos_callback(GLFWwindow *window, double x, double y)
+197
{
+198
(void)window;
+199
if (!g_app) return;
+200
g_app->cursor_x = x;
+201
g_app->cursor_y = y;
202
}
203
−164
static void app_cleanup(void)
+204
static void window_close_callback(GLFWwindow *window)
205
{
−166
if (g_app && !sigil_is_false(g_app->cleanup_callback)) {
−167
sigil_apply0(g_app->vm, g_app->cleanup_callback);
−168
check_vm_error("cleanup");
−169
}
+206
(void)window;
+207
if (!g_app) return;
+208
/* The window manager asked; the game sees (quit-requested?) => #t
+209
* and the loop ends after this frame, as with sokol_app's
+210
* QUIT_REQUESTED event. */
+211
g_app->quit_requested = true;
212
}
213
−172
static void app_event(const sapp_event *ev)
+214
static void framebuffer_size_callback(GLFWwindow *window, int width, int height)
215
{
+216
(void)window;
217
if (!g_app) return;
+218
g_app->fb_width = width;
+219
g_app->fb_height = height;
+220
}
221
−176
switch (ev->type) {
−177
case SAPP_EVENTTYPE_KEY_DOWN:
−178
if (ev->key_code < 512) {
−179
if (!g_app->keys_down[ev->key_code]) {
−180
g_app->keys_pressed[ev->key_code] = true;
−181
}
−182
g_app->keys_down[ev->key_code] = true;
−183
}
−184
break;
+222
static void window_size_callback(GLFWwindow *window, int width, int height)
+223
{
+224
(void)window;
+225
if (!g_app) return;
+226
g_app->win_width = width;
+227
g_app->win_height = height;
+228
}
229
−186
case SAPP_EVENTTYPE_KEY_UP:
−187
if (ev->key_code < 512) {
−188
g_app->keys_down[ev->key_code] = false;
−189
g_app->keys_released[ev->key_code] = true;
−190
}
−191
break;
−192
−193
case SAPP_EVENTTYPE_MOUSE_DOWN:
−194
if (ev->mouse_button < 3) {
−195
if (!g_app->mouse_buttons[ev->mouse_button]) {
−196
g_app->mouse_pressed[ev->mouse_button] = true;
−197
}
−198
g_app->mouse_buttons[ev->mouse_button] = true;
−199
}
−200
break;
+230
/* Cursor position scaled from window units into framebuffer pixels, so
+231
* mouse-x/mouse-y and frame-width/frame-height share one coordinate
+232
* system whatever the output scale is. */
+233
static double cursor_to_fb_x(void)
+234
{
+235
if (!g_app || g_app->win_width <= 0) return 0.0;
+236
return g_app->cursor_x * ((double)g_app->fb_width / (double)g_app->win_width);
+237
}
238
−202
case SAPP_EVENTTYPE_MOUSE_UP:
−203
if (ev->mouse_button < 3) {
−204
g_app->mouse_buttons[ev->mouse_button] = false;
−205
g_app->mouse_released[ev->mouse_button] = true;
+239
static double cursor_to_fb_y(void)
+240
{
+241
if (!g_app || g_app->win_height <= 0) return 0.0;
+242
return g_app->cursor_y * ((double)g_app->fb_height / (double)g_app->win_height);
+243
}
+244
+245
/* ============================================================
+246
* PLATFORM SELECTION
+247
* ============================================================ */
+248
+249
/*
+250
* GLFW picks Wayland when XDG_SESSION_TYPE=wayland and WAYLAND_DISPLAY is
+251
* set, X11 when XDG_SESSION_TYPE=x11 and DISPLAY is set, and otherwise
+252
* tries Wayland then X11. SIGIL_APP_PLATFORM=wayland|x11 forces one, for
+253
* tests that run under a private compositor or X server and for users
+254
* whose session variables lie.
+255
*/
+256
static void apply_platform_hint(void)
+257
{
+258
const char *want = getenv("SIGIL_APP_PLATFORM");
+259
if (!want || !*want) return;
+260
if (strcmp(want, "wayland") == 0) {
+261
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WAYLAND);
+262
} else if (strcmp(want, "x11") == 0) {
+263
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
+264
} else if (strcmp(want, "win32") == 0) {
+265
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WIN32);
+266
} else if (strcmp(want, "cocoa") == 0) {
+267
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_COCOA);
+268
} else {
+269
fprintf(stderr, "sigil-app: SIGIL_APP_PLATFORM=%s is not one of wayland, x11, win32, cocoa; ignored\n", want);
+270
}
+271
}
+272
+273
static const char *platform_name(int platform)
+274
{
+275
switch (platform) {
+276
case GLFW_PLATFORM_WAYLAND: return "wayland";
+277
case GLFW_PLATFORM_X11: return "x11";
+278
case GLFW_PLATFORM_WIN32: return "win32";
+279
case GLFW_PLATFORM_COCOA: return "cocoa";
+280
case GLFW_PLATFORM_NULL: return "null";
+281
default: return "unknown";
+282
}
+283
}
+284
+285
/* ============================================================
+286
* MAIN LOOP
+287
* ============================================================ */
+288
+289
static void run_main_loop(const char *title, int width, int height)
+290
{
+291
glfwSetErrorCallback(glfw_error_callback);
+292
apply_platform_hint();
+293
+294
if (!glfwInit()) {
+295
fprintf(stderr, "sigil-app: glfwInit failed; no usable display platform\n");
+296
return;
+297
}
+298
+299
/* GL 4.1 core, the profile sokol_app asked for (and the newest macOS
+300
* offers). Forward-compat is required by macOS for core profiles and
+301
* harmless elsewhere. Depth 24 / stencil 8 are GLFW's defaults and
+302
* match the sokol_app swapchain the graphics layer expects. */
+303
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
+304
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
+305
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
+306
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
+307
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
+308
+309
GLFWwindow *window = glfwCreateWindow(width, height, title, NULL, NULL);
+310
if (!window) {
+311
fprintf(stderr, "sigil-app: window creation failed (platform %s)\n",
+312
platform_name(glfwGetPlatform()));
+313
glfwTerminate();
+314
return;
+315
}
+316
g_app->window = window;
+317
+318
glfwMakeContextCurrent(window);
+319
glfwSwapInterval(1);
+320
+321
glfwGetFramebufferSize(window, &g_app->fb_width, &g_app->fb_height);
+322
glfwGetWindowSize(window, &g_app->win_width, &g_app->win_height);
+323
glfwGetCursorPos(window, &g_app->cursor_x, &g_app->cursor_y);
+324
+325
if (getenv("SIGIL_APP_VERBOSE")) {
+326
float sx = 1.0f, sy = 1.0f;
+327
glfwGetWindowContentScale(window, &sx, &sy);
+328
fprintf(stderr, "sigil-app: platform=%s window=%dx%d framebuffer=%dx%d content-scale=%.2fx%.2f gl=%s\n",
+329
platform_name(glfwGetPlatform()),
+330
g_app->win_width, g_app->win_height,
+331
g_app->fb_width, g_app->fb_height, sx, sy,
+332
glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR) == 4 ? "4.x" : "other");
+333
}
+334
+335
glfwSetKeyCallback(window, key_callback);
+336
glfwSetMouseButtonCallback(window, mouse_button_callback);
+337
glfwSetCursorPosCallback(window, cursor_pos_callback);
+338
glfwSetWindowCloseCallback(window, window_close_callback);
+339
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
+340
glfwSetWindowSizeCallback(window, window_size_callback);
+341
+342
/* init */
+343
g_app->last_time = glfwGetTime();
+344
if (!sigil_is_false(g_app->init_callback)) {
+345
sigil_apply0(g_app->vm, g_app->init_callback);
+346
check_vm_error("init");
+347
}
+348
+349
/* frames */
+350
while (!glfwWindowShouldClose(window)) {
+351
glfwPollEvents();
+352
+353
double now = glfwGetTime();
+354
g_app->frame_time = now - g_app->last_time;
+355
g_app->time_elapsed += g_app->frame_time;
+356
g_app->last_time = now;
+357
+358
if (!sigil_is_false(g_app->frame_callback)) {
+359
Value dt = sigil_flonum(g_app->frame_time);
+360
sigil_apply1(g_app->vm, g_app->frame_callback, dt);
+361
check_vm_error("frame");
362
}
−207
break;
363
−209
case SAPP_EVENTTYPE_MOUSE_MOVE:
−210
g_app->mouse_x = ev->mouse_x;
−211
g_app->mouse_y = ev->mouse_y;
−212
break;
+364
/* The frame is drawn; present it. */
+365
glfwSwapBuffers(window);
366
−214
case SAPP_EVENTTYPE_QUIT_REQUESTED:
−215
g_app->quit_requested = true;
−216
break;
+367
/* Clear per-frame input state for next frame */
+368
sigil_app_clear_frame_input();
+369
}
370
−218
default:
−219
break;
+371
/* cleanup */
+372
if (!sigil_is_false(g_app->cleanup_callback)) {
+373
sigil_apply0(g_app->vm, g_app->cleanup_callback);
+374
check_vm_error("cleanup");
375
}
+376
+377
g_app->window = NULL;
+378
glfwDestroyWindow(window);
+379
glfwTerminate();
380
}
381
382
/* ============================================================
@@ -263,20 +422,7 @@ static Value native_app_run(SigilVM *vm, int argc, Value *args)
422
height = (int)sigil_as_fixnum(args[5]);
423
}
424
−266
/* Configure and run Sokol app */
−267
sapp_desc desc = {
−268
.init_cb = app_init,
−269
.frame_cb = app_frame,
−270
.cleanup_cb = app_cleanup,
−271
.event_cb = app_event,
−272
.width = width,
−273
.height = height,
−274
.window_title = title,
−275
.icon.sokol_default = true,
−276
.logger.func = slog_func,
−277
};
−278
−279
sapp_run(&desc);
+425
run_main_loop(title, width, height);
426
427
/* Cleanup */
428
sigil_app_state_shutdown();
@@ -285,21 +431,21 @@ static Value native_app_run(SigilVM *vm, int argc, Value *args)
431
}
432
433
/*
−288
* (frame-width) -> integer
+434
* (frame-width) -> integer, framebuffer pixels
435
*/
436
static Value native_frame_width(SigilVM *vm, int argc, Value *args)
437
{
438
(void)vm; (void)argc; (void)args;
−293
return sigil_fixnum(sapp_width());
+439
return sigil_fixnum(sigil_app_framebuffer_width());
440
}
441
442
/*
−297
* (frame-height) -> integer
+443
* (frame-height) -> integer, framebuffer pixels
444
*/
445
static Value native_frame_height(SigilVM *vm, int argc, Value *args)
446
{
447
(void)vm; (void)argc; (void)args;
−302
return sigil_fixnum(sapp_height());
+448
return sigil_fixnum(sigil_app_framebuffer_height());
449
}
450
451
/*
@@ -323,23 +469,21 @@ static Value native_time_elapsed(SigilVM *vm, int argc, Value *args)
469
}
470
471
/*
−326
* (mouse-x) -> float
+472
* (mouse-x) -> float, framebuffer pixels
473
*/
474
static Value native_mouse_x(SigilVM *vm, int argc, Value *args)
475
{
476
(void)vm; (void)argc; (void)args;
−331
if (!g_app) return sigil_flonum(0.0);
−332
return sigil_flonum(g_app->mouse_x);

Showing the first 500 of 561 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

src/c/sokol-app.cdeleted
@@ -1,13 +0,0 @@
−1
/*
−2
* sokol.c - Sokol implementation for sigil-app
−3
*
−4
* Implements sokol_app, sokol_time, and sokol_log.
−5
* Note: sokol_glue is in sigil-graphics since it bridges app and gfx.
−6
*/
−7
−8
#define SOKOL_IMPL
−9
/* SOKOL_GLCORE is defined via compiler flags */
−10
−11
#include "sokol_app.h"
−12
#include "sokol_time.h"
−13
#include "sokol_log.h"
src/c/sokol-compat.cadded
@@ -0,0 +1,57 @@
+1
/*
+2
* sokol-compat.c - the sokol_app symbols sigil-graphics still links against
+3
*
+4
* The window no longer comes from sokol_app (see app.c: it is GLFW now), but
+5
* sigil-graphics' vendored sokol_glue.h calls sapp_get_environment() and
+6
* sapp_get_swapchain(), its graphics.c calls sapp_width()/sapp_height(), and
+7
* every sokol_gfx logger points at slog_func from sokol_log.h. This file
+8
* implements exactly those five symbols over the GLFW host state so a
+9
* consumer relocks sigil-app and nothing else changes. The types come from
+10
* the vendored sokol_app.h, included for declarations only (no SOKOL_IMPL),
+11
* so the struct layouts match what sigil-graphics compiled against.
+12
*
+13
* The values are the ones sokol_app's GL backend reported: RGBA8 colour,
+14
* a combined depth-stencil buffer (GLFW's default framebuffer is 24/8), no
+15
* MSAA, GL framebuffer 0.
+16
*/
+17
+18
#include "app-internal.h"
+19
#include <string.h>
+20
+21
#define SOKOL_LOG_IMPL
+22
#include "sokol_log.h"
+23
+24
#include "sokol_app.h"
+25
+26
SOKOL_API_IMPL int sapp_width(void)
+27
{
+28
return sigil_app_framebuffer_width();
+29
}
+30
+31
SOKOL_API_IMPL int sapp_height(void)
+32
{
+33
return sigil_app_framebuffer_height();
+34
}
+35
+36
SOKOL_API_IMPL sapp_environment sapp_get_environment(void)
+37
{
+38
sapp_environment env;
+39
memset(&env, 0, sizeof(env));
+40
env.defaults.color_format = SAPP_PIXELFORMAT_RGBA8;
+41
env.defaults.depth_format = SAPP_PIXELFORMAT_DEPTH_STENCIL;
+42
env.defaults.sample_count = 1;
+43
return env;
+44
}
+45
+46
SOKOL_API_IMPL sapp_swapchain sapp_get_swapchain(void)
+47
{
+48
sapp_swapchain sc;
+49
memset(&sc, 0, sizeof(sc));
+50
sc.width = sigil_app_framebuffer_width();
+51
sc.height = sigil_app_framebuffer_height();
+52
sc.sample_count = 1;
+53
sc.color_format = SAPP_PIXELFORMAT_RGBA8;
+54
sc.depth_format = SAPP_PIXELFORMAT_DEPTH_STENCIL;
+55
sc.gl.framebuffer = 0;
+56
return sc;
+57
}
vendor/glfw/LICENSE.mdadded
@@ -0,0 +1,23 @@
+1
Copyright (c) 2002-2006 Marcus Geelnard
+2
+3
Copyright (c) 2006-2019 Camilla Löwy
+4
+5
This software is provided 'as-is', without any express or implied
+6
warranty. In no event will the authors be held liable for any damages
+7
arising from the use of this software.
+8
+9
Permission is granted to anyone to use this software for any purpose,
+10
including commercial applications, and to alter it and redistribute it
+11
freely, subject to the following restrictions:
+12
+13
1. The origin of this software must not be misrepresented; you must not
+14
claim that you wrote the original software. If you use this software
+15
in a product, an acknowledgment in the product documentation would
+16
be appreciated but is not required.
+17
+18
2. Altered source versions must be plainly marked as such, and must not
+19
be misrepresented as being the original software.
+20
+21
3. This notice may not be removed or altered from any source
+22
distribution.
+23
vendor/glfw/VENDOR.mdadded
@@ -0,0 +1,180 @@
+1
# Vendored GLFW
+2
+3
- Upstream: https://github.com/glfw/glfw
+4
- Tag: `3.5.1` (released 2026-07-31; there is no 3.5.0 release, see
+5
upstream `docs/news.md`)
+6
- Source archive: `https://github.com/glfw/glfw/archive/refs/tags/3.5.1.tar.gz`,
+7
sha256 `5234f4f29473e9a06bc7847d8371858dd135d38466eeeaa652fdc9f8f9ff0c20`
+8
- License: zlib/libpng, `LICENSE.md` (copied from the archive root)
+9
+10
## Rule
+11
+12
No local patches. Every file under `include/`, `src/` (except
+13
`src/wayland-protocols/`) and `deps/` is byte-identical to the file of the
+14
same path in the tagged archive. Configuration is done with compile-time
+15
defines in `package.sgl` only (`_GLFW_X11`, `_GLFW_WAYLAND`, `_GLFW_WIN32`,
+16
`_GLFW_COCOA`, `_DEFAULT_SOURCE`, `HAVE_MEMFD_CREATE`, `UNICODE`).
+17
+18
Upgrade by replacing the directory from a newer tag, regenerating
+19
`src/wayland-protocols/`, and updating this file.
+20
+21
Re-derive the identity check:
+22
+23
```sh
+24
curl -sSL -o /tmp/glfw.tar.gz https://github.com/glfw/glfw/archive/refs/tags/3.5.1.tar.gz
+25
sha256sum /tmp/glfw.tar.gz # 5234f4f2...
+26
tar xzf /tmp/glfw.tar.gz -C /tmp
+27
for f in $(cd vendor/glfw && find include src deps LICENSE.md -type f | grep -v wayland-protocols); do
+28
cmp vendor/glfw/$f /tmp/glfw-3.5.1/$f || echo "DIFFERS $f"
+29
done
+30
```
+31
+32
## What is vendored, and why
+33
+34
The file selection follows `src/CMakeLists.txt` in the archive:
+35
+36
- **common** (every platform): `context.c init.c input.c monitor.c
+37
platform.c vulkan.c window.c egl_context.c osmesa_context.c null_init.c
+38
null_monitor.c null_window.c null_joystick.c` and the headers
+39
`internal.h platform.h mappings.h null_platform.h null_joystick.h`.
+40
- **Linux** (`_GLFW_X11` + `_GLFW_WAYLAND`, both in one archive, picked at
+41
`glfwInit`): `posix_module.c posix_time.c posix_thread.c posix_poll.c
+42
linux_joystick.c`; X11 `x11_init.c x11_monitor.c x11_window.c
+43
xkb_unicode.c glx_context.c`; Wayland `wl_init.c wl_monitor.c
+44
wl_window.c`; headers `posix_*.h linux_joystick.h x11_platform.h
+45
wl_platform.h`.
+46
- **Windows** (`_GLFW_WIN32`): `win32_module.c win32_time.c win32_thread.c
+47
win32_init.c win32_joystick.c win32_monitor.c win32_window.c
+48
wgl_context.c`; headers `win32_*.h`.
+49
- **macOS** (`_GLFW_COCOA`; listed and vendored, compiled only for a darwin
+50
target, which no build has exercised yet): `posix_module.c
+51
posix_thread.c macos_time.c cocoa_init.m cocoa_joystick.m
+52
cocoa_monitor.m cocoa_window.m nsgl_context.m`; headers `macos_time.h
+53
cocoa_platform.h cocoa_joystick.h`.
+54
- **public headers**: `include/GLFW/glfw3.h`, `include/GLFW/glfw3native.h`.
+55
- **Wayland protocols**: the nine XML files under `deps/wayland/` as
+56
shipped, and under `src/wayland-protocols/` the C generated from them
+57
with `wayland-scanner 1.24.0` (`client-header` and `private-code` per
+58
XML, the exact commands GLFW's CMake runs). They are checked in so no
+59
consumer needs `wayland-scanner`. Regenerate with:
+60
+61
```sh
+62
cd vendor/glfw/src/wayland-protocols
+63
for x in ../../deps/wayland/*.xml; do b=$(basename $x .xml)
+64
wayland-scanner client-header $x $b-client-protocol.h
+65
wayland-scanner private-code $x $b-client-protocol-code.h
+66
done
+67
```
+68
+69
Not vendored: `CMake/`, `docs/`, `examples/`, `tests/`, `deps/` other
+70
than `wayland/`, `src/CMakeLists.txt`, `src/glfw.rc.in`, `src/mappings.h.in`.
+71
+72
## Compile-time headers a build needs
+73
+74
GLFW loads every platform library with `dlopen` at run time, but its
+75
backends still compile against the platform headers. A Linux build of
+76
this package needs the X11 headers (`libx11 libxcursor libxrandr
+77
libxinerama libxi libxext xorgproto` in Guix), `wayland-client-core.h`
+78
(`wayland`) and `xkbcommon/xkbcommon.h` (`libxkbcommon`). No GL/EGL headers:
+79
GLFW declares its own GLX/EGL types, and `app.c` includes `glfw3.h` with
+80
`GLFW_INCLUDE_NONE`.
+81
+82
## Runtime libraries GLFW loads (Linux)
+83
+84
Wayland: `libwayland-client.so.0`, `libwayland-cursor.so.0`,
+85
`libwayland-egl.so.1`, `libxkbcommon.so.0`, `libEGL.so.1`, and optionally
+86
`libdecor-0.so.0` (client-side decorations where the compositor has no
+87
xdg-decoration). X11: `libX11.so.6`, and optionally `libXi`, `libXrandr`,
+88
`libXcursor`, `libXinerama`, `libXrender`, `libXext`, `libX11-xcb`,
+89
`libXxf86vm`; `libGL.so.1` for GLX.
+90
+91
## File inventory (88 files, plus this one)
+92
+93
LICENSE.md
+94
deps/wayland/fractional-scale-v1.xml
+95
deps/wayland/idle-inhibit-unstable-v1.xml
+96
deps/wayland/pointer-constraints-unstable-v1.xml
+97
deps/wayland/relative-pointer-unstable-v1.xml
+98
deps/wayland/viewporter.xml
+99
deps/wayland/wayland.xml
+100
deps/wayland/xdg-activation-v1.xml
+101
deps/wayland/xdg-decoration-unstable-v1.xml
+102
deps/wayland/xdg-shell.xml
+103
include/GLFW/glfw3.h
+104
include/GLFW/glfw3native.h
+105
src/cocoa_init.m
+106
src/cocoa_joystick.h
+107
src/cocoa_joystick.m
+108
src/cocoa_monitor.m
+109
src/cocoa_platform.h
+110
src/cocoa_window.m
+111
src/context.c
+112
src/egl_context.c
+113
src/glx_context.c
+114
src/init.c
+115
src/input.c
+116
src/internal.h
+117
src/linux_joystick.c
+118
src/linux_joystick.h
+119
src/macos_time.c
+120
src/macos_time.h
+121
src/mappings.h
+122
src/monitor.c
+123
src/nsgl_context.m
+124
src/null_init.c
+125
src/null_joystick.c
+126
src/null_joystick.h
+127
src/null_monitor.c
+128
src/null_platform.h
+129
src/null_window.c
+130
src/osmesa_context.c
+131
src/platform.c
+132
src/platform.h
+133
src/posix_module.c
+134
src/posix_poll.c
+135
src/posix_poll.h
+136
src/posix_thread.c
+137
src/posix_thread.h
+138
src/posix_time.c
+139
src/posix_time.h
+140
src/vulkan.c
+141
src/wayland-protocols/fractional-scale-v1-client-protocol-code.h
+142
src/wayland-protocols/fractional-scale-v1-client-protocol.h
+143
src/wayland-protocols/idle-inhibit-unstable-v1-client-protocol-code.h
+144
src/wayland-protocols/idle-inhibit-unstable-v1-client-protocol.h
+145
src/wayland-protocols/pointer-constraints-unstable-v1-client-protocol-code.h
+146
src/wayland-protocols/pointer-constraints-unstable-v1-client-protocol.h
+147
src/wayland-protocols/relative-pointer-unstable-v1-client-protocol-code.h
+148
src/wayland-protocols/relative-pointer-unstable-v1-client-protocol.h
+149
src/wayland-protocols/viewporter-client-protocol-code.h
+150
src/wayland-protocols/viewporter-client-protocol.h
+151
src/wayland-protocols/wayland-client-protocol-code.h
+152
src/wayland-protocols/wayland-client-protocol.h
+153
src/wayland-protocols/xdg-activation-v1-client-protocol-code.h
+154
src/wayland-protocols/xdg-activation-v1-client-protocol.h
+155
src/wayland-protocols/xdg-decoration-unstable-v1-client-protocol-code.h
+156
src/wayland-protocols/xdg-decoration-unstable-v1-client-protocol.h
+157
src/wayland-protocols/xdg-shell-client-protocol-code.h
+158
src/wayland-protocols/xdg-shell-client-protocol.h
+159
src/wgl_context.c
+160
src/win32_init.c
+161
src/win32_joystick.c
+162
src/win32_joystick.h
+163
src/win32_module.c
+164
src/win32_monitor.c
+165
src/win32_platform.h
+166
src/win32_thread.c
+167
src/win32_thread.h
+168
src/win32_time.c
+169
src/win32_time.h
+170
src/win32_window.c
+171
src/window.c
+172
src/wl_init.c
+173
src/wl_monitor.c
+174
src/wl_platform.h
+175
src/wl_window.c
+176
src/x11_init.c
+177
src/x11_monitor.c
+178
src/x11_platform.h
+179
src/x11_window.c
+180
src/xkb_unicode.c
vendor/glfw/deps/wayland/fractional-scale-v1.xmladded
@@ -0,0 +1,102 @@
+1
<?xml version="1.0" encoding="UTF-8"?>
+2
<protocol name="fractional_scale_v1">
+3
<copyright>
+4
Copyright © 2022 Kenny Levinsen
+5
+6
Permission is hereby granted, free of charge, to any person obtaining a
+7
copy of this software and associated documentation files (the "Software"),
+8
to deal in the Software without restriction, including without limitation
+9
the rights to use, copy, modify, merge, publish, distribute, sublicense,
+10
and/or sell copies of the Software, and to permit persons to whom the
+11
Software is furnished to do so, subject to the following conditions:
+12
+13
The above copyright notice and this permission notice (including the next
+14
paragraph) shall be included in all copies or substantial portions of the
+15
Software.
+16
+17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+20
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+22
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+23
DEALINGS IN THE SOFTWARE.
+24
</copyright>
+25
+26
<description summary="Protocol for requesting fractional surface scales">
+27
This protocol allows a compositor to suggest for surfaces to render at
+28
fractional scales.
+29
+30
A client can submit scaled content by utilizing wp_viewport. This is done by
+31
creating a wp_viewport object for the surface and setting the destination
+32
rectangle to the surface size before the scale factor is applied.
+33
+34
The buffer size is calculated by multiplying the surface size by the
+35
intended scale.
+36
+37
The wl_surface buffer scale should remain set to 1.
+38
+39
If a surface has a surface-local size of 100 px by 50 px and wishes to
+40
submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
+41
be used and the wp_viewport destination rectangle should be 100 px by 50 px.
+42
+43
For toplevel surfaces, the size is rounded halfway away from zero. The
+44
rounding algorithm for subsurface position and size is not defined.
+45
</description>
+46
+47
<interface name="wp_fractional_scale_manager_v1" version="1">
+48
<description summary="fractional surface scale information">
+49
A global interface for requesting surfaces to use fractional scales.
+50
</description>
+51
+52
<request name="destroy" type="destructor">
+53
<description summary="unbind the fractional surface scale interface">
+54
Informs the server that the client will not be using this protocol
+55
object anymore. This does not affect any other objects,
+56
wp_fractional_scale_v1 objects included.
+57
</description>
+58
</request>
+59
+60
<enum name="error">
+61
<entry name="fractional_scale_exists" value="0"
+62
summary="the surface already has a fractional_scale object associated"/>
+63
</enum>
+64
+65
<request name="get_fractional_scale">
+66
<description summary="extend surface interface for scale information">
+67
Create an add-on object for the the wl_surface to let the compositor
+68
request fractional scales. If the given wl_surface already has a
+69
wp_fractional_scale_v1 object associated, the fractional_scale_exists
+70
protocol error is raised.
+71
</description>
+72
<arg name="id" type="new_id" interface="wp_fractional_scale_v1"
+73
summary="the new surface scale info interface id"/>
+74
<arg name="surface" type="object" interface="wl_surface"
+75
summary="the surface"/>
+76
</request>
+77
</interface>
+78
+79
<interface name="wp_fractional_scale_v1" version="1">
+80
<description summary="fractional scale interface to a wl_surface">
+81
An additional interface to a wl_surface object which allows the compositor
+82
to inform the client of the preferred scale.
+83
</description>
+84
+85
<request name="destroy" type="destructor">
+86
<description summary="remove surface scale information for surface">
+87
Destroy the fractional scale object. When this object is destroyed,
+88
preferred_scale events will no longer be sent.
+89
</description>
+90
</request>
+91
+92
<event name="preferred_scale">
+93
<description summary="notify of new preferred scale">
+94
Notification of a new preferred scale for this surface that the
+95
compositor suggests that the client should use.
+96
+97
The sent scale is the numerator of a fraction with a denominator of 120.
+98
</description>
+99
<arg name="scale" type="uint" summary="the new preferred scale"/>
+100
</event>
+101
</interface>
+102
</protocol>
vendor/glfw/deps/wayland/idle-inhibit-unstable-v1.xmladded
@@ -0,0 +1,83 @@
+1
<?xml version="1.0" encoding="UTF-8"?>
+2
<protocol name="idle_inhibit_unstable_v1">
+3
+4
<copyright>
+5
Copyright © 2015 Samsung Electronics Co., Ltd
+6
+7
Permission is hereby granted, free of charge, to any person obtaining a
+8
copy of this software and associated documentation files (the "Software"),
+9
to deal in the Software without restriction, including without limitation
+10
the rights to use, copy, modify, merge, publish, distribute, sublicense,
+11
and/or sell copies of the Software, and to permit persons to whom the
+12
Software is furnished to do so, subject to the following conditions:
+13
+14
The above copyright notice and this permission notice (including the next
+15
paragraph) shall be included in all copies or substantial portions of the
+16
Software.
+17
+18
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+19
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+20
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+21
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+22
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+23
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+24
DEALINGS IN THE SOFTWARE.
+25
</copyright>
+26
+27
<interface name="zwp_idle_inhibit_manager_v1" version="1">
+28
<description summary="control behavior when display idles">
+29
This interface permits inhibiting the idle behavior such as screen
+30
blanking, locking, and screensaving. The client binds the idle manager
+31
globally, then creates idle-inhibitor objects for each surface.
+32
+33
Warning! The protocol described in this file is experimental and
+34
backward incompatible changes may be made. Backward compatible changes
+35
may be added together with the corresponding interface version bump.
+36
Backward incompatible changes are done by bumping the version number in
+37
the protocol and interface names and resetting the interface version.
+38
Once the protocol is to be declared stable, the 'z' prefix and the
+39
version number in the protocol and interface names are removed and the
+40
interface version number is reset.
+41
</description>
+42
+43
<request name="destroy" type="destructor">
+44
<description summary="destroy the idle inhibitor object">
+45
Destroy the inhibit manager.
+46
</description>
+47
</request>
+48
+49
<request name="create_inhibitor">
+50
<description summary="create a new inhibitor object">
+51
Create a new inhibitor object associated with the given surface.
+52
</description>
+53
<arg name="id" type="new_id" interface="zwp_idle_inhibitor_v1"/>
+54
<arg name="surface" type="object" interface="wl_surface"
+55
summary="the surface that inhibits the idle behavior"/>
+56
</request>
+57
+58
</interface>
+59
+60
<interface name="zwp_idle_inhibitor_v1" version="1">
+61
<description summary="context object for inhibiting idle behavior">
+62
An idle inhibitor prevents the output that the associated surface is
+63
visible on from being set to a state where it is not visually usable due
+64
to lack of user interaction (e.g. blanked, dimmed, locked, set to power
+65
save, etc.) Any screensaver processes are also blocked from displaying.
+66
+67
If the surface is destroyed, unmapped, becomes occluded, loses
+68
visibility, or otherwise becomes not visually relevant for the user, the
+69
idle inhibitor will not be honored by the compositor; if the surface
+70
subsequently regains visibility the inhibitor takes effect once again.
+71
Likewise, the inhibitor isn't honored if the system was already idled at
+72
the time the inhibitor was established, although if the system later
+73
de-idles and re-idles the inhibitor will take effect.
+74
</description>
+75
+76
<request name="destroy" type="destructor">
+77
<description summary="destroy the idle inhibitor object">
+78
Remove the inhibitor effect from the associated wl_surface.
+79
</description>
+80
</request>
+81
+82
</interface>
+83
</protocol>
vendor/glfw/deps/wayland/pointer-constraints-unstable-v1.xmladded
@@ -0,0 +1,339 @@
+1
<?xml version="1.0" encoding="UTF-8"?>
+2
<protocol name="pointer_constraints_unstable_v1">
+3
+4
<copyright>
+5
Copyright © 2014 Jonas Ådahl
+6
Copyright © 2015 Red Hat Inc.
+7
+8
Permission is hereby granted, free of charge, to any person obtaining a
+9
copy of this software and associated documentation files (the "Software"),
+10
to deal in the Software without restriction, including without limitation
+11
the rights to use, copy, modify, merge, publish, distribute, sublicense,
+12
and/or sell copies of the Software, and to permit persons to whom the
+13
Software is furnished to do so, subject to the following conditions:
+14
+15
The above copyright notice and this permission notice (including the next
+16
paragraph) shall be included in all copies or substantial portions of the
+17
Software.
+18
+19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+22
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+23
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+24
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+25
DEALINGS IN THE SOFTWARE.
+26
</copyright>
+27
+28
<description summary="protocol for constraining pointer motions">
+29
This protocol specifies a set of interfaces used for adding constraints to
+30
the motion of a pointer. Possible constraints include confining pointer
+31
motions to a given region, or locking it to its current position.
+32
+33
In order to constrain the pointer, a client must first bind the global
+34
interface "wp_pointer_constraints" which, if a compositor supports pointer
+35
constraints, is exposed by the registry. Using the bound global object, the
+36
client uses the request that corresponds to the type of constraint it wants
+37
to make. See wp_pointer_constraints for more details.
+38
+39
Warning! The protocol described in this file is experimental and backward
+40
incompatible changes may be made. Backward compatible changes may be added
+41
together with the corresponding interface version bump. Backward
+42
incompatible changes are done by bumping the version number in the protocol
+43
and interface names and resetting the interface version. Once the protocol
+44
is to be declared stable, the 'z' prefix and the version number in the
+45
protocol and interface names are removed and the interface version number is
+46
reset.
+47
</description>
+48
+49
<interface name="zwp_pointer_constraints_v1" version="1">
+50
<description summary="constrain the movement of a pointer">
+51
The global interface exposing pointer constraining functionality. It
+52
exposes two requests: lock_pointer for locking the pointer to its
+53
position, and confine_pointer for locking the pointer to a region.
+54
+55
The lock_pointer and confine_pointer requests create the objects
+56
wp_locked_pointer and wp_confined_pointer respectively, and the client can
+57
use these objects to interact with the lock.
+58
+59
For any surface, only one lock or confinement may be active across all
+60
wl_pointer objects of the same seat. If a lock or confinement is requested
+61
when another lock or confinement is active or requested on the same surface
+62
and with any of the wl_pointer objects of the same seat, an
+63
'already_constrained' error will be raised.
+64
</description>
+65
+66
<enum name="error">
+67
<description summary="wp_pointer_constraints error values">
+68
These errors can be emitted in response to wp_pointer_constraints
+69
requests.
+70
</description>
+71
<entry name="already_constrained" value="1"
+72
summary="pointer constraint already requested on that surface"/>
+73
</enum>
+74
+75
<enum name="lifetime">
+76
<description summary="constraint lifetime">
+77
These values represent different lifetime semantics. They are passed
+78
as arguments to the factory requests to specify how the constraint
+79
lifetimes should be managed.
+80
</description>
+81
<entry name="oneshot" value="1">
+82
<description summary="the pointer constraint is defunct once deactivated">
+83
A oneshot pointer constraint will never reactivate once it has been
+84
deactivated. See the corresponding deactivation event
+85
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
+86
details.
+87
</description>
+88
</entry>
+89
<entry name="persistent" value="2">
+90
<description summary="the pointer constraint may reactivate">
+91
A persistent pointer constraint may again reactivate once it has
+92
been deactivated. See the corresponding deactivation event
+93
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
+94
details.
+95
</description>
+96
</entry>
+97
</enum>
+98
+99
<request name="destroy" type="destructor">
+100
<description summary="destroy the pointer constraints manager object">
+101
Used by the client to notify the server that it will no longer use this
+102
pointer constraints object.
+103
</description>
+104
</request>
+105
+106
<request name="lock_pointer">
+107
<description summary="lock pointer to a position">
+108
The lock_pointer request lets the client request to disable movements of
+109
the virtual pointer (i.e. the cursor), effectively locking the pointer
+110
to a position. This request may not take effect immediately; in the
+111
future, when the compositor deems implementation-specific constraints
+112
are satisfied, the pointer lock will be activated and the compositor
+113
sends a locked event.
+114
+115
The protocol provides no guarantee that the constraints are ever
+116
satisfied, and does not require the compositor to send an error if the
+117
constraints cannot ever be satisfied. It is thus possible to request a
+118
lock that will never activate.
+119
+120
There may not be another pointer constraint of any kind requested or
+121
active on the surface for any of the wl_pointer objects of the seat of
+122
the passed pointer when requesting a lock. If there is, an error will be
+123
raised. See general pointer lock documentation for more details.
+124
+125
The intersection of the region passed with this request and the input
+126
region of the surface is used to determine where the pointer must be
+127
in order for the lock to activate. It is up to the compositor whether to
+128
warp the pointer or require some kind of user interaction for the lock
+129
to activate. If the region is null the surface input region is used.
+130
+131
A surface may receive pointer focus without the lock being activated.
+132
+133
The request creates a new object wp_locked_pointer which is used to
+134
interact with the lock as well as receive updates about its state. See
+135
the the description of wp_locked_pointer for further information.
+136
+137
Note that while a pointer is locked, the wl_pointer objects of the
+138
corresponding seat will not emit any wl_pointer.motion events, but
+139
relative motion events will still be emitted via wp_relative_pointer
+140
objects of the same seat. wl_pointer.axis and wl_pointer.button events
+141
are unaffected.
+142
</description>
+143
<arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/>
+144
<arg name="surface" type="object" interface="wl_surface"
+145
summary="surface to lock pointer to"/>
+146
<arg name="pointer" type="object" interface="wl_pointer"
+147
summary="the pointer that should be locked"/>
+148
<arg name="region" type="object" interface="wl_region" allow-null="true"
+149
summary="region of surface"/>
+150
<arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/>
+151
</request>
+152
+153
<request name="confine_pointer">
+154
<description summary="confine pointer to a region">
+155
The confine_pointer request lets the client request to confine the
+156
pointer cursor to a given region. This request may not take effect
+157
immediately; in the future, when the compositor deems implementation-
+158
specific constraints are satisfied, the pointer confinement will be
+159
activated and the compositor sends a confined event.
+160
+161
The intersection of the region passed with this request and the input
+162
region of the surface is used to determine where the pointer must be
+163
in order for the confinement to activate. It is up to the compositor
+164
whether to warp the pointer or require some kind of user interaction for
+165
the confinement to activate. If the region is null the surface input
+166
region is used.
+167
+168
The request will create a new object wp_confined_pointer which is used
+169
to interact with the confinement as well as receive updates about its
+170
state. See the the description of wp_confined_pointer for further
+171
information.
+172
</description>
+173
<arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/>
+174
<arg name="surface" type="object" interface="wl_surface"
+175
summary="surface to lock pointer to"/>
+176
<arg name="pointer" type="object" interface="wl_pointer"
+177
summary="the pointer that should be confined"/>
+178
<arg name="region" type="object" interface="wl_region" allow-null="true"
+179
summary="region of surface"/>
+180
<arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/>
+181
</request>
+182
</interface>
+183
+184
<interface name="zwp_locked_pointer_v1" version="1">
+185
<description summary="receive relative pointer motion events">
+186
The wp_locked_pointer interface represents a locked pointer state.
+187
+188
While the lock of this object is active, the wl_pointer objects of the
+189
associated seat will not emit any wl_pointer.motion events.
+190
+191
This object will send the event 'locked' when the lock is activated.
+192
Whenever the lock is activated, it is guaranteed that the locked surface
+193
will already have received pointer focus and that the pointer will be
+194
within the region passed to the request creating this object.
+195
+196
To unlock the pointer, send the destroy request. This will also destroy
+197
the wp_locked_pointer object.
+198
+199
If the compositor decides to unlock the pointer the unlocked event is
+200
sent. See wp_locked_pointer.unlock for details.
+201
+202
When unlocking, the compositor may warp the cursor position to the set
+203
cursor position hint. If it does, it will not result in any relative
+204
motion events emitted via wp_relative_pointer.
+205
+206
If the surface the lock was requested on is destroyed and the lock is not
+207
yet activated, the wp_locked_pointer object is now defunct and must be
+208
destroyed.
+209
</description>
+210
+211
<request name="destroy" type="destructor">
+212
<description summary="destroy the locked pointer object">
+213
Destroy the locked pointer object. If applicable, the compositor will
+214
unlock the pointer.
+215
</description>
+216
</request>
+217
+218
<request name="set_cursor_position_hint">
+219
<description summary="set the pointer cursor position hint">
+220
Set the cursor position hint relative to the top left corner of the
+221
surface.
+222
+223
If the client is drawing its own cursor, it should update the position
+224
hint to the position of its own cursor. A compositor may use this
+225
information to warp the pointer upon unlock in order to avoid pointer
+226
jumps.
+227
+228
The cursor position hint is double buffered. The new hint will only take
+229
effect when the associated surface gets it pending state applied. See
+230
wl_surface.commit for details.
+231
</description>
+232
<arg name="surface_x" type="fixed"
+233
summary="surface-local x coordinate"/>
+234
<arg name="surface_y" type="fixed"
+235
summary="surface-local y coordinate"/>
+236
</request>
+237
+238
<request name="set_region">
+239
<description summary="set a new lock region">
+240
Set a new region used to lock the pointer.
+241
+242
The new lock region is double-buffered. The new lock region will
+243
only take effect when the associated surface gets its pending state
+244
applied. See wl_surface.commit for details.
+245
+246
For details about the lock region, see wp_locked_pointer.
+247
</description>
+248
<arg name="region" type="object" interface="wl_region" allow-null="true"
+249
summary="region of surface"/>
+250
</request>
+251
+252
<event name="locked">
+253
<description summary="lock activation event">
+254
Notification that the pointer lock of the seat's pointer is activated.
+255
</description>
+256
</event>
+257
+258
<event name="unlocked">
+259
<description summary="lock deactivation event">
+260
Notification that the pointer lock of the seat's pointer is no longer
+261
active. If this is a oneshot pointer lock (see
+262
wp_pointer_constraints.lifetime) this object is now defunct and should
+263
be destroyed. If this is a persistent pointer lock (see
+264
wp_pointer_constraints.lifetime) this pointer lock may again
+265
reactivate in the future.
+266
</description>
+267
</event>
+268
</interface>
+269
+270
<interface name="zwp_confined_pointer_v1" version="1">
+271
<description summary="confined pointer object">
+272
The wp_confined_pointer interface represents a confined pointer state.
+273
+274
This object will send the event 'confined' when the confinement is
+275
activated. Whenever the confinement is activated, it is guaranteed that
+276
the surface the pointer is confined to will already have received pointer
+277
focus and that the pointer will be within the region passed to the request
+278
creating this object. It is up to the compositor to decide whether this
+279
requires some user interaction and if the pointer will warp to within the
+280
passed region if outside.
+281
+282
To unconfine the pointer, send the destroy request. This will also destroy
+283
the wp_confined_pointer object.
+284
+285
If the compositor decides to unconfine the pointer the unconfined event is
+286
sent. The wp_confined_pointer object is at this point defunct and should
+287
be destroyed.
+288
</description>
+289
+290
<request name="destroy" type="destructor">
+291
<description summary="destroy the confined pointer object">
+292
Destroy the confined pointer object. If applicable, the compositor will
+293
unconfine the pointer.
+294
</description>
+295
</request>
+296
+297
<request name="set_region">
+298
<description summary="set a new confine region">
+299
Set a new region used to confine the pointer.
+300
+301
The new confine region is double-buffered. The new confine region will
+302
only take effect when the associated surface gets its pending state
+303
applied. See wl_surface.commit for details.
+304
+305
If the confinement is active when the new confinement region is applied
+306
and the pointer ends up outside of newly applied region, the pointer may
+307
warped to a position within the new confinement region. If warped, a
+308
wl_pointer.motion event will be emitted, but no
+309
wp_relative_pointer.relative_motion event.
+310
+311
The compositor may also, instead of using the new region, unconfine the
+312
pointer.
+313
+314
For details about the confine region, see wp_confined_pointer.
+315
</description>
+316
<arg name="region" type="object" interface="wl_region" allow-null="true"
+317
summary="region of surface"/>
+318
</request>
+319
+320
<event name="confined">
+321
<description summary="pointer confined">
+322
Notification that the pointer confinement of the seat's pointer is
+323
activated.
+324
</description>
+325
</event>
+326
+327
<event name="unconfined">
+328
<description summary="pointer unconfined">
+329
Notification that the pointer confinement of the seat's pointer is no
+330
longer active. If this is a oneshot pointer confinement (see
+331
wp_pointer_constraints.lifetime) this object is now defunct and should
+332
be destroyed. If this is a persistent pointer confinement (see
+333
wp_pointer_constraints.lifetime) this pointer confinement may again
+334
reactivate in the future.
+335
</description>
+336
</event>
+337
</interface>
+338
+339
</protocol>
vendor/glfw/deps/wayland/relative-pointer-unstable-v1.xmladded
@@ -0,0 +1,136 @@
+1
<?xml version="1.0" encoding="UTF-8"?>
+2
<protocol name="relative_pointer_unstable_v1">
+3
+4
<copyright>
+5
Copyright © 2014 Jonas Ådahl
+6
Copyright © 2015 Red Hat Inc.
+7
+8
Permission is hereby granted, free of charge, to any person obtaining a
+9
copy of this software and associated documentation files (the "Software"),
+10
to deal in the Software without restriction, including without limitation
+11
the rights to use, copy, modify, merge, publish, distribute, sublicense,
+12
and/or sell copies of the Software, and to permit persons to whom the
+13
Software is furnished to do so, subject to the following conditions:
+14
+15
The above copyright notice and this permission notice (including the next
+16
paragraph) shall be included in all copies or substantial portions of the
+17
Software.
+18
+19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+22
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+23
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+24
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+25
DEALINGS IN THE SOFTWARE.
+26
</copyright>
+27
+28
<description summary="protocol for relative pointer motion events">
+29
This protocol specifies a set of interfaces used for making clients able to
+30
receive relative pointer events not obstructed by barriers (such as the
+31
monitor edge or other pointer barriers).
+32
+33
To start receiving relative pointer events, a client must first bind the
+34
global interface "wp_relative_pointer_manager" which, if a compositor
+35
supports relative pointer motion events, is exposed by the registry. After
+36
having created the relative pointer manager proxy object, the client uses
+37
it to create the actual relative pointer object using the
+38
"get_relative_pointer" request given a wl_pointer. The relative pointer
+39
motion events will then, when applicable, be transmitted via the proxy of
+40
the newly created relative pointer object. See the documentation of the
+41
relative pointer interface for more details.
+42
+43
Warning! The protocol described in this file is experimental and backward
+44
incompatible changes may be made. Backward compatible changes may be added
+45
together with the corresponding interface version bump. Backward
+46
incompatible changes are done by bumping the version number in the protocol
+47
and interface names and resetting the interface version. Once the protocol
+48
is to be declared stable, the 'z' prefix and the version number in the
+49
protocol and interface names are removed and the interface version number is
+50
reset.
+51
</description>
+52
+53
<interface name="zwp_relative_pointer_manager_v1" version="1">
+54
<description summary="get relative pointer objects">
+55
A global interface used for getting the relative pointer object for a
+56
given pointer.
+57
</description>
+58
+59
<request name="destroy" type="destructor">
+60
<description summary="destroy the relative pointer manager object">
+61
Used by the client to notify the server that it will no longer use this
+62
relative pointer manager object.
+63
</description>
+64
</request>
+65
+66
<request name="get_relative_pointer">
+67
<description summary="get a relative pointer object">
+68
Create a relative pointer interface given a wl_pointer object. See the
+69
wp_relative_pointer interface for more details.
+70
</description>
+71
<arg name="id" type="new_id" interface="zwp_relative_pointer_v1"/>
+72
<arg name="pointer" type="object" interface="wl_pointer"/>
+73
</request>
+74
</interface>
+75
+76
<interface name="zwp_relative_pointer_v1" version="1">
+77
<description summary="relative pointer object">
+78
A wp_relative_pointer object is an extension to the wl_pointer interface
+79
used for emitting relative pointer events. It shares the same focus as
+80
wl_pointer objects of the same seat and will only emit events when it has
+81
focus.
+82
</description>
+83
+84
<request name="destroy" type="destructor">
+85
<description summary="release the relative pointer object"/>
+86
</request>
+87
+88
<event name="relative_motion">
+89
<description summary="relative pointer motion">
+90
Relative x/y pointer motion from the pointer of the seat associated with
+91
this object.
+92
+93
A relative motion is in the same dimension as regular wl_pointer motion
+94
events, except they do not represent an absolute position. For example,
+95
moving a pointer from (x, y) to (x', y') would have the equivalent
+96
relative motion (x' - x, y' - y). If a pointer motion caused the
+97
absolute pointer position to be clipped by for example the edge of the
+98
monitor, the relative motion is unaffected by the clipping and will
+99
represent the unclipped motion.
+100
+101
This event also contains non-accelerated motion deltas. The
+102
non-accelerated delta is, when applicable, the regular pointer motion
+103
delta as it was before having applied motion acceleration and other
+104
transformations such as normalization.
+105
+106
Note that the non-accelerated delta does not represent 'raw' events as
+107
they were read from some device. Pointer motion acceleration is device-
+108
and configuration-specific and non-accelerated deltas and accelerated
+109
deltas may have the same value on some devices.
+110
+111
Relative motions are not coupled to wl_pointer.motion events, and can be
+112
sent in combination with such events, but also independently. There may
+113
also be scenarios where wl_pointer.motion is sent, but there is no
+114
relative motion. The order of an absolute and relative motion event
+115
originating from the same physical motion is not guaranteed.
+116
+117
If the client needs button events or focus state, it can receive them
+118
from a wl_pointer object of the same seat that the wp_relative_pointer
+119
object is associated with.
+120
</description>
+121
<arg name="utime_hi" type="uint"
+122
summary="high 32 bits of a 64 bit timestamp with microsecond granularity"/>
+123
<arg name="utime_lo" type="uint"
+124
summary="low 32 bits of a 64 bit timestamp with microsecond granularity"/>
+125
<arg name="dx" type="fixed"
+126
summary="the x component of the motion vector"/>
+127
<arg name="dy" type="fixed"
+128
summary="the y component of the motion vector"/>
+129
<arg name="dx_unaccel" type="fixed"
+130
summary="the x component of the unaccelerated motion vector"/>
+131
<arg name="dy_unaccel" type="fixed"
+132
summary="the y component of the unaccelerated motion vector"/>
+133
</event>
+134
</interface>
+135
+136
</protocol>
vendor/glfw/deps/wayland/viewporter.xmladded
@@ -0,0 +1,180 @@
+1
<?xml version="1.0" encoding="UTF-8"?>
+2
<protocol name="viewporter">
+3
+4
<copyright>
+5
Copyright © 2013-2016 Collabora, Ltd.
+6
+7
Permission is hereby granted, free of charge, to any person obtaining a
+8
copy of this software and associated documentation files (the "Software"),
+9
to deal in the Software without restriction, including without limitation
+10
the rights to use, copy, modify, merge, publish, distribute, sublicense,
+11
and/or sell copies of the Software, and to permit persons to whom the
+12
Software is furnished to do so, subject to the following conditions:
+13
+14
The above copyright notice and this permission notice (including the next
+15
paragraph) shall be included in all copies or substantial portions of the
+16
Software.
+17
+18
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+19
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+20
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+21
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+22
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+23
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+24
DEALINGS IN THE SOFTWARE.
+25
</copyright>
+26
+27
<interface name="wp_viewporter" version="1">
+28
<description summary="surface cropping and scaling">
+29
The global interface exposing surface cropping and scaling
+30
capabilities is used to instantiate an interface extension for a
+31
wl_surface object. This extended interface will then allow
+32
cropping and scaling the surface contents, effectively
+33
disconnecting the direct relationship between the buffer and the
+34
surface size.
+35
</description>
+36
+37
<request name="destroy" type="destructor">
+38
<description summary="unbind from the cropping and scaling interface">
+39
Informs the server that the client will not be using this
+40
protocol object anymore. This does not affect any other objects,
+41
wp_viewport objects included.
+42
</description>
+43
</request>
+44
+45
<enum name="error">
+46
<entry name="viewport_exists" value="0"
+47
summary="the surface already has a viewport object associated"/>
+48
</enum>
+49
+50
<request name="get_viewport">
+51
<description summary="extend surface interface for crop and scale">
+52
Instantiate an interface extension for the given wl_surface to
+53
crop and scale its content. If the given wl_surface already has
+54
a wp_viewport object associated, the viewport_exists
+55
protocol error is raised.
+56
</description>
+57
<arg name="id" type="new_id" interface="wp_viewport"
+58
summary="the new viewport interface id"/>
+59
<arg name="surface" type="object" interface="wl_surface"
+60
summary="the surface"/>
+61
</request>
+62
</interface>
+63
+64
<interface name="wp_viewport" version="1">
+65
<description summary="crop and scale interface to a wl_surface">
+66
An additional interface to a wl_surface object, which allows the
+67
client to specify the cropping and scaling of the surface
+68
contents.
+69
+70
This interface works with two concepts: the source rectangle (src_x,
+71
src_y, src_width, src_height), and the destination size (dst_width,
+72
dst_height). The contents of the source rectangle are scaled to the
+73
destination size, and content outside the source rectangle is ignored.
+74
This state is double-buffered, and is applied on the next
+75
wl_surface.commit.
+76
+77
The two parts of crop and scale state are independent: the source
+78
rectangle, and the destination size. Initially both are unset, that
+79
is, no scaling is applied. The whole of the current wl_buffer is
+80
used as the source, and the surface size is as defined in
+81
wl_surface.attach.
+82
+83
If the destination size is set, it causes the surface size to become
+84
dst_width, dst_height. The source (rectangle) is scaled to exactly
+85
this size. This overrides whatever the attached wl_buffer size is,
+86
unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
+87
has no content and therefore no size. Otherwise, the size is always
+88
at least 1x1 in surface local coordinates.
+89
+90
If the source rectangle is set, it defines what area of the wl_buffer is
+91
taken as the source. If the source rectangle is set and the destination
+92
size is not set, then src_width and src_height must be integers, and the
+93
surface size becomes the source rectangle size. This results in cropping
+94
without scaling. If src_width or src_height are not integers and
+95
destination size is not set, the bad_size protocol error is raised when
+96
the surface state is applied.
+97
+98
The coordinate transformations from buffer pixel coordinates up to
+99
the surface-local coordinates happen in the following order:
+100
1. buffer_transform (wl_surface.set_buffer_transform)
+101
2. buffer_scale (wl_surface.set_buffer_scale)
+102
3. crop and scale (wp_viewport.set*)
+103
This means, that the source rectangle coordinates of crop and scale
+104
are given in the coordinates after the buffer transform and scale,
+105
i.e. in the coordinates that would be the surface-local coordinates
+106
if the crop and scale was not applied.
+107
+108
If src_x or src_y are negative, the bad_value protocol error is raised.
+109
Otherwise, if the source rectangle is partially or completely outside of
+110
the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
+111
when the surface state is applied. A NULL wl_buffer does not raise the
+112
out_of_buffer error.
+113
+114
If the wl_surface associated with the wp_viewport is destroyed,
+115
all wp_viewport requests except 'destroy' raise the protocol error
+116
no_surface.
+117
+118
If the wp_viewport object is destroyed, the crop and scale
+119
state is removed from the wl_surface. The change will be applied
+120
on the next wl_surface.commit.
+121
</description>
+122
+123
<request name="destroy" type="destructor">
+124
<description summary="remove scaling and cropping from the surface">
+125
The associated wl_surface's crop and scale state is removed.
+126
The change is applied on the next wl_surface.commit.
+127
</description>
+128
</request>
+129
+130
<enum name="error">
+131
<entry name="bad_value" value="0"
+132
summary="negative or zero values in width or height"/>
+133
<entry name="bad_size" value="1"
+134
summary="destination size is not integer"/>
+135
<entry name="out_of_buffer" value="2"
+136
summary="source rectangle extends outside of the content area"/>
+137
<entry name="no_surface" value="3"
+138
summary="the wl_surface was destroyed"/>
+139
</enum>
+140
+141
<request name="set_source">
+142
<description summary="set the source rectangle for cropping">
+143
Set the source rectangle of the associated wl_surface. See
+144
wp_viewport for the description, and relation to the wl_buffer
+145
size.
+146
+147
If all of x, y, width and height are -1.0, the source rectangle is
+148
unset instead. Any other set of values where width or height are zero
+149
or negative, or x or y are negative, raise the bad_value protocol
+150
error.
+151
+152
The crop and scale state is double-buffered state, and will be
+153
applied on the next wl_surface.commit.
+154
</description>
+155
<arg name="x" type="fixed" summary="source rectangle x"/>
+156
<arg name="y" type="fixed" summary="source rectangle y"/>
+157
<arg name="width" type="fixed" summary="source rectangle width"/>
+158
<arg name="height" type="fixed" summary="source rectangle height"/>
+159
</request>
+160
+161
<request name="set_destination">
+162
<description summary="set the surface size for scaling">
+163
Set the destination size of the associated wl_surface. See
+164
wp_viewport for the description, and relation to the wl_buffer
+165
size.
+166
+167
If width is -1 and height is -1, the destination size is unset
+168
instead. Any other pair of values for width and height that
+169
contains zero or negative values raises the bad_value protocol
+170
error.
+171
+172
The crop and scale state is double-buffered state, and will be
+173
applied on the next wl_surface.commit.
+174
</description>
+175
<arg name="width" type="int" summary="surface width"/>
+176
<arg name="height" type="int" summary="surface height"/>
+177
</request>
+178
</interface>
+179
+180
</protocol>
vendor/glfw/deps/wayland/wayland.xmladded
@@ -0,0 +1,3151 @@
+1
<?xml version="1.0" encoding="UTF-8"?>
+2
<protocol name="wayland">
+3
+4
<copyright>
+5
Copyright © 2008-2011 Kristian Høgsberg
+6
Copyright © 2010-2011 Intel Corporation
+7
Copyright © 2012-2013 Collabora, Ltd.
+8
+9
Permission is hereby granted, free of charge, to any person
+10
obtaining a copy of this software and associated documentation files
+11
(the "Software"), to deal in the Software without restriction,
+12
including without limitation the rights to use, copy, modify, merge,
+13
publish, distribute, sublicense, and/or sell copies of the Software,
+14
and to permit persons to whom the Software is furnished to do so,
+15
subject to the following conditions:
+16
+17
The above copyright notice and this permission notice (including the
+18
next paragraph) shall be included in all copies or substantial
+19
portions of the Software.
+20
+21
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+22
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+23
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+24
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+25
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+26
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+27
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+28
SOFTWARE.
+29
</copyright>
+30
+31
<interface name="wl_display" version="1">
+32
<description summary="core global object">
+33
The core global object. This is a special singleton object. It
+34
is used for internal Wayland protocol features.
+35
</description>
+36
+37
<request name="sync">
+38
<description summary="asynchronous roundtrip">
+39
The sync request asks the server to emit the 'done' event
+40
on the returned wl_callback object. Since requests are
+41
handled in-order and events are delivered in-order, this can
+42
be used as a barrier to ensure all previous requests and the
+43
resulting events have been handled.
+44
+45
The object returned by this request will be destroyed by the
+46
compositor after the callback is fired and as such the client must not
+47
attempt to use it after that point.
+48
+49
The callback_data passed in the callback is the event serial.
+50
</description>
+51
<arg name="callback" type="new_id" interface="wl_callback"
+52
summary="callback object for the sync request"/>
+53
</request>
+54
+55
<request name="get_registry">
+56
<description summary="get global registry object">
+57
This request creates a registry object that allows the client
+58
to list and bind the global objects available from the
+59
compositor.
+60
+61
It should be noted that the server side resources consumed in
+62
response to a get_registry request can only be released when the
+63
client disconnects, not when the client side proxy is destroyed.
+64
Therefore, clients should invoke get_registry as infrequently as
+65
possible to avoid wasting memory.
+66
</description>
+67
<arg name="registry" type="new_id" interface="wl_registry"
+68
summary="global registry object"/>
+69
</request>
+70
+71
<event name="error">
+72
<description summary="fatal error event">
+73
The error event is sent out when a fatal (non-recoverable)
+74
error has occurred. The object_id argument is the object
+75
where the error occurred, most often in response to a request
+76
to that object. The code identifies the error and is defined
+77
by the object interface. As such, each interface defines its
+78
own set of error codes. The message is a brief description
+79
of the error, for (debugging) convenience.
+80
</description>
+81
<arg name="object_id" type="object" summary="object where the error occurred"/>
+82
<arg name="code" type="uint" summary="error code"/>
+83
<arg name="message" type="string" summary="error description"/>
+84
</event>
+85
+86
<enum name="error">
+87
<description summary="global error values">
+88
These errors are global and can be emitted in response to any
+89
server request.
+90
</description>
+91
<entry name="invalid_object" value="0"
+92
summary="server couldn't find object"/>
+93
<entry name="invalid_method" value="1"
+94
summary="method doesn't exist on the specified interface or malformed request"/>
+95
<entry name="no_memory" value="2"
+96
summary="server is out of memory"/>
+97
<entry name="implementation" value="3"
+98
summary="implementation error in compositor"/>
+99
</enum>
+100
+101
<event name="delete_id">
+102
<description summary="acknowledge object ID deletion">
+103
This event is used internally by the object ID management
+104
logic. When a client deletes an object that it had created,
+105
the server will send this event to acknowledge that it has
+106
seen the delete request. When the client receives this event,
+107
it will know that it can safely reuse the object ID.
+108
</description>
+109
<arg name="id" type="uint" summary="deleted object ID"/>
+110
</event>
+111
</interface>
+112
+113
<interface name="wl_registry" version="1">
+114
<description summary="global registry object">
+115
The singleton global registry object. The server has a number of
+116
global objects that are available to all clients. These objects
+117
typically represent an actual object in the server (for example,
+118
an input device) or they are singleton objects that provide
+119
extension functionality.
+120
+121
When a client creates a registry object, the registry object
+122
will emit a global event for each global currently in the
+123
registry. Globals come and go as a result of device or
+124
monitor hotplugs, reconfiguration or other events, and the
+125
registry will send out global and global_remove events to
+126
keep the client up to date with the changes. To mark the end
+127
of the initial burst of events, the client can use the
+128
wl_display.sync request immediately after calling
+129
wl_display.get_registry.
+130
+131
A client can bind to a global object by using the bind
+132
request. This creates a client-side handle that lets the object
+133
emit events to the client and lets the client invoke requests on
+134
the object.
+135
</description>
+136
+137
<request name="bind">
+138
<description summary="bind an object to the display">
+139
Binds a new, client-created object to the server using the
+140
specified name as the identifier.
+141
</description>
+142
<arg name="name" type="uint" summary="unique numeric name of the object"/>
+143
<arg name="id" type="new_id" summary="bounded object"/>
+144
</request>
+145
+146
<event name="global">
+147
<description summary="announce global object">
+148
Notify the client of global objects.
+149
+150
The event notifies the client that a global object with
+151
the given name is now available, and it implements the
+152
given version of the given interface.
+153
</description>
+154
<arg name="name" type="uint" summary="numeric name of the global object"/>
+155
<arg name="interface" type="string" summary="interface implemented by the object"/>
+156
<arg name="version" type="uint" summary="interface version"/>
+157
</event>
+158
+159
<event name="global_remove">
+160
<description summary="announce removal of global object">
+161
Notify the client of removed global objects.
+162
+163
This event notifies the client that the global identified
+164
by name is no longer available. If the client bound to
+165
the global using the bind request, the client should now
+166
destroy that object.
+167
+168
The object remains valid and requests to the object will be
+169
ignored until the client destroys it, to avoid races between
+170
the global going away and a client sending a request to it.
+171
</description>
+172
<arg name="name" type="uint" summary="numeric name of the global object"/>
+173
</event>
+174
</interface>
+175
+176
<interface name="wl_callback" version="1">
+177
<description summary="callback object">
+178
Clients can handle the 'done' event to get notified when
+179
the related request is done.
+180
+181
Note, because wl_callback objects are created from multiple independent
+182
factory interfaces, the wl_callback interface is frozen at version 1.
+183
</description>
+184
+185
<event name="done" type="destructor">
+186
<description summary="done event">
+187
Notify the client when the related request is done.
+188
</description>
+189
<arg name="callback_data" type="uint" summary="request-specific data for the callback"/>
+190
</event>
+191
</interface>
+192
+193
<interface name="wl_compositor" version="6">
+194
<description summary="the compositor singleton">
+195
A compositor. This object is a singleton global. The
+196
compositor is in charge of combining the contents of multiple
+197
surfaces into one displayable output.
+198
</description>
+199
+200
<request name="create_surface">
+201
<description summary="create new surface">
+202
Ask the compositor to create a new surface.
+203
</description>
+204
<arg name="id" type="new_id" interface="wl_surface" summary="the new surface"/>
+205
</request>
+206
+207
<request name="create_region">
+208
<description summary="create new region">
+209
Ask the compositor to create a new region.
+210
</description>
+211
<arg name="id" type="new_id" interface="wl_region" summary="the new region"/>
+212
</request>
+213
</interface>
+214
+215
<interface name="wl_shm_pool" version="1">
+216
<description summary="a shared memory pool">
+217
The wl_shm_pool object encapsulates a piece of memory shared
+218
between the compositor and client. Through the wl_shm_pool
+219
object, the client can allocate shared memory wl_buffer objects.
+220
All objects created through the same pool share the same
+221
underlying mapped memory. Reusing the mapped memory avoids the
+222
setup/teardown overhead and is useful when interactively resizing
+223
a surface or for many small buffers.
+224
</description>
+225
+226
<request name="create_buffer">
+227
<description summary="create a buffer from the pool">
+228
Create a wl_buffer object from the pool.
+229
+230
The buffer is created offset bytes into the pool and has
+231
width and height as specified. The stride argument specifies
+232
the number of bytes from the beginning of one row to the beginning
+233
of the next. The format is the pixel format of the buffer and
+234
must be one of those advertised through the wl_shm.format event.
+235
+236
A buffer will keep a reference to the pool it was created from
+237
so it is valid to destroy the pool immediately after creating
+238
a buffer from it.
+239
</description>
+240
<arg name="id" type="new_id" interface="wl_buffer" summary="buffer to create"/>
+241
<arg name="offset" type="int" summary="buffer byte offset within the pool"/>
+242
<arg name="width" type="int" summary="buffer width, in pixels"/>
+243
<arg name="height" type="int" summary="buffer height, in pixels"/>
+244
<arg name="stride" type="int" summary="number of bytes from the beginning of one row to the beginning of the next row"/>
+245
<arg name="format" type="uint" enum="wl_shm.format" summary="buffer pixel format"/>
+246
</request>
+247
+248
<request name="destroy" type="destructor">
+249
<description summary="destroy the pool">
+250
Destroy the shared memory pool.
+251
+252
The mmapped memory will be released when all
+253
buffers that have been created from this pool
+254
are gone.
+255
</description>
+256
</request>
+257
+258
<request name="resize">
+259
<description summary="change the size of the pool mapping">
+260
This request will cause the server to remap the backing memory
+261
for the pool from the file descriptor passed when the pool was
+262
created, but using the new size. This request can only be
+263
used to make the pool bigger.
+264
+265
This request only changes the amount of bytes that are mmapped
+266
by the server and does not touch the file corresponding to the
+267
file descriptor passed at creation time. It is the client's
+268
responsibility to ensure that the file is at least as big as
+269
the new pool size.
+270
</description>
+271
<arg name="size" type="int" summary="new size of the pool, in bytes"/>
+272
</request>
+273
</interface>
+274
+275
<interface name="wl_shm" version="1">
+276
<description summary="shared memory support">
+277
A singleton global object that provides support for shared
+278
memory.
+279
+280
Clients can create wl_shm_pool objects using the create_pool
+281
request.
+282
+283
On binding the wl_shm object one or more format events
+284
are emitted to inform clients about the valid pixel formats
+285
that can be used for buffers.
+286
</description>
+287
+288
<enum name="error">
+289
<description summary="wl_shm error values">
+290
These errors can be emitted in response to wl_shm requests.
+291
</description>
+292
<entry name="invalid_format" value="0" summary="buffer format is not known"/>
+293
<entry name="invalid_stride" value="1" summary="invalid size or stride during pool or buffer creation"/>
+294
<entry name="invalid_fd" value="2" summary="mmapping the file descriptor failed"/>
+295
</enum>
+296
+297
<enum name="format">
+298
<description summary="pixel formats">
+299
This describes the memory layout of an individual pixel.
+300
+301
All renderers should support argb8888 and xrgb8888 but any other
+302
formats are optional and may not be supported by the particular
+303
renderer in use.
+304
+305
The drm format codes match the macros defined in drm_fourcc.h, except
+306
argb8888 and xrgb8888. The formats actually supported by the compositor
+307
will be reported by the format event.
+308
+309
For all wl_shm formats and unless specified in another protocol
+310
extension, pre-multiplied alpha is used for pixel values.
+311
</description>
+312
<!-- Note to protocol writers: don't update this list manually, instead
+313
run the automated script that keeps it in sync with drm_fourcc.h. -->
+314
<entry name="argb8888" value="0" summary="32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian"/>
+315
<entry name="xrgb8888" value="1" summary="32-bit RGB format, [31:0] x:R:G:B 8:8:8:8 little endian"/>
+316
<entry name="c8" value="0x20203843" summary="8-bit color index format, [7:0] C"/>
+317
<entry name="rgb332" value="0x38424752" summary="8-bit RGB format, [7:0] R:G:B 3:3:2"/>
+318
<entry name="bgr233" value="0x38524742" summary="8-bit BGR format, [7:0] B:G:R 2:3:3"/>
+319
<entry name="xrgb4444" value="0x32315258" summary="16-bit xRGB format, [15:0] x:R:G:B 4:4:4:4 little endian"/>
+320
<entry name="xbgr4444" value="0x32314258" summary="16-bit xBGR format, [15:0] x:B:G:R 4:4:4:4 little endian"/>
+321
<entry name="rgbx4444" value="0x32315852" summary="16-bit RGBx format, [15:0] R:G:B:x 4:4:4:4 little endian"/>
+322
<entry name="bgrx4444" value="0x32315842" summary="16-bit BGRx format, [15:0] B:G:R:x 4:4:4:4 little endian"/>
+323
<entry name="argb4444" value="0x32315241" summary="16-bit ARGB format, [15:0] A:R:G:B 4:4:4:4 little endian"/>
+324
<entry name="abgr4444" value="0x32314241" summary="16-bit ABGR format, [15:0] A:B:G:R 4:4:4:4 little endian"/>
+325
<entry name="rgba4444" value="0x32314152" summary="16-bit RBGA format, [15:0] R:G:B:A 4:4:4:4 little endian"/>
+326
<entry name="bgra4444" value="0x32314142" summary="16-bit BGRA format, [15:0] B:G:R:A 4:4:4:4 little endian"/>
+327
<entry name="xrgb1555" value="0x35315258" summary="16-bit xRGB format, [15:0] x:R:G:B 1:5:5:5 little endian"/>
+328
<entry name="xbgr1555" value="0x35314258" summary="16-bit xBGR 1555 format, [15:0] x:B:G:R 1:5:5:5 little endian"/>
+329
<entry name="rgbx5551" value="0x35315852" summary="16-bit RGBx 5551 format, [15:0] R:G:B:x 5:5:5:1 little endian"/>
+330
<entry name="bgrx5551" value="0x35315842" summary="16-bit BGRx 5551 format, [15:0] B:G:R:x 5:5:5:1 little endian"/>
+331
<entry name="argb1555" value="0x35315241" summary="16-bit ARGB 1555 format, [15:0] A:R:G:B 1:5:5:5 little endian"/>
+332
<entry name="abgr1555" value="0x35314241" summary="16-bit ABGR 1555 format, [15:0] A:B:G:R 1:5:5:5 little endian"/>
+333
<entry name="rgba5551" value="0x35314152" summary="16-bit RGBA 5551 format, [15:0] R:G:B:A 5:5:5:1 little endian"/>
+334
<entry name="bgra5551" value="0x35314142" summary="16-bit BGRA 5551 format, [15:0] B:G:R:A 5:5:5:1 little endian"/>
+335
<entry name="rgb565" value="0x36314752" summary="16-bit RGB 565 format, [15:0] R:G:B 5:6:5 little endian"/>
+336
<entry name="bgr565" value="0x36314742" summary="16-bit BGR 565 format, [15:0] B:G:R 5:6:5 little endian"/>
+337
<entry name="rgb888" value="0x34324752" summary="24-bit RGB format, [23:0] R:G:B little endian"/>
+338
<entry name="bgr888" value="0x34324742" summary="24-bit BGR format, [23:0] B:G:R little endian"/>
+339
<entry name="xbgr8888" value="0x34324258" summary="32-bit xBGR format, [31:0] x:B:G:R 8:8:8:8 little endian"/>
+340
<entry name="rgbx8888" value="0x34325852" summary="32-bit RGBx format, [31:0] R:G:B:x 8:8:8:8 little endian"/>
+341
<entry name="bgrx8888" value="0x34325842" summary="32-bit BGRx format, [31:0] B:G:R:x 8:8:8:8 little endian"/>
+342
<entry name="abgr8888" value="0x34324241" summary="32-bit ABGR format, [31:0] A:B:G:R 8:8:8:8 little endian"/>
+343
<entry name="rgba8888" value="0x34324152" summary="32-bit RGBA format, [31:0] R:G:B:A 8:8:8:8 little endian"/>
+344
<entry name="bgra8888" value="0x34324142" summary="32-bit BGRA format, [31:0] B:G:R:A 8:8:8:8 little endian"/>
+345
<entry name="xrgb2101010" value="0x30335258" summary="32-bit xRGB format, [31:0] x:R:G:B 2:10:10:10 little endian"/>
+346
<entry name="xbgr2101010" value="0x30334258" summary="32-bit xBGR format, [31:0] x:B:G:R 2:10:10:10 little endian"/>
+347
<entry name="rgbx1010102" value="0x30335852" summary="32-bit RGBx format, [31:0] R:G:B:x 10:10:10:2 little endian"/>
+348
<entry name="bgrx1010102" value="0x30335842" summary="32-bit BGRx format, [31:0] B:G:R:x 10:10:10:2 little endian"/>
+349
<entry name="argb2101010" value="0x30335241" summary="32-bit ARGB format, [31:0] A:R:G:B 2:10:10:10 little endian"/>
+350
<entry name="abgr2101010" value="0x30334241" summary="32-bit ABGR format, [31:0] A:B:G:R 2:10:10:10 little endian"/>
+351
<entry name="rgba1010102" value="0x30334152" summary="32-bit RGBA format, [31:0] R:G:B:A 10:10:10:2 little endian"/>
+352
<entry name="bgra1010102" value="0x30334142" summary="32-bit BGRA format, [31:0] B:G:R:A 10:10:10:2 little endian"/>
+353
<entry name="yuyv" value="0x56595559" summary="packed YCbCr format, [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian"/>
+354
<entry name="yvyu" value="0x55595659" summary="packed YCbCr format, [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian"/>
+355
<entry name="uyvy" value="0x59565955" summary="packed YCbCr format, [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian"/>
+356
<entry name="vyuy" value="0x59555956" summary="packed YCbCr format, [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian"/>
+357
<entry name="ayuv" value="0x56555941" summary="packed AYCbCr format, [31:0] A:Y:Cb:Cr 8:8:8:8 little endian"/>
+358
<entry name="nv12" value="0x3231564e" summary="2 plane YCbCr Cr:Cb format, 2x2 subsampled Cr:Cb plane"/>
+359
<entry name="nv21" value="0x3132564e" summary="2 plane YCbCr Cb:Cr format, 2x2 subsampled Cb:Cr plane"/>
+360
<entry name="nv16" value="0x3631564e" summary="2 plane YCbCr Cr:Cb format, 2x1 subsampled Cr:Cb plane"/>
+361
<entry name="nv61" value="0x3136564e" summary="2 plane YCbCr Cb:Cr format, 2x1 subsampled Cb:Cr plane"/>
+362
<entry name="yuv410" value="0x39565559" summary="3 plane YCbCr format, 4x4 subsampled Cb (1) and Cr (2) planes"/>
+363
<entry name="yvu410" value="0x39555659" summary="3 plane YCbCr format, 4x4 subsampled Cr (1) and Cb (2) planes"/>
+364
<entry name="yuv411" value="0x31315559" summary="3 plane YCbCr format, 4x1 subsampled Cb (1) and Cr (2) planes"/>
+365
<entry name="yvu411" value="0x31315659" summary="3 plane YCbCr format, 4x1 subsampled Cr (1) and Cb (2) planes"/>
+366
<entry name="yuv420" value="0x32315559" summary="3 plane YCbCr format, 2x2 subsampled Cb (1) and Cr (2) planes"/>
+367
<entry name="yvu420" value="0x32315659" summary="3 plane YCbCr format, 2x2 subsampled Cr (1) and Cb (2) planes"/>
+368
<entry name="yuv422" value="0x36315559" summary="3 plane YCbCr format, 2x1 subsampled Cb (1) and Cr (2) planes"/>
+369
<entry name="yvu422" value="0x36315659" summary="3 plane YCbCr format, 2x1 subsampled Cr (1) and Cb (2) planes"/>
+370
<entry name="yuv444" value="0x34325559" summary="3 plane YCbCr format, non-subsampled Cb (1) and Cr (2) planes"/>
+371
<entry name="yvu444" value="0x34325659" summary="3 plane YCbCr format, non-subsampled Cr (1) and Cb (2) planes"/>
+372
<entry name="r8" value="0x20203852" summary="[7:0] R"/>
+373
<entry name="r16" value="0x20363152" summary="[15:0] R little endian"/>
+374
<entry name="rg88" value="0x38384752" summary="[15:0] R:G 8:8 little endian"/>
+375
<entry name="gr88" value="0x38385247" summary="[15:0] G:R 8:8 little endian"/>
+376
<entry name="rg1616" value="0x32334752" summary="[31:0] R:G 16:16 little endian"/>
+377
<entry name="gr1616" value="0x32335247" summary="[31:0] G:R 16:16 little endian"/>
+378
<entry name="xrgb16161616f" value="0x48345258" summary="[63:0] x:R:G:B 16:16:16:16 little endian"/>
+379
<entry name="xbgr16161616f" value="0x48344258" summary="[63:0] x:B:G:R 16:16:16:16 little endian"/>
+380
<entry name="argb16161616f" value="0x48345241" summary="[63:0] A:R:G:B 16:16:16:16 little endian"/>
+381
<entry name="abgr16161616f" value="0x48344241" summary="[63:0] A:B:G:R 16:16:16:16 little endian"/>
+382
<entry name="xyuv8888" value="0x56555958" summary="[31:0] X:Y:Cb:Cr 8:8:8:8 little endian"/>
+383
<entry name="vuy888" value="0x34325556" summary="[23:0] Cr:Cb:Y 8:8:8 little endian"/>
+384
<entry name="vuy101010" value="0x30335556" summary="Y followed by U then V, 10:10:10. Non-linear modifier only"/>
+385
<entry name="y210" value="0x30313259" summary="[63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels"/>
+386
<entry name="y212" value="0x32313259" summary="[63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels"/>
+387
<entry name="y216" value="0x36313259" summary="[63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels"/>
+388
<entry name="y410" value="0x30313459" summary="[31:0] A:Cr:Y:Cb 2:10:10:10 little endian"/>
+389
<entry name="y412" value="0x32313459" summary="[63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian"/>
+390
<entry name="y416" value="0x36313459" summary="[63:0] A:Cr:Y:Cb 16:16:16:16 little endian"/>
+391
<entry name="xvyu2101010" value="0x30335658" summary="[31:0] X:Cr:Y:Cb 2:10:10:10 little endian"/>
+392
<entry name="xvyu12_16161616" value="0x36335658" summary="[63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian"/>
+393
<entry name="xvyu16161616" value="0x38345658" summary="[63:0] X:Cr:Y:Cb 16:16:16:16 little endian"/>
+394
<entry name="y0l0" value="0x304c3059" summary="[63:0] A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian"/>
+395
<entry name="x0l0" value="0x304c3058" summary="[63:0] X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian"/>
+396
<entry name="y0l2" value="0x324c3059" summary="[63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian"/>
+397
<entry name="x0l2" value="0x324c3058" summary="[63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian"/>
+398
<entry name="yuv420_8bit" value="0x38305559"/>
+399
<entry name="yuv420_10bit" value="0x30315559"/>
+400
<entry name="xrgb8888_a8" value="0x38415258"/>
+401
<entry name="xbgr8888_a8" value="0x38414258"/>
+402
<entry name="rgbx8888_a8" value="0x38415852"/>
+403
<entry name="bgrx8888_a8" value="0x38415842"/>
+404
<entry name="rgb888_a8" value="0x38413852"/>
+405
<entry name="bgr888_a8" value="0x38413842"/>
+406
<entry name="rgb565_a8" value="0x38413552"/>
+407
<entry name="bgr565_a8" value="0x38413542"/>
+408
<entry name="nv24" value="0x3432564e" summary="non-subsampled Cr:Cb plane"/>
+409
<entry name="nv42" value="0x3234564e" summary="non-subsampled Cb:Cr plane"/>
+410
<entry name="p210" value="0x30313250" summary="2x1 subsampled Cr:Cb plane, 10 bit per channel"/>
+411
<entry name="p010" value="0x30313050" summary="2x2 subsampled Cr:Cb plane 10 bits per channel"/>
+412
<entry name="p012" value="0x32313050" summary="2x2 subsampled Cr:Cb plane 12 bits per channel"/>
+413
<entry name="p016" value="0x36313050" summary="2x2 subsampled Cr:Cb plane 16 bits per channel"/>
+414
<entry name="axbxgxrx106106106106" value="0x30314241" summary="[63:0] A:x:B:x:G:x:R:x 10:6:10:6:10:6:10:6 little endian"/>
+415
<entry name="nv15" value="0x3531564e" summary="2x2 subsampled Cr:Cb plane"/>
+416
<entry name="q410" value="0x30313451"/>
+417
<entry name="q401" value="0x31303451"/>
+418
<entry name="xrgb16161616" value="0x38345258" summary="[63:0] x:R:G:B 16:16:16:16 little endian"/>
+419
<entry name="xbgr16161616" value="0x38344258" summary="[63:0] x:B:G:R 16:16:16:16 little endian"/>
+420
<entry name="argb16161616" value="0x38345241" summary="[63:0] A:R:G:B 16:16:16:16 little endian"/>
+421
<entry name="abgr16161616" value="0x38344241" summary="[63:0] A:B:G:R 16:16:16:16 little endian"/>
+422
</enum>
+423
+424
<request name="create_pool">
+425
<description summary="create a shm pool">
+426
Create a new wl_shm_pool object.
+427
+428
The pool can be used to create shared memory based buffer
+429
objects. The server will mmap size bytes of the passed file
+430
descriptor, to use as backing memory for the pool.
+431
</description>
+432
<arg name="id" type="new_id" interface="wl_shm_pool" summary="pool to create"/>
+433
<arg name="fd" type="fd" summary="file descriptor for the pool"/>
+434
<arg name="size" type="int" summary="pool size, in bytes"/>
+435
</request>
+436
+437
<event name="format">
+438
<description summary="pixel format description">
+439
Informs the client about a valid pixel format that
+440
can be used for buffers. Known formats include
+441
argb8888 and xrgb8888.
+442
</description>
+443
<arg name="format" type="uint" enum="format" summary="buffer pixel format"/>
+444
</event>
+445
</interface>
+446
+447
<interface name="wl_buffer" version="1">
+448
<description summary="content for a wl_surface">
+449
A buffer provides the content for a wl_surface. Buffers are
+450
created through factory interfaces such as wl_shm, wp_linux_buffer_params
+451
(from the linux-dmabuf protocol extension) or similar. It has a width and
+452
a height and can be attached to a wl_surface, but the mechanism by which a
+453
client provides and updates the contents is defined by the buffer factory
+454
interface.
+455
+456
If the buffer uses a format that has an alpha channel, the alpha channel
+457
is assumed to be premultiplied in the color channels unless otherwise
+458
specified.
+459
+460
Note, because wl_buffer objects are created from multiple independent
+461
factory interfaces, the wl_buffer interface is frozen at version 1.
+462
</description>
+463
+464
<request name="destroy" type="destructor">
+465
<description summary="destroy a buffer">
+466
Destroy a buffer. If and how you need to release the backing
+467
storage is defined by the buffer factory interface.
+468
+469
For possible side-effects to a surface, see wl_surface.attach.
+470
</description>
+471
</request>
+472
+473
<event name="release">
+474
<description summary="compositor releases buffer">
+475
Sent when this wl_buffer is no longer used by the compositor.
+476
The client is now free to reuse or destroy this buffer and its
+477
backing storage.
+478
+479
If a client receives a release event before the frame callback
+480
requested in the same wl_surface.commit that attaches this
+481
wl_buffer to a surface, then the client is immediately free to
+482
reuse the buffer and its backing storage, and does not need a
+483
second buffer for the next surface content update. Typically
+484
this is possible, when the compositor maintains a copy of the
+485
wl_surface contents, e.g. as a GL texture. This is an important
+486
optimization for GL(ES) compositors with wl_shm clients.
+487
</description>
+488
</event>
+489
</interface>
+490
+491
<interface name="wl_data_offer" version="3">
+492
<description summary="offer to transfer data">
+493
A wl_data_offer represents a piece of data offered for transfer
+494
by another client (the source client). It is used by the
+495
copy-and-paste and drag-and-drop mechanisms. The offer
+496
describes the different mime types that the data can be
+497
converted to and provides the mechanism for transferring the
+498
data directly from the source client.
+499
</description>

Showing the first 500 of 3152 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/deps/wayland/xdg-activation-v1.xmladded
@@ -0,0 +1,200 @@
+1
<?xml version="1.0" encoding="UTF-8"?>
+2
<protocol name="xdg_activation_v1">
+3
+4
<copyright>
+5
Copyright © 2020 Aleix Pol Gonzalez &lt;aleixpol@kde.org&gt;
+6
Copyright © 2020 Carlos Garnacho &lt;carlosg@gnome.org&gt;
+7
+8
Permission is hereby granted, free of charge, to any person obtaining a
+9
copy of this software and associated documentation files (the "Software"),
+10
to deal in the Software without restriction, including without limitation
+11
the rights to use, copy, modify, merge, publish, distribute, sublicense,
+12
and/or sell copies of the Software, and to permit persons to whom the
+13
Software is furnished to do so, subject to the following conditions:
+14
+15
The above copyright notice and this permission notice (including the next
+16
paragraph) shall be included in all copies or substantial portions of the
+17
Software.
+18
+19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+22
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+23
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+24
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+25
DEALINGS IN THE SOFTWARE.
+26
</copyright>
+27
+28
<description summary="Protocol for requesting activation of surfaces">
+29
The way for a client to pass focus to another toplevel is as follows.
+30
+31
The client that intends to activate another toplevel uses the
+32
xdg_activation_v1.get_activation_token request to get an activation token.
+33
This token is then forwarded to the client, which is supposed to activate
+34
one of its surfaces, through a separate band of communication.
+35
+36
One established way of doing this is through the XDG_ACTIVATION_TOKEN
+37
environment variable of a newly launched child process. The child process
+38
should unset the environment variable again right after reading it out in
+39
order to avoid propagating it to other child processes.
+40
+41
Another established way exists for Applications implementing the D-Bus
+42
interface org.freedesktop.Application, which should get their token under
+43
activation-token on their platform_data.
+44
+45
In general activation tokens may be transferred across clients through
+46
means not described in this protocol.
+47
+48
The client to be activated will then pass the token
+49
it received to the xdg_activation_v1.activate request. The compositor can
+50
then use this token to decide how to react to the activation request.
+51
+52
The token the activating client gets may be ineffective either already at
+53
the time it receives it, for example if it was not focused, for focus
+54
stealing prevention. The activating client will have no way to discover
+55
the validity of the token, and may still forward it to the to be activated
+56
client.
+57
+58
The created activation token may optionally get information attached to it
+59
that can be used by the compositor to identify the application that we
+60
intend to activate. This can for example be used to display a visual hint
+61
about what application is being started.
+62
+63
Warning! The protocol described in this file is currently in the testing
+64
phase. Backward compatible changes may be added together with the
+65
corresponding interface version bump. Backward incompatible changes can
+66
only be done by creating a new major version of the extension.
+67
</description>
+68
+69
<interface name="xdg_activation_v1" version="1">
+70
<description summary="interface for activating surfaces">
+71
A global interface used for informing the compositor about applications
+72
being activated or started, or for applications to request to be
+73
activated.
+74
</description>
+75
+76
<request name="destroy" type="destructor">
+77
<description summary="destroy the xdg_activation object">
+78
Notify the compositor that the xdg_activation object will no longer be
+79
used.
+80
+81
The child objects created via this interface are unaffected and should
+82
be destroyed separately.
+83
</description>
+84
</request>
+85
+86
<request name="get_activation_token">
+87
<description summary="requests a token">
+88
Creates an xdg_activation_token_v1 object that will provide
+89
the initiating client with a unique token for this activation. This
+90
token should be offered to the clients to be activated.
+91
</description>
+92
+93
<arg name="id" type="new_id" interface="xdg_activation_token_v1"/>
+94
</request>
+95
+96
<request name="activate">
+97
<description summary="notify new interaction being available">
+98
Requests surface activation. It's up to the compositor to display
+99
this information as desired, for example by placing the surface above
+100
the rest.
+101
+102
The compositor may know who requested this by checking the activation
+103
token and might decide not to follow through with the activation if it's
+104
considered unwanted.
+105
+106
Compositors can ignore unknown activation tokens when an invalid
+107
token is passed.
+108
</description>
+109
<arg name="token" type="string" summary="the activation token of the initiating client"/>
+110
<arg name="surface" type="object" interface="wl_surface"
+111
summary="the wl_surface to activate"/>
+112
</request>
+113
</interface>
+114
+115
<interface name="xdg_activation_token_v1" version="1">
+116
<description summary="an exported activation handle">
+117
An object for setting up a token and receiving a token handle that can
+118
be passed as an activation token to another client.
+119
+120
The object is created using the xdg_activation_v1.get_activation_token
+121
request. This object should then be populated with the app_id, surface
+122
and serial information and committed. The compositor shall then issue a
+123
done event with the token. In case the request's parameters are invalid,
+124
the compositor will provide an invalid token.
+125
</description>
+126
+127
<enum name="error">
+128
<entry name="already_used" value="0"
+129
summary="The token has already been used previously"/>
+130
</enum>
+131
+132
<request name="set_serial">
+133
<description summary="specifies the seat and serial of the activating event">
+134
Provides information about the seat and serial event that requested the
+135
token.
+136
+137
The serial can come from an input or focus event. For instance, if a
+138
click triggers the launch of a third-party client, the launcher client
+139
should send a set_serial request with the serial and seat from the
+140
wl_pointer.button event.
+141
+142
Some compositors might refuse to activate toplevels when the token
+143
doesn't have a valid and recent enough event serial.
+144
+145
Must be sent before commit. This information is optional.
+146
</description>
+147
<arg name="serial" type="uint"
+148
summary="the serial of the event that triggered the activation"/>
+149
<arg name="seat" type="object" interface="wl_seat"
+150
summary="the wl_seat of the event"/>
+151
</request>
+152
+153
<request name="set_app_id">
+154
<description summary="specifies the application being activated">
+155
The requesting client can specify an app_id to associate the token
+156
being created with it.
+157
+158
Must be sent before commit. This information is optional.
+159
</description>
+160
<arg name="app_id" type="string"
+161
summary="the application id of the client being activated."/>
+162
</request>
+163
+164
<request name="set_surface">
+165
<description summary="specifies the surface requesting activation">
+166
This request sets the surface requesting the activation. Note, this is
+167
different from the surface that will be activated.
+168
+169
Some compositors might refuse to activate toplevels when the token
+170
doesn't have a requesting surface.
+171
+172
Must be sent before commit. This information is optional.
+173
</description>
+174
<arg name="surface" type="object" interface="wl_surface"
+175
summary="the requesting surface"/>
+176
</request>
+177
+178
<request name="commit">
+179
<description summary="issues the token request">
+180
Requests an activation token based on the different parameters that
+181
have been offered through set_serial, set_surface and set_app_id.
+182
</description>
+183
</request>
+184
+185
<event name="done">
+186
<description summary="the exported activation token">
+187
The 'done' event contains the unique token of this activation request
+188
and notifies that the provider is done.
+189
</description>
+190
<arg name="token" type="string" summary="the exported activation token"/>
+191
</event>
+192
+193
<request name="destroy" type="destructor">
+194
<description summary="destroy the xdg_activation_token_v1 object">
+195
Notify the compositor that the xdg_activation_token_v1 object will no
+196
longer be used. The received token stays valid.
+197
</description>
+198
</request>
+199
</interface>
+200
</protocol>
vendor/glfw/deps/wayland/xdg-decoration-unstable-v1.xmladded
@@ -0,0 +1,156 @@
+1
<?xml version="1.0" encoding="UTF-8"?>
+2
<protocol name="xdg_decoration_unstable_v1">
+3
<copyright>
+4
Copyright © 2018 Simon Ser
+5
+6
Permission is hereby granted, free of charge, to any person obtaining a
+7
copy of this software and associated documentation files (the "Software"),
+8
to deal in the Software without restriction, including without limitation
+9
the rights to use, copy, modify, merge, publish, distribute, sublicense,
+10
and/or sell copies of the Software, and to permit persons to whom the
+11
Software is furnished to do so, subject to the following conditions:
+12
+13
The above copyright notice and this permission notice (including the next
+14
paragraph) shall be included in all copies or substantial portions of the
+15
Software.
+16
+17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+20
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+22
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+23
DEALINGS IN THE SOFTWARE.
+24
</copyright>
+25
+26
<interface name="zxdg_decoration_manager_v1" version="1">
+27
<description summary="window decoration manager">
+28
This interface allows a compositor to announce support for server-side
+29
decorations.
+30
+31
A window decoration is a set of window controls as deemed appropriate by
+32
the party managing them, such as user interface components used to move,
+33
resize and change a window's state.
+34
+35
A client can use this protocol to request being decorated by a supporting
+36
compositor.
+37
+38
If compositor and client do not negotiate the use of a server-side
+39
decoration using this protocol, clients continue to self-decorate as they
+40
see fit.
+41
+42
Warning! The protocol described in this file is experimental and
+43
backward incompatible changes may be made. Backward compatible changes
+44
may be added together with the corresponding interface version bump.
+45
Backward incompatible changes are done by bumping the version number in
+46
the protocol and interface names and resetting the interface version.
+47
Once the protocol is to be declared stable, the 'z' prefix and the
+48
version number in the protocol and interface names are removed and the
+49
interface version number is reset.
+50
</description>
+51
+52
<request name="destroy" type="destructor">
+53
<description summary="destroy the decoration manager object">
+54
Destroy the decoration manager. This doesn't destroy objects created
+55
with the manager.
+56
</description>
+57
</request>
+58
+59
<request name="get_toplevel_decoration">
+60
<description summary="create a new toplevel decoration object">
+61
Create a new decoration object associated with the given toplevel.
+62
+63
Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
+64
buffer attached or committed is a client error, and any attempts by a
+65
client to attach or manipulate a buffer prior to the first
+66
xdg_toplevel_decoration.configure event must also be treated as
+67
errors.
+68
</description>
+69
<arg name="id" type="new_id" interface="zxdg_toplevel_decoration_v1"/>
+70
<arg name="toplevel" type="object" interface="xdg_toplevel"/>
+71
</request>
+72
</interface>
+73
+74
<interface name="zxdg_toplevel_decoration_v1" version="1">
+75
<description summary="decoration object for a toplevel surface">
+76
The decoration object allows the compositor to toggle server-side window
+77
decorations for a toplevel surface. The client can request to switch to
+78
another mode.
+79
+80
The xdg_toplevel_decoration object must be destroyed before its
+81
xdg_toplevel.
+82
</description>
+83
+84
<enum name="error">
+85
<entry name="unconfigured_buffer" value="0"
+86
summary="xdg_toplevel has a buffer attached before configure"/>
+87
<entry name="already_constructed" value="1"
+88
summary="xdg_toplevel already has a decoration object"/>
+89
<entry name="orphaned" value="2"
+90
summary="xdg_toplevel destroyed before the decoration object"/>
+91
</enum>
+92
+93
<request name="destroy" type="destructor">
+94
<description summary="destroy the decoration object">
+95
Switch back to a mode without any server-side decorations at the next
+96
commit.
+97
</description>
+98
</request>
+99
+100
<enum name="mode">
+101
<description summary="window decoration modes">
+102
These values describe window decoration modes.
+103
</description>
+104
<entry name="client_side" value="1"
+105
summary="no server-side window decoration"/>
+106
<entry name="server_side" value="2"
+107
summary="server-side window decoration"/>
+108
</enum>
+109
+110
<request name="set_mode">
+111
<description summary="set the decoration mode">
+112
Set the toplevel surface decoration mode. This informs the compositor
+113
that the client prefers the provided decoration mode.
+114
+115
After requesting a decoration mode, the compositor will respond by
+116
emitting an xdg_surface.configure event. The client should then update
+117
its content, drawing it without decorations if the received mode is
+118
server-side decorations. The client must also acknowledge the configure
+119
when committing the new content (see xdg_surface.ack_configure).
+120
+121
The compositor can decide not to use the client's mode and enforce a
+122
different mode instead.
+123
+124
Clients whose decoration mode depend on the xdg_toplevel state may send
+125
a set_mode request in response to an xdg_surface.configure event and wait
+126
for the next xdg_surface.configure event to prevent unwanted state.
+127
Such clients are responsible for preventing configure loops and must
+128
make sure not to send multiple successive set_mode requests with the
+129
same decoration mode.
+130
</description>
+131
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
+132
</request>
+133
+134
<request name="unset_mode">
+135
<description summary="unset the decoration mode">
+136
Unset the toplevel surface decoration mode. This informs the compositor
+137
that the client doesn't prefer a particular decoration mode.
+138
+139
This request has the same semantics as set_mode.
+140
</description>
+141
</request>
+142
+143
<event name="configure">
+144
<description summary="suggest a surface change">
+145
The configure event asks the client to change its decoration mode. The
+146
configured state should not be applied immediately. Clients must send an
+147
ack_configure in response to this event. See xdg_surface.configure and
+148
xdg_surface.ack_configure for details.
+149
+150
A configure event can be sent at any time. The specified mode must be
+151
obeyed by the client.
+152
</description>
+153
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
+154
</event>
+155
</interface>
+156
</protocol>
vendor/glfw/deps/wayland/xdg-shell.xmladded
@@ -0,0 +1,1370 @@
+1
<?xml version="1.0" encoding="UTF-8"?>
+2
<protocol name="xdg_shell">
+3
+4
<copyright>
+5
Copyright © 2008-2013 Kristian Høgsberg
+6
Copyright © 2013 Rafael Antognolli
+7
Copyright © 2013 Jasper St. Pierre
+8
Copyright © 2010-2013 Intel Corporation
+9
Copyright © 2015-2017 Samsung Electronics Co., Ltd
+10
Copyright © 2015-2017 Red Hat Inc.
+11
+12
Permission is hereby granted, free of charge, to any person obtaining a
+13
copy of this software and associated documentation files (the "Software"),
+14
to deal in the Software without restriction, including without limitation
+15
the rights to use, copy, modify, merge, publish, distribute, sublicense,
+16
and/or sell copies of the Software, and to permit persons to whom the
+17
Software is furnished to do so, subject to the following conditions:
+18
+19
The above copyright notice and this permission notice (including the next
+20
paragraph) shall be included in all copies or substantial portions of the
+21
Software.
+22
+23
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+24
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+25
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+26
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+27
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+28
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+29
DEALINGS IN THE SOFTWARE.
+30
</copyright>
+31
+32
<interface name="xdg_wm_base" version="6">
+33
<description summary="create desktop-style surfaces">
+34
The xdg_wm_base interface is exposed as a global object enabling clients
+35
to turn their wl_surfaces into windows in a desktop environment. It
+36
defines the basic functionality needed for clients and the compositor to
+37
create windows that can be dragged, resized, maximized, etc, as well as
+38
creating transient windows such as popup menus.
+39
</description>
+40
+41
<enum name="error">
+42
<entry name="role" value="0" summary="given wl_surface has another role"/>
+43
<entry name="defunct_surfaces" value="1"
+44
summary="xdg_wm_base was destroyed before children"/>
+45
<entry name="not_the_topmost_popup" value="2"
+46
summary="the client tried to map or destroy a non-topmost popup"/>
+47
<entry name="invalid_popup_parent" value="3"
+48
summary="the client specified an invalid popup parent surface"/>
+49
<entry name="invalid_surface_state" value="4"
+50
summary="the client provided an invalid surface state"/>
+51
<entry name="invalid_positioner" value="5"
+52
summary="the client provided an invalid positioner"/>
+53
<entry name="unresponsive" value="6"
+54
summary="the client didn’t respond to a ping event in time"/>
+55
</enum>
+56
+57
<request name="destroy" type="destructor">
+58
<description summary="destroy xdg_wm_base">
+59
Destroy this xdg_wm_base object.
+60
+61
Destroying a bound xdg_wm_base object while there are surfaces
+62
still alive created by this xdg_wm_base object instance is illegal
+63
and will result in a defunct_surfaces error.
+64
</description>
+65
</request>
+66
+67
<request name="create_positioner">
+68
<description summary="create a positioner object">
+69
Create a positioner object. A positioner object is used to position
+70
surfaces relative to some parent surface. See the interface description
+71
and xdg_surface.get_popup for details.
+72
</description>
+73
<arg name="id" type="new_id" interface="xdg_positioner"/>
+74
</request>
+75
+76
<request name="get_xdg_surface">
+77
<description summary="create a shell surface from a surface">
+78
This creates an xdg_surface for the given surface. While xdg_surface
+79
itself is not a role, the corresponding surface may only be assigned
+80
a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is
+81
illegal to create an xdg_surface for a wl_surface which already has an
+82
assigned role and this will result in a role error.
+83
+84
This creates an xdg_surface for the given surface. An xdg_surface is
+85
used as basis to define a role to a given surface, such as xdg_toplevel
+86
or xdg_popup. It also manages functionality shared between xdg_surface
+87
based surface roles.
+88
+89
See the documentation of xdg_surface for more details about what an
+90
xdg_surface is and how it is used.
+91
</description>
+92
<arg name="id" type="new_id" interface="xdg_surface"/>
+93
<arg name="surface" type="object" interface="wl_surface"/>
+94
</request>
+95
+96
<request name="pong">
+97
<description summary="respond to a ping event">
+98
A client must respond to a ping event with a pong request or
+99
the client may be deemed unresponsive. See xdg_wm_base.ping
+100
and xdg_wm_base.error.unresponsive.
+101
</description>
+102
<arg name="serial" type="uint" summary="serial of the ping event"/>
+103
</request>
+104
+105
<event name="ping">
+106
<description summary="check if the client is alive">
+107
The ping event asks the client if it's still alive. Pass the
+108
serial specified in the event back to the compositor by sending
+109
a "pong" request back with the specified serial. See xdg_wm_base.pong.
+110
+111
Compositors can use this to determine if the client is still
+112
alive. It's unspecified what will happen if the client doesn't
+113
respond to the ping request, or in what timeframe. Clients should
+114
try to respond in a reasonable amount of time. The “unresponsive”
+115
error is provided for compositors that wish to disconnect unresponsive
+116
clients.
+117
+118
A compositor is free to ping in any way it wants, but a client must
+119
always respond to any xdg_wm_base object it created.
+120
</description>
+121
<arg name="serial" type="uint" summary="pass this to the pong request"/>
+122
</event>
+123
</interface>
+124
+125
<interface name="xdg_positioner" version="6">
+126
<description summary="child surface positioner">
+127
The xdg_positioner provides a collection of rules for the placement of a
+128
child surface relative to a parent surface. Rules can be defined to ensure
+129
the child surface remains within the visible area's borders, and to
+130
specify how the child surface changes its position, such as sliding along
+131
an axis, or flipping around a rectangle. These positioner-created rules are
+132
constrained by the requirement that a child surface must intersect with or
+133
be at least partially adjacent to its parent surface.
+134
+135
See the various requests for details about possible rules.
+136
+137
At the time of the request, the compositor makes a copy of the rules
+138
specified by the xdg_positioner. Thus, after the request is complete the
+139
xdg_positioner object can be destroyed or reused; further changes to the
+140
object will have no effect on previous usages.
+141
+142
For an xdg_positioner object to be considered complete, it must have a
+143
non-zero size set by set_size, and a non-zero anchor rectangle set by
+144
set_anchor_rect. Passing an incomplete xdg_positioner object when
+145
positioning a surface raises an invalid_positioner error.
+146
</description>
+147
+148
<enum name="error">
+149
<entry name="invalid_input" value="0" summary="invalid input provided"/>
+150
</enum>
+151
+152
<request name="destroy" type="destructor">
+153
<description summary="destroy the xdg_positioner object">
+154
Notify the compositor that the xdg_positioner will no longer be used.
+155
</description>
+156
</request>
+157
+158
<request name="set_size">
+159
<description summary="set the size of the to-be positioned rectangle">
+160
Set the size of the surface that is to be positioned with the positioner
+161
object. The size is in surface-local coordinates and corresponds to the
+162
window geometry. See xdg_surface.set_window_geometry.
+163
+164
If a zero or negative size is set the invalid_input error is raised.
+165
</description>
+166
<arg name="width" type="int" summary="width of positioned rectangle"/>
+167
<arg name="height" type="int" summary="height of positioned rectangle"/>
+168
</request>
+169
+170
<request name="set_anchor_rect">
+171
<description summary="set the anchor rectangle within the parent surface">
+172
Specify the anchor rectangle within the parent surface that the child
+173
surface will be placed relative to. The rectangle is relative to the
+174
window geometry as defined by xdg_surface.set_window_geometry of the
+175
parent surface.
+176
+177
When the xdg_positioner object is used to position a child surface, the
+178
anchor rectangle may not extend outside the window geometry of the
+179
positioned child's parent surface.
+180
+181
If a negative size is set the invalid_input error is raised.
+182
</description>
+183
<arg name="x" type="int" summary="x position of anchor rectangle"/>
+184
<arg name="y" type="int" summary="y position of anchor rectangle"/>
+185
<arg name="width" type="int" summary="width of anchor rectangle"/>
+186
<arg name="height" type="int" summary="height of anchor rectangle"/>
+187
</request>
+188
+189
<enum name="anchor">
+190
<entry name="none" value="0"/>
+191
<entry name="top" value="1"/>
+192
<entry name="bottom" value="2"/>
+193
<entry name="left" value="3"/>
+194
<entry name="right" value="4"/>
+195
<entry name="top_left" value="5"/>
+196
<entry name="bottom_left" value="6"/>
+197
<entry name="top_right" value="7"/>
+198
<entry name="bottom_right" value="8"/>
+199
</enum>
+200
+201
<request name="set_anchor">
+202
<description summary="set anchor rectangle anchor">
+203
Defines the anchor point for the anchor rectangle. The specified anchor
+204
is used derive an anchor point that the child surface will be
+205
positioned relative to. If a corner anchor is set (e.g. 'top_left' or
+206
'bottom_right'), the anchor point will be at the specified corner;
+207
otherwise, the derived anchor point will be centered on the specified
+208
edge, or in the center of the anchor rectangle if no edge is specified.
+209
</description>
+210
<arg name="anchor" type="uint" enum="anchor"
+211
summary="anchor"/>
+212
</request>
+213
+214
<enum name="gravity">
+215
<entry name="none" value="0"/>
+216
<entry name="top" value="1"/>
+217
<entry name="bottom" value="2"/>
+218
<entry name="left" value="3"/>
+219
<entry name="right" value="4"/>
+220
<entry name="top_left" value="5"/>
+221
<entry name="bottom_left" value="6"/>
+222
<entry name="top_right" value="7"/>
+223
<entry name="bottom_right" value="8"/>
+224
</enum>
+225
+226
<request name="set_gravity">
+227
<description summary="set child surface gravity">
+228
Defines in what direction a surface should be positioned, relative to
+229
the anchor point of the parent surface. If a corner gravity is
+230
specified (e.g. 'bottom_right' or 'top_left'), then the child surface
+231
will be placed towards the specified gravity; otherwise, the child
+232
surface will be centered over the anchor point on any axis that had no
+233
gravity specified. If the gravity is not in the ‘gravity’ enum, an
+234
invalid_input error is raised.
+235
</description>
+236
<arg name="gravity" type="uint" enum="gravity"
+237
summary="gravity direction"/>
+238
</request>
+239
+240
<enum name="constraint_adjustment" bitfield="true">
+241
<description summary="constraint adjustments">
+242
The constraint adjustment value define ways the compositor will adjust
+243
the position of the surface, if the unadjusted position would result
+244
in the surface being partly constrained.
+245
+246
Whether a surface is considered 'constrained' is left to the compositor
+247
to determine. For example, the surface may be partly outside the
+248
compositor's defined 'work area', thus necessitating the child surface's
+249
position be adjusted until it is entirely inside the work area.
+250
+251
The adjustments can be combined, according to a defined precedence: 1)
+252
Flip, 2) Slide, 3) Resize.
+253
</description>
+254
<entry name="none" value="0">
+255
<description summary="don't move the child surface when constrained">
+256
Don't alter the surface position even if it is constrained on some
+257
axis, for example partially outside the edge of an output.
+258
</description>
+259
</entry>
+260
<entry name="slide_x" value="1">
+261
<description summary="move along the x axis until unconstrained">
+262
Slide the surface along the x axis until it is no longer constrained.
+263
+264
First try to slide towards the direction of the gravity on the x axis
+265
until either the edge in the opposite direction of the gravity is
+266
unconstrained or the edge in the direction of the gravity is
+267
constrained.
+268
+269
Then try to slide towards the opposite direction of the gravity on the
+270
x axis until either the edge in the direction of the gravity is
+271
unconstrained or the edge in the opposite direction of the gravity is
+272
constrained.
+273
</description>
+274
</entry>
+275
<entry name="slide_y" value="2">
+276
<description summary="move along the y axis until unconstrained">
+277
Slide the surface along the y axis until it is no longer constrained.
+278
+279
First try to slide towards the direction of the gravity on the y axis
+280
until either the edge in the opposite direction of the gravity is
+281
unconstrained or the edge in the direction of the gravity is
+282
constrained.
+283
+284
Then try to slide towards the opposite direction of the gravity on the
+285
y axis until either the edge in the direction of the gravity is
+286
unconstrained or the edge in the opposite direction of the gravity is
+287
constrained.
+288
</description>
+289
</entry>
+290
<entry name="flip_x" value="4">
+291
<description summary="invert the anchor and gravity on the x axis">
+292
Invert the anchor and gravity on the x axis if the surface is
+293
constrained on the x axis. For example, if the left edge of the
+294
surface is constrained, the gravity is 'left' and the anchor is
+295
'left', change the gravity to 'right' and the anchor to 'right'.
+296
+297
If the adjusted position also ends up being constrained, the resulting
+298
position of the flip_x adjustment will be the one before the
+299
adjustment.
+300
</description>
+301
</entry>
+302
<entry name="flip_y" value="8">
+303
<description summary="invert the anchor and gravity on the y axis">
+304
Invert the anchor and gravity on the y axis if the surface is
+305
constrained on the y axis. For example, if the bottom edge of the
+306
surface is constrained, the gravity is 'bottom' and the anchor is
+307
'bottom', change the gravity to 'top' and the anchor to 'top'.
+308
+309
The adjusted position is calculated given the original anchor
+310
rectangle and offset, but with the new flipped anchor and gravity
+311
values.
+312
+313
If the adjusted position also ends up being constrained, the resulting
+314
position of the flip_y adjustment will be the one before the
+315
adjustment.
+316
</description>
+317
</entry>
+318
<entry name="resize_x" value="16">
+319
<description summary="horizontally resize the surface">
+320
Resize the surface horizontally so that it is completely
+321
unconstrained.
+322
</description>
+323
</entry>
+324
<entry name="resize_y" value="32">
+325
<description summary="vertically resize the surface">
+326
Resize the surface vertically so that it is completely unconstrained.
+327
</description>
+328
</entry>
+329
</enum>
+330
+331
<request name="set_constraint_adjustment">
+332
<description summary="set the adjustment to be done when constrained">
+333
Specify how the window should be positioned if the originally intended
+334
position caused the surface to be constrained, meaning at least
+335
partially outside positioning boundaries set by the compositor. The
+336
adjustment is set by constructing a bitmask describing the adjustment to
+337
be made when the surface is constrained on that axis.
+338
+339
If no bit for one axis is set, the compositor will assume that the child
+340
surface should not change its position on that axis when constrained.
+341
+342
If more than one bit for one axis is set, the order of how adjustments
+343
are applied is specified in the corresponding adjustment descriptions.
+344
+345
The default adjustment is none.
+346
</description>
+347
<arg name="constraint_adjustment" type="uint"
+348
summary="bit mask of constraint adjustments"/>
+349
</request>
+350
+351
<request name="set_offset">
+352
<description summary="set surface position offset">
+353
Specify the surface position offset relative to the position of the
+354
anchor on the anchor rectangle and the anchor on the surface. For
+355
example if the anchor of the anchor rectangle is at (x, y), the surface
+356
has the gravity bottom|right, and the offset is (ox, oy), the calculated
+357
surface position will be (x + ox, y + oy). The offset position of the
+358
surface is the one used for constraint testing. See
+359
set_constraint_adjustment.
+360
+361
An example use case is placing a popup menu on top of a user interface
+362
element, while aligning the user interface element of the parent surface
+363
with some user interface element placed somewhere in the popup surface.
+364
</description>
+365
<arg name="x" type="int" summary="surface position x offset"/>
+366
<arg name="y" type="int" summary="surface position y offset"/>
+367
</request>
+368
+369
<!-- Version 3 additions -->
+370
+371
<request name="set_reactive" since="3">
+372
<description summary="continuously reconstrain the surface">
+373
When set reactive, the surface is reconstrained if the conditions used
+374
for constraining changed, e.g. the parent window moved.
+375
+376
If the conditions changed and the popup was reconstrained, an
+377
xdg_popup.configure event is sent with updated geometry, followed by an
+378
xdg_surface.configure event.
+379
</description>
+380
</request>
+381
+382
<request name="set_parent_size" since="3">
+383
<description summary="">
+384
Set the parent window geometry the compositor should use when
+385
positioning the popup. The compositor may use this information to
+386
determine the future state the popup should be constrained using. If
+387
this doesn't match the dimension of the parent the popup is eventually
+388
positioned against, the behavior is undefined.
+389
+390
The arguments are given in the surface-local coordinate space.
+391
</description>
+392
<arg name="parent_width" type="int"
+393
summary="future window geometry width of parent"/>
+394
<arg name="parent_height" type="int"
+395
summary="future window geometry height of parent"/>
+396
</request>
+397
+398
<request name="set_parent_configure" since="3">
+399
<description summary="set parent configure this is a response to">
+400
Set the serial of an xdg_surface.configure event this positioner will be
+401
used in response to. The compositor may use this information together
+402
with set_parent_size to determine what future state the popup should be
+403
constrained using.
+404
</description>
+405
<arg name="serial" type="uint"
+406
summary="serial of parent configure event"/>
+407
</request>
+408
</interface>
+409
+410
<interface name="xdg_surface" version="6">
+411
<description summary="desktop user interface surface base interface">
+412
An interface that may be implemented by a wl_surface, for
+413
implementations that provide a desktop-style user interface.
+414
+415
It provides a base set of functionality required to construct user
+416
interface elements requiring management by the compositor, such as
+417
toplevel windows, menus, etc. The types of functionality are split into
+418
xdg_surface roles.
+419
+420
Creating an xdg_surface does not set the role for a wl_surface. In order
+421
to map an xdg_surface, the client must create a role-specific object
+422
using, e.g., get_toplevel, get_popup. The wl_surface for any given
+423
xdg_surface can have at most one role, and may not be assigned any role
+424
not based on xdg_surface.
+425
+426
A role must be assigned before any other requests are made to the
+427
xdg_surface object.
+428
+429
The client must call wl_surface.commit on the corresponding wl_surface
+430
for the xdg_surface state to take effect.
+431
+432
Creating an xdg_surface from a wl_surface which has a buffer attached or
+433
committed is a client error, and any attempts by a client to attach or
+434
manipulate a buffer prior to the first xdg_surface.configure call must
+435
also be treated as errors.
+436
+437
After creating a role-specific object and setting it up, the client must
+438
perform an initial commit without any buffer attached. The compositor
+439
will reply with initial wl_surface state such as
+440
wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
+441
event. The client must acknowledge it and is then allowed to attach a
+442
buffer to map the surface.
+443
+444
Mapping an xdg_surface-based role surface is defined as making it
+445
possible for the surface to be shown by the compositor. Note that
+446
a mapped surface is not guaranteed to be visible once it is mapped.
+447
+448
For an xdg_surface to be mapped by the compositor, the following
+449
conditions must be met:
+450
(1) the client has assigned an xdg_surface-based role to the surface
+451
(2) the client has set and committed the xdg_surface state and the
+452
role-dependent state to the surface
+453
(3) the client has committed a buffer to the surface
+454
+455
A newly-unmapped surface is considered to have met condition (1) out
+456
of the 3 required conditions for mapping a surface if its role surface
+457
has not been destroyed, i.e. the client must perform the initial commit
+458
again before attaching a buffer.
+459
</description>
+460
+461
<enum name="error">
+462
<entry name="not_constructed" value="1"
+463
summary="Surface was not fully constructed"/>
+464
<entry name="already_constructed" value="2"
+465
summary="Surface was already constructed"/>
+466
<entry name="unconfigured_buffer" value="3"
+467
summary="Attaching a buffer to an unconfigured surface"/>
+468
<entry name="invalid_serial" value="4"
+469
summary="Invalid serial number when acking a configure event"/>
+470
<entry name="invalid_size" value="5"
+471
summary="Width or height was zero or negative"/>
+472
<entry name="defunct_role_object" value="6"
+473
summary="Surface was destroyed before its role object"/>
+474
</enum>
+475
+476
<request name="destroy" type="destructor">
+477
<description summary="destroy the xdg_surface">
+478
Destroy the xdg_surface object. An xdg_surface must only be destroyed
+479
after its role object has been destroyed, otherwise
+480
a defunct_role_object error is raised.
+481
</description>
+482
</request>
+483
+484
<request name="get_toplevel">
+485
<description summary="assign the xdg_toplevel surface role">
+486
This creates an xdg_toplevel object for the given xdg_surface and gives
+487
the associated wl_surface the xdg_toplevel role.
+488
+489
See the documentation of xdg_toplevel for more details about what an
+490
xdg_toplevel is and how it is used.
+491
</description>
+492
<arg name="id" type="new_id" interface="xdg_toplevel"/>
+493
</request>
+494
+495
<request name="get_popup">
+496
<description summary="assign the xdg_popup surface role">
+497
This creates an xdg_popup object for the given xdg_surface and gives
+498
the associated wl_surface the xdg_popup role.
+499

Showing the first 500 of 1371 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/include/GLFW/glfw3.hadded
@@ -0,0 +1,6577 @@
+1
/*************************************************************************
+2
* GLFW 3.5 - www.glfw.org
+3
* A library for OpenGL, window and input
+4
*------------------------------------------------------------------------
+5
* Copyright (c) 2002-2006 Marcus Geelnard
+6
* Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+7
*
+8
* This software is provided 'as-is', without any express or implied
+9
* warranty. In no event will the authors be held liable for any damages
+10
* arising from the use of this software.
+11
*
+12
* Permission is granted to anyone to use this software for any purpose,
+13
* including commercial applications, and to alter it and redistribute it
+14
* freely, subject to the following restrictions:
+15
*
+16
* 1. The origin of this software must not be misrepresented; you must not
+17
* claim that you wrote the original software. If you use this software
+18
* in a product, an acknowledgment in the product documentation would
+19
* be appreciated but is not required.
+20
*
+21
* 2. Altered source versions must be plainly marked as such, and must not
+22
* be misrepresented as being the original software.
+23
*
+24
* 3. This notice may not be removed or altered from any source
+25
* distribution.
+26
*
+27
*************************************************************************/
+28
+29
#ifndef _glfw3_h_
+30
#define _glfw3_h_
+31
+32
#ifdef __cplusplus
+33
extern "C" {
+34
#endif
+35
+36
+37
/*************************************************************************
+38
* Doxygen documentation
+39
*************************************************************************/
+40
+41
/*! @file glfw3.h
+42
* @brief The header of the GLFW 3 API.
+43
*
+44
* This is the header file of the GLFW 3 API. It defines all its types and
+45
* declares all its functions.
+46
*
+47
* For more information about how to use this file, see @ref build_include.
+48
*/
+49
/*! @defgroup context Context reference
+50
* @brief Functions and types related to OpenGL and OpenGL ES contexts.
+51
*
+52
* This is the reference documentation for OpenGL and OpenGL ES context related
+53
* functions. For more task-oriented information, see the @ref context_guide.
+54
*/
+55
/*! @defgroup vulkan Vulkan support reference
+56
* @brief Functions and types related to Vulkan.
+57
*
+58
* This is the reference documentation for Vulkan related functions and types.
+59
* For more task-oriented information, see the @ref vulkan_guide.
+60
*/
+61
/*! @defgroup init Initialization, version and error reference
+62
* @brief Functions and types related to initialization and error handling.
+63
*
+64
* This is the reference documentation for initialization and termination of
+65
* the library, version management and error handling. For more task-oriented
+66
* information, see the @ref intro_guide.
+67
*/
+68
/*! @defgroup input Input reference
+69
* @brief Functions and types related to input handling.
+70
*
+71
* This is the reference documentation for input related functions and types.
+72
* For more task-oriented information, see the @ref input_guide.
+73
*/
+74
/*! @defgroup monitor Monitor reference
+75
* @brief Functions and types related to monitors.
+76
*
+77
* This is the reference documentation for monitor related functions and types.
+78
* For more task-oriented information, see the @ref monitor_guide.
+79
*/
+80
/*! @defgroup window Window reference
+81
* @brief Functions and types related to windows.
+82
*
+83
* This is the reference documentation for window related functions and types,
+84
* including creation, deletion and event polling. For more task-oriented
+85
* information, see the @ref window_guide.
+86
*/
+87
+88
+89
/*************************************************************************
+90
* Compiler- and platform-specific preprocessor work
+91
*************************************************************************/
+92
+93
/* If we are we on Windows, we want a single define for it.
+94
*/
+95
#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
+96
#define _WIN32
+97
#endif /* _WIN32 */
+98
+99
/* Include because most Windows GLU headers need wchar_t and
+100
* the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.
+101
* Include it unconditionally to avoid surprising side-effects.
+102
*/
+103
#include <stddef.h>
+104
+105
/* Include because it is needed by Vulkan and related functions.
+106
* Include it unconditionally to avoid surprising side-effects.
+107
*/
+108
#include <stdint.h>
+109
+110
#if defined(GLFW_INCLUDE_VULKAN)
+111
#include <vulkan/vulkan.h>
+112
#endif /* Vulkan header */
+113
+114
/* The Vulkan header may have indirectly included windows.h (because of
+115
* VK_USE_PLATFORM_WIN32_KHR) so we offer our replacement symbols after it.
+116
*/
+117
+118
/* It is customary to use APIENTRY for OpenGL function pointer declarations on
+119
* all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
+120
*/
+121
#if !defined(APIENTRY)
+122
#if defined(_WIN32)
+123
#define APIENTRY __stdcall
+124
#else
+125
#define APIENTRY
+126
#endif
+127
#define GLFW_APIENTRY_DEFINED
+128
#endif /* APIENTRY */
+129
+130
/* Some Windows OpenGL headers need this.
+131
*/
+132
#if !defined(WINGDIAPI) && defined(_WIN32)
+133
#define WINGDIAPI __declspec(dllimport)
+134
#define GLFW_WINGDIAPI_DEFINED
+135
#endif /* WINGDIAPI */
+136
+137
/* Some Windows GLU headers need this.
+138
*/
+139
#if !defined(CALLBACK) && defined(_WIN32)
+140
#define CALLBACK __stdcall
+141
#define GLFW_CALLBACK_DEFINED
+142
#endif /* CALLBACK */
+143
+144
/* Include the chosen OpenGL or OpenGL ES headers.
+145
*/
+146
#if defined(GLFW_INCLUDE_ES1)
+147
+148
#include <GLES/gl.h>
+149
#if defined(GLFW_INCLUDE_GLEXT)
+150
#include <GLES/glext.h>
+151
#endif
+152
+153
#elif defined(GLFW_INCLUDE_ES2)
+154
+155
#include <GLES2/gl2.h>
+156
#if defined(GLFW_INCLUDE_GLEXT)
+157
#include <GLES2/gl2ext.h>
+158
#endif
+159
+160
#elif defined(GLFW_INCLUDE_ES3)
+161
+162
#include <GLES3/gl3.h>
+163
#if defined(GLFW_INCLUDE_GLEXT)
+164
#include <GLES2/gl2ext.h>
+165
#endif
+166
+167
#elif defined(GLFW_INCLUDE_ES31)
+168
+169
#include <GLES3/gl31.h>
+170
#if defined(GLFW_INCLUDE_GLEXT)
+171
#include <GLES2/gl2ext.h>
+172
#endif
+173
+174
#elif defined(GLFW_INCLUDE_ES32)
+175
+176
#include <GLES3/gl32.h>
+177
#if defined(GLFW_INCLUDE_GLEXT)
+178
#include <GLES2/gl2ext.h>
+179
#endif
+180
+181
#elif defined(GLFW_INCLUDE_GLCOREARB)
+182
+183
#if defined(__APPLE__)
+184
+185
#include <OpenGL/gl3.h>
+186
#if defined(GLFW_INCLUDE_GLEXT)
+187
#include <OpenGL/gl3ext.h>
+188
#endif /*GLFW_INCLUDE_GLEXT*/
+189
+190
#else /*__APPLE__*/
+191
+192
#include <GL/glcorearb.h>
+193
#if defined(GLFW_INCLUDE_GLEXT)
+194
#include <GL/glext.h>
+195
#endif
+196
+197
#endif /*__APPLE__*/
+198
+199
#elif defined(GLFW_INCLUDE_GLU)
+200
+201
#if defined(__APPLE__)
+202
+203
#if defined(GLFW_INCLUDE_GLU)
+204
#include <OpenGL/glu.h>
+205
#endif
+206
+207
#else /*__APPLE__*/
+208
+209
#if defined(GLFW_INCLUDE_GLU)
+210
#include <GL/glu.h>
+211
#endif
+212
+213
#endif /*__APPLE__*/
+214
+215
#elif !defined(GLFW_INCLUDE_NONE) && \
+216
!defined(__gl_h_) && \
+217
!defined(__gles1_gl_h_) && \
+218
!defined(__gles2_gl2_h_) && \
+219
!defined(__gles2_gl3_h_) && \
+220
!defined(__gles2_gl31_h_) && \
+221
!defined(__gles2_gl32_h_) && \
+222
!defined(__gl_glcorearb_h_) && \
+223
!defined(__gl2_h_) /*legacy*/ && \
+224
!defined(__gl3_h_) /*legacy*/ && \
+225
!defined(__gl31_h_) /*legacy*/ && \
+226
!defined(__gl32_h_) /*legacy*/ && \
+227
!defined(__glcorearb_h_) /*legacy*/ && \
+228
!defined(__GL_H__) /*non-standard*/ && \
+229
!defined(__gltypes_h_) /*non-standard*/ && \
+230
!defined(__glee_h_) /*non-standard*/
+231
+232
#if defined(__APPLE__)
+233
+234
#if !defined(GLFW_INCLUDE_GLEXT)
+235
#define GL_GLEXT_LEGACY
+236
#endif
+237
#include <OpenGL/gl.h>
+238
+239
#else /*__APPLE__*/
+240
+241
#include <GL/gl.h>
+242
#if defined(GLFW_INCLUDE_GLEXT)
+243
#include <GL/glext.h>
+244
#endif
+245
+246
#endif /*__APPLE__*/
+247
+248
#endif /* OpenGL and OpenGL ES headers */
+249
+250
#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
+251
/* GLFW_DLL must be defined by applications that are linking against the DLL
+252
* version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
+253
* configuration header when compiling the DLL version of the library.
+254
*/
+255
#error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
+256
#endif
+257
+258
/* GLFWAPI is used to declare public API functions for export
+259
* from the DLL / shared library / dynamic library.
+260
*/
+261
#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
+262
/* We are building GLFW as a Win32 DLL */
+263
#define GLFWAPI __declspec(dllexport)
+264
#elif defined(_WIN32) && defined(GLFW_DLL)
+265
/* We are calling a GLFW Win32 DLL */
+266
#define GLFWAPI __declspec(dllimport)
+267
#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
+268
/* We are building GLFW as a Unix shared library */
+269
#define GLFWAPI __attribute__((visibility("default")))
+270
#else
+271
#define GLFWAPI
+272
#endif
+273
+274
+275
/*************************************************************************
+276
* GLFW API tokens
+277
*************************************************************************/
+278
+279
/*! @name GLFW version macros
+280
* @{ */
+281
/*! @brief The major version number of the GLFW header.
+282
*
+283
* The major version number of the GLFW header. This is incremented when the
+284
* API is changed in non-compatible ways.
+285
* @ingroup init
+286
*/
+287
#define GLFW_VERSION_MAJOR 3
+288
/*! @brief The minor version number of the GLFW header.
+289
*
+290
* The minor version number of the GLFW header. This is incremented when
+291
* features are added to the API but it remains backward-compatible.
+292
* @ingroup init
+293
*/
+294
#define GLFW_VERSION_MINOR 5
+295
/*! @brief The revision number of the GLFW header.
+296
*
+297
* The revision number of the GLFW header. This is incremented when a bug fix
+298
* release is made that does not contain any API changes.
+299
* @ingroup init
+300
*/
+301
#define GLFW_VERSION_REVISION 1
+302
/*! @} */
+303
+304
/*! @brief One.
+305
*
+306
* This is only semantic sugar for the number 1. You can instead use `1` or
+307
* `true` or `_True` or `GL_TRUE` or `VK_TRUE` or anything else that is equal
+308
* to one.
+309
*
+310
* @ingroup init
+311
*/
+312
#define GLFW_TRUE 1
+313
/*! @brief Zero.
+314
*
+315
* This is only semantic sugar for the number 0. You can instead use `0` or
+316
* `false` or `_False` or `GL_FALSE` or `VK_FALSE` or anything else that is
+317
* equal to zero.
+318
*
+319
* @ingroup init
+320
*/
+321
#define GLFW_FALSE 0
+322
+323
/*! @name Key and button actions
+324
* @{ */
+325
/*! @brief The key or mouse button was released.
+326
*
+327
* The key or mouse button was released.
+328
*
+329
* @ingroup input
+330
*/
+331
#define GLFW_RELEASE 0
+332
/*! @brief The key or mouse button was pressed.
+333
*
+334
* The key or mouse button was pressed.
+335
*
+336
* @ingroup input
+337
*/
+338
#define GLFW_PRESS 1
+339
/*! @brief The key was held down until it repeated.
+340
*
+341
* The key was held down until it repeated.
+342
*
+343
* @ingroup input
+344
*/
+345
#define GLFW_REPEAT 2
+346
/*! @} */
+347
+348
/*! @defgroup hat_state Joystick hat states
+349
* @brief Joystick hat states.
+350
*
+351
* See [joystick hat input](@ref joystick_hat) for how these are used.
+352
*
+353
* @ingroup input
+354
* @{ */
+355
#define GLFW_HAT_CENTERED 0
+356
#define GLFW_HAT_UP 1
+357
#define GLFW_HAT_RIGHT 2
+358
#define GLFW_HAT_DOWN 4
+359
#define GLFW_HAT_LEFT 8
+360
#define GLFW_HAT_RIGHT_UP (GLFW_HAT_RIGHT | GLFW_HAT_UP)
+361
#define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
+362
#define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)
+363
#define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
+364
+365
/*! @ingroup input
+366
*/
+367
#define GLFW_KEY_UNKNOWN -1
+368
+369
/*! @} */
+370
+371
/*! @defgroup keys Keyboard key tokens
+372
* @brief Keyboard key tokens.
+373
*
+374
* See [key input](@ref input_key) for how these are used.
+375
*
+376
* These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
+377
* but re-arranged to map to 7-bit ASCII for printable keys (function keys are
+378
* put in the 256+ range).
+379
*
+380
* The naming of the key codes follow these rules:
+381
* - The US keyboard layout is used
+382
* - Names of printable alphanumeric characters are used (e.g. "A", "R",
+383
* "3", etc.)
+384
* - For non-alphanumeric characters, Unicode:ish names are used (e.g.
+385
* "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
+386
* correspond to the Unicode standard (usually for brevity)
+387
* - Keys that lack a clear US mapping are named "WORLD_x"
+388
* - For non-printable keys, custom names are used (e.g. "F4",
+389
* "BACKSPACE", etc.)
+390
*
+391
* @ingroup input
+392
* @{
+393
*/
+394
+395
/* Printable keys */
+396
#define GLFW_KEY_SPACE 32
+397
#define GLFW_KEY_APOSTROPHE 39 /* ' */
+398
#define GLFW_KEY_COMMA 44 /* , */
+399
#define GLFW_KEY_MINUS 45 /* - */
+400
#define GLFW_KEY_PERIOD 46 /* . */
+401
#define GLFW_KEY_SLASH 47 /* / */
+402
#define GLFW_KEY_0 48
+403
#define GLFW_KEY_1 49
+404
#define GLFW_KEY_2 50
+405
#define GLFW_KEY_3 51
+406
#define GLFW_KEY_4 52
+407
#define GLFW_KEY_5 53
+408
#define GLFW_KEY_6 54
+409
#define GLFW_KEY_7 55
+410
#define GLFW_KEY_8 56
+411
#define GLFW_KEY_9 57
+412
#define GLFW_KEY_SEMICOLON 59 /* ; */
+413
#define GLFW_KEY_EQUAL 61 /* = */
+414
#define GLFW_KEY_A 65
+415
#define GLFW_KEY_B 66
+416
#define GLFW_KEY_C 67
+417
#define GLFW_KEY_D 68
+418
#define GLFW_KEY_E 69
+419
#define GLFW_KEY_F 70
+420
#define GLFW_KEY_G 71
+421
#define GLFW_KEY_H 72
+422
#define GLFW_KEY_I 73
+423
#define GLFW_KEY_J 74
+424
#define GLFW_KEY_K 75
+425
#define GLFW_KEY_L 76
+426
#define GLFW_KEY_M 77
+427
#define GLFW_KEY_N 78
+428
#define GLFW_KEY_O 79
+429
#define GLFW_KEY_P 80
+430
#define GLFW_KEY_Q 81
+431
#define GLFW_KEY_R 82
+432
#define GLFW_KEY_S 83
+433
#define GLFW_KEY_T 84
+434
#define GLFW_KEY_U 85
+435
#define GLFW_KEY_V 86
+436
#define GLFW_KEY_W 87
+437
#define GLFW_KEY_X 88
+438
#define GLFW_KEY_Y 89
+439
#define GLFW_KEY_Z 90
+440
#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
+441
#define GLFW_KEY_BACKSLASH 92 /* \ */
+442
#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
+443
#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
+444
#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
+445
#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
+446
+447
/* Function keys */
+448
#define GLFW_KEY_ESCAPE 256
+449
#define GLFW_KEY_ENTER 257
+450
#define GLFW_KEY_TAB 258
+451
#define GLFW_KEY_BACKSPACE 259
+452
#define GLFW_KEY_INSERT 260
+453
#define GLFW_KEY_DELETE 261
+454
#define GLFW_KEY_RIGHT 262
+455
#define GLFW_KEY_LEFT 263
+456
#define GLFW_KEY_DOWN 264
+457
#define GLFW_KEY_UP 265
+458
#define GLFW_KEY_PAGE_UP 266
+459
#define GLFW_KEY_PAGE_DOWN 267
+460
#define GLFW_KEY_HOME 268
+461
#define GLFW_KEY_END 269
+462
#define GLFW_KEY_CAPS_LOCK 280
+463
#define GLFW_KEY_SCROLL_LOCK 281
+464
#define GLFW_KEY_NUM_LOCK 282
+465
#define GLFW_KEY_PRINT_SCREEN 283
+466
#define GLFW_KEY_PAUSE 284
+467
#define GLFW_KEY_F1 290
+468
#define GLFW_KEY_F2 291
+469
#define GLFW_KEY_F3 292
+470
#define GLFW_KEY_F4 293
+471
#define GLFW_KEY_F5 294
+472
#define GLFW_KEY_F6 295
+473
#define GLFW_KEY_F7 296
+474
#define GLFW_KEY_F8 297
+475
#define GLFW_KEY_F9 298
+476
#define GLFW_KEY_F10 299
+477
#define GLFW_KEY_F11 300
+478
#define GLFW_KEY_F12 301
+479
#define GLFW_KEY_F13 302
+480
#define GLFW_KEY_F14 303
+481
#define GLFW_KEY_F15 304
+482
#define GLFW_KEY_F16 305
+483
#define GLFW_KEY_F17 306
+484
#define GLFW_KEY_F18 307
+485
#define GLFW_KEY_F19 308
+486
#define GLFW_KEY_F20 309
+487
#define GLFW_KEY_F21 310
+488
#define GLFW_KEY_F22 311
+489
#define GLFW_KEY_F23 312
+490
#define GLFW_KEY_F24 313
+491
#define GLFW_KEY_F25 314
+492
#define GLFW_KEY_KP_0 320
+493
#define GLFW_KEY_KP_1 321
+494
#define GLFW_KEY_KP_2 322
+495
#define GLFW_KEY_KP_3 323
+496
#define GLFW_KEY_KP_4 324
+497
#define GLFW_KEY_KP_5 325
+498
#define GLFW_KEY_KP_6 326
+499
#define GLFW_KEY_KP_7 327

Showing the first 500 of 6578 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/include/GLFW/glfw3native.hadded
@@ -0,0 +1,709 @@
+1
/*************************************************************************
+2
* GLFW 3.5 - www.glfw.org
+3
* A library for OpenGL, window and input
+4
*------------------------------------------------------------------------
+5
* Copyright (c) 2002-2006 Marcus Geelnard
+6
* Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
+7
*
+8
* This software is provided 'as-is', without any express or implied
+9
* warranty. In no event will the authors be held liable for any damages
+10
* arising from the use of this software.
+11
*
+12
* Permission is granted to anyone to use this software for any purpose,
+13
* including commercial applications, and to alter it and redistribute it
+14
* freely, subject to the following restrictions:
+15
*
+16
* 1. The origin of this software must not be misrepresented; you must not
+17
* claim that you wrote the original software. If you use this software
+18
* in a product, an acknowledgment in the product documentation would
+19
* be appreciated but is not required.
+20
*
+21
* 2. Altered source versions must be plainly marked as such, and must not
+22
* be misrepresented as being the original software.
+23
*
+24
* 3. This notice may not be removed or altered from any source
+25
* distribution.
+26
*
+27
*************************************************************************/
+28
+29
#ifndef _glfw3_native_h_
+30
#define _glfw3_native_h_
+31
+32
#ifdef __cplusplus
+33
extern "C" {
+34
#endif
+35
+36
+37
/*************************************************************************
+38
* Doxygen documentation
+39
*************************************************************************/
+40
+41
/*! @file glfw3native.h
+42
* @brief The header of the native access functions.
+43
*
+44
* This is the header file of the native access functions. See @ref native for
+45
* more information.
+46
*/
+47
/*! @defgroup native Native access
+48
* @brief Functions related to accessing native handles.
+49
*
+50
* **By using the native access functions you assert that you know what you're
+51
* doing and how to fix problems caused by using them. If you don't, you
+52
* shouldn't be using them.**
+53
*
+54
* Before the inclusion of @ref glfw3native.h, you may define zero or more
+55
* window system API macro and zero or more context creation API macros.
+56
*
+57
* The chosen backends must match those the library was compiled for. Failure
+58
* to do this will cause a link-time error.
+59
*
+60
* The available window API macros are:
+61
* * `GLFW_EXPOSE_NATIVE_WIN32`
+62
* * `GLFW_EXPOSE_NATIVE_COCOA`
+63
* * `GLFW_EXPOSE_NATIVE_X11`
+64
* * `GLFW_EXPOSE_NATIVE_WAYLAND`
+65
*
+66
* The available context API macros are:
+67
* * `GLFW_EXPOSE_NATIVE_WGL`
+68
* * `GLFW_EXPOSE_NATIVE_NSGL`
+69
* * `GLFW_EXPOSE_NATIVE_GLX`
+70
* * `GLFW_EXPOSE_NATIVE_EGL`
+71
* * `GLFW_EXPOSE_NATIVE_OSMESA`
+72
*
+73
* These macros select which of the native access functions that are declared
+74
* and which platform-specific headers to include. It is then up your (by
+75
* definition platform-specific) code to handle which of these should be
+76
* defined.
+77
*
+78
* If you do not want the platform-specific headers to be included, define
+79
* `GLFW_NATIVE_INCLUDE_NONE` before including the @ref glfw3native.h header.
+80
*
+81
* @code
+82
* #define GLFW_EXPOSE_NATIVE_WIN32
+83
* #define GLFW_EXPOSE_NATIVE_WGL
+84
* #define GLFW_NATIVE_INCLUDE_NONE
+85
* #include <GLFW/glfw3native.h>
+86
* @endcode
+87
*/
+88
+89
+90
/*************************************************************************
+91
* System headers and types
+92
*************************************************************************/
+93
+94
#if !defined(GLFW_NATIVE_INCLUDE_NONE)
+95
+96
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
+97
/* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
+98
* example to allow applications to correctly declare a GL_KHR_debug callback)
+99
* but windows.h assumes no one will define APIENTRY before it does
+100
*/
+101
#if defined(GLFW_APIENTRY_DEFINED)
+102
#undef APIENTRY
+103
#undef GLFW_APIENTRY_DEFINED
+104
#endif
+105
#include <windows.h>
+106
#endif
+107
+108
#if defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
+109
#if defined(__OBJC__)
+110
#import <Cocoa/Cocoa.h>
+111
#else
+112
#include <ApplicationServices/ApplicationServices.h>
+113
#include <objc/objc.h>
+114
#endif
+115
#endif
+116
+117
#if defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
+118
#include <X11/Xlib.h>
+119
#include <X11/extensions/Xrandr.h>
+120
#endif
+121
+122
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
+123
#include <wayland-client.h>
+124
#endif
+125
+126
#if defined(GLFW_EXPOSE_NATIVE_WGL)
+127
/* WGL is declared by windows.h */
+128
#endif
+129
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
+130
/* NSGL is declared by Cocoa.h */
+131
#endif
+132
#if defined(GLFW_EXPOSE_NATIVE_GLX)
+133
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
+134
* default it also acts as an OpenGL header
+135
* However, glx.h will include gl.h, which will define it unconditionally
+136
*/
+137
#if defined(GLFW_GLAPIENTRY_DEFINED)
+138
#undef GLAPIENTRY
+139
#undef GLFW_GLAPIENTRY_DEFINED
+140
#endif
+141
#include <GL/glx.h>
+142
#endif
+143
#if defined(GLFW_EXPOSE_NATIVE_EGL)
+144
#include <EGL/egl.h>
+145
#endif
+146
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
+147
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
+148
* default it also acts as an OpenGL header
+149
* However, osmesa.h will include gl.h, which will define it unconditionally
+150
*/
+151
#if defined(GLFW_GLAPIENTRY_DEFINED)
+152
#undef GLAPIENTRY
+153
#undef GLFW_GLAPIENTRY_DEFINED
+154
#endif
+155
#include <GL/osmesa.h>
+156
#endif
+157
+158
#endif /*GLFW_NATIVE_INCLUDE_NONE*/
+159
+160
+161
/*************************************************************************
+162
* Functions
+163
*************************************************************************/
+164
+165
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
+166
/*! @brief Returns the adapter device name of the specified monitor.
+167
*
+168
* @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
+169
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
+170
* occurred.
+171
*
+172
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+173
* GLFW_PLATFORM_UNAVAILABLE.
+174
*
+175
* @thread_safety This function may be called from any thread. Access is not
+176
* synchronized.
+177
*
+178
* @since Added in version 3.1.
+179
*
+180
* @ingroup native
+181
*/
+182
GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
+183
+184
/*! @brief Returns the display device name of the specified monitor.
+185
*
+186
* @return The UTF-8 encoded display device name (for example
+187
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
+188
* [error](@ref error_handling) occurred.
+189
*
+190
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+191
* GLFW_PLATFORM_UNAVAILABLE.
+192
*
+193
* @thread_safety This function may be called from any thread. Access is not
+194
* synchronized.
+195
*
+196
* @since Added in version 3.1.
+197
*
+198
* @ingroup native
+199
*/
+200
GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
+201
+202
/*! @brief Returns the `HWND` of the specified window.
+203
*
+204
* @return The `HWND` of the specified window, or `NULL` if an
+205
* [error](@ref error_handling) occurred.
+206
*
+207
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+208
* GLFW_PLATFORM_UNAVAILABLE.
+209
*
+210
* @remark The `HDC` associated with the window can be queried with the
+211
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
+212
* function.
+213
* @code
+214
* HDC dc = GetDC(glfwGetWin32Window(window));
+215
* @endcode
+216
* This DC is private and does not need to be released.
+217
*
+218
* @thread_safety This function may be called from any thread. Access is not
+219
* synchronized.
+220
*
+221
* @since Added in version 3.0.
+222
*
+223
* @ingroup native
+224
*/
+225
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
+226
#endif
+227
+228
#if defined(GLFW_EXPOSE_NATIVE_WGL)
+229
/*! @brief Returns the `HGLRC` of the specified window.
+230
*
+231
* @return The `HGLRC` of the specified window, or `NULL` if an
+232
* [error](@ref error_handling) occurred.
+233
*
+234
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+235
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
+236
*
+237
* @remark The `HDC` associated with the window can be queried with the
+238
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
+239
* function.
+240
* @code
+241
* HDC dc = GetDC(glfwGetWin32Window(window));
+242
* @endcode
+243
* This DC is private and does not need to be released.
+244
*
+245
* @thread_safety This function may be called from any thread. Access is not
+246
* synchronized.
+247
*
+248
* @since Added in version 3.0.
+249
*
+250
* @ingroup native
+251
*/
+252
GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
+253
#endif
+254
+255
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
+256
/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
+257
*
+258
* @return The `CGDirectDisplayID` of the specified monitor, or
+259
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
+260
*
+261
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+262
* GLFW_PLATFORM_UNAVAILABLE.
+263
*
+264
* @thread_safety This function may be called from any thread. Access is not
+265
* synchronized.
+266
*
+267
* @since Added in version 3.1.
+268
*
+269
* @ingroup native
+270
*/
+271
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
+272
+273
/*! @brief Returns the `NSWindow` of the specified window.
+274
*
+275
* @return The `NSWindow` of the specified window, or `nil` if an
+276
* [error](@ref error_handling) occurred.
+277
*
+278
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+279
* GLFW_PLATFORM_UNAVAILABLE.
+280
*
+281
* @thread_safety This function may be called from any thread. Access is not
+282
* synchronized.
+283
*
+284
* @since Added in version 3.0.
+285
*
+286
* @ingroup native
+287
*/
+288
GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
+289
+290
/*! @brief Returns the `NSView` of the specified window.
+291
*
+292
* @return The `NSView` of the specified window, or `nil` if an
+293
* [error](@ref error_handling) occurred.
+294
*
+295
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+296
* GLFW_PLATFORM_UNAVAILABLE.
+297
*
+298
* @thread_safety This function may be called from any thread. Access is not
+299
* synchronized.
+300
*
+301
* @since Added in version 3.4.
+302
*
+303
* @ingroup native
+304
*/
+305
GLFWAPI id glfwGetCocoaView(GLFWwindow* window);
+306
#endif
+307
+308
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
+309
/*! @brief Returns the `NSOpenGLContext` of the specified window.
+310
*
+311
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
+312
* [error](@ref error_handling) occurred.
+313
*
+314
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+315
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
+316
*
+317
* @thread_safety This function may be called from any thread. Access is not
+318
* synchronized.
+319
*
+320
* @since Added in version 3.0.
+321
*
+322
* @ingroup native
+323
*/
+324
GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
+325
#endif
+326
+327
#if defined(GLFW_EXPOSE_NATIVE_X11)
+328
/*! @brief Returns the `Display` used by GLFW.
+329
*
+330
* @return The `Display` used by GLFW, or `NULL` if an
+331
* [error](@ref error_handling) occurred.
+332
*
+333
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+334
* GLFW_PLATFORM_UNAVAILABLE.
+335
*
+336
* @thread_safety This function may be called from any thread. Access is not
+337
* synchronized.
+338
*
+339
* @since Added in version 3.0.
+340
*
+341
* @ingroup native
+342
*/
+343
GLFWAPI Display* glfwGetX11Display(void);
+344
+345
/*! @brief Returns the `RRCrtc` of the specified monitor.
+346
*
+347
* @return The `RRCrtc` of the specified monitor, or `None` if an
+348
* [error](@ref error_handling) occurred.
+349
*
+350
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+351
* GLFW_PLATFORM_UNAVAILABLE.
+352
*
+353
* @thread_safety This function may be called from any thread. Access is not
+354
* synchronized.
+355
*
+356
* @since Added in version 3.1.
+357
*
+358
* @ingroup native
+359
*/
+360
GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
+361
+362
/*! @brief Returns the `RROutput` of the specified monitor.
+363
*
+364
* @return The `RROutput` of the specified monitor, or `None` if an
+365
* [error](@ref error_handling) occurred.
+366
*
+367
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+368
* GLFW_PLATFORM_UNAVAILABLE.
+369
*
+370
* @thread_safety This function may be called from any thread. Access is not
+371
* synchronized.
+372
*
+373
* @since Added in version 3.1.
+374
*
+375
* @ingroup native
+376
*/
+377
GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
+378
+379
/*! @brief Returns the `Window` of the specified window.
+380
*
+381
* @return The `Window` of the specified window, or `None` if an
+382
* [error](@ref error_handling) occurred.
+383
*
+384
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+385
* GLFW_PLATFORM_UNAVAILABLE.
+386
*
+387
* @thread_safety This function may be called from any thread. Access is not
+388
* synchronized.
+389
*
+390
* @since Added in version 3.0.
+391
*
+392
* @ingroup native
+393
*/
+394
GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
+395
+396
/*! @brief Sets the current primary selection to the specified string.
+397
*
+398
* @param[in] string A UTF-8 encoded string.
+399
*
+400
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+401
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
+402
*
+403
* @pointer_lifetime The specified string is copied before this function
+404
* returns.
+405
*
+406
* @thread_safety This function must only be called from the main thread.
+407
*
+408
* @sa @ref clipboard
+409
* @sa glfwGetX11SelectionString
+410
* @sa glfwSetClipboardString
+411
*
+412
* @since Added in version 3.3.
+413
*
+414
* @ingroup native
+415
*/
+416
GLFWAPI void glfwSetX11SelectionString(const char* string);
+417
+418
/*! @brief Returns the contents of the current primary selection as a string.
+419
*
+420
* If the selection is empty or if its contents cannot be converted, `NULL`
+421
* is returned and a @ref GLFW_FORMAT_UNAVAILABLE error is generated.
+422
*
+423
* @return The contents of the selection as a UTF-8 encoded string, or `NULL`
+424
* if an [error](@ref error_handling) occurred.
+425
*
+426
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+427
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
+428
*
+429
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
+430
* should not free it yourself. It is valid until the next call to @ref
+431
* glfwGetX11SelectionString or @ref glfwSetX11SelectionString, or until the
+432
* library is terminated.
+433
*
+434
* @thread_safety This function must only be called from the main thread.
+435
*
+436
* @sa @ref clipboard
+437
* @sa glfwSetX11SelectionString
+438
* @sa glfwGetClipboardString
+439
*
+440
* @since Added in version 3.3.
+441
*
+442
* @ingroup native
+443
*/
+444
GLFWAPI const char* glfwGetX11SelectionString(void);
+445
#endif
+446
+447
#if defined(GLFW_EXPOSE_NATIVE_GLX)
+448
/*! @brief Returns the `GLXContext` of the specified window.
+449
*
+450
* @return The `GLXContext` of the specified window, or `NULL` if an
+451
* [error](@ref error_handling) occurred.
+452
*
+453
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+454
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
+455
*
+456
* @thread_safety This function may be called from any thread. Access is not
+457
* synchronized.
+458
*
+459
* @since Added in version 3.0.
+460
*
+461
* @ingroup native
+462
*/
+463
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
+464
+465
/*! @brief Returns the `GLXWindow` of the specified window.
+466
*
+467
* @return The `GLXWindow` of the specified window, or `None` if an
+468
* [error](@ref error_handling) occurred.
+469
*
+470
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+471
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
+472
*
+473
* @thread_safety This function may be called from any thread. Access is not
+474
* synchronized.
+475
*
+476
* @since Added in version 3.2.
+477
*
+478
* @ingroup native
+479
*/
+480
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
+481
+482
/*! @brief Retrieves the `GLXFBConfig` of the specified window's `GLXWindow`.
+483
*
+484
* @param[in] window The window whose `GLXWindow` to query.
+485
* @param[out] config The `GLXFBConfig` of the window `GLXWindow`, if available.
+486
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
+487
* [error](@ref error_handling) occurred.
+488
*
+489
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+490
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
+491
*
+492
* @remark `GLXFBConfig` is an opaque type. Unlike other GLFW functions, the
+493
* @p config out parameter is not cleared on error, as core GLX does not define
+494
* any invalid value.
+495
*
+496
* @thread_safety This function may be called from any thread. Access is not
+497
* synchronized.
+498
*
+499
* @since Added in version 3.5

Showing the first 500 of 710 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/cocoa_init.madded
@@ -0,0 +1,662 @@
+1
//========================================================================
+2
// GLFW 3.5 Cocoa - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
+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 "internal.h"
+28
+29
#if defined(_GLFW_COCOA)
+30
+31
#include <sys/param.h> // For MAXPATHLEN
+32
+33
// Needed for _NSGetProgname
+34
#include <crt_externs.h>
+35
+36
// Change to our application bundle's resources directory, if present
+37
//
+38
static void changeToResourcesDirectory(void)
+39
{
+40
char resourcesPath[MAXPATHLEN];
+41
+42
CFBundleRef bundle = CFBundleGetMainBundle();
+43
if (!bundle)
+44
return;
+45
+46
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(bundle);
+47
+48
CFStringRef last = CFURLCopyLastPathComponent(resourcesURL);
+49
if (CFStringCompare(CFSTR("Resources"), last, 0) != kCFCompareEqualTo)
+50
{
+51
CFRelease(last);
+52
CFRelease(resourcesURL);
+53
return;
+54
}
+55
+56
CFRelease(last);
+57
+58
if (!CFURLGetFileSystemRepresentation(resourcesURL,
+59
true,
+60
(UInt8*) resourcesPath,
+61
MAXPATHLEN))
+62
{
+63
CFRelease(resourcesURL);
+64
return;
+65
}
+66
+67
CFRelease(resourcesURL);
+68
+69
chdir(resourcesPath);
+70
}
+71
+72
// Set up the menu bar (manually)
+73
// This is nasty, nasty stuff -- calls to undocumented semi-private APIs that
+74
// could go away at any moment, lots of stuff that really should be
+75
// localize(d|able), etc. Add a nib to save us this horror.
+76
//
+77
static void createMenuBar(void)
+78
{
+79
NSString* appName = nil;
+80
NSDictionary* bundleInfo = [[NSBundle mainBundle] infoDictionary];
+81
NSString* nameKeys[] =
+82
{
+83
@"CFBundleDisplayName",
+84
@"CFBundleName",
+85
@"CFBundleExecutable",
+86
};
+87
+88
// Try to figure out what the calling application is called
+89
+90
for (size_t i = 0; i < sizeof(nameKeys) / sizeof(nameKeys[0]); i++)
+91
{
+92
id name = bundleInfo[nameKeys[i]];
+93
if (name &&
+94
[name isKindOfClass:[NSString class]] &&
+95
![name isEqualToString:@""])
+96
{
+97
appName = name;
+98
break;
+99
}
+100
}
+101
+102
if (!appName)
+103
{
+104
char** progname = _NSGetProgname();
+105
if (progname && *progname)
+106
appName = @(*progname);
+107
else
+108
appName = @"GLFW Application";
+109
}
+110
+111
NSMenu* bar = [[NSMenu alloc] init];
+112
[NSApp setMainMenu:bar];
+113
+114
NSMenuItem* appMenuItem =
+115
[bar addItemWithTitle:@"" action:NULL keyEquivalent:@""];
+116
NSMenu* appMenu = [[NSMenu alloc] init];
+117
[appMenuItem setSubmenu:appMenu];
+118
+119
[appMenu addItemWithTitle:[NSString stringWithFormat:@"About %@", appName]
+120
action:@selector(orderFrontStandardAboutPanel:)
+121
keyEquivalent:@""];
+122
[appMenu addItem:[NSMenuItem separatorItem]];
+123
NSMenu* servicesMenu = [[NSMenu alloc] init];
+124
[NSApp setServicesMenu:servicesMenu];
+125
[[appMenu addItemWithTitle:@"Services"
+126
action:NULL
+127
keyEquivalent:@""] setSubmenu:servicesMenu];
+128
[servicesMenu release];
+129
[appMenu addItem:[NSMenuItem separatorItem]];
+130
[appMenu addItemWithTitle:[NSString stringWithFormat:@"Hide %@", appName]
+131
action:@selector(hide:)
+132
keyEquivalent:@"h"];
+133
[[appMenu addItemWithTitle:@"Hide Others"
+134
action:@selector(hideOtherApplications:)
+135
keyEquivalent:@"h"]
+136
setKeyEquivalentModifierMask:NSEventModifierFlagOption | NSEventModifierFlagCommand];
+137
[appMenu addItemWithTitle:@"Show All"
+138
action:@selector(unhideAllApplications:)
+139
keyEquivalent:@""];
+140
[appMenu addItem:[NSMenuItem separatorItem]];
+141
[appMenu addItemWithTitle:[NSString stringWithFormat:@"Quit %@", appName]
+142
action:@selector(terminate:)
+143
keyEquivalent:@"q"];
+144
+145
NSMenuItem* windowMenuItem =
+146
[bar addItemWithTitle:@"" action:NULL keyEquivalent:@""];
+147
[bar release];
+148
NSMenu* windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
+149
[NSApp setWindowsMenu:windowMenu];
+150
[windowMenuItem setSubmenu:windowMenu];
+151
+152
[windowMenu addItemWithTitle:@"Minimize"
+153
action:@selector(performMiniaturize:)
+154
keyEquivalent:@"m"];
+155
[windowMenu addItemWithTitle:@"Zoom"
+156
action:@selector(performZoom:)
+157
keyEquivalent:@""];
+158
[windowMenu addItem:[NSMenuItem separatorItem]];
+159
[windowMenu addItemWithTitle:@"Bring All to Front"
+160
action:@selector(arrangeInFront:)
+161
keyEquivalent:@""];
+162
+163
// TODO: Make this appear at the bottom of the menu (for consistency)
+164
[windowMenu addItem:[NSMenuItem separatorItem]];
+165
[[windowMenu addItemWithTitle:@"Enter Full Screen"
+166
action:@selector(toggleFullScreen:)
+167
keyEquivalent:@"f"]
+168
setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand];
+169
+170
// Prior to Snow Leopard, we need to use this oddly-named semi-private API
+171
// to get the application menu working properly.
+172
SEL setAppleMenuSelector = NSSelectorFromString(@"setAppleMenu:");
+173
[NSApp performSelector:setAppleMenuSelector withObject:appMenu];
+174
}
+175
+176
// Create key code translation tables
+177
//
+178
static void createKeyTables(void)
+179
{
+180
memset(_glfw.ns.keycodes, -1, sizeof(_glfw.ns.keycodes));
+181
memset(_glfw.ns.scancodes, -1, sizeof(_glfw.ns.scancodes));
+182
+183
_glfw.ns.keycodes[0x1D] = GLFW_KEY_0;
+184
_glfw.ns.keycodes[0x12] = GLFW_KEY_1;
+185
_glfw.ns.keycodes[0x13] = GLFW_KEY_2;
+186
_glfw.ns.keycodes[0x14] = GLFW_KEY_3;
+187
_glfw.ns.keycodes[0x15] = GLFW_KEY_4;
+188
_glfw.ns.keycodes[0x17] = GLFW_KEY_5;
+189
_glfw.ns.keycodes[0x16] = GLFW_KEY_6;
+190
_glfw.ns.keycodes[0x1A] = GLFW_KEY_7;
+191
_glfw.ns.keycodes[0x1C] = GLFW_KEY_8;
+192
_glfw.ns.keycodes[0x19] = GLFW_KEY_9;
+193
_glfw.ns.keycodes[0x00] = GLFW_KEY_A;
+194
_glfw.ns.keycodes[0x0B] = GLFW_KEY_B;
+195
_glfw.ns.keycodes[0x08] = GLFW_KEY_C;
+196
_glfw.ns.keycodes[0x02] = GLFW_KEY_D;
+197
_glfw.ns.keycodes[0x0E] = GLFW_KEY_E;
+198
_glfw.ns.keycodes[0x03] = GLFW_KEY_F;
+199
_glfw.ns.keycodes[0x05] = GLFW_KEY_G;
+200
_glfw.ns.keycodes[0x04] = GLFW_KEY_H;
+201
_glfw.ns.keycodes[0x22] = GLFW_KEY_I;
+202
_glfw.ns.keycodes[0x26] = GLFW_KEY_J;
+203
_glfw.ns.keycodes[0x28] = GLFW_KEY_K;
+204
_glfw.ns.keycodes[0x25] = GLFW_KEY_L;
+205
_glfw.ns.keycodes[0x2E] = GLFW_KEY_M;
+206
_glfw.ns.keycodes[0x2D] = GLFW_KEY_N;
+207
_glfw.ns.keycodes[0x1F] = GLFW_KEY_O;
+208
_glfw.ns.keycodes[0x23] = GLFW_KEY_P;
+209
_glfw.ns.keycodes[0x0C] = GLFW_KEY_Q;
+210
_glfw.ns.keycodes[0x0F] = GLFW_KEY_R;
+211
_glfw.ns.keycodes[0x01] = GLFW_KEY_S;
+212
_glfw.ns.keycodes[0x11] = GLFW_KEY_T;
+213
_glfw.ns.keycodes[0x20] = GLFW_KEY_U;
+214
_glfw.ns.keycodes[0x09] = GLFW_KEY_V;
+215
_glfw.ns.keycodes[0x0D] = GLFW_KEY_W;
+216
_glfw.ns.keycodes[0x07] = GLFW_KEY_X;
+217
_glfw.ns.keycodes[0x10] = GLFW_KEY_Y;
+218
_glfw.ns.keycodes[0x06] = GLFW_KEY_Z;
+219
+220
_glfw.ns.keycodes[0x27] = GLFW_KEY_APOSTROPHE;
+221
_glfw.ns.keycodes[0x2A] = GLFW_KEY_BACKSLASH;
+222
_glfw.ns.keycodes[0x2B] = GLFW_KEY_COMMA;
+223
_glfw.ns.keycodes[0x18] = GLFW_KEY_EQUAL;
+224
_glfw.ns.keycodes[0x32] = GLFW_KEY_GRAVE_ACCENT;
+225
_glfw.ns.keycodes[0x21] = GLFW_KEY_LEFT_BRACKET;
+226
_glfw.ns.keycodes[0x1B] = GLFW_KEY_MINUS;
+227
_glfw.ns.keycodes[0x2F] = GLFW_KEY_PERIOD;
+228
_glfw.ns.keycodes[0x1E] = GLFW_KEY_RIGHT_BRACKET;
+229
_glfw.ns.keycodes[0x29] = GLFW_KEY_SEMICOLON;
+230
_glfw.ns.keycodes[0x2C] = GLFW_KEY_SLASH;
+231
_glfw.ns.keycodes[0x0A] = GLFW_KEY_WORLD_1;
+232
+233
_glfw.ns.keycodes[0x33] = GLFW_KEY_BACKSPACE;
+234
_glfw.ns.keycodes[0x39] = GLFW_KEY_CAPS_LOCK;
+235
_glfw.ns.keycodes[0x75] = GLFW_KEY_DELETE;
+236
_glfw.ns.keycodes[0x7D] = GLFW_KEY_DOWN;
+237
_glfw.ns.keycodes[0x77] = GLFW_KEY_END;
+238
_glfw.ns.keycodes[0x24] = GLFW_KEY_ENTER;
+239
_glfw.ns.keycodes[0x35] = GLFW_KEY_ESCAPE;
+240
_glfw.ns.keycodes[0x7A] = GLFW_KEY_F1;
+241
_glfw.ns.keycodes[0x78] = GLFW_KEY_F2;
+242
_glfw.ns.keycodes[0x63] = GLFW_KEY_F3;
+243
_glfw.ns.keycodes[0x76] = GLFW_KEY_F4;
+244
_glfw.ns.keycodes[0x60] = GLFW_KEY_F5;
+245
_glfw.ns.keycodes[0x61] = GLFW_KEY_F6;
+246
_glfw.ns.keycodes[0x62] = GLFW_KEY_F7;
+247
_glfw.ns.keycodes[0x64] = GLFW_KEY_F8;
+248
_glfw.ns.keycodes[0x65] = GLFW_KEY_F9;
+249
_glfw.ns.keycodes[0x6D] = GLFW_KEY_F10;
+250
_glfw.ns.keycodes[0x67] = GLFW_KEY_F11;
+251
_glfw.ns.keycodes[0x6F] = GLFW_KEY_F12;
+252
_glfw.ns.keycodes[0x69] = GLFW_KEY_PRINT_SCREEN;
+253
_glfw.ns.keycodes[0x6B] = GLFW_KEY_F14;
+254
_glfw.ns.keycodes[0x71] = GLFW_KEY_F15;
+255
_glfw.ns.keycodes[0x6A] = GLFW_KEY_F16;
+256
_glfw.ns.keycodes[0x40] = GLFW_KEY_F17;
+257
_glfw.ns.keycodes[0x4F] = GLFW_KEY_F18;
+258
_glfw.ns.keycodes[0x50] = GLFW_KEY_F19;
+259
_glfw.ns.keycodes[0x5A] = GLFW_KEY_F20;
+260
_glfw.ns.keycodes[0x73] = GLFW_KEY_HOME;
+261
_glfw.ns.keycodes[0x72] = GLFW_KEY_INSERT;
+262
_glfw.ns.keycodes[0x7B] = GLFW_KEY_LEFT;
+263
_glfw.ns.keycodes[0x3A] = GLFW_KEY_LEFT_ALT;
+264
_glfw.ns.keycodes[0x3B] = GLFW_KEY_LEFT_CONTROL;
+265
_glfw.ns.keycodes[0x38] = GLFW_KEY_LEFT_SHIFT;
+266
_glfw.ns.keycodes[0x37] = GLFW_KEY_LEFT_SUPER;
+267
_glfw.ns.keycodes[0x6E] = GLFW_KEY_MENU;
+268
_glfw.ns.keycodes[0x47] = GLFW_KEY_NUM_LOCK;
+269
_glfw.ns.keycodes[0x79] = GLFW_KEY_PAGE_DOWN;
+270
_glfw.ns.keycodes[0x74] = GLFW_KEY_PAGE_UP;
+271
_glfw.ns.keycodes[0x7C] = GLFW_KEY_RIGHT;
+272
_glfw.ns.keycodes[0x3D] = GLFW_KEY_RIGHT_ALT;
+273
_glfw.ns.keycodes[0x3E] = GLFW_KEY_RIGHT_CONTROL;
+274
_glfw.ns.keycodes[0x3C] = GLFW_KEY_RIGHT_SHIFT;
+275
_glfw.ns.keycodes[0x36] = GLFW_KEY_RIGHT_SUPER;
+276
_glfw.ns.keycodes[0x31] = GLFW_KEY_SPACE;
+277
_glfw.ns.keycodes[0x30] = GLFW_KEY_TAB;
+278
_glfw.ns.keycodes[0x7E] = GLFW_KEY_UP;
+279
+280
_glfw.ns.keycodes[0x52] = GLFW_KEY_KP_0;
+281
_glfw.ns.keycodes[0x53] = GLFW_KEY_KP_1;
+282
_glfw.ns.keycodes[0x54] = GLFW_KEY_KP_2;
+283
_glfw.ns.keycodes[0x55] = GLFW_KEY_KP_3;
+284
_glfw.ns.keycodes[0x56] = GLFW_KEY_KP_4;
+285
_glfw.ns.keycodes[0x57] = GLFW_KEY_KP_5;
+286
_glfw.ns.keycodes[0x58] = GLFW_KEY_KP_6;
+287
_glfw.ns.keycodes[0x59] = GLFW_KEY_KP_7;
+288
_glfw.ns.keycodes[0x5B] = GLFW_KEY_KP_8;
+289
_glfw.ns.keycodes[0x5C] = GLFW_KEY_KP_9;
+290
_glfw.ns.keycodes[0x45] = GLFW_KEY_KP_ADD;
+291
_glfw.ns.keycodes[0x41] = GLFW_KEY_KP_DECIMAL;
+292
_glfw.ns.keycodes[0x4B] = GLFW_KEY_KP_DIVIDE;
+293
_glfw.ns.keycodes[0x4C] = GLFW_KEY_KP_ENTER;
+294
_glfw.ns.keycodes[0x51] = GLFW_KEY_KP_EQUAL;
+295
_glfw.ns.keycodes[0x43] = GLFW_KEY_KP_MULTIPLY;
+296
_glfw.ns.keycodes[0x4E] = GLFW_KEY_KP_SUBTRACT;
+297
+298
for (int scancode = 0; scancode < 256; scancode++)
+299
{
+300
// Store the reverse translation for faster key name lookup
+301
if (_glfw.ns.keycodes[scancode] >= 0)
+302
_glfw.ns.scancodes[_glfw.ns.keycodes[scancode]] = scancode;
+303
}
+304
}
+305
+306
// Retrieve Unicode data for the current keyboard layout
+307
//
+308
static GLFWbool updateUnicodeData(void)
+309
{
+310
if (_glfw.ns.inputSource)
+311
{
+312
CFRelease(_glfw.ns.inputSource);
+313
_glfw.ns.inputSource = NULL;
+314
_glfw.ns.unicodeData = nil;
+315
}
+316
+317
_glfw.ns.inputSource = TISCopyCurrentKeyboardLayoutInputSource();
+318
if (!_glfw.ns.inputSource)
+319
{
+320
_glfwInputError(GLFW_PLATFORM_ERROR,
+321
"Cocoa: Failed to retrieve keyboard layout input source");
+322
return GLFW_FALSE;
+323
}
+324
+325
_glfw.ns.unicodeData =
+326
TISGetInputSourceProperty(_glfw.ns.inputSource,
+327
kTISPropertyUnicodeKeyLayoutData);
+328
if (!_glfw.ns.unicodeData)
+329
{
+330
_glfwInputError(GLFW_PLATFORM_ERROR,
+331
"Cocoa: Failed to retrieve keyboard layout Unicode data");
+332
return GLFW_FALSE;
+333
}
+334
+335
return GLFW_TRUE;
+336
}
+337
+338
// Load HIToolbox.framework and the TIS symbols we need from it
+339
//
+340
static GLFWbool initializeTIS(void)
+341
{
+342
// This works only because Cocoa has already loaded it properly
+343
_glfw.ns.tis.bundle =
+344
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.HIToolbox"));
+345
if (!_glfw.ns.tis.bundle)
+346
{
+347
_glfwInputError(GLFW_PLATFORM_ERROR,
+348
"Cocoa: Failed to load HIToolbox.framework");
+349
return GLFW_FALSE;
+350
}
+351
+352
CFStringRef* kPropertyUnicodeKeyLayoutData =
+353
CFBundleGetDataPointerForName(_glfw.ns.tis.bundle,
+354
CFSTR("kTISPropertyUnicodeKeyLayoutData"));
+355
_glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource =
+356
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
+357
CFSTR("TISCopyCurrentKeyboardLayoutInputSource"));
+358
_glfw.ns.tis.GetInputSourceProperty =
+359
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
+360
CFSTR("TISGetInputSourceProperty"));
+361
_glfw.ns.tis.GetKbdType =
+362
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
+363
CFSTR("LMGetKbdType"));
+364
+365
if (!kPropertyUnicodeKeyLayoutData ||
+366
!TISCopyCurrentKeyboardLayoutInputSource ||
+367
!TISGetInputSourceProperty ||
+368
!LMGetKbdType)
+369
{
+370
_glfwInputError(GLFW_PLATFORM_ERROR,
+371
"Cocoa: Failed to load TIS API symbols");
+372
return GLFW_FALSE;
+373
}
+374
+375
_glfw.ns.tis.kPropertyUnicodeKeyLayoutData =
+376
*kPropertyUnicodeKeyLayoutData;
+377
+378
return updateUnicodeData();
+379
}
+380
+381
@interface GLFWHelper : NSObject
+382
@end
+383
+384
@implementation GLFWHelper
+385
+386
- (void)selectedKeyboardInputSourceChanged:(NSObject* )object
+387
{
+388
updateUnicodeData();
+389
}
+390
+391
- (void)doNothing:(id)object
+392
{
+393
}
+394
+395
@end // GLFWHelper
+396
+397
@interface GLFWApplicationDelegate : NSObject <NSApplicationDelegate>
+398
@end
+399
+400
@implementation GLFWApplicationDelegate
+401
+402
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
+403
{
+404
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
+405
_glfwInputWindowCloseRequest(window);
+406
+407
return NSTerminateCancel;
+408
}
+409
+410
- (void)applicationDidChangeScreenParameters:(NSNotification *) notification
+411
{
+412
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
+413
{
+414
if (window->context.client != GLFW_NO_API)
+415
[window->context.nsgl.object update];
+416
}
+417
+418
_glfwPollMonitorsCocoa();
+419
}
+420
+421
- (void)applicationWillFinishLaunching:(NSNotification *)notification
+422
{
+423
if (_glfw.hints.init.ns.menubar)
+424
{
+425
// Menu bar setup must go between sharedApplication and finishLaunching
+426
// in order to properly emulate the behavior of NSApplicationMain
+427
+428
if ([[NSBundle mainBundle] pathForResource:@"MainMenu" ofType:@"nib"])
+429
{
+430
[[NSBundle mainBundle] loadNibNamed:@"MainMenu"
+431
owner:NSApp
+432
topLevelObjects:&_glfw.ns.nibObjects];
+433
}
+434
else
+435
createMenuBar();
+436
}
+437
}
+438
+439
- (void)applicationDidFinishLaunching:(NSNotification *)notification
+440
{
+441
_glfwPostEmptyEventCocoa();
+442
[NSApp stop:nil];
+443
}
+444
+445
- (void)applicationDidHide:(NSNotification *)notification
+446
{
+447
for (int i = 0; i < _glfw.monitorCount; i++)
+448
_glfwRestoreVideoModeCocoa(_glfw.monitors[i]);
+449
}
+450
+451
@end // GLFWApplicationDelegate
+452
+453
//////////////////////////////////////////////////////////////////////////
+454
////// GLFW platform API //////
+455
//////////////////////////////////////////////////////////////////////////
+456
+457
GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform)
+458
{
+459
const _GLFWplatform cocoa =
+460
{
+461
.platformID = GLFW_PLATFORM_COCOA,
+462
.init = _glfwInitCocoa,
+463
.terminate = _glfwTerminateCocoa,
+464
.getCursorPos = _glfwGetCursorPosCocoa,
+465
.setCursorPos = _glfwSetCursorPosCocoa,
+466
.setCursorMode = _glfwSetCursorModeCocoa,
+467
.setRawMouseMotion = _glfwSetRawMouseMotionCocoa,
+468
.rawMouseMotionSupported = _glfwRawMouseMotionSupportedCocoa,
+469
.createCursor = _glfwCreateCursorCocoa,
+470
.createStandardCursor = _glfwCreateStandardCursorCocoa,
+471
.destroyCursor = _glfwDestroyCursorCocoa,
+472
.setCursor = _glfwSetCursorCocoa,
+473
.getScancodeName = _glfwGetScancodeNameCocoa,
+474
.getKeyScancode = _glfwGetKeyScancodeCocoa,
+475
.setClipboardString = _glfwSetClipboardStringCocoa,
+476
.getClipboardString = _glfwGetClipboardStringCocoa,
+477
.initJoysticks = _glfwInitJoysticksCocoa,
+478
.terminateJoysticks = _glfwTerminateJoysticksCocoa,
+479
.pollJoystick = _glfwPollJoystickCocoa,
+480
.getMappingName = _glfwGetMappingNameCocoa,
+481
.updateGamepadGUID = _glfwUpdateGamepadGUIDCocoa,
+482
.freeMonitor = _glfwFreeMonitorCocoa,
+483
.getMonitorPos = _glfwGetMonitorPosCocoa,
+484
.getMonitorContentScale = _glfwGetMonitorContentScaleCocoa,
+485
.getMonitorWorkarea = _glfwGetMonitorWorkareaCocoa,
+486
.getVideoModes = _glfwGetVideoModesCocoa,
+487
.getVideoMode = _glfwGetVideoModeCocoa,
+488
.getGammaRamp = _glfwGetGammaRampCocoa,
+489
.setGammaRamp = _glfwSetGammaRampCocoa,
+490
.createWindow = _glfwCreateWindowCocoa,
+491
.destroyWindow = _glfwDestroyWindowCocoa,
+492
.setWindowTitle = _glfwSetWindowTitleCocoa,
+493
.setWindowIcon = _glfwSetWindowIconCocoa,
+494
.getWindowPos = _glfwGetWindowPosCocoa,
+495
.setWindowPos = _glfwSetWindowPosCocoa,
+496
.getWindowSize = _glfwGetWindowSizeCocoa,
+497
.setWindowSize = _glfwSetWindowSizeCocoa,
+498
.setWindowSizeLimits = _glfwSetWindowSizeLimitsCocoa,
+499
.setWindowAspectRatio = _glfwSetWindowAspectRatioCocoa,

Showing the first 500 of 663 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/cocoa_joystick.hadded
@@ -0,0 +1,49 @@
+1
//========================================================================
+2
// GLFW 3.5 Cocoa - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+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 <IOKit/IOKitLib.h>
+28
#include <IOKit/IOCFPlugIn.h>
+29
#include <IOKit/hid/IOHIDKeys.h>
+30
+31
#define GLFW_COCOA_JOYSTICK_STATE _GLFWjoystickNS ns;
+32
#define GLFW_COCOA_LIBRARY_JOYSTICK_STATE
+33
+34
// Cocoa-specific per-joystick data
+35
//
+36
typedef struct _GLFWjoystickNS
+37
{
+38
IOHIDDeviceRef device;
+39
CFMutableArrayRef axes;
+40
CFMutableArrayRef buttons;
+41
CFMutableArrayRef hats;
+42
} _GLFWjoystickNS;
+43
+44
GLFWbool _glfwInitJoysticksCocoa(void);
+45
void _glfwTerminateJoysticksCocoa(void);
+46
GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode);
+47
const char* _glfwGetMappingNameCocoa(void);
+48
void _glfwUpdateGamepadGUIDCocoa(char* guid);
+49
vendor/glfw/src/cocoa_joystick.madded
@@ -0,0 +1,485 @@
+1
//========================================================================
+2
// GLFW 3.5 Cocoa - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
+5
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_COCOA)
+31
+32
#include <unistd.h>
+33
#include <ctype.h>
+34
#include <string.h>
+35
+36
#include <mach/mach.h>
+37
#include <mach/mach_error.h>
+38
+39
#include <CoreFoundation/CoreFoundation.h>
+40
#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
+41
+42
+43
// Joystick element information
+44
//
+45
typedef struct _GLFWjoyelementNS
+46
{
+47
IOHIDElementRef native;
+48
uint32_t usage;
+49
int index;
+50
long minimum;
+51
long maximum;
+52
+53
} _GLFWjoyelementNS;
+54
+55
+56
// Returns the value of the specified element of the specified joystick
+57
//
+58
static long getElementValue(_GLFWjoystick* js, _GLFWjoyelementNS* element)
+59
{
+60
IOHIDValueRef valueRef;
+61
long value = 0;
+62
+63
if (js->ns.device)
+64
{
+65
if (IOHIDDeviceGetValue(js->ns.device,
+66
element->native,
+67
&valueRef) == kIOReturnSuccess)
+68
{
+69
value = IOHIDValueGetIntegerValue(valueRef);
+70
}
+71
}
+72
+73
return value;
+74
}
+75
+76
// Comparison function for matching the SDL element order
+77
//
+78
static CFComparisonResult compareElements(const void* fp,
+79
const void* sp,
+80
void* user)
+81
{
+82
const _GLFWjoyelementNS* fe = fp;
+83
const _GLFWjoyelementNS* se = sp;
+84
if (fe->usage < se->usage)
+85
return kCFCompareLessThan;
+86
if (fe->usage > se->usage)
+87
return kCFCompareGreaterThan;
+88
if (fe->index < se->index)
+89
return kCFCompareLessThan;
+90
if (fe->index > se->index)
+91
return kCFCompareGreaterThan;
+92
return kCFCompareEqualTo;
+93
}
+94
+95
// Removes the specified joystick
+96
//
+97
static void closeJoystick(_GLFWjoystick* js)
+98
{
+99
_glfwInputJoystick(js, GLFW_DISCONNECTED);
+100
+101
for (int i = 0; i < CFArrayGetCount(js->ns.axes); i++)
+102
_glfw_free((void*) CFArrayGetValueAtIndex(js->ns.axes, i));
+103
CFRelease(js->ns.axes);
+104
+105
for (int i = 0; i < CFArrayGetCount(js->ns.buttons); i++)
+106
_glfw_free((void*) CFArrayGetValueAtIndex(js->ns.buttons, i));
+107
CFRelease(js->ns.buttons);
+108
+109
for (int i = 0; i < CFArrayGetCount(js->ns.hats); i++)
+110
_glfw_free((void*) CFArrayGetValueAtIndex(js->ns.hats, i));
+111
CFRelease(js->ns.hats);
+112
+113
_glfwFreeJoystick(js);
+114
}
+115
+116
// Callback for user-initiated joystick addition
+117
//
+118
static void matchCallback(void* context,
+119
IOReturn result,
+120
void* sender,
+121
IOHIDDeviceRef device)
+122
{
+123
int jid;
+124
char name[256];
+125
char guid[33];
+126
CFTypeRef property;
+127
uint32_t vendor = 0, product = 0, version = 0;
+128
_GLFWjoystick* js;
+129
CFMutableArrayRef axes, buttons, hats;
+130
+131
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
+132
{
+133
if (_glfw.joysticks[jid].ns.device == device)
+134
return;
+135
}
+136
+137
CFArrayRef elements =
+138
IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
+139
+140
// It is reportedly possible for this to fail on macOS 13 Ventura
+141
// if the application does not have input monitoring permissions
+142
if (!elements)
+143
return;
+144
+145
axes = CFArrayCreateMutable(NULL, 0, NULL);
+146
buttons = CFArrayCreateMutable(NULL, 0, NULL);
+147
hats = CFArrayCreateMutable(NULL, 0, NULL);
+148
+149
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey));
+150
if (property)
+151
{
+152
CFStringGetCString(property,
+153
name,
+154
sizeof(name),
+155
kCFStringEncodingUTF8);
+156
}
+157
else
+158
strncpy(name, "Unknown", sizeof(name));
+159
+160
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey));
+161
if (property)
+162
CFNumberGetValue(property, kCFNumberSInt32Type, &vendor);
+163
+164
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductIDKey));
+165
if (property)
+166
CFNumberGetValue(property, kCFNumberSInt32Type, &product);
+167
+168
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVersionNumberKey));
+169
if (property)
+170
CFNumberGetValue(property, kCFNumberSInt32Type, &version);
+171
+172
// Generate a joystick GUID that matches the SDL 2.0.5+ one
+173
if (vendor && product)
+174
{
+175
sprintf(guid, "03000000%02x%02x0000%02x%02x0000%02x%02x0000",
+176
(uint8_t) vendor, (uint8_t) (vendor >> 8),
+177
(uint8_t) product, (uint8_t) (product >> 8),
+178
(uint8_t) version, (uint8_t) (version >> 8));
+179
}
+180
else
+181
{
+182
sprintf(guid, "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
+183
name[0], name[1], name[2], name[3],
+184
name[4], name[5], name[6], name[7],
+185
name[8], name[9], name[10]);
+186
}
+187
+188
for (CFIndex i = 0; i < CFArrayGetCount(elements); i++)
+189
{
+190
IOHIDElementRef native = (IOHIDElementRef)
+191
CFArrayGetValueAtIndex(elements, i);
+192
if (CFGetTypeID(native) != IOHIDElementGetTypeID())
+193
continue;
+194
+195
const IOHIDElementType type = IOHIDElementGetType(native);
+196
if ((type != kIOHIDElementTypeInput_Axis) &&
+197
(type != kIOHIDElementTypeInput_Button) &&
+198
(type != kIOHIDElementTypeInput_Misc))
+199
{
+200
continue;
+201
}
+202
+203
CFMutableArrayRef target = NULL;
+204
+205
const uint32_t usage = IOHIDElementGetUsage(native);
+206
const uint32_t page = IOHIDElementGetUsagePage(native);
+207
if (page == kHIDPage_GenericDesktop)
+208
{
+209
switch (usage)
+210
{
+211
case kHIDUsage_GD_X:
+212
case kHIDUsage_GD_Y:
+213
case kHIDUsage_GD_Z:
+214
case kHIDUsage_GD_Rx:
+215
case kHIDUsage_GD_Ry:
+216
case kHIDUsage_GD_Rz:
+217
case kHIDUsage_GD_Slider:
+218
case kHIDUsage_GD_Dial:
+219
case kHIDUsage_GD_Wheel:
+220
target = axes;
+221
break;
+222
case kHIDUsage_GD_Hatswitch:
+223
target = hats;
+224
break;
+225
case kHIDUsage_GD_DPadUp:
+226
case kHIDUsage_GD_DPadRight:
+227
case kHIDUsage_GD_DPadDown:
+228
case kHIDUsage_GD_DPadLeft:
+229
case kHIDUsage_GD_SystemMainMenu:
+230
case kHIDUsage_GD_Select:
+231
case kHIDUsage_GD_Start:
+232
target = buttons;
+233
break;
+234
}
+235
}
+236
else if (page == kHIDPage_Simulation)
+237
{
+238
switch (usage)
+239
{
+240
case kHIDUsage_Sim_Accelerator:
+241
case kHIDUsage_Sim_Brake:
+242
case kHIDUsage_Sim_Throttle:
+243
case kHIDUsage_Sim_Rudder:
+244
case kHIDUsage_Sim_Steering:
+245
target = axes;
+246
break;
+247
}
+248
}
+249
else if (page == kHIDPage_Button || page == kHIDPage_Consumer)
+250
target = buttons;
+251
+252
if (target)
+253
{
+254
_GLFWjoyelementNS* element = _glfw_calloc(1, sizeof(_GLFWjoyelementNS));
+255
element->native = native;
+256
element->usage = usage;
+257
element->index = (int) CFArrayGetCount(target);
+258
element->minimum = IOHIDElementGetLogicalMin(native);
+259
element->maximum = IOHIDElementGetLogicalMax(native);
+260
CFArrayAppendValue(target, element);
+261
}
+262
}
+263
+264
CFRelease(elements);
+265
+266
CFArraySortValues(axes, CFRangeMake(0, CFArrayGetCount(axes)),
+267
compareElements, NULL);
+268
CFArraySortValues(buttons, CFRangeMake(0, CFArrayGetCount(buttons)),
+269
compareElements, NULL);
+270
CFArraySortValues(hats, CFRangeMake(0, CFArrayGetCount(hats)),
+271
compareElements, NULL);
+272
+273
js = _glfwAllocJoystick(name, guid,
+274
(int) CFArrayGetCount(axes),
+275
(int) CFArrayGetCount(buttons),
+276
(int) CFArrayGetCount(hats));
+277
+278
js->ns.device = device;
+279
js->ns.axes = axes;
+280
js->ns.buttons = buttons;
+281
js->ns.hats = hats;
+282
+283
_glfwInputJoystick(js, GLFW_CONNECTED);
+284
}
+285
+286
// Callback for user-initiated joystick removal
+287
//
+288
static void removeCallback(void* context,
+289
IOReturn result,
+290
void* sender,
+291
IOHIDDeviceRef device)
+292
{
+293
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
+294
{
+295
if (_glfw.joysticks[jid].connected && _glfw.joysticks[jid].ns.device == device)
+296
{
+297
closeJoystick(&_glfw.joysticks[jid]);
+298
break;
+299
}
+300
}
+301
}
+302
+303
+304
//////////////////////////////////////////////////////////////////////////
+305
////// GLFW platform API //////
+306
//////////////////////////////////////////////////////////////////////////
+307
+308
GLFWbool _glfwInitJoysticksCocoa(void)
+309
{
+310
CFMutableArrayRef matching;
+311
const long usages[] =
+312
{
+313
kHIDUsage_GD_Joystick,
+314
kHIDUsage_GD_GamePad,
+315
kHIDUsage_GD_MultiAxisController
+316
};
+317
+318
_glfw.ns.hidManager = IOHIDManagerCreate(kCFAllocatorDefault,
+319
kIOHIDOptionsTypeNone);
+320
+321
matching = CFArrayCreateMutable(kCFAllocatorDefault,
+322
0,
+323
&kCFTypeArrayCallBacks);
+324
if (!matching)
+325
{
+326
_glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create array");
+327
return GLFW_FALSE;
+328
}
+329
+330
for (size_t i = 0; i < sizeof(usages) / sizeof(long); i++)
+331
{
+332
const long page = kHIDPage_GenericDesktop;
+333
+334
CFMutableDictionaryRef dict =
+335
CFDictionaryCreateMutable(kCFAllocatorDefault,
+336
0,
+337
&kCFTypeDictionaryKeyCallBacks,
+338
&kCFTypeDictionaryValueCallBacks);
+339
if (!dict)
+340
continue;
+341
+342
CFNumberRef pageRef = CFNumberCreate(kCFAllocatorDefault,
+343
kCFNumberLongType,
+344
&page);
+345
CFNumberRef usageRef = CFNumberCreate(kCFAllocatorDefault,
+346
kCFNumberLongType,
+347
&usages[i]);
+348
if (pageRef && usageRef)
+349
{
+350
CFDictionarySetValue(dict,
+351
CFSTR(kIOHIDDeviceUsagePageKey),
+352
pageRef);
+353
CFDictionarySetValue(dict,
+354
CFSTR(kIOHIDDeviceUsageKey),
+355
usageRef);
+356
CFArrayAppendValue(matching, dict);
+357
}
+358
+359
if (pageRef)
+360
CFRelease(pageRef);
+361
if (usageRef)
+362
CFRelease(usageRef);
+363
+364
CFRelease(dict);
+365
}
+366
+367
IOHIDManagerSetDeviceMatchingMultiple(_glfw.ns.hidManager, matching);
+368
CFRelease(matching);
+369
+370
IOHIDManagerRegisterDeviceMatchingCallback(_glfw.ns.hidManager,
+371
&matchCallback, NULL);
+372
IOHIDManagerRegisterDeviceRemovalCallback(_glfw.ns.hidManager,
+373
&removeCallback, NULL);
+374
IOHIDManagerScheduleWithRunLoop(_glfw.ns.hidManager,
+375
CFRunLoopGetMain(),
+376
kCFRunLoopDefaultMode);
+377
IOHIDManagerOpen(_glfw.ns.hidManager, kIOHIDOptionsTypeNone);
+378
+379
// Execute the run loop once in order to register any initially-attached
+380
// joysticks
+381
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false);
+382
return GLFW_TRUE;
+383
}
+384
+385
void _glfwTerminateJoysticksCocoa(void)
+386
{
+387
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
+388
{
+389
if (_glfw.joysticks[jid].connected)
+390
closeJoystick(&_glfw.joysticks[jid]);
+391
}
+392
+393
if (_glfw.ns.hidManager)
+394
{
+395
CFRelease(_glfw.ns.hidManager);
+396
_glfw.ns.hidManager = NULL;
+397
}
+398
}
+399
+400
+401
GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode)
+402
{
+403
if (mode & _GLFW_POLL_AXES)
+404
{
+405
for (CFIndex i = 0; i < CFArrayGetCount(js->ns.axes); i++)
+406
{
+407
_GLFWjoyelementNS* axis = (_GLFWjoyelementNS*)
+408
CFArrayGetValueAtIndex(js->ns.axes, i);
+409
+410
const long raw = getElementValue(js, axis);
+411
// Perform auto calibration
+412
if (raw < axis->minimum)
+413
axis->minimum = raw;
+414
if (raw > axis->maximum)
+415
axis->maximum = raw;
+416
+417
const long size = axis->maximum - axis->minimum;
+418
if (size == 0)
+419
_glfwInputJoystickAxis(js, (int) i, 0.f);
+420
else
+421
{
+422
const float value = (2.f * (raw - axis->minimum) / size) - 1.f;
+423
_glfwInputJoystickAxis(js, (int) i, value);
+424
}
+425
}
+426
}
+427
+428
if (mode & _GLFW_POLL_BUTTONS)
+429
{
+430
for (CFIndex i = 0; i < CFArrayGetCount(js->ns.buttons); i++)
+431
{
+432
_GLFWjoyelementNS* button = (_GLFWjoyelementNS*)
+433
CFArrayGetValueAtIndex(js->ns.buttons, i);
+434
const char value = getElementValue(js, button) - button->minimum;
+435
const int state = (value > 0) ? GLFW_PRESS : GLFW_RELEASE;
+436
_glfwInputJoystickButton(js, (int) i, state);
+437
}
+438
+439
for (CFIndex i = 0; i < CFArrayGetCount(js->ns.hats); i++)
+440
{
+441
const int states[9] =
+442
{
+443
GLFW_HAT_UP,
+444
GLFW_HAT_RIGHT_UP,
+445
GLFW_HAT_RIGHT,
+446
GLFW_HAT_RIGHT_DOWN,
+447
GLFW_HAT_DOWN,
+448
GLFW_HAT_LEFT_DOWN,
+449
GLFW_HAT_LEFT,
+450
GLFW_HAT_LEFT_UP,
+451
GLFW_HAT_CENTERED
+452
};
+453
+454
_GLFWjoyelementNS* hat = (_GLFWjoyelementNS*)
+455
CFArrayGetValueAtIndex(js->ns.hats, i);
+456
long state = getElementValue(js, hat) - hat->minimum;
+457
if (state < 0 || state > 8)
+458
state = 8;
+459
+460
_glfwInputJoystickHat(js, (int) i, states[state]);
+461
}
+462
}
+463
+464
return js->connected;
+465
}
+466
+467
const char* _glfwGetMappingNameCocoa(void)
+468
{
+469
return "Mac OS X";
+470
}
+471
+472
void _glfwUpdateGamepadGUIDCocoa(char* guid)
+473
{
+474
if ((strncmp(guid + 4, "000000000000", 12) == 0) &&
+475
(strncmp(guid + 20, "000000000000", 12) == 0))
+476
{
+477
char original[33];
+478
strncpy(original, guid, sizeof(original) - 1);
+479
sprintf(guid, "03000000%.4s0000%.4s000000000000",
+480
original, original + 16);
+481
}
+482
}
+483
+484
#endif // _GLFW_COCOA
+485
vendor/glfw/src/cocoa_monitor.madded
@@ -0,0 +1,646 @@
+1
//========================================================================
+2
// GLFW 3.5 Cocoa - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_COCOA)
+31
+32
#include <stdlib.h>
+33
#include <limits.h>
+34
#include <math.h>
+35
#include <assert.h>
+36
+37
#include <IOKit/graphics/IOGraphicsLib.h>
+38
#include <ApplicationServices/ApplicationServices.h>
+39
+40
+41
// Get the name of the specified display, or NULL
+42
//
+43
static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
+44
{
+45
// IOKit doesn't work on Apple Silicon anymore
+46
// Luckily, 10.15 introduced -[NSScreen localizedName].
+47
// Use it if available, and fall back to IOKit otherwise.
+48
if (screen)
+49
{
+50
if ([screen respondsToSelector:@selector(localizedName)])
+51
{
+52
NSString* name = [screen valueForKey:@"localizedName"];
+53
if (name)
+54
return _glfw_strdup([name UTF8String]);
+55
}
+56
}
+57
+58
io_iterator_t it;
+59
io_service_t service;
+60
CFDictionaryRef info;
+61
+62
if (IOServiceGetMatchingServices(MACH_PORT_NULL,
+63
IOServiceMatching("IODisplayConnect"),
+64
&it) != 0)
+65
{
+66
// This may happen if a desktop Mac is running headless
+67
return _glfw_strdup("Display");
+68
}
+69
+70
while ((service = IOIteratorNext(it)) != 0)
+71
{
+72
info = IODisplayCreateInfoDictionary(service,
+73
kIODisplayOnlyPreferredName);
+74
+75
CFNumberRef vendorIDRef =
+76
CFDictionaryGetValue(info, CFSTR(kDisplayVendorID));
+77
CFNumberRef productIDRef =
+78
CFDictionaryGetValue(info, CFSTR(kDisplayProductID));
+79
if (!vendorIDRef || !productIDRef)
+80
{
+81
CFRelease(info);
+82
continue;
+83
}
+84
+85
unsigned int vendorID, productID;
+86
CFNumberGetValue(vendorIDRef, kCFNumberIntType, &vendorID);
+87
CFNumberGetValue(productIDRef, kCFNumberIntType, &productID);
+88
+89
if (CGDisplayVendorNumber(displayID) == vendorID &&
+90
CGDisplayModelNumber(displayID) == productID)
+91
{
+92
// Info dictionary is used and freed below
+93
break;
+94
}
+95
+96
CFRelease(info);
+97
}
+98
+99
IOObjectRelease(it);
+100
+101
if (!service)
+102
return _glfw_strdup("Display");
+103
+104
CFDictionaryRef names =
+105
CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
+106
+107
CFStringRef nameRef;
+108
+109
if (!names || !CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
+110
(const void**) &nameRef))
+111
{
+112
// This may happen if a desktop Mac is running headless
+113
CFRelease(info);
+114
return _glfw_strdup("Display");
+115
}
+116
+117
const CFIndex size =
+118
CFStringGetMaximumSizeForEncoding(CFStringGetLength(nameRef),
+119
kCFStringEncodingUTF8);
+120
char* name = _glfw_calloc(size + 1, 1);
+121
CFStringGetCString(nameRef, name, size, kCFStringEncodingUTF8);
+122
+123
CFRelease(info);
+124
return name;
+125
}
+126
+127
// Check whether the display mode should be included in enumeration
+128
//
+129
static GLFWbool modeIsGood(CGDisplayModeRef mode)
+130
{
+131
uint32_t flags = CGDisplayModeGetIOFlags(mode);
+132
+133
if (!(flags & kDisplayModeValidFlag) || !(flags & kDisplayModeSafeFlag))
+134
return GLFW_FALSE;
+135
if (flags & kDisplayModeInterlacedFlag)
+136
return GLFW_FALSE;
+137
if (flags & kDisplayModeStretchedFlag)
+138
return GLFW_FALSE;
+139
+140
#if MAC_OS_X_VERSION_MAX_ALLOWED == 101100
+141
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
+142
if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) &&
+143
CFStringCompare(format, CFSTR(IO32BitDirectPixels), 0))
+144
{
+145
CFRelease(format);
+146
return GLFW_FALSE;
+147
}
+148
+149
CFRelease(format);
+150
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+151
return GLFW_TRUE;
+152
}
+153
+154
// Convert Core Graphics display mode to GLFW video mode
+155
//
+156
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
+157
double fallbackRefreshRate)
+158
{
+159
GLFWvidmode result;
+160
result.width = (int) CGDisplayModeGetWidth(mode);
+161
result.height = (int) CGDisplayModeGetHeight(mode);
+162
result.refreshRate = (int) round(CGDisplayModeGetRefreshRate(mode));
+163
+164
if (result.refreshRate == 0)
+165
result.refreshRate = (int) round(fallbackRefreshRate);
+166
+167
#if MAC_OS_X_VERSION_MAX_ALLOWED == 101100
+168
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
+169
if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0)
+170
{
+171
result.redBits = 5;
+172
result.greenBits = 5;
+173
result.blueBits = 5;
+174
}
+175
else
+176
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+177
{
+178
result.redBits = 8;
+179
result.greenBits = 8;
+180
result.blueBits = 8;
+181
}
+182
+183
#if MAC_OS_X_VERSION_MAX_ALLOWED == 101100
+184
CFRelease(format);
+185
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+186
return result;
+187
}
+188
+189
// Starts reservation for display fading
+190
//
+191
static CGDisplayFadeReservationToken beginFadeReservation(void)
+192
{
+193
CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken;
+194
+195
if (CGAcquireDisplayFadeReservation(5, &token) == kCGErrorSuccess)
+196
{
+197
CGDisplayFade(token, 0.3,
+198
kCGDisplayBlendNormal,
+199
kCGDisplayBlendSolidColor,
+200
0.0, 0.0, 0.0,
+201
TRUE);
+202
}
+203
+204
return token;
+205
}
+206
+207
// Ends reservation for display fading
+208
//
+209
static void endFadeReservation(CGDisplayFadeReservationToken token)
+210
{
+211
if (token != kCGDisplayFadeReservationInvalidToken)
+212
{
+213
CGDisplayFade(token, 0.5,
+214
kCGDisplayBlendSolidColor,
+215
kCGDisplayBlendNormal,
+216
0.0, 0.0, 0.0,
+217
FALSE);
+218
CGReleaseDisplayFadeReservation(token);
+219
}
+220
}
+221
+222
// Returns the display refresh rate queried from the I/O registry
+223
//
+224
static double getFallbackRefreshRate(CGDirectDisplayID displayID)
+225
{
+226
double refreshRate = 60.0;
+227
+228
io_iterator_t it;
+229
io_service_t service;
+230
+231
if (IOServiceGetMatchingServices(MACH_PORT_NULL,
+232
IOServiceMatching("IOFramebuffer"),
+233
&it) != 0)
+234
{
+235
return refreshRate;
+236
}
+237
+238
while ((service = IOIteratorNext(it)) != 0)
+239
{
+240
const CFNumberRef indexRef =
+241
IORegistryEntryCreateCFProperty(service,
+242
CFSTR("IOFramebufferOpenGLIndex"),
+243
kCFAllocatorDefault,
+244
kNilOptions);
+245
if (!indexRef)
+246
continue;
+247
+248
uint32_t index = 0;
+249
CFNumberGetValue(indexRef, kCFNumberIntType, &index);
+250
CFRelease(indexRef);
+251
+252
if (CGOpenGLDisplayMaskToDisplayID(1 << index) != displayID)
+253
continue;
+254
+255
const CFNumberRef clockRef =
+256
IORegistryEntryCreateCFProperty(service,
+257
CFSTR("IOFBCurrentPixelClock"),
+258
kCFAllocatorDefault,
+259
kNilOptions);
+260
const CFNumberRef countRef =
+261
IORegistryEntryCreateCFProperty(service,
+262
CFSTR("IOFBCurrentPixelCount"),
+263
kCFAllocatorDefault,
+264
kNilOptions);
+265
+266
uint32_t clock = 0, count = 0;
+267
+268
if (clockRef)
+269
{
+270
CFNumberGetValue(clockRef, kCFNumberIntType, &clock);
+271
CFRelease(clockRef);
+272
}
+273
+274
if (countRef)
+275
{
+276
CFNumberGetValue(countRef, kCFNumberIntType, &count);
+277
CFRelease(countRef);
+278
}
+279
+280
if (clock > 0 && count > 0)
+281
refreshRate = clock / (double) count;
+282
+283
break;
+284
}
+285
+286
IOObjectRelease(it);
+287
return refreshRate;
+288
}
+289
+290
+291
//////////////////////////////////////////////////////////////////////////
+292
////// GLFW internal API //////
+293
//////////////////////////////////////////////////////////////////////////
+294
+295
// Poll for changes in the set of connected monitors
+296
//
+297
void _glfwPollMonitorsCocoa(void)
+298
{
+299
uint32_t displayCount;
+300
CGGetOnlineDisplayList(0, NULL, &displayCount);
+301
CGDirectDisplayID* displays = _glfw_calloc(displayCount, sizeof(CGDirectDisplayID));
+302
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
+303
+304
for (int i = 0; i < _glfw.monitorCount; i++)
+305
_glfw.monitors[i]->ns.screen = nil;
+306
+307
_GLFWmonitor** disconnected = NULL;
+308
uint32_t disconnectedCount = _glfw.monitorCount;
+309
if (disconnectedCount)
+310
{
+311
disconnected = _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
+312
memcpy(disconnected,
+313
_glfw.monitors,
+314
_glfw.monitorCount * sizeof(_GLFWmonitor*));
+315
}
+316
+317
for (uint32_t i = 0; i < displayCount; i++)
+318
{
+319
if (CGDisplayIsAsleep(displays[i]))
+320
continue;
+321
+322
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
+323
NSScreen* screen = nil;
+324
+325
for (screen in [NSScreen screens])
+326
{
+327
NSNumber* screenNumber = [screen deviceDescription][@"NSScreenNumber"];
+328
+329
// HACK: Compare unit numbers instead of display IDs to work around
+330
// display replacement on machines with automatic graphics
+331
// switching
+332
if (CGDisplayUnitNumber([screenNumber unsignedIntValue]) == unitNumber)
+333
break;
+334
}
+335
+336
// HACK: Compare unit numbers instead of display IDs to work around
+337
// display replacement on machines with automatic graphics
+338
// switching
+339
uint32_t j;
+340
for (j = 0; j < disconnectedCount; j++)
+341
{
+342
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
+343
{
+344
disconnected[j]->ns.screen = screen;
+345
disconnected[j] = NULL;
+346
break;
+347
}
+348
}
+349
+350
if (j < disconnectedCount)
+351
continue;
+352
+353
const CGSize size = CGDisplayScreenSize(displays[i]);
+354
char* name = getMonitorName(displays[i], screen);
+355
if (!name)
+356
continue;
+357
+358
_GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
+359
monitor->ns.displayID = displays[i];
+360
monitor->ns.unitNumber = unitNumber;
+361
monitor->ns.screen = screen;
+362
+363
_glfw_free(name);
+364
+365
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displays[i]);
+366
if (CGDisplayModeGetRefreshRate(mode) == 0.0)
+367
monitor->ns.fallbackRefreshRate = getFallbackRefreshRate(displays[i]);
+368
CGDisplayModeRelease(mode);
+369
+370
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
+371
}
+372
+373
for (uint32_t i = 0; i < disconnectedCount; i++)
+374
{
+375
if (disconnected[i])
+376
_glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
+377
}
+378
+379
_glfw_free(disconnected);
+380
_glfw_free(displays);
+381
}
+382
+383
// Change the current video mode
+384
//
+385
void _glfwSetVideoModeCocoa(_GLFWmonitor* monitor, const GLFWvidmode* desired)
+386
{
+387
GLFWvidmode current;
+388
_glfwGetVideoModeCocoa(monitor, &current);
+389
+390
const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired);
+391
if (_glfwCompareVideoModes(&current, best) == 0)
+392
return;
+393
+394
CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
+395
const CFIndex count = CFArrayGetCount(modes);
+396
CGDisplayModeRef native = NULL;
+397
+398
for (CFIndex i = 0; i < count; i++)
+399
{
+400
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
+401
if (!modeIsGood(dm))
+402
continue;
+403
+404
const GLFWvidmode mode =
+405
vidmodeFromCGDisplayMode(dm, monitor->ns.fallbackRefreshRate);
+406
if (_glfwCompareVideoModes(best, &mode) == 0)
+407
{
+408
native = dm;
+409
break;
+410
}
+411
}
+412
+413
if (native)
+414
{
+415
if (monitor->ns.previousMode == NULL)
+416
monitor->ns.previousMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
+417
+418
CGDisplayFadeReservationToken token = beginFadeReservation();
+419
CGDisplaySetDisplayMode(monitor->ns.displayID, native, NULL);
+420
endFadeReservation(token);
+421
}
+422
+423
CFRelease(modes);
+424
}
+425
+426
// Restore the previously saved (original) video mode
+427
//
+428
void _glfwRestoreVideoModeCocoa(_GLFWmonitor* monitor)
+429
{
+430
if (monitor->ns.previousMode)
+431
{
+432
CGDisplayFadeReservationToken token = beginFadeReservation();
+433
CGDisplaySetDisplayMode(monitor->ns.displayID,
+434
monitor->ns.previousMode, NULL);
+435
endFadeReservation(token);
+436
+437
CGDisplayModeRelease(monitor->ns.previousMode);
+438
monitor->ns.previousMode = NULL;
+439
}
+440
}
+441
+442
+443
//////////////////////////////////////////////////////////////////////////
+444
////// GLFW platform API //////
+445
//////////////////////////////////////////////////////////////////////////
+446
+447
void _glfwFreeMonitorCocoa(_GLFWmonitor* monitor)
+448
{
+449
}
+450
+451
void _glfwGetMonitorPosCocoa(_GLFWmonitor* monitor, int* xpos, int* ypos)
+452
{
+453
@autoreleasepool {
+454
+455
const CGRect bounds = CGDisplayBounds(monitor->ns.displayID);
+456
+457
if (xpos)
+458
*xpos = (int) bounds.origin.x;
+459
if (ypos)
+460
*ypos = (int) bounds.origin.y;
+461
+462
} // autoreleasepool
+463
}
+464
+465
void _glfwGetMonitorContentScaleCocoa(_GLFWmonitor* monitor,
+466
float* xscale, float* yscale)
+467
{
+468
@autoreleasepool {
+469
+470
if (!monitor->ns.screen)
+471
{
+472
_glfwInputError(GLFW_PLATFORM_ERROR,
+473
"Cocoa: Cannot query content scale without screen");
+474
}
+475
+476
const NSRect points = [monitor->ns.screen frame];
+477
const NSRect pixels = [monitor->ns.screen convertRectToBacking:points];
+478
+479
if (xscale)
+480
*xscale = (float) (pixels.size.width / points.size.width);
+481
if (yscale)
+482
*yscale = (float) (pixels.size.height / points.size.height);
+483
+484
} // autoreleasepool
+485
}
+486
+487
void _glfwGetMonitorWorkareaCocoa(_GLFWmonitor* monitor,
+488
int* xpos, int* ypos,
+489
int* width, int* height)
+490
{
+491
@autoreleasepool {
+492
+493
if (!monitor->ns.screen)
+494
{
+495
_glfwInputError(GLFW_PLATFORM_ERROR,
+496
"Cocoa: Cannot query workarea without screen");
+497
}
+498
+499
const NSRect frameRect = [monitor->ns.screen visibleFrame];

Showing the first 500 of 647 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/cocoa_platform.hadded
@@ -0,0 +1,300 @@
+1
//========================================================================
+2
// GLFW 3.5 Cocoa - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
+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 <stdint.h>
+28
+29
#include <Carbon/Carbon.h>
+30
#include <IOKit/hid/IOHIDLib.h>
+31
+32
// NOTE: All of NSGL was deprecated in the 10.14 SDK
+33
// This disables the pointless warnings for every symbol we use
+34
#ifndef GL_SILENCE_DEPRECATION
+35
#define GL_SILENCE_DEPRECATION
+36
#endif
+37
+38
#if defined(__OBJC__)
+39
#import <Cocoa/Cocoa.h>
+40
#else
+41
typedef void* id;
+42
#endif
+43
+44
// NOTE: Many Cocoa enum values have been renamed and we need to build across
+45
// SDK versions where one is unavailable or deprecated.
+46
// We use the newer names in code and replace them with the older names if
+47
// the base SDK does not provide the newer names.
+48
+49
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
+50
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
+51
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
+52
#endif
+53
+54
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
+55
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
+56
#define NSEventMaskAny NSAnyEventMask
+57
#define NSEventMaskKeyUp NSKeyUpMask
+58
#define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask
+59
#define NSEventModifierFlagCommand NSCommandKeyMask
+60
#define NSEventModifierFlagControl NSControlKeyMask
+61
#define NSEventModifierFlagDeviceIndependentFlagsMask NSDeviceIndependentModifierFlagsMask
+62
#define NSEventModifierFlagOption NSAlternateKeyMask
+63
#define NSEventModifierFlagShift NSShiftKeyMask
+64
#define NSEventTypeApplicationDefined NSApplicationDefined
+65
#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
+66
#define NSWindowStyleMaskClosable NSClosableWindowMask
+67
#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
+68
#define NSWindowStyleMaskResizable NSResizableWindowMask
+69
#define NSWindowStyleMaskTitled NSTitledWindowMask
+70
#endif
+71
+72
// NOTE: Many Cocoa dynamically linked constants have been renamed and we need
+73
// to build across SDK versions where one is unavailable or deprecated.
+74
// We use the newer names in code and replace them with the older names if
+75
// the deployment target is older than the newer names.
+76
+77
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+78
#define NSPasteboardTypeURL NSURLPboardType
+79
#endif
+80
+81
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
+82
typedef VkFlags VkMetalSurfaceCreateFlagsEXT;
+83
+84
typedef struct VkMacOSSurfaceCreateInfoMVK
+85
{
+86
VkStructureType sType;
+87
const void* pNext;
+88
VkMacOSSurfaceCreateFlagsMVK flags;
+89
const void* pView;
+90
} VkMacOSSurfaceCreateInfoMVK;
+91
+92
typedef struct VkMetalSurfaceCreateInfoEXT
+93
{
+94
VkStructureType sType;
+95
const void* pNext;
+96
VkMetalSurfaceCreateFlagsEXT flags;
+97
const void* pLayer;
+98
} VkMetalSurfaceCreateInfoEXT;
+99
+100
typedef VkResult (APIENTRY *PFN_vkCreateMacOSSurfaceMVK)(VkInstance,const VkMacOSSurfaceCreateInfoMVK*,const VkAllocationCallbacks*,VkSurfaceKHR*);
+101
typedef VkResult (APIENTRY *PFN_vkCreateMetalSurfaceEXT)(VkInstance,const VkMetalSurfaceCreateInfoEXT*,const VkAllocationCallbacks*,VkSurfaceKHR*);
+102
+103
#define GLFW_COCOA_WINDOW_STATE _GLFWwindowNS ns;
+104
#define GLFW_COCOA_LIBRARY_WINDOW_STATE _GLFWlibraryNS ns;
+105
#define GLFW_COCOA_MONITOR_STATE _GLFWmonitorNS ns;
+106
#define GLFW_COCOA_CURSOR_STATE _GLFWcursorNS ns;
+107
+108
#define GLFW_NSGL_CONTEXT_STATE _GLFWcontextNSGL nsgl;
+109
#define GLFW_NSGL_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl;
+110
+111
// HIToolbox.framework pointer typedefs
+112
#define kTISPropertyUnicodeKeyLayoutData _glfw.ns.tis.kPropertyUnicodeKeyLayoutData
+113
typedef TISInputSourceRef (*PFN_TISCopyCurrentKeyboardLayoutInputSource)(void);
+114
#define TISCopyCurrentKeyboardLayoutInputSource _glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource
+115
typedef void* (*PFN_TISGetInputSourceProperty)(TISInputSourceRef,CFStringRef);
+116
#define TISGetInputSourceProperty _glfw.ns.tis.GetInputSourceProperty
+117
typedef UInt8 (*PFN_LMGetKbdType)(void);
+118
#define LMGetKbdType _glfw.ns.tis.GetKbdType
+119
+120
+121
// NSGL-specific per-context data
+122
//
+123
typedef struct _GLFWcontextNSGL
+124
{
+125
id pixelFormat;
+126
id object;
+127
} _GLFWcontextNSGL;
+128
+129
// NSGL-specific global data
+130
//
+131
typedef struct _GLFWlibraryNSGL
+132
{
+133
// dlopen handle for OpenGL.framework (for glfwGetProcAddress)
+134
CFBundleRef framework;
+135
} _GLFWlibraryNSGL;
+136
+137
// Cocoa-specific per-window data
+138
//
+139
typedef struct _GLFWwindowNS
+140
{
+141
id object;
+142
id delegate;
+143
id view;
+144
id layer;
+145
+146
GLFWbool maximized;
+147
GLFWbool occluded;
+148
GLFWbool scaleFramebuffer;
+149
+150
// Cached window properties to filter out duplicate events
+151
int width, height;
+152
int fbWidth, fbHeight;
+153
float xscale, yscale;
+154
+155
// The total sum of the distances the cursor has been warped
+156
// since the last cursor motion event was processed
+157
// This is kept to counteract Cocoa doing the same internally
+158
double cursorWarpDeltaX, cursorWarpDeltaY;
+159
} _GLFWwindowNS;
+160
+161
// Cocoa-specific global data
+162
//
+163
typedef struct _GLFWlibraryNS
+164
{
+165
CGEventSourceRef eventSource;
+166
id delegate;
+167
GLFWbool cursorHidden;
+168
TISInputSourceRef inputSource;
+169
IOHIDManagerRef hidManager;
+170
id unicodeData;
+171
id helper;
+172
id keyUpMonitor;
+173
id nibObjects;
+174
+175
char keynames[GLFW_KEY_LAST + 1][17];
+176
short int keycodes[256];
+177
short int scancodes[GLFW_KEY_LAST + 1];
+178
char* clipboardString;
+179
CGPoint cascadePoint;
+180
// Where to place the cursor when re-enabled
+181
double restoreCursorPosX, restoreCursorPosY;
+182
// The window whose disabled cursor mode is active
+183
_GLFWwindow* disabledCursorWindow;
+184
+185
struct {
+186
CFBundleRef bundle;
+187
PFN_TISCopyCurrentKeyboardLayoutInputSource CopyCurrentKeyboardLayoutInputSource;
+188
PFN_TISGetInputSourceProperty GetInputSourceProperty;
+189
PFN_LMGetKbdType GetKbdType;
+190
CFStringRef kPropertyUnicodeKeyLayoutData;
+191
} tis;
+192
} _GLFWlibraryNS;
+193
+194
// Cocoa-specific per-monitor data
+195
//
+196
typedef struct _GLFWmonitorNS
+197
{
+198
CGDirectDisplayID displayID;
+199
CGDisplayModeRef previousMode;
+200
uint32_t unitNumber;
+201
id screen;
+202
double fallbackRefreshRate;
+203
} _GLFWmonitorNS;
+204
+205
// Cocoa-specific per-cursor data
+206
//
+207
typedef struct _GLFWcursorNS
+208
{
+209
id object;
+210
} _GLFWcursorNS;
+211
+212
+213
GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform);
+214
int _glfwInitCocoa(void);
+215
void _glfwTerminateCocoa(void);
+216
+217
GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
+218
void _glfwDestroyWindowCocoa(_GLFWwindow* window);
+219
void _glfwSetWindowTitleCocoa(_GLFWwindow* window, const char* title);
+220
void _glfwSetWindowIconCocoa(_GLFWwindow* window, int count, const GLFWimage* images);
+221
void _glfwGetWindowPosCocoa(_GLFWwindow* window, int* xpos, int* ypos);
+222
void _glfwSetWindowPosCocoa(_GLFWwindow* window, int xpos, int ypos);
+223
void _glfwGetWindowSizeCocoa(_GLFWwindow* window, int* width, int* height);
+224
void _glfwSetWindowSizeCocoa(_GLFWwindow* window, int width, int height);
+225
void _glfwSetWindowSizeLimitsCocoa(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
+226
void _glfwSetWindowAspectRatioCocoa(_GLFWwindow* window, int numer, int denom);
+227
void _glfwGetFramebufferSizeCocoa(_GLFWwindow* window, int* width, int* height);
+228
void _glfwGetWindowFrameSizeCocoa(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
+229
void _glfwGetWindowContentScaleCocoa(_GLFWwindow* window, float* xscale, float* yscale);
+230
void _glfwIconifyWindowCocoa(_GLFWwindow* window);
+231
void _glfwRestoreWindowCocoa(_GLFWwindow* window);
+232
void _glfwMaximizeWindowCocoa(_GLFWwindow* window);
+233
void _glfwShowWindowCocoa(_GLFWwindow* window);
+234
void _glfwHideWindowCocoa(_GLFWwindow* window);
+235
void _glfwRequestWindowAttentionCocoa(_GLFWwindow* window);
+236
void _glfwFocusWindowCocoa(_GLFWwindow* window);
+237
void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
+238
GLFWbool _glfwWindowFocusedCocoa(_GLFWwindow* window);
+239
GLFWbool _glfwWindowIconifiedCocoa(_GLFWwindow* window);
+240
GLFWbool _glfwWindowVisibleCocoa(_GLFWwindow* window);
+241
GLFWbool _glfwWindowMaximizedCocoa(_GLFWwindow* window);
+242
GLFWbool _glfwWindowHoveredCocoa(_GLFWwindow* window);
+243
GLFWbool _glfwFramebufferTransparentCocoa(_GLFWwindow* window);
+244
void _glfwSetWindowResizableCocoa(_GLFWwindow* window, GLFWbool enabled);
+245
void _glfwSetWindowDecoratedCocoa(_GLFWwindow* window, GLFWbool enabled);
+246
void _glfwSetWindowFloatingCocoa(_GLFWwindow* window, GLFWbool enabled);
+247
float _glfwGetWindowOpacityCocoa(_GLFWwindow* window);
+248
void _glfwSetWindowOpacityCocoa(_GLFWwindow* window, float opacity);
+249
void _glfwSetWindowMousePassthroughCocoa(_GLFWwindow* window, GLFWbool enabled);
+250
+251
void _glfwSetRawMouseMotionCocoa(_GLFWwindow *window, GLFWbool enabled);
+252
GLFWbool _glfwRawMouseMotionSupportedCocoa(void);
+253
+254
void _glfwPollEventsCocoa(void);
+255
void _glfwWaitEventsCocoa(void);
+256
void _glfwWaitEventsTimeoutCocoa(double timeout);
+257
void _glfwPostEmptyEventCocoa(void);
+258
+259
void _glfwGetCursorPosCocoa(_GLFWwindow* window, double* xpos, double* ypos);
+260
void _glfwSetCursorPosCocoa(_GLFWwindow* window, double xpos, double ypos);
+261
void _glfwSetCursorModeCocoa(_GLFWwindow* window, int mode);
+262
const char* _glfwGetScancodeNameCocoa(int scancode);
+263
int _glfwGetKeyScancodeCocoa(int key);
+264
GLFWbool _glfwCreateCursorCocoa(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
+265
GLFWbool _glfwCreateStandardCursorCocoa(_GLFWcursor* cursor, int shape);
+266
void _glfwDestroyCursorCocoa(_GLFWcursor* cursor);
+267
void _glfwSetCursorCocoa(_GLFWwindow* window, _GLFWcursor* cursor);
+268
void _glfwSetClipboardStringCocoa(const char* string);
+269
const char* _glfwGetClipboardStringCocoa(void);
+270
+271
EGLenum _glfwGetEGLPlatformCocoa(EGLint** attribs);
+272
EGLNativeDisplayType _glfwGetEGLNativeDisplayCocoa(void);
+273
EGLNativeWindowType _glfwGetEGLNativeWindowCocoa(_GLFWwindow* window);
+274
+275
void _glfwGetRequiredInstanceExtensionsCocoa(char** extensions);
+276
GLFWbool _glfwGetPhysicalDevicePresentationSupportCocoa(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
+277
VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
+278
+279
void _glfwFreeMonitorCocoa(_GLFWmonitor* monitor);
+280
void _glfwGetMonitorPosCocoa(_GLFWmonitor* monitor, int* xpos, int* ypos);
+281
void _glfwGetMonitorContentScaleCocoa(_GLFWmonitor* monitor, float* xscale, float* yscale);
+282
void _glfwGetMonitorWorkareaCocoa(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
+283
GLFWvidmode* _glfwGetVideoModesCocoa(_GLFWmonitor* monitor, int* count);
+284
GLFWbool _glfwGetVideoModeCocoa(_GLFWmonitor* monitor, GLFWvidmode* mode);
+285
GLFWbool _glfwGetGammaRampCocoa(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
+286
void _glfwSetGammaRampCocoa(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
+287
+288
void _glfwPollMonitorsCocoa(void);
+289
void _glfwSetVideoModeCocoa(_GLFWmonitor* monitor, const GLFWvidmode* desired);
+290
void _glfwRestoreVideoModeCocoa(_GLFWmonitor* monitor);
+291
+292
float _glfwTransformYCocoa(float y);
+293
+294
GLFWbool _glfwInitNSGL(void);
+295
void _glfwTerminateNSGL(void);
+296
GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
+297
const _GLFWctxconfig* ctxconfig,
+298
const _GLFWfbconfig* fbconfig);
+299
void _glfwDestroyContextNSGL(_GLFWwindow* window);
+300
vendor/glfw/src/cocoa_window.madded
@@ -0,0 +1,2091 @@
+1
//========================================================================
+2
// GLFW 3.5 Cocoa - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
+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 "internal.h"
+28
+29
#if defined(_GLFW_COCOA)
+30
+31
#import <QuartzCore/CAMetalLayer.h>
+32
+33
#include <float.h>
+34
#include <string.h>
+35
#include <assert.h>
+36
+37
// HACK: This enum value is missing from framework headers on OS X 10.11 despite
+38
// having been (according to documentation) added in Mac OS X 10.7
+39
#define NSWindowCollectionBehaviorFullScreenNone (1 << 9)
+40
+41
// Returns whether the cursor is in the content area of the specified window
+42
//
+43
static GLFWbool cursorInContentArea(_GLFWwindow* window)
+44
{
+45
const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream];
+46
return [window->ns.view mouse:pos inRect:[window->ns.view frame]];
+47
}
+48
+49
// Hides the cursor if not already hidden
+50
//
+51
static void hideCursor(_GLFWwindow* window)
+52
{
+53
if (!_glfw.ns.cursorHidden)
+54
{
+55
[NSCursor hide];
+56
_glfw.ns.cursorHidden = GLFW_TRUE;
+57
}
+58
}
+59
+60
// Shows the cursor if not already shown
+61
//
+62
static void showCursor(_GLFWwindow* window)
+63
{
+64
if (_glfw.ns.cursorHidden)
+65
{
+66
[NSCursor unhide];
+67
_glfw.ns.cursorHidden = GLFW_FALSE;
+68
}
+69
}
+70
+71
// Updates the cursor image according to its cursor mode
+72
//
+73
static void updateCursorImage(_GLFWwindow* window)
+74
{
+75
if (window->cursorMode == GLFW_CURSOR_NORMAL)
+76
{
+77
showCursor(window);
+78
+79
if (window->cursor)
+80
[(NSCursor*) window->cursor->ns.object set];
+81
else
+82
[[NSCursor arrowCursor] set];
+83
}
+84
else
+85
hideCursor(window);
+86
}
+87
+88
// Apply chosen cursor mode to a focused window
+89
//
+90
static void updateCursorMode(_GLFWwindow* window)
+91
{
+92
if (window->cursorMode == GLFW_CURSOR_DISABLED)
+93
{
+94
_glfw.ns.disabledCursorWindow = window;
+95
_glfwGetCursorPosCocoa(window,
+96
&_glfw.ns.restoreCursorPosX,
+97
&_glfw.ns.restoreCursorPosY);
+98
_glfwCenterCursorInContentArea(window);
+99
CGAssociateMouseAndMouseCursorPosition(false);
+100
}
+101
else if (_glfw.ns.disabledCursorWindow == window)
+102
{
+103
_glfw.ns.disabledCursorWindow = NULL;
+104
_glfwSetCursorPosCocoa(window,
+105
_glfw.ns.restoreCursorPosX,
+106
_glfw.ns.restoreCursorPosY);
+107
// NOTE: The matching CGAssociateMouseAndMouseCursorPosition call is
+108
// made in _glfwSetCursorPosCocoa as part of a workaround
+109
}
+110
+111
if (cursorInContentArea(window))
+112
updateCursorImage(window);
+113
}
+114
+115
// Make the specified window and its video mode active on its monitor
+116
//
+117
static void acquireMonitor(_GLFWwindow* window)
+118
{
+119
_glfwSetVideoModeCocoa(window->monitor, &window->videoMode);
+120
const CGRect bounds = CGDisplayBounds(window->monitor->ns.displayID);
+121
const NSRect frame = NSMakeRect(bounds.origin.x,
+122
_glfwTransformYCocoa(bounds.origin.y + bounds.size.height - 1),
+123
bounds.size.width,
+124
bounds.size.height);
+125
+126
[window->ns.object setFrame:frame display:YES];
+127
+128
_glfwInputMonitorWindow(window->monitor, window);
+129
}
+130
+131
// Remove the window and restore the original video mode
+132
//
+133
static void releaseMonitor(_GLFWwindow* window)
+134
{
+135
if (window->monitor->window != window)
+136
return;
+137
+138
_glfwInputMonitorWindow(window->monitor, NULL);
+139
_glfwRestoreVideoModeCocoa(window->monitor);
+140
}
+141
+142
// Translates macOS key modifiers into GLFW ones
+143
//
+144
static int translateFlags(NSUInteger flags)
+145
{
+146
int mods = 0;
+147
+148
if (flags & NSEventModifierFlagShift)
+149
mods |= GLFW_MOD_SHIFT;
+150
if (flags & NSEventModifierFlagControl)
+151
mods |= GLFW_MOD_CONTROL;
+152
if (flags & NSEventModifierFlagOption)
+153
mods |= GLFW_MOD_ALT;
+154
if (flags & NSEventModifierFlagCommand)
+155
mods |= GLFW_MOD_SUPER;
+156
if (flags & NSEventModifierFlagCapsLock)
+157
mods |= GLFW_MOD_CAPS_LOCK;
+158
+159
return mods;
+160
}
+161
+162
// Translates a macOS keycode to a GLFW keycode
+163
//
+164
static int translateKey(unsigned int key)
+165
{
+166
if (key >= sizeof(_glfw.ns.keycodes) / sizeof(_glfw.ns.keycodes[0]))
+167
return GLFW_KEY_UNKNOWN;
+168
+169
return _glfw.ns.keycodes[key];
+170
}
+171
+172
// Translate a GLFW keycode to a Cocoa modifier flag
+173
//
+174
static NSUInteger translateKeyToModifierFlag(int key)
+175
{
+176
switch (key)
+177
{
+178
case GLFW_KEY_LEFT_SHIFT:
+179
case GLFW_KEY_RIGHT_SHIFT:
+180
return NSEventModifierFlagShift;
+181
case GLFW_KEY_LEFT_CONTROL:
+182
case GLFW_KEY_RIGHT_CONTROL:
+183
return NSEventModifierFlagControl;
+184
case GLFW_KEY_LEFT_ALT:
+185
case GLFW_KEY_RIGHT_ALT:
+186
return NSEventModifierFlagOption;
+187
case GLFW_KEY_LEFT_SUPER:
+188
case GLFW_KEY_RIGHT_SUPER:
+189
return NSEventModifierFlagCommand;
+190
case GLFW_KEY_CAPS_LOCK:
+191
return NSEventModifierFlagCapsLock;
+192
}
+193
+194
return 0;
+195
}
+196
+197
// Defines a constant for empty ranges in NSTextInputClient
+198
//
+199
static const NSRange kEmptyRange = { NSNotFound, 0 };
+200
+201
+202
//------------------------------------------------------------------------
+203
// Delegate for window related notifications
+204
//------------------------------------------------------------------------
+205
+206
@interface GLFWWindowDelegate : NSObject
+207
{
+208
_GLFWwindow* window;
+209
}
+210
+211
- (instancetype)initWithGlfwWindow:(_GLFWwindow *)initWindow;
+212
+213
@end
+214
+215
@implementation GLFWWindowDelegate
+216
+217
- (instancetype)initWithGlfwWindow:(_GLFWwindow *)initWindow
+218
{
+219
self = [super init];
+220
if (self != nil)
+221
window = initWindow;
+222
+223
return self;
+224
}
+225
+226
- (BOOL)windowShouldClose:(id)sender
+227
{
+228
_glfwInputWindowCloseRequest(window);
+229
return NO;
+230
}
+231
+232
- (void)windowDidResize:(NSNotification *)notification
+233
{
+234
if (window->context.source == GLFW_NATIVE_CONTEXT_API)
+235
[window->context.nsgl.object update];
+236
+237
if (_glfw.ns.disabledCursorWindow == window)
+238
_glfwCenterCursorInContentArea(window);
+239
+240
const int maximized = [window->ns.object isZoomed];
+241
if (window->ns.maximized != maximized)
+242
{
+243
window->ns.maximized = maximized;
+244
_glfwInputWindowMaximize(window, maximized);
+245
}
+246
+247
const NSRect contentRect = [window->ns.view frame];
+248
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
+249
+250
if (fbRect.size.width != window->ns.fbWidth ||
+251
fbRect.size.height != window->ns.fbHeight)
+252
{
+253
window->ns.fbWidth = fbRect.size.width;
+254
window->ns.fbHeight = fbRect.size.height;
+255
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
+256
}
+257
+258
if (contentRect.size.width != window->ns.width ||
+259
contentRect.size.height != window->ns.height)
+260
{
+261
window->ns.width = contentRect.size.width;
+262
window->ns.height = contentRect.size.height;
+263
_glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height);
+264
}
+265
}
+266
+267
- (void)windowDidMove:(NSNotification *)notification
+268
{
+269
if (window->context.source == GLFW_NATIVE_CONTEXT_API)
+270
[window->context.nsgl.object update];
+271
+272
if (_glfw.ns.disabledCursorWindow == window)
+273
_glfwCenterCursorInContentArea(window);
+274
+275
int x, y;
+276
_glfwGetWindowPosCocoa(window, &x, &y);
+277
_glfwInputWindowPos(window, x, y);
+278
}
+279
+280
- (void)windowDidMiniaturize:(NSNotification *)notification
+281
{
+282
if (window->monitor)
+283
releaseMonitor(window);
+284
+285
_glfwInputWindowIconify(window, GLFW_TRUE);
+286
}
+287
+288
- (void)windowDidDeminiaturize:(NSNotification *)notification
+289
{
+290
if (window->monitor)
+291
acquireMonitor(window);
+292
+293
_glfwInputWindowIconify(window, GLFW_FALSE);
+294
}
+295
+296
- (void)windowDidBecomeKey:(NSNotification *)notification
+297
{
+298
if (_glfw.ns.disabledCursorWindow == window)
+299
_glfwCenterCursorInContentArea(window);
+300
+301
_glfwInputWindowFocus(window, GLFW_TRUE);
+302
updateCursorMode(window);
+303
}
+304
+305
- (void)windowDidResignKey:(NSNotification *)notification
+306
{
+307
if (window->monitor && window->autoIconify)
+308
_glfwIconifyWindowCocoa(window);
+309
+310
_glfwInputWindowFocus(window, GLFW_FALSE);
+311
}
+312
+313
- (void)windowDidChangeOcclusionState:(NSNotification* )notification
+314
{
+315
if ([window->ns.object respondsToSelector:@selector(occlusionState)])
+316
{
+317
if ([window->ns.object occlusionState] & NSWindowOcclusionStateVisible)
+318
window->ns.occluded = GLFW_FALSE;
+319
else
+320
window->ns.occluded = GLFW_TRUE;
+321
}
+322
}
+323
+324
@end
+325
+326
+327
//------------------------------------------------------------------------
+328
// Content view class for the GLFW window
+329
//------------------------------------------------------------------------
+330
+331
@interface GLFWContentView : NSView <NSTextInputClient>
+332
{
+333
_GLFWwindow* window;
+334
NSTrackingArea* trackingArea;
+335
NSMutableAttributedString* markedText;
+336
}
+337
+338
- (instancetype)initWithGlfwWindow:(_GLFWwindow *)initWindow;
+339
+340
@end
+341
+342
@implementation GLFWContentView
+343
+344
- (instancetype)initWithGlfwWindow:(_GLFWwindow *)initWindow
+345
{
+346
self = [super init];
+347
if (self != nil)
+348
{
+349
window = initWindow;
+350
trackingArea = nil;
+351
markedText = [[NSMutableAttributedString alloc] init];
+352
+353
[self updateTrackingAreas];
+354
[self registerForDraggedTypes:@[NSPasteboardTypeURL]];
+355
}
+356
+357
return self;
+358
}
+359
+360
- (void)dealloc
+361
{
+362
[trackingArea release];
+363
[markedText release];
+364
[super dealloc];
+365
}
+366
+367
- (BOOL)isOpaque
+368
{
+369
return [window->ns.object isOpaque];
+370
}
+371
+372
- (BOOL)canBecomeKeyView
+373
{
+374
return YES;
+375
}
+376
+377
- (BOOL)acceptsFirstResponder
+378
{
+379
return YES;
+380
}
+381
+382
- (BOOL)wantsUpdateLayer
+383
{
+384
return YES;
+385
}
+386
+387
- (void)updateLayer
+388
{
+389
if (window->context.source == GLFW_NATIVE_CONTEXT_API)
+390
[window->context.nsgl.object update];
+391
+392
_glfwInputWindowDamage(window);
+393
}
+394
+395
- (void)cursorUpdate:(NSEvent *)event
+396
{
+397
updateCursorImage(window);
+398
}
+399
+400
- (BOOL)acceptsFirstMouse:(NSEvent *)event
+401
{
+402
return YES;
+403
}
+404
+405
- (void)mouseDown:(NSEvent *)event
+406
{
+407
_glfwInputMouseClick(window,
+408
GLFW_MOUSE_BUTTON_LEFT,
+409
GLFW_PRESS,
+410
translateFlags([event modifierFlags]));
+411
}
+412
+413
- (void)mouseDragged:(NSEvent *)event
+414
{
+415
[self mouseMoved:event];
+416
}
+417
+418
- (void)mouseUp:(NSEvent *)event
+419
{
+420
_glfwInputMouseClick(window,
+421
GLFW_MOUSE_BUTTON_LEFT,
+422
GLFW_RELEASE,
+423
translateFlags([event modifierFlags]));
+424
}
+425
+426
- (void)mouseMoved:(NSEvent *)event
+427
{
+428
if (window->cursorMode == GLFW_CURSOR_DISABLED)
+429
{
+430
const double dx = [event deltaX] - window->ns.cursorWarpDeltaX;
+431
const double dy = [event deltaY] - window->ns.cursorWarpDeltaY;
+432
+433
_glfwInputCursorPos(window,
+434
window->virtualCursorPosX + dx,
+435
window->virtualCursorPosY + dy);
+436
}
+437
else
+438
{
+439
const NSRect contentRect = [window->ns.view frame];
+440
// NOTE: The returned location uses base 0,1 not 0,0
+441
const NSPoint pos = [event locationInWindow];
+442
+443
_glfwInputCursorPos(window, pos.x, contentRect.size.height - pos.y);
+444
}
+445
+446
window->ns.cursorWarpDeltaX = 0;
+447
window->ns.cursorWarpDeltaY = 0;
+448
}
+449
+450
- (void)rightMouseDown:(NSEvent *)event
+451
{
+452
_glfwInputMouseClick(window,
+453
GLFW_MOUSE_BUTTON_RIGHT,
+454
GLFW_PRESS,
+455
translateFlags([event modifierFlags]));
+456
}
+457
+458
- (void)rightMouseDragged:(NSEvent *)event
+459
{
+460
[self mouseMoved:event];
+461
}
+462
+463
- (void)rightMouseUp:(NSEvent *)event
+464
{
+465
_glfwInputMouseClick(window,
+466
GLFW_MOUSE_BUTTON_RIGHT,
+467
GLFW_RELEASE,
+468
translateFlags([event modifierFlags]));
+469
}
+470
+471
- (void)otherMouseDown:(NSEvent *)event
+472
{
+473
_glfwInputMouseClick(window,
+474
(int) [event buttonNumber],
+475
GLFW_PRESS,
+476
translateFlags([event modifierFlags]));
+477
}
+478
+479
- (void)otherMouseDragged:(NSEvent *)event
+480
{
+481
[self mouseMoved:event];
+482
}
+483
+484
- (void)otherMouseUp:(NSEvent *)event
+485
{
+486
_glfwInputMouseClick(window,
+487
(int) [event buttonNumber],
+488
GLFW_RELEASE,
+489
translateFlags([event modifierFlags]));
+490
}
+491
+492
- (void)mouseExited:(NSEvent *)event
+493
{
+494
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
+495
showCursor(window);
+496
+497
_glfwInputCursorEnter(window, GLFW_FALSE);
+498
}
+499

Showing the first 500 of 2092 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/context.cadded
@@ -0,0 +1,770 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#include <assert.h>
+31
#include <stdio.h>
+32
#include <string.h>
+33
#include <limits.h>
+34
#include <stdio.h>
+35
+36
+37
//////////////////////////////////////////////////////////////////////////
+38
////// GLFW internal API //////
+39
//////////////////////////////////////////////////////////////////////////
+40
+41
// Checks whether the desired context attributes are valid
+42
//
+43
// This function checks things like whether the specified client API version
+44
// exists and whether all relevant options have supported and non-conflicting
+45
// values
+46
//
+47
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
+48
{
+49
if (ctxconfig->source != GLFW_NATIVE_CONTEXT_API &&
+50
ctxconfig->source != GLFW_EGL_CONTEXT_API &&
+51
ctxconfig->source != GLFW_OSMESA_CONTEXT_API)
+52
{
+53
_glfwInputError(GLFW_INVALID_ENUM,
+54
"Invalid context creation API 0x%08X",
+55
ctxconfig->source);
+56
return GLFW_FALSE;
+57
}
+58
+59
if (ctxconfig->client != GLFW_NO_API &&
+60
ctxconfig->client != GLFW_OPENGL_API &&
+61
ctxconfig->client != GLFW_OPENGL_ES_API)
+62
{
+63
_glfwInputError(GLFW_INVALID_ENUM,
+64
"Invalid client API 0x%08X",
+65
ctxconfig->client);
+66
return GLFW_FALSE;
+67
}
+68
+69
if (ctxconfig->share)
+70
{
+71
if (ctxconfig->client == GLFW_NO_API ||
+72
ctxconfig->share->context.client == GLFW_NO_API)
+73
{
+74
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
+75
return GLFW_FALSE;
+76
}
+77
+78
if (ctxconfig->source != ctxconfig->share->context.source)
+79
{
+80
_glfwInputError(GLFW_INVALID_ENUM,
+81
"Context creation APIs do not match between contexts");
+82
return GLFW_FALSE;
+83
}
+84
}
+85
+86
if (ctxconfig->client == GLFW_OPENGL_API)
+87
{
+88
if ((ctxconfig->major < 1 || ctxconfig->minor < 0) ||
+89
(ctxconfig->major == 1 && ctxconfig->minor > 5) ||
+90
(ctxconfig->major == 2 && ctxconfig->minor > 1) ||
+91
(ctxconfig->major == 3 && ctxconfig->minor > 3))
+92
{
+93
// OpenGL 1.0 is the smallest valid version
+94
// OpenGL 1.x series ended with version 1.5
+95
// OpenGL 2.x series ended with version 2.1
+96
// OpenGL 3.x series ended with version 3.3
+97
// For now, let everything else through
+98
+99
_glfwInputError(GLFW_INVALID_VALUE,
+100
"Invalid OpenGL version %i.%i",
+101
ctxconfig->major, ctxconfig->minor);
+102
return GLFW_FALSE;
+103
}
+104
+105
if (ctxconfig->profile)
+106
{
+107
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE &&
+108
ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE)
+109
{
+110
_glfwInputError(GLFW_INVALID_ENUM,
+111
"Invalid OpenGL profile 0x%08X",
+112
ctxconfig->profile);
+113
return GLFW_FALSE;
+114
}
+115
+116
if (ctxconfig->major <= 2 ||
+117
(ctxconfig->major == 3 && ctxconfig->minor < 2))
+118
{
+119
// Desktop OpenGL context profiles are only defined for version 3.2
+120
// and above
+121
+122
_glfwInputError(GLFW_INVALID_VALUE,
+123
"Context profiles are only defined for OpenGL version 3.2 and above");
+124
return GLFW_FALSE;
+125
}
+126
}
+127
+128
if (ctxconfig->forward && ctxconfig->major <= 2)
+129
{
+130
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above
+131
_glfwInputError(GLFW_INVALID_VALUE,
+132
"Forward-compatibility is only defined for OpenGL version 3.0 and above");
+133
return GLFW_FALSE;
+134
}
+135
}
+136
else if (ctxconfig->client == GLFW_OPENGL_ES_API)
+137
{
+138
if (ctxconfig->major < 1 || ctxconfig->minor < 0 ||
+139
(ctxconfig->major == 1 && ctxconfig->minor > 1) ||
+140
(ctxconfig->major == 2 && ctxconfig->minor > 0))
+141
{
+142
// OpenGL ES 1.0 is the smallest valid version
+143
// OpenGL ES 1.x series ended with version 1.1
+144
// OpenGL ES 2.x series ended with version 2.0
+145
// For now, let everything else through
+146
+147
_glfwInputError(GLFW_INVALID_VALUE,
+148
"Invalid OpenGL ES version %i.%i",
+149
ctxconfig->major, ctxconfig->minor);
+150
return GLFW_FALSE;
+151
}
+152
}
+153
+154
if (ctxconfig->robustness)
+155
{
+156
if (ctxconfig->robustness != GLFW_NO_RESET_NOTIFICATION &&
+157
ctxconfig->robustness != GLFW_LOSE_CONTEXT_ON_RESET)
+158
{
+159
_glfwInputError(GLFW_INVALID_ENUM,
+160
"Invalid context robustness mode 0x%08X",
+161
ctxconfig->robustness);
+162
return GLFW_FALSE;
+163
}
+164
}
+165
+166
if (ctxconfig->release)
+167
{
+168
if (ctxconfig->release != GLFW_RELEASE_BEHAVIOR_NONE &&
+169
ctxconfig->release != GLFW_RELEASE_BEHAVIOR_FLUSH)
+170
{
+171
_glfwInputError(GLFW_INVALID_ENUM,
+172
"Invalid context release behavior 0x%08X",
+173
ctxconfig->release);
+174
return GLFW_FALSE;
+175
}
+176
}
+177
+178
return GLFW_TRUE;
+179
}
+180
+181
// Chooses the framebuffer config that best matches the desired one
+182
//
+183
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
+184
const _GLFWfbconfig* alternatives,
+185
unsigned int count)
+186
{
+187
unsigned int i;
+188
unsigned int missing, leastMissing = UINT_MAX;
+189
unsigned int colorDiff, leastColorDiff = UINT_MAX;
+190
unsigned int extraDiff, leastExtraDiff = UINT_MAX;
+191
const _GLFWfbconfig* current;
+192
const _GLFWfbconfig* closest = NULL;
+193
+194
for (i = 0; i < count; i++)
+195
{
+196
current = alternatives + i;
+197
+198
if (desired->stereo && !current->stereo)
+199
{
+200
// Stereo is a hard constraint
+201
continue;
+202
}
+203
+204
// Count number of missing buffers
+205
{
+206
missing = 0;
+207
+208
if (desired->alphaBits > 0 && current->alphaBits == 0)
+209
missing++;
+210
+211
if (desired->depthBits > 0 && current->depthBits == 0)
+212
missing++;
+213
+214
if (desired->stencilBits > 0 && current->stencilBits == 0)
+215
missing++;
+216
+217
if (desired->auxBuffers > 0 &&
+218
current->auxBuffers < desired->auxBuffers)
+219
{
+220
missing += desired->auxBuffers - current->auxBuffers;
+221
}
+222
+223
if (desired->samples > 0 && current->samples == 0)
+224
{
+225
// Technically, several multisampling buffers could be
+226
// involved, but that's a lower level implementation detail and
+227
// not important to us here, so we count them as one
+228
missing++;
+229
}
+230
+231
if (desired->transparent != current->transparent)
+232
missing++;
+233
}
+234
+235
// These polynomials make many small channel size differences matter
+236
// less than one large channel size difference
+237
+238
// Calculate color channel size difference value
+239
{
+240
colorDiff = 0;
+241
+242
if (desired->redBits != GLFW_DONT_CARE)
+243
{
+244
colorDiff += (desired->redBits - current->redBits) *
+245
(desired->redBits - current->redBits);
+246
}
+247
+248
if (desired->greenBits != GLFW_DONT_CARE)
+249
{
+250
colorDiff += (desired->greenBits - current->greenBits) *
+251
(desired->greenBits - current->greenBits);
+252
}
+253
+254
if (desired->blueBits != GLFW_DONT_CARE)
+255
{
+256
colorDiff += (desired->blueBits - current->blueBits) *
+257
(desired->blueBits - current->blueBits);
+258
}
+259
}
+260
+261
// Calculate non-color channel size difference value
+262
{
+263
extraDiff = 0;
+264
+265
if (desired->alphaBits != GLFW_DONT_CARE)
+266
{
+267
extraDiff += (desired->alphaBits - current->alphaBits) *
+268
(desired->alphaBits - current->alphaBits);
+269
}
+270
+271
if (desired->depthBits != GLFW_DONT_CARE)
+272
{
+273
extraDiff += (desired->depthBits - current->depthBits) *
+274
(desired->depthBits - current->depthBits);
+275
}
+276
+277
if (desired->stencilBits != GLFW_DONT_CARE)
+278
{
+279
extraDiff += (desired->stencilBits - current->stencilBits) *
+280
(desired->stencilBits - current->stencilBits);
+281
}
+282
+283
if (desired->accumRedBits != GLFW_DONT_CARE)
+284
{
+285
extraDiff += (desired->accumRedBits - current->accumRedBits) *
+286
(desired->accumRedBits - current->accumRedBits);
+287
}
+288
+289
if (desired->accumGreenBits != GLFW_DONT_CARE)
+290
{
+291
extraDiff += (desired->accumGreenBits - current->accumGreenBits) *
+292
(desired->accumGreenBits - current->accumGreenBits);
+293
}
+294
+295
if (desired->accumBlueBits != GLFW_DONT_CARE)
+296
{
+297
extraDiff += (desired->accumBlueBits - current->accumBlueBits) *
+298
(desired->accumBlueBits - current->accumBlueBits);
+299
}
+300
+301
if (desired->accumAlphaBits != GLFW_DONT_CARE)
+302
{
+303
extraDiff += (desired->accumAlphaBits - current->accumAlphaBits) *
+304
(desired->accumAlphaBits - current->accumAlphaBits);
+305
}
+306
+307
if (desired->samples != GLFW_DONT_CARE)
+308
{
+309
extraDiff += (desired->samples - current->samples) *
+310
(desired->samples - current->samples);
+311
}
+312
+313
if (desired->sRGB && !current->sRGB)
+314
extraDiff++;
+315
}
+316
+317
// Figure out if the current one is better than the best one found so far
+318
// Least number of missing buffers is the most important heuristic,
+319
// then color buffer size match and lastly size match for other buffers
+320
+321
if (missing < leastMissing)
+322
closest = current;
+323
else if (missing == leastMissing)
+324
{
+325
if ((colorDiff < leastColorDiff) ||
+326
(colorDiff == leastColorDiff && extraDiff < leastExtraDiff))
+327
{
+328
closest = current;
+329
}
+330
}
+331
+332
if (current == closest)
+333
{
+334
leastMissing = missing;
+335
leastColorDiff = colorDiff;
+336
leastExtraDiff = extraDiff;
+337
}
+338
}
+339
+340
return closest;
+341
}
+342
+343
// Retrieves the attributes of the current context
+344
//
+345
GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
+346
const _GLFWctxconfig* ctxconfig)
+347
{
+348
int i;
+349
_GLFWwindow* previous;
+350
const char* version;
+351
const char* prefixes[] =
+352
{
+353
"OpenGL ES-CM ",
+354
"OpenGL ES-CL ",
+355
"OpenGL ES ",
+356
NULL
+357
};
+358
+359
window->context.source = ctxconfig->source;
+360
window->context.client = GLFW_OPENGL_API;
+361
+362
previous = _glfwPlatformGetTls(&_glfw.contextSlot);
+363
glfwMakeContextCurrent((GLFWwindow*) window);
+364
if (_glfwPlatformGetTls(&_glfw.contextSlot) != window)
+365
return GLFW_FALSE;
+366
+367
window->context.GetIntegerv = (PFNGLGETINTEGERVPROC)
+368
window->context.getProcAddress("glGetIntegerv");
+369
window->context.GetString = (PFNGLGETSTRINGPROC)
+370
window->context.getProcAddress("glGetString");
+371
window->context.Flush = (PFNGLFLUSHPROC)
+372
window->context.getProcAddress("glFlush");
+373
+374
if (!window->context.GetIntegerv ||
+375
!window->context.GetString ||
+376
!window->context.Flush)
+377
{
+378
_glfwInputError(GLFW_PLATFORM_ERROR, "Entry point retrieval is broken");
+379
glfwMakeContextCurrent((GLFWwindow*) previous);
+380
return GLFW_FALSE;
+381
}
+382
+383
version = (const char*) window->context.GetString(GL_VERSION);
+384
if (!version)
+385
{
+386
if (ctxconfig->client == GLFW_OPENGL_API)
+387
{
+388
_glfwInputError(GLFW_PLATFORM_ERROR,
+389
"OpenGL version string retrieval is broken");
+390
}
+391
else
+392
{
+393
_glfwInputError(GLFW_PLATFORM_ERROR,
+394
"OpenGL ES version string retrieval is broken");
+395
}
+396
+397
glfwMakeContextCurrent((GLFWwindow*) previous);
+398
return GLFW_FALSE;
+399
}
+400
+401
for (i = 0; prefixes[i]; i++)
+402
{
+403
const size_t length = strlen(prefixes[i]);
+404
+405
if (strncmp(version, prefixes[i], length) == 0)
+406
{
+407
version += length;
+408
window->context.client = GLFW_OPENGL_ES_API;
+409
break;
+410
}
+411
}
+412
+413
if (!sscanf(version, "%d.%d.%d",
+414
&window->context.major,
+415
&window->context.minor,
+416
&window->context.revision))
+417
{
+418
if (window->context.client == GLFW_OPENGL_API)
+419
{
+420
_glfwInputError(GLFW_PLATFORM_ERROR,
+421
"No version found in OpenGL version string");
+422
}
+423
else
+424
{
+425
_glfwInputError(GLFW_PLATFORM_ERROR,
+426
"No version found in OpenGL ES version string");
+427
}
+428
+429
glfwMakeContextCurrent((GLFWwindow*) previous);
+430
return GLFW_FALSE;
+431
}
+432
+433
if (window->context.major < ctxconfig->major ||
+434
(window->context.major == ctxconfig->major &&
+435
window->context.minor < ctxconfig->minor))
+436
{
+437
// The desired OpenGL version is greater than the actual version
+438
// This only happens if the machine lacks {GLX|WGL}_ARB_create_context
+439
// /and/ the user has requested an OpenGL version greater than 1.0
+440
+441
// For API consistency, we emulate the behavior of the
+442
// {GLX|WGL}_ARB_create_context extension and fail here
+443
+444
if (window->context.client == GLFW_OPENGL_API)
+445
{
+446
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
+447
"Requested OpenGL version %i.%i, got version %i.%i",
+448
ctxconfig->major, ctxconfig->minor,
+449
window->context.major, window->context.minor);
+450
}
+451
else
+452
{
+453
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
+454
"Requested OpenGL ES version %i.%i, got version %i.%i",
+455
ctxconfig->major, ctxconfig->minor,
+456
window->context.major, window->context.minor);
+457
}
+458
+459
glfwMakeContextCurrent((GLFWwindow*) previous);
+460
return GLFW_FALSE;
+461
}
+462
+463
if (window->context.major >= 3)
+464
{
+465
// OpenGL 3.0+ uses a different function for extension string retrieval
+466
// We cache it here instead of in glfwExtensionSupported mostly to alert
+467
// users as early as possible that their build may be broken
+468
+469
window->context.GetStringi = (PFNGLGETSTRINGIPROC)
+470
window->context.getProcAddress("glGetStringi");
+471
if (!window->context.GetStringi)
+472
{
+473
_glfwInputError(GLFW_PLATFORM_ERROR,
+474
"Entry point retrieval is broken");
+475
glfwMakeContextCurrent((GLFWwindow*) previous);
+476
return GLFW_FALSE;
+477
}
+478
}
+479
+480
if (window->context.client == GLFW_OPENGL_API)
+481
{
+482
// Read back context flags (OpenGL 3.0 and above)
+483
if (window->context.major >= 3)
+484
{
+485
GLint flags;
+486
window->context.GetIntegerv(GL_CONTEXT_FLAGS, &flags);
+487
+488
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
+489
window->context.forward = GLFW_TRUE;
+490
+491
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
+492
window->context.debug = GLFW_TRUE;
+493
else if (glfwExtensionSupported("GL_ARB_debug_output") &&
+494
ctxconfig->debug)
+495
{
+496
// HACK: This is a workaround for older drivers (pre KHR_debug)
+497
// not setting the debug bit in the context flags for
+498
// debug contexts
+499
window->context.debug = GLFW_TRUE;

Showing the first 500 of 771 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/egl_context.cadded
@@ -0,0 +1,988 @@
+1
//========================================================================
+2
// GLFW 3.5 EGL - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#include <stdio.h>
+31
#include <string.h>
+32
#include <stdlib.h>
+33
#include <assert.h>
+34
+35
+36
// Return a description of the specified EGL error
+37
//
+38
static const char* getEGLErrorString(EGLint error)
+39
{
+40
switch (error)
+41
{
+42
case EGL_SUCCESS:
+43
return "Success";
+44
case EGL_NOT_INITIALIZED:
+45
return "EGL is not or could not be initialized";
+46
case EGL_BAD_ACCESS:
+47
return "EGL cannot access a requested resource";
+48
case EGL_BAD_ALLOC:
+49
return "EGL failed to allocate resources for the requested operation";
+50
case EGL_BAD_ATTRIBUTE:
+51
return "An unrecognized attribute or attribute value was passed in the attribute list";
+52
case EGL_BAD_CONTEXT:
+53
return "An EGLContext argument does not name a valid EGL rendering context";
+54
case EGL_BAD_CONFIG:
+55
return "An EGLConfig argument does not name a valid EGL frame buffer configuration";
+56
case EGL_BAD_CURRENT_SURFACE:
+57
return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid";
+58
case EGL_BAD_DISPLAY:
+59
return "An EGLDisplay argument does not name a valid EGL display connection";
+60
case EGL_BAD_SURFACE:
+61
return "An EGLSurface argument does not name a valid surface configured for GL rendering";
+62
case EGL_BAD_MATCH:
+63
return "Arguments are inconsistent";
+64
case EGL_BAD_PARAMETER:
+65
return "One or more argument values are invalid";
+66
case EGL_BAD_NATIVE_PIXMAP:
+67
return "A NativePixmapType argument does not refer to a valid native pixmap";
+68
case EGL_BAD_NATIVE_WINDOW:
+69
return "A NativeWindowType argument does not refer to a valid native window";
+70
case EGL_CONTEXT_LOST:
+71
return "The application must destroy all contexts and reinitialise";
+72
default:
+73
return "ERROR: UNKNOWN EGL ERROR";
+74
}
+75
}
+76
+77
// Returns the specified attribute of the specified EGLConfig
+78
//
+79
static int getEGLConfigAttrib(EGLConfig config, int attrib)
+80
{
+81
int value;
+82
eglGetConfigAttrib(_glfw.egl.display, config, attrib, &value);
+83
return value;
+84
}
+85
+86
// Return the EGLConfig most closely matching the specified hints
+87
//
+88
static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
+89
const _GLFWfbconfig* fbconfig,
+90
EGLConfig* result)
+91
{
+92
EGLConfig* nativeConfigs;
+93
_GLFWfbconfig* usableConfigs;
+94
const _GLFWfbconfig* closest;
+95
int i, nativeCount, usableCount, apiBit, surfaceTypeBit;
+96
GLFWbool wrongApiAvailable = GLFW_FALSE;
+97
+98
if (ctxconfig->client == GLFW_OPENGL_ES_API)
+99
{
+100
if (ctxconfig->major == 1)
+101
apiBit = EGL_OPENGL_ES_BIT;
+102
else
+103
apiBit = EGL_OPENGL_ES2_BIT;
+104
}
+105
else
+106
apiBit = EGL_OPENGL_BIT;
+107
+108
if (_glfw.egl.platform == EGL_PLATFORM_SURFACELESS_MESA)
+109
surfaceTypeBit = EGL_PBUFFER_BIT;
+110
else
+111
surfaceTypeBit = EGL_WINDOW_BIT;
+112
+113
if (fbconfig->stereo)
+114
{
+115
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, "EGL: Stereo rendering not supported");
+116
return GLFW_FALSE;
+117
}
+118
+119
eglGetConfigs(_glfw.egl.display, NULL, 0, &nativeCount);
+120
if (!nativeCount)
+121
{
+122
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: No EGLConfigs returned");
+123
return GLFW_FALSE;
+124
}
+125
+126
nativeConfigs = _glfw_calloc(nativeCount, sizeof(EGLConfig));
+127
eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount);
+128
+129
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
+130
usableCount = 0;
+131
+132
for (i = 0; i < nativeCount; i++)
+133
{
+134
const EGLConfig n = nativeConfigs[i];
+135
_GLFWfbconfig* u = usableConfigs + usableCount;
+136
+137
// Only consider RGB(A) EGLConfigs
+138
if (getEGLConfigAttrib(n, EGL_COLOR_BUFFER_TYPE) != EGL_RGB_BUFFER)
+139
continue;
+140
+141
if (!(getEGLConfigAttrib(n, EGL_SURFACE_TYPE) & surfaceTypeBit))
+142
continue;
+143
+144
#if defined(_GLFW_X11)
+145
if (_glfw.platform.platformID == GLFW_PLATFORM_X11)
+146
{
+147
XVisualInfo vi = {0};
+148
+149
// Only consider EGLConfigs with associated Visuals
+150
vi.visualid = getEGLConfigAttrib(n, EGL_NATIVE_VISUAL_ID);
+151
if (!vi.visualid)
+152
continue;
+153
+154
if (fbconfig->transparent)
+155
{
+156
int count;
+157
XVisualInfo* vis =
+158
XGetVisualInfo(_glfw.x11.display, VisualIDMask, &vi, &count);
+159
if (vis)
+160
{
+161
u->transparent = _glfwIsVisualTransparentX11(vis[0].visual);
+162
XFree(vis);
+163
}
+164
}
+165
}
+166
#endif // _GLFW_X11
+167
+168
if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & apiBit))
+169
{
+170
wrongApiAvailable = GLFW_TRUE;
+171
continue;
+172
}
+173
+174
u->redBits = getEGLConfigAttrib(n, EGL_RED_SIZE);
+175
u->greenBits = getEGLConfigAttrib(n, EGL_GREEN_SIZE);
+176
u->blueBits = getEGLConfigAttrib(n, EGL_BLUE_SIZE);
+177
+178
u->alphaBits = getEGLConfigAttrib(n, EGL_ALPHA_SIZE);
+179
u->depthBits = getEGLConfigAttrib(n, EGL_DEPTH_SIZE);
+180
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
+181
+182
#if defined(_GLFW_WAYLAND)
+183
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
+184
{
+185
// NOTE: The wl_surface opaque region is no guarantee that its buffer
+186
// is presented as opaque, if it also has an alpha channel
+187
// HACK: If EGL_EXT_present_opaque is unavailable, ignore any config
+188
// with an alpha channel to ensure the buffer is opaque
+189
if (!_glfw.egl.EXT_present_opaque)
+190
{
+191
if (!fbconfig->transparent && u->alphaBits > 0)
+192
continue;
+193
}
+194
}
+195
#endif // _GLFW_WAYLAND
+196
+197
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
+198
u->doublebuffer = fbconfig->doublebuffer;
+199
+200
u->handle = (uintptr_t) n;
+201
usableCount++;
+202
}
+203
+204
closest = _glfwChooseFBConfig(fbconfig, usableConfigs, usableCount);
+205
if (closest)
+206
*result = (EGLConfig) closest->handle;
+207
else
+208
{
+209
if (wrongApiAvailable)
+210
{
+211
if (ctxconfig->client == GLFW_OPENGL_ES_API)
+212
{
+213
if (ctxconfig->major == 1)
+214
{
+215
_glfwInputError(GLFW_API_UNAVAILABLE,
+216
"EGL: Failed to find support for OpenGL ES 1.x");
+217
}
+218
else
+219
{
+220
_glfwInputError(GLFW_API_UNAVAILABLE,
+221
"EGL: Failed to find support for OpenGL ES 2 or later");
+222
}
+223
}
+224
else
+225
{
+226
_glfwInputError(GLFW_API_UNAVAILABLE,
+227
"EGL: Failed to find support for OpenGL");
+228
}
+229
}
+230
else
+231
{
+232
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
+233
"EGL: Failed to find a suitable EGLConfig");
+234
}
+235
}
+236
+237
_glfw_free(nativeConfigs);
+238
_glfw_free(usableConfigs);
+239
+240
return closest != NULL;
+241
}
+242
+243
static void makeContextCurrentEGL(_GLFWwindow* window)
+244
{
+245
if (window)
+246
{
+247
if (!eglMakeCurrent(_glfw.egl.display,
+248
window->context.egl.surface,
+249
window->context.egl.surface,
+250
window->context.egl.handle))
+251
{
+252
_glfwInputError(GLFW_PLATFORM_ERROR,
+253
"EGL: Failed to make context current: %s",
+254
getEGLErrorString(eglGetError()));
+255
return;
+256
}
+257
+258
#if defined(_GLFW_WAYLAND)
+259
// NOTE: Disable EGL vsync so we can substitute our own that includes a timeout
+260
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
+261
eglSwapInterval(_glfw.egl.display, 0);
+262
#endif // _GLFW_WAYLAND
+263
}
+264
else
+265
{
+266
if (!eglMakeCurrent(_glfw.egl.display,
+267
EGL_NO_SURFACE,
+268
EGL_NO_SURFACE,
+269
EGL_NO_CONTEXT))
+270
{
+271
_glfwInputError(GLFW_PLATFORM_ERROR,
+272
"EGL: Failed to clear current context: %s",
+273
getEGLErrorString(eglGetError()));
+274
return;
+275
}
+276
}
+277
+278
_glfwPlatformSetTls(&_glfw.contextSlot, window);
+279
}
+280
+281
static void swapBuffersEGL(_GLFWwindow* window)
+282
{
+283
if (window != _glfwPlatformGetTls(&_glfw.contextSlot))
+284
{
+285
_glfwInputError(GLFW_PLATFORM_ERROR,
+286
"EGL: The context must be current on the calling thread when swapping buffers");
+287
return;
+288
}
+289
+290
#if defined(_GLFW_WAYLAND)
+291
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
+292
{
+293
// NOTE: Swapping buffers on a hidden window on Wayland makes it visible
+294
if (!window->wl.visible)
+295
return;
+296
+297
// NOTE: We wait for a frame manually so we can add a timeout,
+298
// as the EGL implementation will wait indefinitely
+299
if (window->wl.egl.interval > 0)
+300
{
+301
window->context.Flush();
+302
if (!_glfwWaitForEGLFrameWayland(window))
+303
return;
+304
}
+305
}
+306
#endif
+307
+308
eglSwapBuffers(_glfw.egl.display, window->context.egl.surface);
+309
}
+310
+311
static void swapIntervalEGL(int interval)
+312
{
+313
#if defined(_GLFW_WAYLAND)
+314
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
+315
{
+316
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
+317
assert(window != NULL);
+318
window->wl.egl.interval = interval;
+319
return;
+320
}
+321
#endif
+322
+323
eglSwapInterval(_glfw.egl.display, interval);
+324
}
+325
+326
static int extensionSupportedEGL(const char* extension)
+327
{
+328
const char* extensions = eglQueryString(_glfw.egl.display, EGL_EXTENSIONS);
+329
if (extensions)
+330
{
+331
if (_glfwStringInExtensionString(extension, extensions))
+332
return GLFW_TRUE;
+333
}
+334
+335
return GLFW_FALSE;
+336
}
+337
+338
static GLFWglproc getProcAddressEGL(const char* procname)
+339
{
+340
const GLFWglproc proc = (GLFWglproc) eglGetProcAddress(procname);
+341
if (proc)
+342
return proc;
+343
+344
if (!_glfw.egl.KHR_get_all_proc_addresses)
+345
{
+346
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
+347
assert(window != NULL);
+348
+349
return _glfwPlatformGetModuleSymbol(window->context.egl.client, procname);
+350
}
+351
+352
return NULL;
+353
}
+354
+355
static void destroyContextEGL(_GLFWwindow* window)
+356
{
+357
// NOTE: Do not unload libGL.so.1 while the X11 display is still open,
+358
// as it will make XCloseDisplay segfault
+359
if (_glfw.platform.platformID != GLFW_PLATFORM_X11 ||
+360
window->context.client != GLFW_OPENGL_API)
+361
{
+362
_glfwPlatformFreeModule(window->context.egl.client);
+363
window->context.egl.client = NULL;
+364
}
+365
+366
if (window->context.egl.surface)
+367
{
+368
eglDestroySurface(_glfw.egl.display, window->context.egl.surface);
+369
window->context.egl.surface = EGL_NO_SURFACE;
+370
}
+371
+372
if (window->context.egl.handle)
+373
{
+374
eglDestroyContext(_glfw.egl.display, window->context.egl.handle);
+375
window->context.egl.handle = EGL_NO_CONTEXT;
+376
}
+377
}
+378
+379
+380
//////////////////////////////////////////////////////////////////////////
+381
////// GLFW internal API //////
+382
//////////////////////////////////////////////////////////////////////////
+383
+384
GLFWbool _glfwInitEGL(void)
+385
{
+386
int i;
+387
EGLint* attribs = NULL;
+388
const char* extensions;
+389
const char* sonames[] =
+390
{
+391
#if defined(_GLFW_EGL_LIBRARY)
+392
_GLFW_EGL_LIBRARY,
+393
#elif defined(_WIN32)
+394
"libEGL.dll",
+395
"EGL.dll",
+396
#elif defined(__APPLE__)
+397
"libEGL.dylib",
+398
#elif defined(__CYGWIN__)
+399
"libEGL-1.so",
+400
#elif defined(__OpenBSD__) || defined(__NetBSD__)
+401
"libEGL.so",
+402
#else
+403
"libEGL.so.1",
+404
#endif
+405
NULL
+406
};
+407
+408
if (_glfw.egl.handle)
+409
return GLFW_TRUE;
+410
+411
for (i = 0; sonames[i]; i++)
+412
{
+413
_glfw.egl.handle = _glfwPlatformLoadModule(sonames[i]);
+414
if (_glfw.egl.handle)
+415
break;
+416
}
+417
+418
if (!_glfw.egl.handle)
+419
{
+420
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Library not found");
+421
return GLFW_FALSE;
+422
}
+423
+424
_glfw.egl.prefix = (strncmp(sonames[i], "lib", 3) == 0);
+425
+426
_glfw.egl.GetConfigAttrib = (PFN_eglGetConfigAttrib)
+427
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetConfigAttrib");
+428
_glfw.egl.GetConfigs = (PFN_eglGetConfigs)
+429
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetConfigs");
+430
_glfw.egl.GetDisplay = (PFN_eglGetDisplay)
+431
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetDisplay");
+432
_glfw.egl.GetError = (PFN_eglGetError)
+433
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetError");
+434
_glfw.egl.Initialize = (PFN_eglInitialize)
+435
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglInitialize");
+436
_glfw.egl.Terminate = (PFN_eglTerminate)
+437
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglTerminate");
+438
_glfw.egl.BindAPI = (PFN_eglBindAPI)
+439
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglBindAPI");
+440
_glfw.egl.CreateContext = (PFN_eglCreateContext)
+441
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglCreateContext");
+442
_glfw.egl.DestroySurface = (PFN_eglDestroySurface)
+443
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglDestroySurface");
+444
_glfw.egl.DestroyContext = (PFN_eglDestroyContext)
+445
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglDestroyContext");
+446
_glfw.egl.CreateWindowSurface = (PFN_eglCreateWindowSurface)
+447
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglCreateWindowSurface");
+448
_glfw.egl.CreatePbufferSurface = (PFN_eglCreatePbufferSurface)
+449
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglCreatePbufferSurface");
+450
_glfw.egl.MakeCurrent = (PFN_eglMakeCurrent)
+451
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglMakeCurrent");
+452
_glfw.egl.SwapBuffers = (PFN_eglSwapBuffers)
+453
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglSwapBuffers");
+454
_glfw.egl.SwapInterval = (PFN_eglSwapInterval)
+455
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglSwapInterval");
+456
_glfw.egl.QueryString = (PFN_eglQueryString)
+457
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglQueryString");
+458
_glfw.egl.GetProcAddress = (PFN_eglGetProcAddress)
+459
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetProcAddress");
+460
+461
if (!_glfw.egl.GetConfigAttrib ||
+462
!_glfw.egl.GetConfigs ||
+463
!_glfw.egl.GetDisplay ||
+464
!_glfw.egl.GetError ||
+465
!_glfw.egl.Initialize ||
+466
!_glfw.egl.Terminate ||
+467
!_glfw.egl.BindAPI ||
+468
!_glfw.egl.CreateContext ||
+469
!_glfw.egl.DestroySurface ||
+470
!_glfw.egl.DestroyContext ||
+471
!_glfw.egl.CreateWindowSurface ||
+472
!_glfw.egl.CreatePbufferSurface ||
+473
!_glfw.egl.MakeCurrent ||
+474
!_glfw.egl.SwapBuffers ||
+475
!_glfw.egl.SwapInterval ||
+476
!_glfw.egl.QueryString ||
+477
!_glfw.egl.GetProcAddress)
+478
{
+479
_glfwInputError(GLFW_PLATFORM_ERROR,
+480
"EGL: Failed to load required entry points");
+481
+482
_glfwTerminateEGL();
+483
return GLFW_FALSE;
+484
}
+485
+486
extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+487
if (extensions && eglGetError() == EGL_SUCCESS)
+488
_glfw.egl.EXT_client_extensions = GLFW_TRUE;
+489
+490
if (_glfw.egl.EXT_client_extensions)
+491
{
+492
_glfw.egl.EXT_platform_base =
+493
_glfwStringInExtensionString("EGL_EXT_platform_base", extensions);
+494
_glfw.egl.EXT_platform_x11 =
+495
_glfwStringInExtensionString("EGL_EXT_platform_x11", extensions);
+496
_glfw.egl.EXT_platform_wayland =
+497
_glfwStringInExtensionString("EGL_EXT_platform_wayland", extensions);
+498
_glfw.egl.ANGLE_platform_angle =
+499
_glfwStringInExtensionString("EGL_ANGLE_platform_angle", extensions);

Showing the first 500 of 989 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/glx_context.cadded
@@ -0,0 +1,738 @@
+1
//========================================================================
+2
// GLFW 3.5 GLX - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_X11)
+31
+32
#include <string.h>
+33
#include <stdlib.h>
+34
#include <assert.h>
+35
+36
#ifndef GLXBadProfileARB
+37
#define GLXBadProfileARB 13
+38
#endif
+39
+40
+41
// Returns the specified attribute of the specified GLXFBConfig
+42
//
+43
static int getGLXFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
+44
{
+45
int value;
+46
glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value);
+47
return value;
+48
}
+49
+50
// Return the GLXFBConfig most closely matching the specified hints
+51
//
+52
static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
+53
GLXFBConfig* result)
+54
{
+55
GLXFBConfig* nativeConfigs;
+56
_GLFWfbconfig* usableConfigs;
+57
const _GLFWfbconfig* closest;
+58
int nativeCount, usableCount;
+59
const char* vendor;
+60
GLFWbool trustWindowBit = GLFW_TRUE;
+61
+62
// HACK: This is a (hopefully temporary) workaround for Chromium
+63
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
+64
vendor = glXGetClientString(_glfw.x11.display, GLX_VENDOR);
+65
if (vendor && strcmp(vendor, "Chromium") == 0)
+66
trustWindowBit = GLFW_FALSE;
+67
+68
nativeConfigs =
+69
glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen, &nativeCount);
+70
if (!nativeConfigs || !nativeCount)
+71
{
+72
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: No GLXFBConfigs returned");
+73
return GLFW_FALSE;
+74
}
+75
+76
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
+77
usableCount = 0;
+78
+79
for (int i = 0; i < nativeCount; i++)
+80
{
+81
const GLXFBConfig n = nativeConfigs[i];
+82
_GLFWfbconfig* u = usableConfigs + usableCount;
+83
+84
// Only consider RGBA GLXFBConfigs
+85
if (!(getGLXFBConfigAttrib(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT))
+86
continue;
+87
+88
// Only consider window GLXFBConfigs
+89
if (!(getGLXFBConfigAttrib(n, GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT))
+90
{
+91
if (trustWindowBit)
+92
continue;
+93
}
+94
+95
if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER) != desired->doublebuffer)
+96
continue;
+97
+98
if (desired->transparent)
+99
{
+100
XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n);
+101
if (vi)
+102
{
+103
u->transparent = _glfwIsVisualTransparentX11(vi->visual);
+104
XFree(vi);
+105
}
+106
}
+107
+108
u->redBits = getGLXFBConfigAttrib(n, GLX_RED_SIZE);
+109
u->greenBits = getGLXFBConfigAttrib(n, GLX_GREEN_SIZE);
+110
u->blueBits = getGLXFBConfigAttrib(n, GLX_BLUE_SIZE);
+111
+112
u->alphaBits = getGLXFBConfigAttrib(n, GLX_ALPHA_SIZE);
+113
u->depthBits = getGLXFBConfigAttrib(n, GLX_DEPTH_SIZE);
+114
u->stencilBits = getGLXFBConfigAttrib(n, GLX_STENCIL_SIZE);
+115
+116
u->accumRedBits = getGLXFBConfigAttrib(n, GLX_ACCUM_RED_SIZE);
+117
u->accumGreenBits = getGLXFBConfigAttrib(n, GLX_ACCUM_GREEN_SIZE);
+118
u->accumBlueBits = getGLXFBConfigAttrib(n, GLX_ACCUM_BLUE_SIZE);
+119
u->accumAlphaBits = getGLXFBConfigAttrib(n, GLX_ACCUM_ALPHA_SIZE);
+120
+121
u->auxBuffers = getGLXFBConfigAttrib(n, GLX_AUX_BUFFERS);
+122
u->stereo = getGLXFBConfigAttrib(n, GLX_STEREO);
+123
+124
if (_glfw.glx.ARB_multisample)
+125
u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES);
+126
+127
if (_glfw.glx.ARB_framebuffer_sRGB || _glfw.glx.EXT_framebuffer_sRGB)
+128
u->sRGB = getGLXFBConfigAttrib(n, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB);
+129
+130
u->handle = (uintptr_t) n;
+131
usableCount++;
+132
}
+133
+134
closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
+135
if (closest)
+136
*result = (GLXFBConfig) closest->handle;
+137
+138
XFree(nativeConfigs);
+139
_glfw_free(usableConfigs);
+140
+141
return closest != NULL;
+142
}
+143
+144
// Create the OpenGL context using legacy API
+145
//
+146
static GLXContext createLegacyContextGLX(_GLFWwindow* window,
+147
GLXFBConfig fbconfig,
+148
GLXContext share)
+149
{
+150
return glXCreateNewContext(_glfw.x11.display,
+151
fbconfig,
+152
GLX_RGBA_TYPE,
+153
share,
+154
True);
+155
}
+156
+157
static void makeContextCurrentGLX(_GLFWwindow* window)
+158
{
+159
if (window)
+160
{
+161
if (!glXMakeCurrent(_glfw.x11.display,
+162
window->context.glx.window,
+163
window->context.glx.handle))
+164
{
+165
_glfwInputError(GLFW_PLATFORM_ERROR,
+166
"GLX: Failed to make context current");
+167
return;
+168
}
+169
}
+170
else
+171
{
+172
if (!glXMakeCurrent(_glfw.x11.display, None, NULL))
+173
{
+174
_glfwInputError(GLFW_PLATFORM_ERROR,
+175
"GLX: Failed to clear current context");
+176
return;
+177
}
+178
}
+179
+180
_glfwPlatformSetTls(&_glfw.contextSlot, window);
+181
}
+182
+183
static void swapBuffersGLX(_GLFWwindow* window)
+184
{
+185
glXSwapBuffers(_glfw.x11.display, window->context.glx.window);
+186
}
+187
+188
static void swapIntervalGLX(int interval)
+189
{
+190
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
+191
assert(window != NULL);
+192
+193
if (_glfw.glx.EXT_swap_control)
+194
{
+195
_glfw.glx.SwapIntervalEXT(_glfw.x11.display,
+196
window->context.glx.window,
+197
interval);
+198
}
+199
else if (_glfw.glx.MESA_swap_control)
+200
_glfw.glx.SwapIntervalMESA(interval);
+201
else if (_glfw.glx.SGI_swap_control)
+202
{
+203
if (interval > 0)
+204
_glfw.glx.SwapIntervalSGI(interval);
+205
}
+206
}
+207
+208
static int extensionSupportedGLX(const char* extension)
+209
{
+210
const char* extensions =
+211
glXQueryExtensionsString(_glfw.x11.display, _glfw.x11.screen);
+212
if (extensions)
+213
{
+214
if (_glfwStringInExtensionString(extension, extensions))
+215
return GLFW_TRUE;
+216
}
+217
+218
return GLFW_FALSE;
+219
}
+220
+221
static GLFWglproc getProcAddressGLX(const char* procname)
+222
{
+223
if (_glfw.glx.GetProcAddress)
+224
return _glfw.glx.GetProcAddress((const GLubyte*) procname);
+225
else if (_glfw.glx.GetProcAddressARB)
+226
return _glfw.glx.GetProcAddressARB((const GLubyte*) procname);
+227
else
+228
{
+229
// NOTE: glvnd provides GLX 1.4, so this can only happen with libGL
+230
return _glfwPlatformGetModuleSymbol(_glfw.glx.handle, procname);
+231
}
+232
}
+233
+234
static void destroyContextGLX(_GLFWwindow* window)
+235
{
+236
if (window->context.glx.window)
+237
{
+238
glXDestroyWindow(_glfw.x11.display, window->context.glx.window);
+239
window->context.glx.window = None;
+240
}
+241
+242
if (window->context.glx.handle)
+243
{
+244
glXDestroyContext(_glfw.x11.display, window->context.glx.handle);
+245
window->context.glx.handle = NULL;
+246
}
+247
}
+248
+249
+250
//////////////////////////////////////////////////////////////////////////
+251
////// GLFW internal API //////
+252
//////////////////////////////////////////////////////////////////////////
+253
+254
GLFWbool _glfwInitGLX(void)
+255
{
+256
const char* sonames[] =
+257
{
+258
#if defined(_GLFW_GLX_LIBRARY)
+259
_GLFW_GLX_LIBRARY,
+260
#elif defined(__CYGWIN__)
+261
"libGL-1.so",
+262
#elif defined(__OpenBSD__) || defined(__NetBSD__)
+263
"libGL.so",
+264
#else
+265
"libGLX.so.0",
+266
"libGL.so.1",
+267
"libGL.so",
+268
#endif
+269
NULL
+270
};
+271
+272
if (_glfw.glx.handle)
+273
return GLFW_TRUE;
+274
+275
for (int i = 0; sonames[i]; i++)
+276
{
+277
_glfw.glx.handle = _glfwPlatformLoadModule(sonames[i]);
+278
if (_glfw.glx.handle)
+279
break;
+280
}
+281
+282
if (!_glfw.glx.handle)
+283
{
+284
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: Failed to load GLX");
+285
return GLFW_FALSE;
+286
}
+287
+288
_glfw.glx.GetFBConfigs = (PFNGLXGETFBCONFIGSPROC)
+289
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetFBConfigs");
+290
_glfw.glx.GetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)
+291
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetFBConfigAttrib");
+292
_glfw.glx.GetClientString = (PFNGLXGETCLIENTSTRINGPROC)
+293
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetClientString");
+294
_glfw.glx.QueryExtension = (PFNGLXQUERYEXTENSIONPROC)
+295
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXQueryExtension");
+296
_glfw.glx.QueryVersion = (PFNGLXQUERYVERSIONPROC)
+297
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXQueryVersion");
+298
_glfw.glx.DestroyContext = (PFNGLXDESTROYCONTEXTPROC)
+299
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXDestroyContext");
+300
_glfw.glx.MakeCurrent = (PFNGLXMAKECURRENTPROC)
+301
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXMakeCurrent");
+302
_glfw.glx.SwapBuffers = (PFNGLXSWAPBUFFERSPROC)
+303
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXSwapBuffers");
+304
_glfw.glx.QueryExtensionsString = (PFNGLXQUERYEXTENSIONSSTRINGPROC)
+305
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXQueryExtensionsString");
+306
_glfw.glx.CreateNewContext = (PFNGLXCREATENEWCONTEXTPROC)
+307
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXCreateNewContext");
+308
_glfw.glx.CreateWindow = (PFNGLXCREATEWINDOWPROC)
+309
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXCreateWindow");
+310
_glfw.glx.DestroyWindow = (PFNGLXDESTROYWINDOWPROC)
+311
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXDestroyWindow");
+312
_glfw.glx.GetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)
+313
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetVisualFromFBConfig");
+314
+315
if (!_glfw.glx.GetFBConfigs ||
+316
!_glfw.glx.GetFBConfigAttrib ||
+317
!_glfw.glx.GetClientString ||
+318
!_glfw.glx.QueryExtension ||
+319
!_glfw.glx.QueryVersion ||
+320
!_glfw.glx.DestroyContext ||
+321
!_glfw.glx.MakeCurrent ||
+322
!_glfw.glx.SwapBuffers ||
+323
!_glfw.glx.QueryExtensionsString ||
+324
!_glfw.glx.CreateNewContext ||
+325
!_glfw.glx.CreateWindow ||
+326
!_glfw.glx.DestroyWindow ||
+327
!_glfw.glx.GetVisualFromFBConfig)
+328
{
+329
_glfwInputError(GLFW_PLATFORM_ERROR,
+330
"GLX: Failed to load required entry points");
+331
return GLFW_FALSE;
+332
}
+333
+334
// NOTE: Unlike GLX 1.3 entry points these are not required to be present
+335
_glfw.glx.GetProcAddress = (PFNGLXGETPROCADDRESSPROC)
+336
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetProcAddress");
+337
_glfw.glx.GetProcAddressARB = (PFNGLXGETPROCADDRESSPROC)
+338
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetProcAddressARB");
+339
+340
if (!glXQueryExtension(_glfw.x11.display,
+341
&_glfw.glx.errorBase,
+342
&_glfw.glx.eventBase))
+343
{
+344
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX extension not found");
+345
return GLFW_FALSE;
+346
}
+347
+348
if (!glXQueryVersion(_glfw.x11.display, &_glfw.glx.major, &_glfw.glx.minor))
+349
{
+350
_glfwInputError(GLFW_API_UNAVAILABLE,
+351
"GLX: Failed to query GLX version");
+352
return GLFW_FALSE;
+353
}
+354
+355
if (_glfw.glx.major == 1 && _glfw.glx.minor < 3)
+356
{
+357
_glfwInputError(GLFW_API_UNAVAILABLE,
+358
"GLX: GLX version 1.3 is required");
+359
return GLFW_FALSE;
+360
}
+361
+362
if (extensionSupportedGLX("GLX_EXT_swap_control"))
+363
{
+364
_glfw.glx.SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)
+365
getProcAddressGLX("glXSwapIntervalEXT");
+366
+367
if (_glfw.glx.SwapIntervalEXT)
+368
_glfw.glx.EXT_swap_control = true;
+369
}
+370
+371
if (extensionSupportedGLX("GLX_SGI_swap_control"))
+372
{
+373
_glfw.glx.SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)
+374
getProcAddressGLX("glXSwapIntervalSGI");
+375
+376
if (_glfw.glx.SwapIntervalSGI)
+377
_glfw.glx.SGI_swap_control = true;
+378
}
+379
+380
if (extensionSupportedGLX("GLX_MESA_swap_control"))
+381
{
+382
_glfw.glx.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
+383
getProcAddressGLX("glXSwapIntervalMESA");
+384
+385
if (_glfw.glx.SwapIntervalMESA)
+386
_glfw.glx.MESA_swap_control = true;
+387
}
+388
+389
if (extensionSupportedGLX("GLX_ARB_multisample"))
+390
_glfw.glx.ARB_multisample = true;
+391
+392
if (extensionSupportedGLX("GLX_ARB_framebuffer_sRGB"))
+393
_glfw.glx.ARB_framebuffer_sRGB = true;
+394
+395
if (extensionSupportedGLX("GLX_EXT_framebuffer_sRGB"))
+396
_glfw.glx.EXT_framebuffer_sRGB = true;
+397
+398
if (extensionSupportedGLX("GLX_ARB_create_context"))
+399
{
+400
_glfw.glx.CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
+401
getProcAddressGLX("glXCreateContextAttribsARB");
+402
+403
if (_glfw.glx.CreateContextAttribsARB)
+404
_glfw.glx.ARB_create_context = true;
+405
}
+406
+407
if (extensionSupportedGLX("GLX_ARB_create_context_robustness"))
+408
_glfw.glx.ARB_create_context_robustness = true;
+409
+410
if (extensionSupportedGLX("GLX_ARB_create_context_profile"))
+411
_glfw.glx.ARB_create_context_profile = true;
+412
+413
if (extensionSupportedGLX("GLX_EXT_create_context_es2_profile"))
+414
_glfw.glx.EXT_create_context_es2_profile = true;
+415
+416
if (extensionSupportedGLX("GLX_ARB_create_context_no_error"))
+417
_glfw.glx.ARB_create_context_no_error = true;
+418
+419
if (extensionSupportedGLX("GLX_ARB_context_flush_control"))
+420
_glfw.glx.ARB_context_flush_control = true;
+421
+422
return GLFW_TRUE;
+423
}
+424
+425
void _glfwTerminateGLX(void)
+426
{
+427
// NOTE: This function must not call any X11 functions, as it is called
+428
// after XCloseDisplay (see _glfwTerminateX11 for details)
+429
+430
_glfwPlatformFreeModule(_glfw.glx.handle);
+431
_glfw.glx.handle = NULL;
+432
}
+433
+434
#define SET_ATTRIB(a, v) \
+435
{ \
+436
assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
+437
attribs[index++] = a; \
+438
attribs[index++] = v; \
+439
}
+440
+441
GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
+442
const _GLFWctxconfig* ctxconfig,
+443
const _GLFWfbconfig* fbconfig)
+444
{
+445
int attribs[40];
+446
GLXFBConfig native = NULL;
+447
GLXContext share = NULL;
+448
+449
if (ctxconfig->share)
+450
share = ctxconfig->share->context.glx.handle;
+451
+452
if (!chooseGLXFBConfig(fbconfig, &native))
+453
{
+454
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
+455
"GLX: Failed to find a suitable GLXFBConfig");
+456
return GLFW_FALSE;
+457
}
+458
+459
if (ctxconfig->client == GLFW_OPENGL_ES_API)
+460
{
+461
if (!_glfw.glx.ARB_create_context ||
+462
!_glfw.glx.ARB_create_context_profile ||
+463
!_glfw.glx.EXT_create_context_es2_profile)
+464
{
+465
_glfwInputError(GLFW_API_UNAVAILABLE,
+466
"GLX: OpenGL ES requested but GLX_EXT_create_context_es2_profile is unavailable");
+467
return GLFW_FALSE;
+468
}
+469
}
+470
+471
if (ctxconfig->forward)
+472
{
+473
if (!_glfw.glx.ARB_create_context)
+474
{
+475
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
+476
"GLX: Forward compatibility requested but GLX_ARB_create_context_profile is unavailable");
+477
return GLFW_FALSE;
+478
}
+479
}
+480
+481
if (ctxconfig->profile)
+482
{
+483
if (!_glfw.glx.ARB_create_context ||
+484
!_glfw.glx.ARB_create_context_profile)
+485
{
+486
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
+487
"GLX: An OpenGL profile requested but GLX_ARB_create_context_profile is unavailable");
+488
return GLFW_FALSE;
+489
}
+490
}
+491
+492
_glfwGrabErrorHandlerX11();
+493
+494
if (_glfw.glx.ARB_create_context)
+495
{
+496
int index = 0, mask = 0, flags = 0;
+497
+498
if (ctxconfig->client == GLFW_OPENGL_API)
+499
{

Showing the first 500 of 739 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/init.cadded
@@ -0,0 +1,528 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#include <string.h>
+31
#include <stdlib.h>
+32
#include <stdio.h>
+33
#include <stdarg.h>
+34
#include <assert.h>
+35
+36
+37
// NOTE: The global variables below comprise all mutable global data in GLFW
+38
// Any other mutable global variable is a bug
+39
+40
// This contains all mutable state shared between compilation units of GLFW
+41
//
+42
_GLFWlibrary _glfw = { GLFW_FALSE };
+43
+44
// These are outside of _glfw so they can be used before initialization and
+45
// after termination without special handling when _glfw is cleared to zero
+46
//
+47
static _GLFWerror _glfwMainThreadError;
+48
static GLFWerrorfun _glfwErrorCallback;
+49
static GLFWallocator _glfwInitAllocator;
+50
static _GLFWinitconfig _glfwInitHints =
+51
{
+52
.hatButtons = true,
+53
.angleType = GLFW_ANGLE_PLATFORM_TYPE_NONE,
+54
.platformID = GLFW_ANY_PLATFORM,
+55
.vulkanLoader = NULL,
+56
.ns =
+57
{
+58
.menubar = true,
+59
.chdir = true
+60
},
+61
.x11 =
+62
{
+63
.xcbVulkanSurface = true,
+64
},
+65
.wl =
+66
{
+67
.libdecorMode = GLFW_WAYLAND_PREFER_LIBDECOR
+68
},
+69
};
+70
+71
// The allocation function used when no custom allocator is set
+72
//
+73
static void* defaultAllocate(size_t size, void* user)
+74
{
+75
return malloc(size);
+76
}
+77
+78
// The deallocation function used when no custom allocator is set
+79
//
+80
static void defaultDeallocate(void* block, void* user)
+81
{
+82
free(block);
+83
}
+84
+85
// The reallocation function used when no custom allocator is set
+86
//
+87
static void* defaultReallocate(void* block, size_t size, void* user)
+88
{
+89
return realloc(block, size);
+90
}
+91
+92
// Terminate the library
+93
//
+94
static void terminate(void)
+95
{
+96
int i;
+97
+98
memset(&_glfw.callbacks, 0, sizeof(_glfw.callbacks));
+99
+100
while (_glfw.windowListHead)
+101
glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead);
+102
+103
while (_glfw.cursorListHead)
+104
glfwDestroyCursor((GLFWcursor*) _glfw.cursorListHead);
+105
+106
for (i = 0; i < _glfw.monitorCount; i++)
+107
{
+108
_GLFWmonitor* monitor = _glfw.monitors[i];
+109
if (monitor->originalRamp.size)
+110
_glfw.platform.setGammaRamp(monitor, &monitor->originalRamp);
+111
_glfwFreeMonitor(monitor);
+112
}
+113
+114
_glfw_free(_glfw.monitors);
+115
_glfw.monitors = NULL;
+116
_glfw.monitorCount = 0;
+117
+118
_glfw_free(_glfw.mappings);
+119
_glfw.mappings = NULL;
+120
_glfw.mappingCount = 0;
+121
+122
_glfwTerminateVulkan();
+123
_glfw.platform.terminateJoysticks();
+124
_glfw.platform.terminate();
+125
+126
_glfw.initialized = GLFW_FALSE;
+127
+128
while (_glfw.errorListHead)
+129
{
+130
_GLFWerror* error = _glfw.errorListHead;
+131
_glfw.errorListHead = error->next;
+132
_glfw_free(error);
+133
}
+134
+135
_glfwPlatformDestroyTls(&_glfw.contextSlot);
+136
_glfwPlatformDestroyTls(&_glfw.errorSlot);
+137
_glfwPlatformDestroyMutex(&_glfw.errorLock);
+138
+139
memset(&_glfw, 0, sizeof(_glfw));
+140
}
+141
+142
+143
//////////////////////////////////////////////////////////////////////////
+144
////// GLFW internal API //////
+145
//////////////////////////////////////////////////////////////////////////
+146
+147
// Encode a Unicode code point to a UTF-8 stream
+148
// Based on cutef8 by Jeff Bezanson (Public Domain)
+149
//
+150
size_t _glfwEncodeUTF8(char* s, uint32_t codepoint)
+151
{
+152
size_t count = 0;
+153
+154
if (codepoint < 0x80)
+155
s[count++] = (char) codepoint;
+156
else if (codepoint < 0x800)
+157
{
+158
s[count++] = (codepoint >> 6) | 0xc0;
+159
s[count++] = (codepoint & 0x3f) | 0x80;
+160
}
+161
else if (codepoint < 0x10000)
+162
{
+163
s[count++] = (codepoint >> 12) | 0xe0;
+164
s[count++] = ((codepoint >> 6) & 0x3f) | 0x80;
+165
s[count++] = (codepoint & 0x3f) | 0x80;
+166
}
+167
else if (codepoint < 0x110000)
+168
{
+169
s[count++] = (codepoint >> 18) | 0xf0;
+170
s[count++] = ((codepoint >> 12) & 0x3f) | 0x80;
+171
s[count++] = ((codepoint >> 6) & 0x3f) | 0x80;
+172
s[count++] = (codepoint & 0x3f) | 0x80;
+173
}
+174
+175
return count;
+176
}
+177
+178
// Splits and translates a text/uri-list into separate file paths
+179
// NOTE: This function destroys the provided string
+180
//
+181
char** _glfwParseUriList(char* text, int* count)
+182
{
+183
const char* prefix = "file://";
+184
char** paths = NULL;
+185
char* line;
+186
+187
*count = 0;
+188
+189
while ((line = strtok(text, "\r\n")))
+190
{
+191
char* path;
+192
+193
text = NULL;
+194
+195
if (line[0] == '#')
+196
continue;
+197
+198
if (strncmp(line, prefix, strlen(prefix)) == 0)
+199
{
+200
line += strlen(prefix);
+201
// TODO: Validate hostname
+202
while (*line != '/')
+203
line++;
+204
}
+205
+206
(*count)++;
+207
+208
path = _glfw_calloc(strlen(line) + 1, 1);
+209
paths = _glfw_realloc(paths, *count * sizeof(char*));
+210
paths[*count - 1] = path;
+211
+212
while (*line)
+213
{
+214
if (line[0] == '%' && line[1] && line[2])
+215
{
+216
const char digits[3] = { line[1], line[2], '\0' };
+217
*path = (char) strtol(digits, NULL, 16);
+218
line += 2;
+219
}
+220
else
+221
*path = *line;
+222
+223
path++;
+224
line++;
+225
}
+226
}
+227
+228
return paths;
+229
}
+230
+231
char* _glfw_strdup(const char* source)
+232
{
+233
const size_t length = strlen(source);
+234
char* result = _glfw_calloc(length + 1, 1);
+235
strcpy(result, source);
+236
return result;
+237
}
+238
+239
int _glfw_min(int a, int b)
+240
{
+241
return a < b ? a : b;
+242
}
+243
+244
int _glfw_max(int a, int b)
+245
{
+246
return a > b ? a : b;
+247
}
+248
+249
void* _glfw_calloc(size_t count, size_t size)
+250
{
+251
if (count && size)
+252
{
+253
void* block;
+254
+255
if (count > SIZE_MAX / size)
+256
{
+257
_glfwInputError(GLFW_INVALID_VALUE, "Allocation size overflow");
+258
return NULL;
+259
}
+260
+261
block = _glfw.allocator.allocate(count * size, _glfw.allocator.user);
+262
if (block)
+263
return memset(block, 0, count * size);
+264
else
+265
{
+266
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
+267
return NULL;
+268
}
+269
}
+270
else
+271
return NULL;
+272
}
+273
+274
void* _glfw_realloc(void* block, size_t size)
+275
{
+276
if (block && size)
+277
{
+278
void* resized = _glfw.allocator.reallocate(block, size, _glfw.allocator.user);
+279
if (resized)
+280
return resized;
+281
else
+282
{
+283
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
+284
return NULL;
+285
}
+286
}
+287
else if (block)
+288
{
+289
_glfw_free(block);
+290
return NULL;
+291
}
+292
else
+293
return _glfw_calloc(1, size);
+294
}
+295
+296
void _glfw_free(void* block)
+297
{
+298
if (block)
+299
_glfw.allocator.deallocate(block, _glfw.allocator.user);
+300
}
+301
+302
+303
//////////////////////////////////////////////////////////////////////////
+304
////// GLFW event API //////
+305
//////////////////////////////////////////////////////////////////////////
+306
+307
// Notifies shared code of an error
+308
//
+309
void _glfwInputError(int code, const char* format, ...)
+310
{
+311
_GLFWerror* error;
+312
char description[_GLFW_MESSAGE_SIZE];
+313
+314
if (format)
+315
{
+316
va_list vl;
+317
+318
va_start(vl, format);
+319
vsnprintf(description, sizeof(description), format, vl);
+320
va_end(vl);
+321
+322
description[sizeof(description) - 1] = '\0';
+323
}
+324
else
+325
{
+326
if (code == GLFW_NOT_INITIALIZED)
+327
strcpy(description, "The GLFW library is not initialized");
+328
else if (code == GLFW_NO_CURRENT_CONTEXT)
+329
strcpy(description, "There is no current context");
+330
else if (code == GLFW_INVALID_ENUM)
+331
strcpy(description, "Invalid argument for enum parameter");
+332
else if (code == GLFW_INVALID_VALUE)
+333
strcpy(description, "Invalid value for parameter");
+334
else if (code == GLFW_OUT_OF_MEMORY)
+335
strcpy(description, "Out of memory");
+336
else if (code == GLFW_API_UNAVAILABLE)
+337
strcpy(description, "The requested API is unavailable");
+338
else if (code == GLFW_VERSION_UNAVAILABLE)
+339
strcpy(description, "The requested API version is unavailable");
+340
else if (code == GLFW_PLATFORM_ERROR)
+341
strcpy(description, "A platform-specific error occurred");
+342
else if (code == GLFW_FORMAT_UNAVAILABLE)
+343
strcpy(description, "The requested format is unavailable");
+344
else if (code == GLFW_NO_WINDOW_CONTEXT)
+345
strcpy(description, "The specified window has no context");
+346
else if (code == GLFW_CURSOR_UNAVAILABLE)
+347
strcpy(description, "The specified cursor shape is unavailable");
+348
else if (code == GLFW_FEATURE_UNAVAILABLE)
+349
strcpy(description, "The requested feature cannot be implemented for this platform");
+350
else if (code == GLFW_FEATURE_UNIMPLEMENTED)
+351
strcpy(description, "The requested feature has not yet been implemented for this platform");
+352
else if (code == GLFW_PLATFORM_UNAVAILABLE)
+353
strcpy(description, "The requested platform is unavailable");
+354
else
+355
strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
+356
}
+357
+358
if (_glfw.initialized)
+359
{
+360
error = _glfwPlatformGetTls(&_glfw.errorSlot);
+361
if (!error)
+362
{
+363
error = _glfw_calloc(1, sizeof(_GLFWerror));
+364
_glfwPlatformSetTls(&_glfw.errorSlot, error);
+365
_glfwPlatformLockMutex(&_glfw.errorLock);
+366
error->next = _glfw.errorListHead;
+367
_glfw.errorListHead = error;
+368
_glfwPlatformUnlockMutex(&_glfw.errorLock);
+369
}
+370
}
+371
else
+372
error = &_glfwMainThreadError;
+373
+374
error->code = code;
+375
strcpy(error->description, description);
+376
+377
if (_glfwErrorCallback)
+378
_glfwErrorCallback(code, description);
+379
}
+380
+381
+382
//////////////////////////////////////////////////////////////////////////
+383
////// GLFW public API //////
+384
//////////////////////////////////////////////////////////////////////////
+385
+386
GLFWAPI int glfwInit(void)
+387
{
+388
if (_glfw.initialized)
+389
return GLFW_TRUE;
+390
+391
memset(&_glfw, 0, sizeof(_glfw));
+392
_glfw.hints.init = _glfwInitHints;
+393
+394
_glfw.allocator = _glfwInitAllocator;
+395
if (!_glfw.allocator.allocate)
+396
{
+397
_glfw.allocator.allocate = defaultAllocate;
+398
_glfw.allocator.reallocate = defaultReallocate;
+399
_glfw.allocator.deallocate = defaultDeallocate;
+400
}
+401
+402
if (!_glfwSelectPlatform(_glfw.hints.init.platformID, &_glfw.platform))
+403
return GLFW_FALSE;
+404
+405
if (!_glfw.platform.init())
+406
{
+407
terminate();
+408
return GLFW_FALSE;
+409
}
+410
+411
if (!_glfwPlatformCreateMutex(&_glfw.errorLock) ||
+412
!_glfwPlatformCreateTls(&_glfw.errorSlot) ||
+413
!_glfwPlatformCreateTls(&_glfw.contextSlot))
+414
{
+415
terminate();
+416
return GLFW_FALSE;
+417
}
+418
+419
_glfwPlatformSetTls(&_glfw.errorSlot, &_glfwMainThreadError);
+420
+421
_glfwInitGamepadMappings();
+422
+423
_glfwPlatformInitTimer();
+424
_glfw.timer.offset = _glfwPlatformGetTimerValue();
+425
+426
_glfw.initialized = GLFW_TRUE;
+427
+428
glfwDefaultWindowHints();
+429
return GLFW_TRUE;
+430
}
+431
+432
GLFWAPI void glfwTerminate(void)
+433
{
+434
if (!_glfw.initialized)
+435
return;
+436
+437
terminate();
+438
}
+439
+440
GLFWAPI void glfwInitHint(int hint, int value)
+441
{
+442
switch (hint)
+443
{
+444
case GLFW_JOYSTICK_HAT_BUTTONS:
+445
_glfwInitHints.hatButtons = value;
+446
return;
+447
case GLFW_ANGLE_PLATFORM_TYPE:
+448
_glfwInitHints.angleType = value;
+449
return;
+450
case GLFW_PLATFORM:
+451
_glfwInitHints.platformID = value;
+452
return;
+453
case GLFW_COCOA_CHDIR_RESOURCES:
+454
_glfwInitHints.ns.chdir = value;
+455
return;
+456
case GLFW_COCOA_MENUBAR:
+457
_glfwInitHints.ns.menubar = value;
+458
return;
+459
case GLFW_X11_XCB_VULKAN_SURFACE:
+460
_glfwInitHints.x11.xcbVulkanSurface = value;
+461
return;
+462
case GLFW_WAYLAND_LIBDECOR:
+463
_glfwInitHints.wl.libdecorMode = value;
+464
return;
+465
}
+466
+467
_glfwInputError(GLFW_INVALID_ENUM,
+468
"Invalid init hint 0x%08X", hint);
+469
}
+470
+471
GLFWAPI void glfwInitAllocator(const GLFWallocator* allocator)
+472
{
+473
if (allocator)
+474
{
+475
if (allocator->allocate && allocator->reallocate && allocator->deallocate)
+476
_glfwInitAllocator = *allocator;
+477
else
+478
_glfwInputError(GLFW_INVALID_VALUE, "Missing function in allocator");
+479
}
+480
else
+481
memset(&_glfwInitAllocator, 0, sizeof(GLFWallocator));
+482
}
+483
+484
GLFWAPI void glfwInitVulkanLoader(PFN_vkGetInstanceProcAddr loader)
+485
{
+486
_glfwInitHints.vulkanLoader = loader;
+487
}
+488
+489
GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev)
+490
{
+491
if (major != NULL)
+492
*major = GLFW_VERSION_MAJOR;
+493
if (minor != NULL)
+494
*minor = GLFW_VERSION_MINOR;
+495
if (rev != NULL)
+496
*rev = GLFW_VERSION_REVISION;
+497
}
+498
+499
GLFWAPI int glfwGetError(const char** description)

Showing the first 500 of 529 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/input.cadded
@@ -0,0 +1,1519 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
#include "mappings.h"
+30
+31
#include <assert.h>
+32
#include <float.h>
+33
#include <math.h>
+34
#include <stdlib.h>
+35
#include <string.h>
+36
+37
// Internal key state used for sticky keys
+38
#define _GLFW_STICK 3
+39
+40
// Internal constants for gamepad mapping source types
+41
#define _GLFW_JOYSTICK_AXIS 1
+42
#define _GLFW_JOYSTICK_BUTTON 2
+43
#define _GLFW_JOYSTICK_HATBIT 3
+44
+45
#define GLFW_MOD_MASK (GLFW_MOD_SHIFT | \
+46
GLFW_MOD_CONTROL | \
+47
GLFW_MOD_ALT | \
+48
GLFW_MOD_SUPER | \
+49
GLFW_MOD_CAPS_LOCK | \
+50
GLFW_MOD_NUM_LOCK)
+51
+52
// Initializes the platform joystick API if it has not been already
+53
//
+54
static GLFWbool initJoysticks(void)
+55
{
+56
if (!_glfw.joysticksInitialized)
+57
{
+58
if (!_glfw.platform.initJoysticks())
+59
{
+60
_glfw.platform.terminateJoysticks();
+61
return GLFW_FALSE;
+62
}
+63
}
+64
+65
return _glfw.joysticksInitialized = GLFW_TRUE;
+66
}
+67
+68
// Finds a mapping based on joystick GUID
+69
//
+70
static _GLFWmapping* findMapping(const char* guid)
+71
{
+72
int i;
+73
+74
for (i = 0; i < _glfw.mappingCount; i++)
+75
{
+76
if (strcmp(_glfw.mappings[i].guid, guid) == 0)
+77
return _glfw.mappings + i;
+78
}
+79
+80
return NULL;
+81
}
+82
+83
// Checks whether a gamepad mapping element is present in the hardware
+84
//
+85
static GLFWbool isValidElementForJoystick(const _GLFWmapelement* e,
+86
const _GLFWjoystick* js)
+87
{
+88
if (e->type == _GLFW_JOYSTICK_HATBIT && (e->index >> 4) >= js->hatCount)
+89
return GLFW_FALSE;
+90
else if (e->type == _GLFW_JOYSTICK_BUTTON && e->index >= js->buttonCount)
+91
return GLFW_FALSE;
+92
else if (e->type == _GLFW_JOYSTICK_AXIS && e->index >= js->axisCount)
+93
return GLFW_FALSE;
+94
+95
return GLFW_TRUE;
+96
}
+97
+98
// Finds a mapping based on joystick GUID and verifies element indices
+99
//
+100
static _GLFWmapping* findValidMapping(const _GLFWjoystick* js)
+101
{
+102
_GLFWmapping* mapping = findMapping(js->guid);
+103
if (mapping)
+104
{
+105
int i;
+106
+107
for (i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++)
+108
{
+109
if (!isValidElementForJoystick(mapping->buttons + i, js))
+110
return NULL;
+111
}
+112
+113
for (i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++)
+114
{
+115
if (!isValidElementForJoystick(mapping->axes + i, js))
+116
return NULL;
+117
}
+118
}
+119
+120
return mapping;
+121
}
+122
+123
// Parses an SDL_GameControllerDB line and adds it to the mapping list
+124
//
+125
static GLFWbool parseMapping(_GLFWmapping* mapping, const char* string)
+126
{
+127
const char* c = string;
+128
size_t i, length;
+129
struct
+130
{
+131
const char* name;
+132
_GLFWmapelement* element;
+133
} fields[] =
+134
{
+135
{ "platform", NULL },
+136
{ "a", mapping->buttons + GLFW_GAMEPAD_BUTTON_A },
+137
{ "b", mapping->buttons + GLFW_GAMEPAD_BUTTON_B },
+138
{ "x", mapping->buttons + GLFW_GAMEPAD_BUTTON_X },
+139
{ "y", mapping->buttons + GLFW_GAMEPAD_BUTTON_Y },
+140
{ "back", mapping->buttons + GLFW_GAMEPAD_BUTTON_BACK },
+141
{ "start", mapping->buttons + GLFW_GAMEPAD_BUTTON_START },
+142
{ "guide", mapping->buttons + GLFW_GAMEPAD_BUTTON_GUIDE },
+143
{ "leftshoulder", mapping->buttons + GLFW_GAMEPAD_BUTTON_LEFT_BUMPER },
+144
{ "rightshoulder", mapping->buttons + GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER },
+145
{ "leftstick", mapping->buttons + GLFW_GAMEPAD_BUTTON_LEFT_THUMB },
+146
{ "rightstick", mapping->buttons + GLFW_GAMEPAD_BUTTON_RIGHT_THUMB },
+147
{ "dpup", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_UP },
+148
{ "dpright", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_RIGHT },
+149
{ "dpdown", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_DOWN },
+150
{ "dpleft", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_LEFT },
+151
{ "lefttrigger", mapping->axes + GLFW_GAMEPAD_AXIS_LEFT_TRIGGER },
+152
{ "righttrigger", mapping->axes + GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER },
+153
{ "leftx", mapping->axes + GLFW_GAMEPAD_AXIS_LEFT_X },
+154
{ "lefty", mapping->axes + GLFW_GAMEPAD_AXIS_LEFT_Y },
+155
{ "rightx", mapping->axes + GLFW_GAMEPAD_AXIS_RIGHT_X },
+156
{ "righty", mapping->axes + GLFW_GAMEPAD_AXIS_RIGHT_Y }
+157
};
+158
+159
length = strcspn(c, ",");
+160
if (length != 32 || c[length] != ',')
+161
{
+162
_glfwInputError(GLFW_INVALID_VALUE, NULL);
+163
return GLFW_FALSE;
+164
}
+165
+166
memcpy(mapping->guid, c, length);
+167
c += length + 1;
+168
+169
length = strcspn(c, ",");
+170
if (length >= sizeof(mapping->name) || c[length] != ',')
+171
{
+172
_glfwInputError(GLFW_INVALID_VALUE, NULL);
+173
return GLFW_FALSE;
+174
}
+175
+176
memcpy(mapping->name, c, length);
+177
c += length + 1;
+178
+179
while (*c)
+180
{
+181
// TODO: Implement output modifiers
+182
if (*c == '+' || *c == '-')
+183
return GLFW_FALSE;
+184
+185
for (i = 0; i < sizeof(fields) / sizeof(fields[0]); i++)
+186
{
+187
length = strlen(fields[i].name);
+188
if (strncmp(c, fields[i].name, length) != 0 || c[length] != ':')
+189
continue;
+190
+191
c += length + 1;
+192
+193
if (fields[i].element)
+194
{
+195
_GLFWmapelement* e = fields[i].element;
+196
int8_t minimum = -1;
+197
int8_t maximum = 1;
+198
+199
if (*c == '+')
+200
{
+201
minimum = 0;
+202
c += 1;
+203
}
+204
else if (*c == '-')
+205
{
+206
maximum = 0;
+207
c += 1;
+208
}
+209
+210
if (*c == 'a')
+211
e->type = _GLFW_JOYSTICK_AXIS;
+212
else if (*c == 'b')
+213
e->type = _GLFW_JOYSTICK_BUTTON;
+214
else if (*c == 'h')
+215
e->type = _GLFW_JOYSTICK_HATBIT;
+216
else
+217
break;
+218
+219
if (e->type == _GLFW_JOYSTICK_HATBIT)
+220
{
+221
const unsigned long hat = strtoul(c + 1, (char**) &c, 10);
+222
const unsigned long bit = strtoul(c + 1, (char**) &c, 10);
+223
e->index = (uint8_t) ((hat << 4) | bit);
+224
}
+225
else
+226
e->index = (uint8_t) strtoul(c + 1, (char**) &c, 10);
+227
+228
if (e->type == _GLFW_JOYSTICK_AXIS)
+229
{
+230
e->axisScale = 2 / (maximum - minimum);
+231
e->axisOffset = -(maximum + minimum);
+232
+233
if (*c == '~')
+234
{
+235
e->axisScale = -e->axisScale;
+236
e->axisOffset = -e->axisOffset;
+237
}
+238
}
+239
}
+240
else
+241
{
+242
const char* name = _glfw.platform.getMappingName();
+243
length = strlen(name);
+244
if (strncmp(c, name, length) != 0)
+245
return GLFW_FALSE;
+246
}
+247
+248
break;
+249
}
+250
+251
c += strcspn(c, ",");
+252
c += strspn(c, ",");
+253
}
+254
+255
for (i = 0; i < 32; i++)
+256
{
+257
if (mapping->guid[i] >= 'A' && mapping->guid[i] <= 'F')
+258
mapping->guid[i] += 'a' - 'A';
+259
}
+260
+261
_glfw.platform.updateGamepadGUID(mapping->guid);
+262
return GLFW_TRUE;
+263
}
+264
+265
+266
//////////////////////////////////////////////////////////////////////////
+267
////// GLFW event API //////
+268
//////////////////////////////////////////////////////////////////////////
+269
+270
// Notifies shared code of a physical key event
+271
//
+272
void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods)
+273
{
+274
assert(window != NULL);
+275
assert(key >= 0 || key == GLFW_KEY_UNKNOWN);
+276
assert(key <= GLFW_KEY_LAST);
+277
assert(action == GLFW_PRESS || action == GLFW_RELEASE);
+278
assert(mods == (mods & GLFW_MOD_MASK));
+279
+280
if (key >= 0 && key <= GLFW_KEY_LAST)
+281
{
+282
GLFWbool repeated = GLFW_FALSE;
+283
+284
if (action == GLFW_RELEASE && window->keys[key] == GLFW_RELEASE)
+285
return;
+286
+287
if (action == GLFW_PRESS && window->keys[key] == GLFW_PRESS)
+288
repeated = GLFW_TRUE;
+289
+290
if (action == GLFW_RELEASE && window->stickyKeys)
+291
window->keys[key] = _GLFW_STICK;
+292
else
+293
window->keys[key] = (char) action;
+294
+295
if (repeated)
+296
action = GLFW_REPEAT;
+297
}
+298
+299
if (!window->lockKeyMods)
+300
mods &= ~(GLFW_MOD_CAPS_LOCK | GLFW_MOD_NUM_LOCK);
+301
+302
if (window->callbacks.key)
+303
window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods);
+304
}
+305
+306
// Notifies shared code of a Unicode codepoint input event
+307
// The 'plain' parameter determines whether to emit a regular character event
+308
//
+309
void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool plain)
+310
{
+311
assert(window != NULL);
+312
assert(mods == (mods & GLFW_MOD_MASK));
+313
assert(plain == GLFW_TRUE || plain == GLFW_FALSE);
+314
+315
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
+316
return;
+317
+318
if (!window->lockKeyMods)
+319
mods &= ~(GLFW_MOD_CAPS_LOCK | GLFW_MOD_NUM_LOCK);
+320
+321
if (window->callbacks.charmods)
+322
window->callbacks.charmods((GLFWwindow*) window, codepoint, mods);
+323
+324
if (plain)
+325
{
+326
if (window->callbacks.character)
+327
window->callbacks.character((GLFWwindow*) window, codepoint);
+328
}
+329
}
+330
+331
// Notifies shared code of a scroll event
+332
//
+333
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
+334
{
+335
assert(window != NULL);
+336
assert(isfinite(xoffset));
+337
assert(isfinite(yoffset));
+338
+339
if (window->callbacks.scroll)
+340
window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset);
+341
}
+342
+343
// Notifies shared code of a mouse button click event
+344
//
+345
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
+346
{
+347
assert(window != NULL);
+348
assert(button >= 0);
+349
assert(action == GLFW_PRESS || action == GLFW_RELEASE);
+350
assert(mods == (mods & GLFW_MOD_MASK));
+351
+352
if (button < 0 || (!window->disableMouseButtonLimit && button > GLFW_MOUSE_BUTTON_LAST))
+353
return;
+354
+355
if (!window->lockKeyMods)
+356
mods &= ~(GLFW_MOD_CAPS_LOCK | GLFW_MOD_NUM_LOCK);
+357
+358
if (button <= GLFW_MOUSE_BUTTON_LAST)
+359
{
+360
if (action == GLFW_RELEASE && window->stickyMouseButtons)
+361
window->mouseButtons[button] = _GLFW_STICK;
+362
else
+363
window->mouseButtons[button] = (char) action;
+364
}
+365
+366
if (window->callbacks.mouseButton)
+367
window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods);
+368
}
+369
+370
// Notifies shared code of a cursor motion event
+371
// The position is specified in content area relative screen coordinates
+372
//
+373
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos)
+374
{
+375
assert(window != NULL);
+376
assert(isfinite(xpos));
+377
assert(isfinite(ypos));
+378
+379
if (window->virtualCursorPosX == xpos && window->virtualCursorPosY == ypos)
+380
return;
+381
+382
window->virtualCursorPosX = xpos;
+383
window->virtualCursorPosY = ypos;
+384
+385
if (window->callbacks.cursorPos)
+386
window->callbacks.cursorPos((GLFWwindow*) window, xpos, ypos);
+387
}
+388
+389
// Notifies shared code of a cursor enter/leave event
+390
//
+391
void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered)
+392
{
+393
assert(window != NULL);
+394
assert(entered == GLFW_TRUE || entered == GLFW_FALSE);
+395
+396
if (window->callbacks.cursorEnter)
+397
window->callbacks.cursorEnter((GLFWwindow*) window, entered);
+398
}
+399
+400
// Notifies shared code of files or directories dropped on a window
+401
//
+402
void _glfwInputDrop(_GLFWwindow* window, int count, const char** paths)
+403
{
+404
assert(window != NULL);
+405
assert(count > 0);
+406
assert(paths != NULL);
+407
+408
if (window->callbacks.drop)
+409
window->callbacks.drop((GLFWwindow*) window, count, paths);
+410
}
+411
+412
// Notifies shared code of a joystick connection or disconnection
+413
//
+414
void _glfwInputJoystick(_GLFWjoystick* js, int event)
+415
{
+416
assert(js != NULL);
+417
assert(event == GLFW_CONNECTED || event == GLFW_DISCONNECTED);
+418
+419
if (event == GLFW_CONNECTED)
+420
js->connected = GLFW_TRUE;
+421
else if (event == GLFW_DISCONNECTED)
+422
js->connected = GLFW_FALSE;
+423
+424
if (_glfw.callbacks.joystick)
+425
_glfw.callbacks.joystick((int) (js - _glfw.joysticks), event);
+426
}
+427
+428
// Notifies shared code of the new value of a joystick axis
+429
//
+430
void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value)
+431
{
+432
assert(js != NULL);
+433
assert(axis >= 0);
+434
assert(axis < js->axisCount);
+435
assert(isfinite(value));
+436
+437
js->axes[axis] = value;
+438
}
+439
+440
// Notifies shared code of the new value of a joystick button
+441
//
+442
void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value)
+443
{
+444
assert(js != NULL);
+445
assert(button >= 0);
+446
assert(button < js->buttonCount);
+447
assert(value == GLFW_PRESS || value == GLFW_RELEASE);
+448
+449
js->buttons[button] = value;
+450
}
+451
+452
// Notifies shared code of the new value of a joystick hat
+453
//
+454
void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value)
+455
{
+456
int base;
+457
+458
assert(js != NULL);
+459
assert(hat >= 0);
+460
assert(hat < js->hatCount);
+461
+462
// Valid hat values only use the least significant nibble
+463
assert((value & 0xf0) == 0);
+464
// Valid hat values do not have both bits of an axis set
+465
assert((value & GLFW_HAT_LEFT) == 0 || (value & GLFW_HAT_RIGHT) == 0);
+466
assert((value & GLFW_HAT_UP) == 0 || (value & GLFW_HAT_DOWN) == 0);
+467
+468
base = js->buttonCount + hat * 4;
+469
+470
js->buttons[base + 0] = (value & 0x01) ? GLFW_PRESS : GLFW_RELEASE;
+471
js->buttons[base + 1] = (value & 0x02) ? GLFW_PRESS : GLFW_RELEASE;
+472
js->buttons[base + 2] = (value & 0x04) ? GLFW_PRESS : GLFW_RELEASE;
+473
js->buttons[base + 3] = (value & 0x08) ? GLFW_PRESS : GLFW_RELEASE;
+474
+475
js->hats[hat] = value;
+476
}
+477
+478
+479
//////////////////////////////////////////////////////////////////////////
+480
////// GLFW internal API //////
+481
//////////////////////////////////////////////////////////////////////////
+482
+483
// Adds the built-in set of gamepad mappings
+484
//
+485
void _glfwInitGamepadMappings(void)
+486
{
+487
size_t i;
+488
const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*);
+489
_glfw.mappings = _glfw_calloc(count, sizeof(_GLFWmapping));
+490
+491
for (i = 0; i < count; i++)
+492
{
+493
if (parseMapping(&_glfw.mappings[_glfw.mappingCount], _glfwDefaultMappings[i]))
+494
_glfw.mappingCount++;
+495
}
+496
}
+497
+498
// Returns an available joystick object with arrays and name allocated
+499
//

Showing the first 500 of 1520 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/internal.hadded
@@ -0,0 +1,1023 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#pragma once
+29
+30
#if defined(_GLFW_USE_CONFIG_H)
+31
#include "glfw_config.h"
+32
#endif
+33
+34
#if defined(GLFW_INCLUDE_GLCOREARB) || \
+35
defined(GLFW_INCLUDE_ES1) || \
+36
defined(GLFW_INCLUDE_ES2) || \
+37
defined(GLFW_INCLUDE_ES3) || \
+38
defined(GLFW_INCLUDE_ES31) || \
+39
defined(GLFW_INCLUDE_ES32) || \
+40
defined(GLFW_INCLUDE_NONE) || \
+41
defined(GLFW_INCLUDE_GLEXT) || \
+42
defined(GLFW_INCLUDE_GLU) || \
+43
defined(GLFW_INCLUDE_VULKAN) || \
+44
defined(GLFW_DLL)
+45
#error "You must not define any header option macros when compiling GLFW"
+46
#endif
+47
+48
#define GLFW_INCLUDE_NONE
+49
#include "../include/GLFW/glfw3.h"
+50
+51
#include <stdbool.h>
+52
+53
#define _GLFW_INSERT_FIRST 0
+54
#define _GLFW_INSERT_LAST 1
+55
+56
#define _GLFW_POLL_PRESENCE 0
+57
#define _GLFW_POLL_AXES 1
+58
#define _GLFW_POLL_BUTTONS 2
+59
#define _GLFW_POLL_ALL (_GLFW_POLL_AXES | _GLFW_POLL_BUTTONS)
+60
+61
#define _GLFW_MESSAGE_SIZE 1024
+62
+63
typedef int GLFWbool;
+64
typedef void (*GLFWproc)(void);
+65
+66
typedef struct _GLFWerror _GLFWerror;
+67
typedef struct _GLFWinitconfig _GLFWinitconfig;
+68
typedef struct _GLFWwndconfig _GLFWwndconfig;
+69
typedef struct _GLFWctxconfig _GLFWctxconfig;
+70
typedef struct _GLFWfbconfig _GLFWfbconfig;
+71
typedef struct _GLFWcontext _GLFWcontext;
+72
typedef struct _GLFWwindow _GLFWwindow;
+73
typedef struct _GLFWplatform _GLFWplatform;
+74
typedef struct _GLFWlibrary _GLFWlibrary;
+75
typedef struct _GLFWmonitor _GLFWmonitor;
+76
typedef struct _GLFWcursor _GLFWcursor;
+77
typedef struct _GLFWmapelement _GLFWmapelement;
+78
typedef struct _GLFWmapping _GLFWmapping;
+79
typedef struct _GLFWjoystick _GLFWjoystick;
+80
typedef struct _GLFWtls _GLFWtls;
+81
typedef struct _GLFWmutex _GLFWmutex;
+82
+83
#define GL_VERSION 0x1f02
+84
#define GL_NONE 0
+85
#define GL_COLOR_BUFFER_BIT 0x00004000
+86
#define GL_UNSIGNED_BYTE 0x1401
+87
#define GL_EXTENSIONS 0x1f03
+88
#define GL_NUM_EXTENSIONS 0x821d
+89
#define GL_CONTEXT_FLAGS 0x821e
+90
#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
+91
#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
+92
#define GL_CONTEXT_PROFILE_MASK 0x9126
+93
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
+94
#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
+95
#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+96
#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+97
#define GL_NO_RESET_NOTIFICATION_ARB 0x8261
+98
#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82fb
+99
#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc
+100
#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
+101
+102
typedef int GLint;
+103
typedef unsigned int GLuint;
+104
typedef unsigned int GLenum;
+105
typedef unsigned int GLbitfield;
+106
typedef unsigned char GLubyte;
+107
+108
typedef void (APIENTRY * PFNGLCLEARPROC)(GLbitfield);
+109
typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGPROC)(GLenum);
+110
typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*);
+111
typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint);
+112
typedef void (APIENTRY * PFNGLFLUSHPROC)(void);
+113
+114
#define EGL_SUCCESS 0x3000
+115
#define EGL_NOT_INITIALIZED 0x3001
+116
#define EGL_BAD_ACCESS 0x3002
+117
#define EGL_BAD_ALLOC 0x3003
+118
#define EGL_BAD_ATTRIBUTE 0x3004
+119
#define EGL_BAD_CONFIG 0x3005
+120
#define EGL_BAD_CONTEXT 0x3006
+121
#define EGL_BAD_CURRENT_SURFACE 0x3007
+122
#define EGL_BAD_DISPLAY 0x3008
+123
#define EGL_BAD_MATCH 0x3009
+124
#define EGL_BAD_NATIVE_PIXMAP 0x300a
+125
#define EGL_BAD_NATIVE_WINDOW 0x300b
+126
#define EGL_BAD_PARAMETER 0x300c
+127
#define EGL_BAD_SURFACE 0x300d
+128
#define EGL_CONTEXT_LOST 0x300e
+129
#define EGL_COLOR_BUFFER_TYPE 0x303f
+130
#define EGL_RGB_BUFFER 0x308e
+131
#define EGL_SURFACE_TYPE 0x3033
+132
#define EGL_WINDOW_BIT 0x0004
+133
#define EGL_RENDERABLE_TYPE 0x3040
+134
#define EGL_OPENGL_ES_BIT 0x0001
+135
#define EGL_OPENGL_ES2_BIT 0x0004
+136
#define EGL_OPENGL_BIT 0x0008
+137
#define EGL_ALPHA_SIZE 0x3021
+138
#define EGL_BLUE_SIZE 0x3022
+139
#define EGL_GREEN_SIZE 0x3023
+140
#define EGL_RED_SIZE 0x3024
+141
#define EGL_DEPTH_SIZE 0x3025
+142
#define EGL_STENCIL_SIZE 0x3026
+143
#define EGL_SAMPLES 0x3031
+144
#define EGL_OPENGL_ES_API 0x30a0
+145
#define EGL_OPENGL_API 0x30a2
+146
#define EGL_NONE 0x3038
+147
#define EGL_RENDER_BUFFER 0x3086
+148
#define EGL_SINGLE_BUFFER 0x3085
+149
#define EGL_EXTENSIONS 0x3055
+150
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+151
#define EGL_NATIVE_VISUAL_ID 0x302e
+152
#define EGL_NO_SURFACE ((EGLSurface) 0)
+153
#define EGL_NO_DISPLAY ((EGLDisplay) 0)
+154
#define EGL_NO_CONTEXT ((EGLContext) 0)
+155
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType) 0)
+156
#define EGL_PBUFFER_BIT 0x0001
+157
#define EGL_WIDTH 0x3057
+158
#define EGL_HEIGHT 0x3056
+159
+160
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+161
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+162
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+163
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
+164
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31bd
+165
#define EGL_NO_RESET_NOTIFICATION_KHR 0x31be
+166
#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31bf
+167
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+168
#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
+169
#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30fb
+170
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30fd
+171
#define EGL_CONTEXT_FLAGS_KHR 0x30fc
+172
#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3
+173
#define EGL_GL_COLORSPACE_KHR 0x309d
+174
#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
+175
#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
+176
#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
+177
#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
+178
#define EGL_PLATFORM_X11_EXT 0x31d5
+179
#define EGL_PLATFORM_WAYLAND_EXT 0x31d8
+180
#define EGL_PRESENT_OPAQUE_EXT 0x31df
+181
#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
+182
#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
+183
#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320d
+184
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320e
+185
#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207
+186
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
+187
#define EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE 0x3450
+188
#define EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE 0x3489
+189
#define EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE 0x348f
+190
#define EGL_PLATFORM_SURFACELESS_MESA 0x31dd
+191
+192
typedef int EGLint;
+193
typedef unsigned int EGLBoolean;
+194
typedef unsigned int EGLenum;
+195
typedef void* EGLConfig;
+196
typedef void* EGLContext;
+197
typedef void* EGLDisplay;
+198
typedef void* EGLSurface;
+199
+200
typedef void* EGLNativeDisplayType;
+201
typedef void* EGLNativeWindowType;
+202
+203
// EGL function pointer typedefs
+204
typedef EGLBoolean (APIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*);
+205
typedef EGLBoolean (APIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*);
+206
typedef EGLDisplay (APIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType);
+207
typedef EGLint (APIENTRY * PFN_eglGetError)(void);
+208
typedef EGLBoolean (APIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*);
+209
typedef EGLBoolean (APIENTRY * PFN_eglTerminate)(EGLDisplay);
+210
typedef EGLBoolean (APIENTRY * PFN_eglBindAPI)(EGLenum);
+211
typedef EGLContext (APIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*);
+212
typedef EGLBoolean (APIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface);
+213
typedef EGLBoolean (APIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext);
+214
typedef EGLSurface (APIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*);
+215
typedef EGLSurface (APIENTRY * PFN_eglCreatePbufferSurface)(EGLDisplay,EGLContext,const EGLint*);
+216
typedef EGLBoolean (APIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext);
+217
typedef EGLBoolean (APIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface);
+218
typedef EGLBoolean (APIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint);
+219
typedef const char* (APIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint);
+220
typedef GLFWglproc (APIENTRY * PFN_eglGetProcAddress)(const char*);
+221
#define eglGetConfigAttrib _glfw.egl.GetConfigAttrib
+222
#define eglGetConfigs _glfw.egl.GetConfigs
+223
#define eglGetDisplay _glfw.egl.GetDisplay
+224
#define eglGetError _glfw.egl.GetError
+225
#define eglInitialize _glfw.egl.Initialize
+226
#define eglTerminate _glfw.egl.Terminate
+227
#define eglBindAPI _glfw.egl.BindAPI
+228
#define eglCreateContext _glfw.egl.CreateContext
+229
#define eglDestroySurface _glfw.egl.DestroySurface
+230
#define eglDestroyContext _glfw.egl.DestroyContext
+231
#define eglCreateWindowSurface _glfw.egl.CreateWindowSurface
+232
#define eglCreatePbufferSurface _glfw.egl.CreatePbufferSurface
+233
#define eglMakeCurrent _glfw.egl.MakeCurrent
+234
#define eglSwapBuffers _glfw.egl.SwapBuffers
+235
#define eglSwapInterval _glfw.egl.SwapInterval
+236
#define eglQueryString _glfw.egl.QueryString
+237
#define eglGetProcAddress _glfw.egl.GetProcAddress
+238
+239
typedef EGLDisplay (APIENTRY * PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum,void*,const EGLint*);
+240
typedef EGLSurface (APIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay,EGLConfig,void*,const EGLint*);
+241
#define eglGetPlatformDisplayEXT _glfw.egl.GetPlatformDisplayEXT
+242
#define eglCreatePlatformWindowSurfaceEXT _glfw.egl.CreatePlatformWindowSurfaceEXT
+243
+244
#define OSMESA_RGBA 0x1908
+245
#define OSMESA_FORMAT 0x22
+246
#define OSMESA_DEPTH_BITS 0x30
+247
#define OSMESA_STENCIL_BITS 0x31
+248
#define OSMESA_ACCUM_BITS 0x32
+249
#define OSMESA_PROFILE 0x33
+250
#define OSMESA_CORE_PROFILE 0x34
+251
#define OSMESA_COMPAT_PROFILE 0x35
+252
#define OSMESA_CONTEXT_MAJOR_VERSION 0x36
+253
#define OSMESA_CONTEXT_MINOR_VERSION 0x37
+254
+255
typedef void* OSMesaContext;
+256
typedef void (*OSMESAproc)(void);
+257
+258
typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum,GLint,GLint,GLint,OSMesaContext);
+259
typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int*,OSMesaContext);
+260
typedef void (GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext);
+261
typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int);
+262
typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**);
+263
typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**);
+264
typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*);
+265
#define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt
+266
#define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs
+267
#define OSMesaDestroyContext _glfw.osmesa.DestroyContext
+268
#define OSMesaMakeCurrent _glfw.osmesa.MakeCurrent
+269
#define OSMesaGetColorBuffer _glfw.osmesa.GetColorBuffer
+270
#define OSMesaGetDepthBuffer _glfw.osmesa.GetDepthBuffer
+271
#define OSMesaGetProcAddress _glfw.osmesa.GetProcAddress
+272
+273
#define VK_NULL_HANDLE 0
+274
+275
typedef void* VkInstance;
+276
typedef void* VkPhysicalDevice;
+277
typedef uint64_t VkSurfaceKHR;
+278
typedef uint32_t VkFlags;
+279
typedef uint32_t VkBool32;
+280
+281
typedef enum VkStructureType
+282
{
+283
VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
+284
VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
+285
VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
+286
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
+287
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
+288
VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000,
+289
VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT = 1000256000,
+290
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
+291
} VkStructureType;
+292
+293
typedef enum VkResult
+294
{
+295
VK_SUCCESS = 0,
+296
VK_NOT_READY = 1,
+297
VK_TIMEOUT = 2,
+298
VK_EVENT_SET = 3,
+299
VK_EVENT_RESET = 4,
+300
VK_INCOMPLETE = 5,
+301
VK_ERROR_OUT_OF_HOST_MEMORY = -1,
+302
VK_ERROR_OUT_OF_DEVICE_MEMORY = -2,
+303
VK_ERROR_INITIALIZATION_FAILED = -3,
+304
VK_ERROR_DEVICE_LOST = -4,
+305
VK_ERROR_MEMORY_MAP_FAILED = -5,
+306
VK_ERROR_LAYER_NOT_PRESENT = -6,
+307
VK_ERROR_EXTENSION_NOT_PRESENT = -7,
+308
VK_ERROR_FEATURE_NOT_PRESENT = -8,
+309
VK_ERROR_INCOMPATIBLE_DRIVER = -9,
+310
VK_ERROR_TOO_MANY_OBJECTS = -10,
+311
VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
+312
VK_ERROR_SURFACE_LOST_KHR = -1000000000,
+313
VK_SUBOPTIMAL_KHR = 1000001003,
+314
VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
+315
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
+316
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
+317
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
+318
VK_RESULT_MAX_ENUM = 0x7FFFFFFF
+319
} VkResult;
+320
+321
typedef struct VkAllocationCallbacks VkAllocationCallbacks;
+322
+323
typedef struct VkExtensionProperties
+324
{
+325
char extensionName[256];
+326
uint32_t specVersion;
+327
} VkExtensionProperties;
+328
+329
typedef void (APIENTRY * PFN_vkVoidFunction)(void);
+330
+331
typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*);
+332
typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*);
+333
#define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr
+334
+335
#include "platform.h"
+336
+337
#define GLFW_NATIVE_INCLUDE_NONE
+338
#include "../include/GLFW/glfw3native.h"
+339
+340
// Checks for whether the library has been initialized
+341
#define _GLFW_REQUIRE_INIT() \
+342
if (!_glfw.initialized) \
+343
{ \
+344
_glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
+345
return; \
+346
}
+347
#define _GLFW_REQUIRE_INIT_OR_RETURN(x) \
+348
if (!_glfw.initialized) \
+349
{ \
+350
_glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
+351
return x; \
+352
}
+353
+354
// Swaps the provided pointers
+355
#define _GLFW_SWAP(type, x, y) \
+356
{ \
+357
type t; \
+358
t = x; \
+359
x = y; \
+360
y = t; \
+361
}
+362
+363
// Per-thread error structure
+364
//
+365
struct _GLFWerror
+366
{
+367
_GLFWerror* next;
+368
int code;
+369
char description[_GLFW_MESSAGE_SIZE];
+370
};
+371
+372
// Initialization configuration
+373
//
+374
// Parameters relating to the initialization of the library
+375
//
+376
struct _GLFWinitconfig
+377
{
+378
bool hatButtons;
+379
int angleType;
+380
int platformID;
+381
PFN_vkGetInstanceProcAddr vulkanLoader;
+382
struct {
+383
bool menubar;
+384
bool chdir;
+385
} ns;
+386
struct {
+387
bool xcbVulkanSurface;
+388
} x11;
+389
struct {
+390
int libdecorMode;
+391
} wl;
+392
};
+393
+394
// Window configuration
+395
//
+396
// Parameters relating to the creation of the window but not directly related
+397
// to the framebuffer. This is used to pass window creation parameters from
+398
// shared code to the platform API.
+399
//
+400
struct _GLFWwndconfig
+401
{
+402
int xpos;
+403
int ypos;
+404
int width;
+405
int height;
+406
bool resizable;
+407
bool visible;
+408
bool decorated;
+409
bool focused;
+410
bool autoIconify;
+411
bool floating;
+412
bool maximized;
+413
bool centerCursor;
+414
bool focusOnShow;
+415
bool mousePassthrough;
+416
bool scaleToMonitor;
+417
bool scaleFramebuffer;
+418
struct {
+419
char frameName[256];
+420
} ns;
+421
struct {
+422
char className[256];
+423
char instanceName[256];
+424
} x11;
+425
struct {
+426
bool keymenu;
+427
bool showDefault;
+428
} win32;
+429
struct {
+430
char appId[256];
+431
} wl;
+432
};
+433
+434
// Context configuration
+435
//
+436
// Parameters relating to the creation of the context but not directly related
+437
// to the framebuffer. This is used to pass context creation parameters from
+438
// shared code to the platform API.
+439
//
+440
struct _GLFWctxconfig
+441
{
+442
int client;
+443
int source;
+444
int major;
+445
int minor;
+446
bool forward;
+447
bool debug;
+448
bool noerror;
+449
int profile;
+450
int robustness;
+451
int release;
+452
_GLFWwindow* share;
+453
struct {
+454
bool offline;
+455
} nsgl;
+456
};
+457
+458
// Framebuffer configuration
+459
//
+460
// This describes buffers and their sizes. It also contains
+461
// a platform-specific ID used to map back to the backend API object.
+462
//
+463
// It is used to pass framebuffer parameters from shared code to the platform
+464
// API and also to enumerate and select available framebuffer configs.
+465
//
+466
struct _GLFWfbconfig
+467
{
+468
int redBits;
+469
int greenBits;
+470
int blueBits;
+471
int alphaBits;
+472
int depthBits;
+473
int stencilBits;
+474
int accumRedBits;
+475
int accumGreenBits;
+476
int accumBlueBits;
+477
int accumAlphaBits;
+478
int auxBuffers;
+479
bool stereo;
+480
int samples;
+481
bool sRGB;
+482
bool doublebuffer;
+483
bool transparent;
+484
uintptr_t handle;
+485
};
+486
+487
// Context structure
+488
//
+489
struct _GLFWcontext
+490
{
+491
int client;
+492
int source;
+493
int major, minor, revision;
+494
GLFWbool forward, debug, noerror;
+495
int profile;
+496
int robustness;
+497
int release;
+498
+499
PFNGLGETSTRINGIPROC GetStringi;

Showing the first 500 of 1024 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/linux_joystick.cadded
@@ -0,0 +1,437 @@
+1
//========================================================================
+2
// GLFW 3.5 Linux - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
+31
+32
#include <sys/types.h>
+33
#include <sys/stat.h>
+34
#include <sys/inotify.h>
+35
#include <sys/ioctl.h>
+36
#include <fcntl.h>
+37
#include <errno.h>
+38
#include <dirent.h>
+39
#include <stdio.h>
+40
#include <stdlib.h>
+41
#include <string.h>
+42
#include <unistd.h>
+43
+44
#ifndef SYN_DROPPED // < v2.6.39 kernel headers
+45
// Workaround for CentOS-6, which is supported till 2020-11-30, but still on v2.6.32
+46
#define SYN_DROPPED 3
+47
#endif
+48
+49
// Apply an EV_KEY event to the specified joystick
+50
//
+51
static void handleKeyEvent(_GLFWjoystick* js, int code, int value)
+52
{
+53
_glfwInputJoystickButton(js,
+54
js->linjs.keyMap[code - BTN_MISC],
+55
value ? GLFW_PRESS : GLFW_RELEASE);
+56
}
+57
+58
// Apply an EV_ABS event to the specified joystick
+59
//
+60
static void handleAbsEvent(_GLFWjoystick* js, int code, int value)
+61
{
+62
const int index = js->linjs.absMap[code];
+63
+64
if (code >= ABS_HAT0X && code <= ABS_HAT3Y)
+65
{
+66
static const char stateMap[3][3] =
+67
{
+68
{ GLFW_HAT_CENTERED, GLFW_HAT_UP, GLFW_HAT_DOWN },
+69
{ GLFW_HAT_LEFT, GLFW_HAT_LEFT_UP, GLFW_HAT_LEFT_DOWN },
+70
{ GLFW_HAT_RIGHT, GLFW_HAT_RIGHT_UP, GLFW_HAT_RIGHT_DOWN },
+71
};
+72
+73
const int hat = (code - ABS_HAT0X) / 2;
+74
const int axis = (code - ABS_HAT0X) % 2;
+75
int* state = js->linjs.hats[hat];
+76
+77
// NOTE: Looking at several input drivers, it seems all hat events use
+78
// -1 for left / up, 0 for centered and 1 for right / down
+79
if (value == 0)
+80
state[axis] = 0;
+81
else if (value < 0)
+82
state[axis] = 1;
+83
else if (value > 0)
+84
state[axis] = 2;
+85
+86
_glfwInputJoystickHat(js, index, stateMap[state[0]][state[1]]);
+87
}
+88
else
+89
{
+90
const struct input_absinfo* info = &js->linjs.absInfo[code];
+91
float normalized = value;
+92
+93
const int range = info->maximum - info->minimum;
+94
if (range)
+95
{
+96
// Normalize to 0.0 -> 1.0
+97
normalized = (normalized - info->minimum) / range;
+98
// Normalize to -1.0 -> 1.0
+99
normalized = normalized * 2.0f - 1.0f;
+100
}
+101
+102
_glfwInputJoystickAxis(js, index, normalized);
+103
}
+104
}
+105
+106
// Poll state of absolute axes
+107
//
+108
static void pollAbsState(_GLFWjoystick* js)
+109
{
+110
for (int code = 0; code < ABS_CNT; code++)
+111
{
+112
if (js->linjs.absMap[code] < 0)
+113
continue;
+114
+115
struct input_absinfo* info = &js->linjs.absInfo[code];
+116
+117
if (ioctl(js->linjs.fd, EVIOCGABS(code), info) < 0)
+118
continue;
+119
+120
handleAbsEvent(js, code, info->value);
+121
}
+122
}
+123
+124
#define isBitSet(bit, arr) (arr[(bit) / 8] & (1 << ((bit) % 8)))
+125
+126
// Attempt to open the specified joystick device
+127
//
+128
static GLFWbool openJoystickDevice(const char* path)
+129
{
+130
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
+131
{
+132
if (!_glfw.joysticks[jid].connected)
+133
continue;
+134
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
+135
return GLFW_FALSE;
+136
}
+137
+138
_GLFWjoystickLinux linjs = {0};
+139
linjs.fd = open(path, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
+140
if (linjs.fd == -1)
+141
return GLFW_FALSE;
+142
+143
char evBits[(EV_CNT + 7) / 8] = {0};
+144
char keyBits[(KEY_CNT + 7) / 8] = {0};
+145
char absBits[(ABS_CNT + 7) / 8] = {0};
+146
struct input_id id;
+147
+148
if (ioctl(linjs.fd, EVIOCGBIT(0, sizeof(evBits)), evBits) < 0 ||
+149
ioctl(linjs.fd, EVIOCGBIT(EV_KEY, sizeof(keyBits)), keyBits) < 0 ||
+150
ioctl(linjs.fd, EVIOCGBIT(EV_ABS, sizeof(absBits)), absBits) < 0 ||
+151
ioctl(linjs.fd, EVIOCGID, &id) < 0)
+152
{
+153
_glfwInputError(GLFW_PLATFORM_ERROR,
+154
"Linux: Failed to query input device: %s",
+155
strerror(errno));
+156
close(linjs.fd);
+157
return GLFW_FALSE;
+158
}
+159
+160
// Ensure this device supports the events expected of a joystick
+161
if (!isBitSet(EV_ABS, evBits))
+162
{
+163
close(linjs.fd);
+164
return GLFW_FALSE;
+165
}
+166
+167
char name[256] = "";
+168
+169
if (ioctl(linjs.fd, EVIOCGNAME(sizeof(name)), name) < 0)
+170
strncpy(name, "Unknown", sizeof(name));
+171
+172
char guid[33] = "";
+173
+174
// Generate a joystick GUID that matches the SDL 2.0.5+ one
+175
if (id.vendor && id.product && id.version)
+176
{
+177
sprintf(guid, "%02x%02x0000%02x%02x0000%02x%02x0000%02x%02x0000",
+178
id.bustype & 0xff, id.bustype >> 8,
+179
id.vendor & 0xff, id.vendor >> 8,
+180
id.product & 0xff, id.product >> 8,
+181
id.version & 0xff, id.version >> 8);
+182
}
+183
else
+184
{
+185
sprintf(guid, "%02x%02x0000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
+186
id.bustype & 0xff, id.bustype >> 8,
+187
name[0], name[1], name[2], name[3],
+188
name[4], name[5], name[6], name[7],
+189
name[8], name[9], name[10]);
+190
}
+191
+192
int axisCount = 0, buttonCount = 0, hatCount = 0;
+193
+194
for (int code = BTN_MISC; code < KEY_CNT; code++)
+195
{
+196
if (!isBitSet(code, keyBits))
+197
continue;
+198
+199
linjs.keyMap[code - BTN_MISC] = buttonCount;
+200
buttonCount++;
+201
}
+202
+203
for (int code = 0; code < ABS_CNT; code++)
+204
{
+205
linjs.absMap[code] = -1;
+206
if (!isBitSet(code, absBits))
+207
continue;
+208
+209
if (code >= ABS_HAT0X && code <= ABS_HAT3Y)
+210
{
+211
linjs.absMap[code] = hatCount;
+212
hatCount++;
+213
// Skip the Y axis
+214
code++;
+215
}
+216
else
+217
{
+218
if (ioctl(linjs.fd, EVIOCGABS(code), &linjs.absInfo[code]) < 0)
+219
continue;
+220
+221
linjs.absMap[code] = axisCount;
+222
axisCount++;
+223
}
+224
}
+225
+226
_GLFWjoystick* js =
+227
_glfwAllocJoystick(name, guid, axisCount, buttonCount, hatCount);
+228
if (!js)
+229
{
+230
close(linjs.fd);
+231
return GLFW_FALSE;
+232
}
+233
+234
strncpy(linjs.path, path, sizeof(linjs.path) - 1);
+235
memcpy(&js->linjs, &linjs, sizeof(linjs));
+236
+237
pollAbsState(js);
+238
+239
_glfwInputJoystick(js, GLFW_CONNECTED);
+240
return GLFW_TRUE;
+241
}
+242
+243
#undef isBitSet
+244
+245
// Frees all resources associated with the specified joystick
+246
//
+247
static void closeJoystick(_GLFWjoystick* js)
+248
{
+249
_glfwInputJoystick(js, GLFW_DISCONNECTED);
+250
close(js->linjs.fd);
+251
_glfwFreeJoystick(js);
+252
}
+253
+254
// Lexically compare joysticks by name; used by qsort
+255
//
+256
static int compareJoysticks(const void* fp, const void* sp)
+257
{
+258
const _GLFWjoystick* fj = fp;
+259
const _GLFWjoystick* sj = sp;
+260
return strcmp(fj->linjs.path, sj->linjs.path);
+261
}
+262
+263
+264
//////////////////////////////////////////////////////////////////////////
+265
////// GLFW internal API //////
+266
//////////////////////////////////////////////////////////////////////////
+267
+268
void _glfwDetectJoystickConnectionLinux(void)
+269
{
+270
if (_glfw.linjs.inotify <= 0)
+271
return;
+272
+273
ssize_t offset = 0;
+274
char buffer[16384];
+275
const ssize_t size = read(_glfw.linjs.inotify, buffer, sizeof(buffer));
+276
+277
while (size > offset)
+278
{
+279
regmatch_t match;
+280
const struct inotify_event* e = (struct inotify_event*) (buffer + offset);
+281
+282
offset += sizeof(struct inotify_event) + e->len;
+283
+284
if (regexec(&_glfw.linjs.regex, e->name, 1, &match, 0) != 0)
+285
continue;
+286
+287
char path[PATH_MAX];
+288
snprintf(path, sizeof(path), "/dev/input/%s", e->name);
+289
+290
if (e->mask & (IN_CREATE | IN_ATTRIB))
+291
openJoystickDevice(path);
+292
else if (e->mask & IN_DELETE)
+293
{
+294
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
+295
{
+296
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
+297
{
+298
closeJoystick(_glfw.joysticks + jid);
+299
break;
+300
}
+301
}
+302
}
+303
}
+304
}
+305
+306
+307
//////////////////////////////////////////////////////////////////////////
+308
////// GLFW platform API //////
+309
//////////////////////////////////////////////////////////////////////////
+310
+311
GLFWbool _glfwInitJoysticksLinux(void)
+312
{
+313
const char* dirname = "/dev/input";
+314
+315
_glfw.linjs.inotify = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
+316
if (_glfw.linjs.inotify > 0)
+317
{
+318
// HACK: Register for IN_ATTRIB to get notified when udev is done
+319
// This works well in practice but the true way is libudev
+320
+321
_glfw.linjs.watch = inotify_add_watch(_glfw.linjs.inotify,
+322
dirname,
+323
IN_CREATE | IN_ATTRIB | IN_DELETE);
+324
}
+325
+326
// Continue without device connection notifications if inotify fails
+327
+328
_glfw.linjs.regexCompiled = (regcomp(&_glfw.linjs.regex, "^event[0-9]\\+$", 0) == 0);
+329
if (!_glfw.linjs.regexCompiled)
+330
{
+331
_glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex");
+332
return GLFW_FALSE;
+333
}
+334
+335
int count = 0;
+336
+337
DIR* dir = opendir(dirname);
+338
if (dir)
+339
{
+340
struct dirent* entry;
+341
+342
while ((entry = readdir(dir)))
+343
{
+344
regmatch_t match;
+345
+346
if (regexec(&_glfw.linjs.regex, entry->d_name, 1, &match, 0) != 0)
+347
continue;
+348
+349
char path[PATH_MAX];
+350
+351
snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
+352
+353
if (openJoystickDevice(path))
+354
count++;
+355
}
+356
+357
closedir(dir);
+358
}
+359
+360
// Continue with no joysticks if enumeration fails
+361
+362
qsort(_glfw.joysticks, count, sizeof(_GLFWjoystick), compareJoysticks);
+363
return GLFW_TRUE;
+364
}
+365
+366
void _glfwTerminateJoysticksLinux(void)
+367
{
+368
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
+369
{
+370
_GLFWjoystick* js = _glfw.joysticks + jid;
+371
if (js->connected)
+372
closeJoystick(js);
+373
}
+374
+375
if (_glfw.linjs.inotify > 0)
+376
{
+377
if (_glfw.linjs.watch > 0)
+378
inotify_rm_watch(_glfw.linjs.inotify, _glfw.linjs.watch);
+379
+380
close(_glfw.linjs.inotify);
+381
}
+382
+383
if (_glfw.linjs.regexCompiled)
+384
regfree(&_glfw.linjs.regex);
+385
}
+386
+387
GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)
+388
{
+389
// Read all queued events (non-blocking)
+390
for (;;)
+391
{
+392
struct input_event e;
+393
+394
errno = 0;
+395
if (read(js->linjs.fd, &e, sizeof(e)) < 0)
+396
{
+397
// Reset the joystick slot if the device was disconnected
+398
if (errno == ENODEV)
+399
closeJoystick(js);
+400
+401
break;
+402
}
+403
+404
if (e.type == EV_SYN)
+405
{
+406
if (e.code == SYN_DROPPED)
+407
_glfw.linjs.dropped = GLFW_TRUE;
+408
else if (e.code == SYN_REPORT)
+409
{
+410
_glfw.linjs.dropped = GLFW_FALSE;
+411
pollAbsState(js);
+412
}
+413
}
+414
+415
if (_glfw.linjs.dropped)
+416
continue;
+417
+418
if (e.type == EV_KEY)
+419
handleKeyEvent(js, e.code, e.value);
+420
else if (e.type == EV_ABS)
+421
handleAbsEvent(js, e.code, e.value);
+422
}
+423
+424
return js->connected;
+425
}
+426
+427
const char* _glfwGetMappingNameLinux(void)
+428
{
+429
return "Linux";
+430
}
+431
+432
void _glfwUpdateGamepadGUIDLinux(char* guid)
+433
{
+434
}
+435
+436
#endif // GLFW_BUILD_LINUX_JOYSTICK
+437
vendor/glfw/src/linux_joystick.hadded
@@ -0,0 +1,64 @@
+1
//========================================================================
+2
// GLFW 3.5 Linux - 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 <linux/input.h>
+28
#include <linux/limits.h>
+29
#include <regex.h>
+30
+31
#define GLFW_LINUX_JOYSTICK_STATE _GLFWjoystickLinux linjs;
+32
#define GLFW_LINUX_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs;
+33
+34
// Linux-specific joystick data
+35
//
+36
typedef struct _GLFWjoystickLinux
+37
{
+38
int fd;
+39
char path[PATH_MAX];
+40
int keyMap[KEY_CNT - BTN_MISC];
+41
int absMap[ABS_CNT];
+42
struct input_absinfo absInfo[ABS_CNT];
+43
int hats[4][2];
+44
} _GLFWjoystickLinux;
+45
+46
// Linux-specific joystick API data
+47
//
+48
typedef struct _GLFWlibraryLinux
+49
{
+50
int inotify;
+51
int watch;
+52
regex_t regex;
+53
GLFWbool regexCompiled;
+54
GLFWbool dropped;
+55
} _GLFWlibraryLinux;
+56
+57
void _glfwDetectJoystickConnectionLinux(void);
+58
+59
GLFWbool _glfwInitJoysticksLinux(void);
+60
void _glfwTerminateJoysticksLinux(void);
+61
GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode);
+62
const char* _glfwGetMappingNameLinux(void);
+63
void _glfwUpdateGamepadGUIDLinux(char* guid);
+64
vendor/glfw/src/macos_time.cadded
@@ -0,0 +1,57 @@
+1
//========================================================================
+2
// GLFW 3.5 macOS - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org>
+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 "internal.h"
+28
+29
#if defined(GLFW_BUILD_MACOS_TIMER)
+30
+31
#include <mach/mach_time.h>
+32
+33
+34
//////////////////////////////////////////////////////////////////////////
+35
////// GLFW platform API //////
+36
//////////////////////////////////////////////////////////////////////////
+37
+38
void _glfwPlatformInitTimer(void)
+39
{
+40
mach_timebase_info_data_t info;
+41
mach_timebase_info(&info);
+42
+43
_glfw.timer.macos.frequency = (info.denom * 1e9) / info.numer;
+44
}
+45
+46
uint64_t _glfwPlatformGetTimerValue(void)
+47
{
+48
return mach_absolute_time();
+49
}
+50
+51
uint64_t _glfwPlatformGetTimerFrequency(void)
+52
{
+53
return _glfw.timer.macos.frequency;
+54
}
+55
+56
#endif // GLFW_BUILD_MACOS_TIMER
+57
vendor/glfw/src/macos_time.hadded
@@ -0,0 +1,35 @@
+1
//========================================================================
+2
// GLFW 3.5 macOS - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2009-2021 Camilla Löwy <elmindreda@glfw.org>
+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
#define GLFW_MACOS_LIBRARY_TIMER_STATE _GLFWtimerMacOS macos;
+28
+29
// macOS-specific global timer data
+30
//
+31
typedef struct _GLFWtimerMacOS
+32
{
+33
uint64_t frequency;
+34
} _GLFWtimerMacOS;
+35
vendor/glfw/src/mappings.hadded
@@ -0,0 +1,1001 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
+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
// As mappings.h.in, this file is used by CMake to produce the mappings.h
+27
// header file. If you are adding a GLFW specific gamepad mapping, this is
+28
// where to put it.
+29
//========================================================================
+30
// As mappings.h, this provides all pre-defined gamepad mappings, including
+31
// all available in SDL_GameControllerDB. Do not edit this file. Any gamepad
+32
// mappings not specific to GLFW should be submitted to SDL_GameControllerDB.
+33
// This file can be re-generated from mappings.h.in and the upstream
+34
// gamecontrollerdb.txt with the 'update_mappings' CMake target.
+35
//========================================================================
+36
+37
// All gamepad mappings not labeled GLFW are copied from the
+38
// SDL_GameControllerDB project under the following license:
+39
//
+40
// Simple DirectMedia Layer
+41
// Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
+42
//
+43
// This software is provided 'as-is', without any express or implied warranty.
+44
// In no event will the authors be held liable for any damages arising from the
+45
// use of this software.
+46
//
+47
// Permission is granted to anyone to use this software for any purpose,
+48
// including commercial applications, and to alter it and redistribute it
+49
// freely, subject to the following restrictions:
+50
//
+51
// 1. The origin of this software must not be misrepresented; you must not
+52
// claim that you wrote the original software. If you use this software
+53
// in a product, an acknowledgment in the product documentation would
+54
// be appreciated but is not required.
+55
//
+56
// 2. Altered source versions must be plainly marked as such, and must not be
+57
// misrepresented as being the original software.
+58
//
+59
// 3. This notice may not be removed or altered from any source distribution.
+60
+61
const char* _glfwDefaultMappings[] =
+62
{
+63
#if defined(_GLFW_WIN32)
+64
"03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,platform:Windows,",
+65
"03000000c82d00002038000000000000,8bitdo,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,",
+66
"03000000c82d00000951000000000000,8BitDo Dogbone Modkit,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b11,platform:Windows,",
+67
"03000000c82d000011ab000000000000,8BitDo F30,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,",
+68
"03000000c82d00001038000000000000,8BitDo F30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,",
+69
"03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,",
+70
"03000000c82d00000650000000000000,8BitDo M30,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:a4,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Windows,",
+71
"03000000c82d00005106000000000000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b4,y:b3,platform:Windows,",
+72
"03000000c82d00000151000000000000,8BitDo M30 ModKit,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Windows,",
+73
"03000000c82d00000310000000000000,8BitDo N30,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Windows,",
+74
"03000000c82d00002028000000000000,8BitDo N30,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,",
+75
"03000000c82d00008010000000000000,8BitDo N30,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Windows,",
+76
"03000000c82d00000451000000000000,8BitDo N30 Modkit,a:b1,b:b0,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,start:b11,platform:Windows,",
+77
"03000000c82d00000190000000000000,8BitDo N30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,",
+78
"03000000c82d00001590000000000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,",
+79
"03000000c82d00006528000000000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,",
+80
"03000000022000000090000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,",
+81
"03000000203800000900000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,",
+82
"03000000c82d00000360000000000000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,",
+83
"03000000c82d00002867000000000000,8BitDo S30 Modkit,a:b0,b:b1,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b8,lefttrigger:b9,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Windows,",
+84
"03000000c82d00000130000000000000,8BitDo SF30,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,",
+85
"03000000c82d00000060000000000000,8Bitdo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,",
+86
"03000000c82d00000061000000000000,8Bitdo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,",
+87
"03000000c82d000021ab000000000000,8BitDo SFC30,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,",
+88
"03000000102800000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,",
+89
"03000000c82d00003028000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,",
+90
"03000000c82d00000030000000000000,8BitDo SN30,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,",
+91
"03000000c82d00001290000000000000,8BitDo SN30,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,",
+92
"03000000c82d000020ab000000000000,8BitDo SN30,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,",
+93
"03000000c82d00004028000000000000,8BitDo SN30,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,",
+94
"03000000c82d00006228000000000000,8BitDo SN30,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,",
+95
"03000000c82d00000351000000000000,8BitDo SN30 Modkit,a:b1,b:b0,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,",
+96
"03000000c82d00000160000000000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,",
+97
"03000000c82d00000161000000000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,",
+98
"03000000c82d00000121000000000000,8BitDo SN30 Pro for Android,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+99
"03000000c82d00000260000000000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,",
+100
"03000000c82d00000261000000000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,",
+101
"03000000c82d00000031000000000000,8BitDo Wireless Adapter,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+102
"03000000c82d00001890000000000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,",
+103
"03000000c82d00003032000000000000,8BitDo Zero 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,",
+104
"03000000a00500003232000000000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Windows,",
+105
"03000000a30c00002700000000000000,Astro City Mini,a:b2,b:b1,back:b8,leftx:a3,lefty:a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Windows,",
+106
"03000000a30c00002800000000000000,Astro City Mini,a:b2,b:b1,back:b8,leftx:a3,lefty:a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Windows,",
+107
"030000008f0e00001200000000000000,Acme GA-02,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Windows,",
+108
"03000000c01100000355000011010000,ACRUX USB GAME PAD,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+109
"03000000fa190000f0ff000000000000,Acteck AGJ-3200,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+110
"030000006f0e00001413000000000000,Afterglow,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+111
"03000000341a00003608000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+112
"030000006f0e00000263000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+113
"030000006f0e00001101000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+114
"030000006f0e00001401000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+115
"030000006f0e00001402000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+116
"030000006f0e00001901000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+117
"030000006f0e00001a01000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+118
"03000000d62000001d57000000000000,Airflo PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+119
"03000000491900001904000000000000,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,platform:Windows,",
+120
"03000000710100001904000000000000,Amazon Luna Controller,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b8,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b4,rightstick:b7,rightx:a3,righty:a4,start:b6,x:b3,y:b2,platform:Windows,",
+121
"03000000ef0500000300000000000000,AxisPad,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,platform:Windows,",
+122
"03000000d6200000e557000000000000,Batarang,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+123
"03000000c01100001352000000000000,Battalife Joystick,a:b6,b:b7,back:b2,leftshoulder:b0,leftx:a0,lefty:a1,rightshoulder:b1,start:b3,x:b4,y:b5,platform:Windows,",
+124
"030000006f0e00003201000000000000,Battlefield 4 PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+125
"03000000d62000002a79000000000000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+126
"03000000bc2000006012000000000000,Betop 2126F,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+127
"03000000bc2000000055000000000000,Betop BFM Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+128
"03000000bc2000006312000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+129
"03000000bc2000006321000000000000,BETOP CONTROLLER,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+130
"03000000bc2000006412000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+131
"03000000c01100000555000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+132
"03000000c01100000655000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+133
"03000000790000000700000000000000,Betop Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,",
+134
"03000000808300000300000000000000,Betop Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,",
+135
"030000006b1400000055000000000000,Bigben PS3 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+136
"030000006b1400000103000000000000,Bigben PS3 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows,",
+137
"03000000120c0000210e000000000000,Brook Mars,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+138
"0300000066f700000500000000000000,BrutalLegendTest,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,",
+139
"03000000d81d00000b00000000000000,BUFFALO BSGP1601 Series ,a:b5,b:b3,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b13,x:b4,y:b2,platform:Windows,",
+140
"03000000e82000006058000000000000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+141
"03000000457500000401000000000000,Cobra,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+142
"030000005e0400008e02000000000000,Controller (XBOX 360 For Windows),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,",
+143
"030000005e040000a102000000000000,Controller (Xbox 360 Wireless Receiver for Windows),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,",
+144
"030000005e040000ff02000000000000,Controller (Xbox One For Windows) - Wired,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,",
+145
"030000005e040000ea02000000000000,Controller (Xbox One For Windows) - Wireless,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,",
+146
"03000000260900008888000000000000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a4,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Windows,",
+147
"03000000a306000022f6000000000000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,",
+148
"03000000451300000830000000000000,Defender Game Racer X7,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+149
"030000007d0400000840000000000000,Destroyer Tiltpad,+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b1,b:b2,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,x:b0,y:b3,platform:Windows,",
+150
"03000000791d00000103000000000000,Dual Box WII,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+151
"03000000bd12000002e0000000000000,Dual USB Vibration Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,platform:Windows,",
+152
"030000008f0e00000910000000000000,DualShock 2,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,platform:Windows,",
+153
"030000006f0e00003001000000000000,EA SPORTS PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+154
"03000000b80500000410000000000000,Elecom Gamepad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,platform:Windows,",
+155
"03000000b80500000610000000000000,Elecom Gamepad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,platform:Windows,",
+156
"03000000120c0000f61c000000000000,Elite,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+157
"030000008f0e00000f31000000000000,EXEQ,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows,",
+158
"03000000341a00000108000000000000,EXEQ RF USB Gamepad 8206,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+159
"030000006f0e00008401000000000000,Faceoff Deluxe+ Audio Wired Controller for Nintendo Switch,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+160
"030000006f0e00008001000000000000,Faceoff Wired Pro Controller for Nintendo Switch,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+161
"03000000852100000201000000000000,FF-GP1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+162
"030000000d0f00008500000000000000,Fighting Commander 2016 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+163
"030000000d0f00008400000000000000,Fighting Commander 5,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+164
"030000000d0f00008700000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+165
"030000000d0f00008800000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,",
+166
"030000000d0f00002700000000000000,FIGHTING STICK V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+167
"78696e70757403000000000000000000,Fightstick TES,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Windows,",
+168
"03000000790000002201000000000000,Game Controller for PC,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+169
"0300000066f700000100000000000000,Game VIB Joystick,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,platform:Windows,",
+170
"03000000260900002625000000000000,Gamecube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,lefttrigger:a4,leftx:a0,lefty:a1,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Windows,",
+171
"03000000790000004618000000000000,GameCube Controller Adapter,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,",
+172
"030000008f0e00000d31000000000000,GAMEPAD 3 TURBO,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+173
"03000000280400000140000000000000,GamePad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+174
"03000000ac0500003d03000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+175
"03000000ac0500004d04000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+176
"03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+177
"03000000c01100000140000000000000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+178
"030000009b2800003200000000000000,GC/N64 to USB v3.4,a:b0,b:b7,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,lefttrigger:+a5,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:+a2,rightx:a3,righty:a4,start:b3,x:b1,y:b8,platform:Windows,",
+179
"030000009b2800006000000000000000,GC/N64 to USB v3.6,a:b0,b:b7,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,lefttrigger:+a5,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:+a2,rightx:a3,righty:a4,start:b3,x:b1,y:b8,platform:Windows,",
+180
"030000008305000009a0000000000000,Genius,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+181
"030000008305000031b0000000000000,Genius Maxfire Blaze 3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+182
"03000000451300000010000000000000,Genius Maxfire Grandias 12,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+183
"030000005c1a00003330000000000000,Genius MaxFire Grandias 12V,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Windows,",
+184
"03000000300f00000b01000000000000,GGE909 Recoil Pad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,",
+185
"03000000f0250000c283000000000000,Gioteck,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+186
"03000000f025000021c1000000000000,Gioteck PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+187
"03000000f0250000c383000000000000,Gioteck VX2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+188
"03000000f0250000c483000000000000,Gioteck VX2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+189
"030000007d0400000540000000000000,Gravis Eliminator GamePad Pro,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+190
"03000000341a00000302000000000000,Hama Scorpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+191
"030000000d0f00004900000000000000,Hatsune Miku Sho Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+192
"030000001008000001e1000000000000,Havit HV-G60,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b3,y:b0,platform:Windows,",
+193
"03000000d81400000862000000000000,HitBox Edition Cthulhu+,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,",
+194
"03000000632500002605000000000000,HJD-X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+195
"030000000d0f00002d00000000000000,Hori Fighting Commander 3 Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+196
"030000000d0f00005f00000000000000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+197
"030000000d0f00005e00000000000000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+198
"030000000d0f00004000000000000000,Hori Fighting Stick Mini 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,",
+199
"030000000d0f00005400000000000000,Hori Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+200
"030000000d0f00000900000000000000,Hori Pad 3 Turbo,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+201
"030000000d0f00004d00000000000000,Hori Pad A,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+202
"030000000d0f00009200000000000000,Hori Pokken Tournament DX Pro Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+203
"030000000d0f00001600000000007803,HORI Real Arcade Pro EX-SE (Xbox 360),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Windows,",
+204
"030000000d0f00009c00000000000000,Hori TAC Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+205
"030000000d0f0000c100000000000000,Horipad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+206
"030000000d0f00006e00000000000000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+207
"030000000d0f00006600000000000000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+208
"030000000d0f00005500000000000000,Horipad 4 FPS,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+209
"030000000d0f0000ee00000000000000,HORIPAD mini4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+210
"03000000250900000017000000000000,HRAP2 on PS/SS/N64 Joypad to USB BOX,a:b2,b:b1,back:b9,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b8,x:b3,y:b0,platform:Windows,",
+211
"030000008f0e00001330000000000000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,platform:Windows,",
+212
"03000000d81d00000f00000000000000,iBUFFALO BSGP1204 Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+213
"03000000d81d00001000000000000000,iBUFFALO BSGP1204P Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+214
"03000000830500006020000000000000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Windows,",
+215
"03000000b50700001403000000000000,Impact Black,a:b2,b:b3,back:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,",
+216
"030000006f0e00002401000000000000,INJUSTICE FightStick PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+217
"03000000ac0500002c02000000000000,IPEGA,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b13,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b14,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+218
"03000000491900000204000000000000,Ipega PG-9023,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+219
"03000000491900000304000000000000,Ipega PG-9087 - Bluetooth Gamepad,+righty:+a5,-righty:-a4,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,start:b11,x:b3,y:b4,platform:Windows,",
+220
"030000006e0500000a20000000000000,JC-DUX60 ELECOM MMO Gamepad,a:b2,b:b3,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b14,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b15,righttrigger:b13,rightx:a3,righty:a4,start:b20,x:b0,y:b1,platform:Windows,",
+221
"030000006e0500000520000000000000,JC-P301U,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,platform:Windows,",
+222
"030000006e0500000320000000000000,JC-U3613M (DInput),a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,platform:Windows,",
+223
"030000006e0500000720000000000000,JC-W01U,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,platform:Windows,",
+224
"030000007e0500000620000000000000,Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b13,leftshoulder:b4,leftstick:b10,rightshoulder:b5,start:b8,x:b2,y:b3,platform:Windows,",
+225
"030000007e0500000620000001000000,Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b13,leftshoulder:b4,leftstick:b10,rightshoulder:b5,start:b8,x:b2,y:b3,platform:Windows,",
+226
"030000007e0500000720000000000000,Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b12,leftshoulder:b4,leftstick:b11,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Windows,",
+227
"030000007e0500000720000001000000,Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b12,leftshoulder:b4,leftstick:b11,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Windows,",
+228
"03000000bd12000003c0000010010000,Joypad Alpha Shock,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+229
"03000000bd12000003c0000000000000,JY-P70UR,a:b1,b:b0,back:b5,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b8,rightstick:b11,righttrigger:b9,rightx:a3,righty:a2,start:b4,x:b3,y:b2,platform:Windows,",
+230
"03000000242f00002d00000000000000,JYS Wireless Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+231
"03000000242f00008a00000000000000,JYS Wireless Adapter,a:b1,b:b4,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,",
+232
"03000000790000000200000000000000,King PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,",
+233
"030000006d040000d1ca000000000000,Logitech ChillStream,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+234
"030000006d040000d2ca000000000000,Logitech Cordless Precision,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+235
"030000006d04000011c2000000000000,Logitech Cordless Wingman,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b5,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b2,righttrigger:b7,rightx:a3,righty:a4,x:b4,platform:Windows,",
+236
"030000006d04000016c2000000000000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+237
"030000006d04000018c2000000000000,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+238
"030000006d04000019c2000000000000,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+239
"030000006d0400001ac2000000000000,Logitech Precision Gamepad,a:b1,b:b2,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+240
"030000006d0400000ac2000000000000,Logitech WingMan RumblePad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b2,rightx:a3,righty:a4,x:b3,y:b4,platform:Windows,",
+241
"03000000380700006652000000000000,Mad Catz C.T.R.L.R,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,",
+242
"03000000380700005032000000000000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+243
"03000000380700005082000000000000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+244
"03000000380700008433000000000000,Mad Catz FightStick TE S+ (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+245
"03000000380700008483000000000000,Mad Catz FightStick TE S+ (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+246
"03000000380700008134000000000000,Mad Catz FightStick TE2+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b7,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b4,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+247
"03000000380700008184000000000000,Mad Catz FightStick TE2+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,leftstick:b10,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+248
"03000000380700006252000000000000,Mad Catz Micro C.T.R.L.R,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,",
+249
"03000000380700008034000000000000,Mad Catz TE2 PS3 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+250
"03000000380700008084000000000000,Mad Catz TE2 PS4 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+251
"03000000380700008532000000000000,Madcatz Arcade Fightstick TE S PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+252
"03000000380700003888000000000000,Madcatz Arcade Fightstick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+253
"03000000380700001888000000000000,MadCatz SFIV FightStick PS3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,righttrigger:b6,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+254
"03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+255
"030000002a0600001024000000000000,Matricom,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b2,y:b3,platform:Windows,",
+256
"030000009f000000adbb000000000000,MaxJoypad Virtual Controller,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,",
+257
"03000000250900000128000000000000,Mayflash Arcade Stick,a:b1,b:b2,back:b8,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b5,y:b6,platform:Windows,",
+258
"03000000790000004418000000000000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,",
+259
"03000000790000004318000000000000,Mayflash GameCube Controller Adapter,a:b1,b:b2,back:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b0,leftshoulder:b4,leftstick:b0,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b0,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,",
+260
"03000000242f00007300000000000000,Mayflash Magic NS,a:b1,b:b4,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,",
+261
"0300000079000000d218000000000000,Mayflash Magic NS,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+262
"03000000d620000010a7000000000000,Mayflash Magic NS,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+263
"030000008f0e00001030000000000000,Mayflash USB Adapter for original Sega Saturn controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b5,rightshoulder:b2,righttrigger:b7,start:b9,x:b3,y:b4,platform:Windows,",
+264
"0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows,",
+265
"03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+266
"03000000790000002418000000000000,Mega Drive,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,rightshoulder:b2,start:b9,x:b3,y:b4,platform:Windows,",
+267
"03000000380700006382000000000000,MLG GamePad PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+268
"03000000c62400002a89000000000000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+269
"03000000c62400002b89000000000000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+270
"03000000c62400001a89000000000000,MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+271
"03000000c62400001b89000000000000,MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+272
"03000000efbe0000edfe000000000000,Monect Virtual Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Windows,",
+273
"03000000250900006688000000000000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,",
+274
"030000006b140000010c000000000000,NACON GC-400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+275
"03000000921200004b46000000000000,NES 2-port Adapter,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b11,platform:Windows,",
+276
"03000000790000004518000000000000,NEXILUX GAMECUBE Controller Adapter,platform:Windows,a:b1,b:b0,x:b2,y:b3,start:b9,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a5,righty:a2,lefttrigger:a3,righttrigger:a4,",
+277
"030000001008000001e5000000000000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,righttrigger:b6,start:b9,x:b3,y:b0,platform:Windows,",
+278
"03000000152000000182000000000000,NGDS,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Windows,",
+279
"03000000bd12000015d0000000000000,Nintendo Retrolink USB Super SNES Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Windows,",
+280
"030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+281
"030000000d0500000308000000000000,Nostromo N45,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,platform:Windows,",
+282
"03000000550900001472000000000000,NVIDIA Controller v01.04,a:b11,b:b10,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b7,leftstick:b5,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b4,righttrigger:a5,rightx:a3,righty:a6,start:b3,x:b9,y:b8,platform:Windows,",
+283
"030000004b120000014d000000000000,NYKO AIRFLO,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a3,leftstick:a0,lefttrigger:b6,rightshoulder:b5,rightstick:a2,righttrigger:b7,start:b9,x:b2,y:b3,platform:Windows,",
+284
"03000000d620000013a7000000000000,NSW wired controller,platform:Windows,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
+285
"03000000782300000a10000000000000,Onlive Wireless Controller,a:b15,b:b14,back:b7,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b11,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b13,y:b12,platform:Windows,",
+286
"03000000d62000006d57000000000000,OPP PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+287
"030000006b14000001a1000000000000,Orange Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b2,y:b3,platform:Windows,",
+288
"03000000362800000100000000000000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,platform:Windows,",
+289
"03000000120c0000f60e000000000000,P4 Wired Gamepad,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b7,rightshoulder:b4,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,",
+290
"030000006f0e00000901000000000000,PDP Versus Fighting Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+291
"030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,",
+292
"030000004c050000da0c000000000000,PlayStation Classic Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Windows,",
+293
"030000004c0500003713000000000000,PlayStation Vita,a:b1,b:b2,back:b8,dpdown:b13,dpleft:b15,dpright:b14,dpup:b12,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,",
+294
"03000000d62000006dca000000000000,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+295
"03000000d62000009557000000000000,Pro Elite PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+296
"03000000d62000009f31000000000000,Pro Ex mini PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+297
"03000000d6200000c757000000000000,Pro Ex mini PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+298
"03000000632500002306000000000000,PS Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Windows,",
+299
"03000000e30500009605000000000000,PS to USB convert cable,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,",
+300
"03000000100800000100000000000000,PS1 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,",
+301
"030000008f0e00007530000000000000,PS1 Controller,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b1,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+302
"03000000100800000300000000000000,PS2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,platform:Windows,",
+303
"03000000250900008888000000000000,PS2 Controller,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,",
+304
"03000000666600006706000000000000,PS2 Controller,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,platform:Windows,",
+305
"030000006b1400000303000000000000,PS2 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+306
"030000009d0d00001330000000000000,PS2 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+307
"03000000250900000500000000000000,PS3 Controller,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows,",
+308
"030000004c0500006802000000000000,PS3 Controller,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b10,lefttrigger:a3~,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:a4~,rightx:a2,righty:a5,start:b8,x:b3,y:b0,platform:Windows,",
+309
"03000000632500007505000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+310
"03000000888800000803000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,",
+311
"030000008f0e00001431000000000000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+312
"030000003807000056a8000000000000,PS3 RF pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+313
"03000000100000008200000000000000,PS360+ v1.66,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:h0.4,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+314
"030000004c050000a00b000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+315
"030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+316
"030000004c050000cc09000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+317
"030000004c050000e60c000000000000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+318
"03000000ff000000cb01000000000000,PSP,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b2,y:b3,platform:Windows,",
+319
"03000000300f00000011000000000000,QanBa Arcade JoyStick 1008,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b10,x:b0,y:b3,platform:Windows,",
+320
"03000000300f00001611000000000000,QanBa Arcade JoyStick 4018,a:b1,b:b2,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,",
+321
"03000000222c00000020000000000000,QANBA DRONE ARCADE JOYSTICK,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,platform:Windows,",
+322
"03000000300f00001210000000000000,QanBa Joystick Plus,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Windows,",
+323
"03000000341a00000104000000000000,QanBa Joystick Q4RAF,a:b5,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b1,y:b2,platform:Windows,",
+324
"03000000222c00000223000000000000,Qanba Obsidian Arcade Joystick PS3 Mode,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+325
"03000000222c00000023000000000000,Qanba Obsidian Arcade Joystick PS4 Mode,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+326
"03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,",
+327
"03000000321500000204000000000000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+328
"03000000321500000104000000000000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+329
"03000000321500000507000000000000,Razer Raiju Mobile,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+330
"03000000321500000707000000000000,Razer Raiju Mobile,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+331
"03000000321500000011000000000000,Razer Raion Fightpad for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+332
"03000000321500000009000000000000,Razer Serval,+lefty:+a2,-lefty:-a1,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,leftx:a0,rightshoulder:b5,rightstick:b9,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,",
+333
"030000000d0f00001100000000000000,REAL ARCADE PRO.3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+334
"030000000d0f00006a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+335
"030000000d0f00006b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+336
"030000000d0f00008a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+337
"030000000d0f00008b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+338
"030000000d0f00007000000000000000,REAL ARCADE PRO.4 VLX,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+339
"030000000d0f00002200000000000000,REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+340
"030000000d0f00005b00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+341
"030000000d0f00005c00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+342
"03000000790000001100000000000000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Windows,",
+343
"03000000bd12000013d0000000000000,Retrolink USB SEGA Saturn Classic,a:b0,b:b1,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b5,lefttrigger:b6,rightshoulder:b2,righttrigger:b7,start:b8,x:b3,y:b4,platform:Windows,",
+344
"0300000000f000000300000000000000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,",
+345
"0300000000f00000f100000000000000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,",
+346
"030000006b140000010d000000000000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+347
"030000006b140000020d000000000000,Revolution Pro Controller 2(1/2),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+348
"030000006b140000130d000000000000,Revolution Pro Controller 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+349
"030000006f0e00001e01000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+350
"030000006f0e00002801000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+351
"030000006f0e00002f01000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+352
"030000004f04000003d0000000000000,run'n'drive,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,leftshoulder:a3,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:a4,rightstick:b11,righttrigger:b5,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+353
"03000000a30600001af5000000000000,Saitek Cyborg,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,",
+354
"03000000a306000023f6000000000000,Saitek Cyborg V.1 Game pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,",
+355
"03000000300f00001201000000000000,Saitek Dual Analog Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,",
+356
"03000000a30600000701000000000000,Saitek P220,a:b2,b:b3,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,lefttrigger:b7,rightshoulder:b4,righttrigger:b5,x:b0,y:b1,platform:Windows,",
+357
"03000000a30600000cff000000000000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b0,y:b1,platform:Windows,",
+358
"03000000a30600000c04000000000000,Saitek P2900,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,",
+359
"03000000300f00001001000000000000,Saitek P480 Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,",
+360
"03000000a30600000b04000000000000,Saitek P990,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,",
+361
"03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,platform:Windows,",
+362
"03000000a30600002106000000000000,Saitek PS1000,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,",
+363
"03000000a306000020f6000000000000,Saitek PS2700,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,",
+364
"03000000300f00001101000000000000,Saitek Rumble Pad,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,",
+365
"03000000730700000401000000000000,Sanwa PlayOnline Mobile,a:b0,b:b1,back:b2,leftx:a0,lefty:a1,start:b3,platform:Windows,",
+366
"0300000000050000289b000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,platform:Windows,",
+367
"030000009b2800000500000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,platform:Windows,",
+368
"03000000a30c00002500000000000000,Sega Genesis Mini 3B controller,a:b2,b:b1,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,righttrigger:b5,start:b9,platform:Windows,",
+369
"03000000a30c00002400000000000000,Sega Mega Drive Mini 6B controller,a:b2,b:b1,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Windows,",
+370
"03000000341a00000208000000000000,SL-6555-SBK,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:-a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a3,righty:a2,start:b7,x:b2,y:b3,platform:Windows,",
+371
"03000000341a00000908000000000000,SL-6566,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+372
"030000008f0e00000800000000000000,SpeedLink Strike FX,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+373
"03000000c01100000591000000000000,Speedlink Torid,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+374
"03000000d11800000094000000000000,Stadia Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b11,rightx:a3,righty:a4,start:b9,x:b2,y:b3,platform:Windows,",
+375
"03000000110100001914000000000000,SteelSeries,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftstick:b13,lefttrigger:b6,leftx:a0,lefty:a1,rightstick:b14,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+376
"03000000381000001214000000000000,SteelSeries Free,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Windows,",
+377
"03000000110100003114000000000000,SteelSeries Stratus Duo,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+378
"03000000381000001814000000000000,SteelSeries Stratus XL,a:b0,b:b1,back:b18,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b19,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b2,y:b3,platform:Windows,",
+379
"03000000790000001c18000000000000,STK-7024X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+380
"03000000ff1100003133000000000000,SVEN X-PAD,a:b2,b:b3,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a4,start:b5,x:b0,y:b1,platform:Windows,",
+381
"03000000d620000011a7000000000000,Switch,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+382
"03000000457500002211000000000000,SZMY-POWER PC Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+383
"030000004f04000007d0000000000000,T Mini Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+384
"030000004f0400000ab1000000000000,T.16000M,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b4,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b10,x:b2,y:b3,platform:Windows,",
+385
"03000000fa1900000706000000000000,Team 5,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+386
"03000000b50700001203000000000000,Techmobility X6-38V,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,",
+387
"030000004f04000015b3000000000000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,",
+388
"030000004f04000023b3000000000000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+389
"030000004f0400000ed0000000000000,ThrustMaster eSwap PRO Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+390
"030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Windows,",
+391
"030000004f04000004b3000000000000,Thrustmaster Firestorm Dual Power 3,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,",
+392
"03000000666600000488000000000000,TigerGame PS/PS2 Game Controller Adapter,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,",
+393
"03000000d62000006000000000000000,Tournament PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+394
"030000005f140000c501000000000000,Trust Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+395
"03000000b80500000210000000000000,Trust Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+396
"030000004f04000087b6000000000000,TWCS Throttle,dpdown:b8,dpleft:b9,dpright:b7,dpup:b6,leftstick:b5,lefttrigger:-a5,leftx:a0,lefty:a1,righttrigger:+a5,platform:Windows,",
+397
"03000000d90400000200000000000000,TwinShock PS2,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,",
+398
"030000006e0500001320000000000000,U4113,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+399
"03000000101c0000171c000000000000,uRage Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+400
"03000000300f00000701000000000000,USB 4-Axis 12-Button Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,",
+401
"03000000341a00002308000000000000,USB gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+402
"030000005509000000b4000000000000,USB gamepad,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b0,guide:b14,leftshoulder:b8,leftstick:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:a5,rightx:a2,righty:a3,start:b4,x:b12,y:b13,platform:Windows,",
+403
"030000006b1400000203000000000000,USB gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+404
"03000000790000000a00000000000000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,",
+405
"03000000f0250000c183000000000000,USB gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+406
"03000000ff1100004133000000000000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,platform:Windows,",
+407
"03000000632500002305000000000000,USB Vibration Joystick (BM),a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+408
"03000000790000001a18000000000000,Venom,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
+409
"03000000790000001b18000000000000,Venom Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+410
"030000006f0e00000302000000000000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+411
"030000006f0e00000702000000000000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
+412
"0300000034120000adbe000000000000,vJoy Device,a:b0,b:b1,back:b15,dpdown:b6,dpleft:b7,dpright:b8,dpup:b5,guide:b16,leftshoulder:b9,leftstick:b13,lefttrigger:b11,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b14,righttrigger:b12,rightx:a3,righty:a4,start:b4,x:b2,y:b3,platform:Windows,",
+413
"030000005e0400000a0b000000000000,Xbox Adaptive Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,",
+414
"030000005e040000130b000000000000,Xbox Series Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,",
+415
"03000000341a00000608000000000000,Xeox,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+416
"03000000450c00002043000000000000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,",
+417
"03000000ac0500005b05000000000000,Xiaoji Gamesir-G3w,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,",
+418
"03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Windows,",
+419
"03000000786901006e70000000000000,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,",
+420
"03000000790000004f18000000000000,ZD-T Android,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,",
+421
"03000000120c0000101e000000000000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,",
+422
"78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
+423
"78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
+424
"78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
+425
"78696e70757404000000000000000000,XInput Flight Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
+426
"78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
+427
"78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
+428
"78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
+429
#endif // _GLFW_WIN32
+430
+431
#if defined(_GLFW_COCOA)
+432
"030000008f0e00000300000009010000,2In1 USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Mac OS X,",
+433
"03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
+434
"03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
+435
"03000000c82d00000650000001000000,8BitDo M30,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Mac OS X,",
+436
"03000000c82d00005106000000010000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,start:b11,x:b4,y:b3,platform:Mac OS X,",
+437
"03000000c82d00001590000001000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
+438
"03000000c82d00006528000000010000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
+439
"030000003512000012ab000001000000,8BitDo NES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,",
+440
"03000000022000000090000001000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
+441
"03000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
+442
"03000000c82d00000190000001000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
+443
"03000000102800000900000000000000,8Bitdo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,",
+444
"03000000c82d00001290000001000000,8BitDo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,",
+445
"03000000c82d00004028000000010000,8Bitdo SN30 GamePad,a:b1,b:b0,x:b4,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,dpup:-a1,dpdown:+a1,dpleft:-a0,dpright:+a0,platform:Mac OS X,",
+446
"03000000c82d00000160000001000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
+447
"03000000c82d00000161000000010000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Mac OS X,",
+448
"03000000c82d00000260000001000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
+449
"03000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
+450
"03000000c82d00000031000001000000,8BitDo Wireless Adapter,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,",
+451
"03000000c82d00001890000001000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,",
+452
"03000000c82d00003032000000010000,8BitDo Zero 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,rightx:a2,righty:a31,start:b11,x:b4,y:b3,platform:Mac OS X,",
+453
"03000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Mac OS X,",
+454
"03000000a00500003232000009010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Mac OS X,",
+455
"03000000a30c00002700000003030000,Astro City Mini,a:b2,b:b1,back:b8,leftx:a3,lefty:a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Mac OS X,",
+456
"03000000a30c00002800000003030000,Astro City Mini,a:b2,b:b1,back:b8,leftx:a3,lefty:a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Mac OS X,",
+457
"03000000050b00000045000031000000,ASUS Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,",
+458
"03000000ef0500000300000000020000,AxisPad,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,platform:Mac OS X,",
+459
"03000000491900001904000001010000,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,platform:Mac OS X,",
+460
"03000000710100001904000000010000,Amazon Luna Controller,a:b0,b:b1,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Mac OS X,",
+461
"03000000c62400001a89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,leftstick:b15,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b16,righttrigger:a4,rightx:a2,righty:a3,start:b13,x:b3,y:b4,platform:Mac OS X,",
+462
"03000000c62400001b89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,",
+463
"03000000d62000002a79000000010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,",
+464
"03000000120c0000200e000000010000,Brook Mars,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,",
+465
"03000000120c0000210e000000010000,Brook Mars,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+466
"030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+467
"03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Mac OS X,",
+468
"03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Mac OS X,",
+469
"03000000790000004618000000010000,GameCube Controller Adapter,a:b4,b:b0,dpdown:b56,dpleft:b60,dpright:b52,dpup:b48,lefttrigger:a12,leftx:a0,lefty:a4,rightshoulder:b28,righttrigger:a16,rightx:a20,righty:a8,start:b36,x:b8,y:b12,platform:Mac OS X,",
+470
"03000000ad1b000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,",
+471
"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,",
+472
"03000000c01100000140000000010000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,",
+473
"030000006f0e00000102000000000000,GameStop Xbox 360 Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,",
+474
"030000007d0400000540000001010000,Gravis Eliminator GamePad Pro,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,",
+475
"03000000280400000140000000020000,Gravis Gamepad Pro,a:b1,b:b2,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,",
+476
"030000008f0e00000300000007010000,GreenAsia Inc. USB Joystick,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Mac OS X,",
+477
"030000000d0f00002d00000000100000,Hori Fighting Commander 3 Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+478
"030000000d0f00005f00000000010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+479
"030000000d0f00005e00000000010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,",
+480
"030000000d0f00005f00000000000000,HORI Fighting Commander 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+481
"030000000d0f00005e00000000000000,HORI Fighting Commander 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+482
"030000000d0f00004d00000000000000,HORI Gem Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+483
"030000000d0f00009200000000010000,Hori Pokken Tournament DX Pro Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,",
+484
"030000000d0f00006e00000000010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+485
"030000000d0f00006600000000010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,",
+486
"030000000d0f00006600000000000000,HORIPAD FPS PLUS 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,",
+487
"030000000d0f0000ee00000000010000,HORIPAD mini4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,",
+488
"030000008f0e00001330000011010000,HuiJia SNES Controller,a:b4,b:b2,back:b16,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b12,rightshoulder:b14,start:b18,x:b6,y:b0,platform:Mac OS X,",
+489
"03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Mac OS X,",
+490
"03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Mac OS X,",
+491
"030000007e0500000620000001000000,Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b13,leftshoulder:b4,leftstick:b10,rightshoulder:b5,start:b8,x:b2,y:b3,platform:Mac OS X,",
+492
"030000007e0500000720000001000000,Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b12,leftshoulder:b4,leftstick:b11,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Mac OS X,",
+493
"03000000242f00002d00000007010000,JYS Wireless Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Mac OS X,",
+494
"030000006d04000016c2000000020000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+495
"030000006d04000016c2000000030000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+496
"030000006d04000016c2000014040000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+497
"030000006d04000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+498
"030000006d04000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
+499
"030000006d04000019c2000005030000,Logitech F710,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",

Showing the first 500 of 1002 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/monitor.cadded
@@ -0,0 +1,556 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#include <assert.h>
+31
#include <math.h>
+32
#include <float.h>
+33
#include <string.h>
+34
#include <stdlib.h>
+35
#include <limits.h>
+36
+37
+38
// Lexically compare video modes, used by qsort
+39
//
+40
static int compareVideoModes(const void* fp, const void* sp)
+41
{
+42
const GLFWvidmode* fm = fp;
+43
const GLFWvidmode* sm = sp;
+44
const int fbpp = fm->redBits + fm->greenBits + fm->blueBits;
+45
const int sbpp = sm->redBits + sm->greenBits + sm->blueBits;
+46
const int farea = fm->width * fm->height;
+47
const int sarea = sm->width * sm->height;
+48
+49
// First sort on color bits per pixel
+50
if (fbpp != sbpp)
+51
return fbpp - sbpp;
+52
+53
// Then sort on screen area
+54
if (farea != sarea)
+55
return farea - sarea;
+56
+57
// Then sort on width
+58
if (fm->width != sm->width)
+59
return fm->width - sm->width;
+60
+61
// Lastly sort on refresh rate
+62
return fm->refreshRate - sm->refreshRate;
+63
}
+64
+65
// Retrieves the available modes for the specified monitor
+66
//
+67
static GLFWbool refreshVideoModes(_GLFWmonitor* monitor)
+68
{
+69
int modeCount;
+70
GLFWvidmode* modes;
+71
+72
if (monitor->modes)
+73
return GLFW_TRUE;
+74
+75
modes = _glfw.platform.getVideoModes(monitor, &modeCount);
+76
if (!modes)
+77
return GLFW_FALSE;
+78
+79
qsort(modes, modeCount, sizeof(GLFWvidmode), compareVideoModes);
+80
+81
_glfw_free(monitor->modes);
+82
monitor->modes = modes;
+83
monitor->modeCount = modeCount;
+84
+85
return GLFW_TRUE;
+86
}
+87
+88
+89
//////////////////////////////////////////////////////////////////////////
+90
////// GLFW event API //////
+91
//////////////////////////////////////////////////////////////////////////
+92
+93
// Notifies shared code of a monitor connection or disconnection
+94
//
+95
void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
+96
{
+97
assert(monitor != NULL);
+98
assert(action == GLFW_CONNECTED || action == GLFW_DISCONNECTED);
+99
assert(placement == _GLFW_INSERT_FIRST || placement == _GLFW_INSERT_LAST);
+100
+101
if (action == GLFW_CONNECTED)
+102
{
+103
_glfw.monitorCount++;
+104
_glfw.monitors =
+105
_glfw_realloc(_glfw.monitors,
+106
sizeof(_GLFWmonitor*) * _glfw.monitorCount);
+107
+108
if (placement == _GLFW_INSERT_FIRST)
+109
{
+110
memmove(_glfw.monitors + 1,
+111
_glfw.monitors,
+112
((size_t) _glfw.monitorCount - 1) * sizeof(_GLFWmonitor*));
+113
_glfw.monitors[0] = monitor;
+114
}
+115
else
+116
_glfw.monitors[_glfw.monitorCount - 1] = monitor;
+117
}
+118
else if (action == GLFW_DISCONNECTED)
+119
{
+120
int i;
+121
_GLFWwindow* window;
+122
+123
for (window = _glfw.windowListHead; window; window = window->next)
+124
{
+125
if (window->monitor == monitor)
+126
{
+127
int width, height, xoff, yoff;
+128
_glfw.platform.getWindowSize(window, &width, &height);
+129
_glfw.platform.setWindowMonitor(window, NULL, 0, 0, width, height, 0);
+130
_glfw.platform.getWindowFrameSize(window, &xoff, &yoff, NULL, NULL);
+131
_glfw.platform.setWindowPos(window, xoff, yoff);
+132
}
+133
}
+134
+135
for (i = 0; i < _glfw.monitorCount; i++)
+136
{
+137
if (_glfw.monitors[i] == monitor)
+138
{
+139
_glfw.monitorCount--;
+140
memmove(_glfw.monitors + i,
+141
_glfw.monitors + i + 1,
+142
((size_t) _glfw.monitorCount - i) * sizeof(_GLFWmonitor*));
+143
break;
+144
}
+145
}
+146
}
+147
+148
if (_glfw.callbacks.monitor)
+149
_glfw.callbacks.monitor((GLFWmonitor*) monitor, action);
+150
+151
if (action == GLFW_DISCONNECTED)
+152
_glfwFreeMonitor(monitor);
+153
}
+154
+155
// Notifies shared code that a full screen window has acquired or released
+156
// a monitor
+157
//
+158
void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window)
+159
{
+160
assert(monitor != NULL);
+161
monitor->window = window;
+162
}
+163
+164
+165
//////////////////////////////////////////////////////////////////////////
+166
////// GLFW internal API //////
+167
//////////////////////////////////////////////////////////////////////////
+168
+169
// Allocates and returns a monitor object with the specified name and dimensions
+170
//
+171
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
+172
{
+173
_GLFWmonitor* monitor = _glfw_calloc(1, sizeof(_GLFWmonitor));
+174
monitor->widthMM = widthMM;
+175
monitor->heightMM = heightMM;
+176
+177
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
+178
+179
return monitor;
+180
}
+181
+182
// Frees a monitor object and any data associated with it
+183
//
+184
void _glfwFreeMonitor(_GLFWmonitor* monitor)
+185
{
+186
if (monitor == NULL)
+187
return;
+188
+189
_glfw.platform.freeMonitor(monitor);
+190
+191
_glfwFreeGammaArrays(&monitor->originalRamp);
+192
_glfwFreeGammaArrays(&monitor->currentRamp);
+193
+194
_glfw_free(monitor->modes);
+195
_glfw_free(monitor);
+196
}
+197
+198
// Allocates red, green and blue value arrays of the specified size
+199
//
+200
void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size)
+201
{
+202
ramp->red = _glfw_calloc(size, sizeof(unsigned short));
+203
ramp->green = _glfw_calloc(size, sizeof(unsigned short));
+204
ramp->blue = _glfw_calloc(size, sizeof(unsigned short));
+205
ramp->size = size;
+206
}
+207
+208
// Frees the red, green and blue value arrays and clears the struct
+209
//
+210
void _glfwFreeGammaArrays(GLFWgammaramp* ramp)
+211
{
+212
_glfw_free(ramp->red);
+213
_glfw_free(ramp->green);
+214
_glfw_free(ramp->blue);
+215
+216
memset(ramp, 0, sizeof(GLFWgammaramp));
+217
}
+218
+219
// Chooses the video mode most closely matching the desired one
+220
//
+221
const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
+222
const GLFWvidmode* desired)
+223
{
+224
int i;
+225
unsigned int sizeDiff, leastSizeDiff = UINT_MAX;
+226
unsigned int rateDiff, leastRateDiff = UINT_MAX;
+227
unsigned int colorDiff, leastColorDiff = UINT_MAX;
+228
const GLFWvidmode* current;
+229
const GLFWvidmode* closest = NULL;
+230
+231
if (!refreshVideoModes(monitor))
+232
return NULL;
+233
+234
for (i = 0; i < monitor->modeCount; i++)
+235
{
+236
current = monitor->modes + i;
+237
+238
colorDiff = 0;
+239
+240
if (desired->redBits != GLFW_DONT_CARE)
+241
colorDiff += abs(current->redBits - desired->redBits);
+242
if (desired->greenBits != GLFW_DONT_CARE)
+243
colorDiff += abs(current->greenBits - desired->greenBits);
+244
if (desired->blueBits != GLFW_DONT_CARE)
+245
colorDiff += abs(current->blueBits - desired->blueBits);
+246
+247
sizeDiff = abs((current->width - desired->width) *
+248
(current->width - desired->width) +
+249
(current->height - desired->height) *
+250
(current->height - desired->height));
+251
+252
if (desired->refreshRate != GLFW_DONT_CARE)
+253
rateDiff = abs(current->refreshRate - desired->refreshRate);
+254
else
+255
rateDiff = UINT_MAX - current->refreshRate;
+256
+257
if ((colorDiff < leastColorDiff) ||
+258
(colorDiff == leastColorDiff && sizeDiff < leastSizeDiff) ||
+259
(colorDiff == leastColorDiff && sizeDiff == leastSizeDiff && rateDiff < leastRateDiff))
+260
{
+261
closest = current;
+262
leastSizeDiff = sizeDiff;
+263
leastRateDiff = rateDiff;
+264
leastColorDiff = colorDiff;
+265
}
+266
}
+267
+268
return closest;
+269
}
+270
+271
// Performs lexical comparison between two @ref GLFWvidmode structures
+272
//
+273
int _glfwCompareVideoModes(const GLFWvidmode* fm, const GLFWvidmode* sm)
+274
{
+275
return compareVideoModes(fm, sm);
+276
}
+277
+278
// Splits a color depth into red, green and blue bit depths
+279
//
+280
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue)
+281
{
+282
int delta;
+283
+284
// We assume that by 32 the user really meant 24
+285
if (bpp == 32)
+286
bpp = 24;
+287
+288
// Convert "bits per pixel" to red, green & blue sizes
+289
+290
*red = *green = *blue = bpp / 3;
+291
delta = bpp - (*red * 3);
+292
if (delta >= 1)
+293
*green = *green + 1;
+294
+295
if (delta == 2)
+296
*red = *red + 1;
+297
}
+298
+299
+300
//////////////////////////////////////////////////////////////////////////
+301
////// GLFW public API //////
+302
//////////////////////////////////////////////////////////////////////////
+303
+304
GLFWAPI GLFWmonitor** glfwGetMonitors(int* count)
+305
{
+306
assert(count != NULL);
+307
+308
*count = 0;
+309
+310
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+311
+312
*count = _glfw.monitorCount;
+313
return (GLFWmonitor**) _glfw.monitors;
+314
}
+315
+316
GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void)
+317
{
+318
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+319
+320
if (!_glfw.monitorCount)
+321
return NULL;
+322
+323
return (GLFWmonitor*) _glfw.monitors[0];
+324
}
+325
+326
GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos)
+327
{
+328
if (xpos)
+329
*xpos = 0;
+330
if (ypos)
+331
*ypos = 0;
+332
+333
_GLFW_REQUIRE_INIT();
+334
+335
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
+336
assert(monitor != NULL);
+337
+338
_glfw.platform.getMonitorPos(monitor, xpos, ypos);
+339
}
+340
+341
GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* handle,
+342
int* xpos, int* ypos,
+343
int* width, int* height)
+344
{
+345
if (xpos)
+346
*xpos = 0;
+347
if (ypos)
+348
*ypos = 0;
+349
if (width)
+350
*width = 0;
+351
if (height)
+352
*height = 0;
+353
+354
_GLFW_REQUIRE_INIT();
+355
+356
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
+357
assert(monitor != NULL);
+358
+359
_glfw.platform.getMonitorWorkarea(monitor, xpos, ypos, width, height);
+360
}
+361
+362
GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int* heightMM)
+363
{
+364
if (widthMM)
+365
*widthMM = 0;
+366
if (heightMM)
+367
*heightMM = 0;
+368
+369
_GLFW_REQUIRE_INIT();
+370
+371
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
+372
assert(monitor != NULL);
+373
+374
if (widthMM)
+375
*widthMM = monitor->widthMM;
+376
if (heightMM)
+377
*heightMM = monitor->heightMM;
+378
}
+379
+380
GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* handle,
+381
float* xscale, float* yscale)
+382
{
+383
if (xscale)
+384
*xscale = 0.f;
+385
if (yscale)
+386
*yscale = 0.f;
+387
+388
_GLFW_REQUIRE_INIT();
+389
+390
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
+391
assert(monitor != NULL);
+392
+393
_glfw.platform.getMonitorContentScale(monitor, xscale, yscale);
+394
}
+395
+396
GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
+397
{
+398
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+399
+400
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
+401
assert(monitor != NULL);
+402
+403
return monitor->name;
+404
}
+405
+406
GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* handle, void* pointer)
+407
{
+408
_GLFW_REQUIRE_INIT();
+409
+410
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
+411
assert(monitor != NULL);
+412
+413
monitor->userPointer = pointer;
+414
}
+415
+416
GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* handle)
+417
{
+418
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+419
+420
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
+421
assert(monitor != NULL);
+422
+423
return monitor->userPointer;
+424
}
+425
+426
GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
+427
{
+428
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+429
_GLFW_SWAP(GLFWmonitorfun, _glfw.callbacks.monitor, cbfun);
+430
return cbfun;
+431
}
+432
+433
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
+434
{
+435
assert(count != NULL);
+436
+437
*count = 0;
+438
+439
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+440
+441
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
+442
assert(monitor != NULL);
+443
+444
if (!refreshVideoModes(monitor))
+445
return NULL;
+446
+447
*count = monitor->modeCount;
+448
return monitor->modes;
+449
}
+450
+451
GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle)
+452
{
+453
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+454
+455
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
+456
assert(monitor != NULL);
+457
+458
if (!_glfw.platform.getVideoMode(monitor, &monitor->currentMode))
+459
return NULL;
+460
+461
return &monitor->currentMode;
+462
}
+463
+464
GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
+465
{
+466
unsigned int i;
+467
unsigned short* values;
+468
GLFWgammaramp ramp;
+469
const GLFWgammaramp* original;
+470
+471
assert(gamma > 0.f);
+472
assert(isfinite(gamma));
+473
+474
_GLFW_REQUIRE_INIT();
+475
+476
assert(handle != NULL);
+477
+478
if (!isfinite(gamma) || gamma <= 0.f)
+479
{
+480
_glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma value %f", gamma);
+481
return;
+482
}
+483
+484
original = glfwGetGammaRamp(handle);
+485
if (!original)
+486
return;
+487
+488
values = _glfw_calloc(original->size, sizeof(unsigned short));
+489
+490
for (i = 0; i < original->size; i++)
+491
{
+492
float value;
+493
+494
// Calculate intensity
+495
value = i / (float) (original->size - 1);
+496
// Apply gamma curve
+497
value = powf(value, 1.f / gamma) * 65535.f + 0.5f;
+498
// Clamp to value range
+499
value = fminf(value, 65535.f);

Showing the first 500 of 557 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/nsgl_context.madded
@@ -0,0 +1,378 @@
+1
//========================================================================
+2
// GLFW 3.5 macOS - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
+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 "internal.h"
+28
+29
#if defined(_GLFW_COCOA)
+30
+31
#include <unistd.h>
+32
#include <math.h>
+33
#include <assert.h>
+34
+35
static void makeContextCurrentNSGL(_GLFWwindow* window)
+36
{
+37
@autoreleasepool {
+38
+39
if (window)
+40
[window->context.nsgl.object makeCurrentContext];
+41
else
+42
[NSOpenGLContext clearCurrentContext];
+43
+44
_glfwPlatformSetTls(&_glfw.contextSlot, window);
+45
+46
} // autoreleasepool
+47
}
+48
+49
static void swapBuffersNSGL(_GLFWwindow* window)
+50
{
+51
@autoreleasepool {
+52
+53
// HACK: Simulate vsync with usleep as NSGL swap interval does not apply to
+54
// windows with a non-visible occlusion state
+55
if (window->ns.occluded)
+56
{
+57
int interval = 0;
+58
[window->context.nsgl.object getValues:&interval
+59
forParameter:NSOpenGLContextParameterSwapInterval];
+60
+61
if (interval > 0)
+62
{
+63
const double framerate = 60.0;
+64
const uint64_t frequency = _glfwPlatformGetTimerFrequency();
+65
const uint64_t value = _glfwPlatformGetTimerValue();
+66
+67
const double elapsed = value / (double) frequency;
+68
const double period = 1.0 / framerate;
+69
const double delay = period - fmod(elapsed, period);
+70
+71
usleep(floorl(delay * 1e6));
+72
}
+73
}
+74
+75
[window->context.nsgl.object flushBuffer];
+76
+77
} // autoreleasepool
+78
}
+79
+80
static void swapIntervalNSGL(int interval)
+81
{
+82
@autoreleasepool {
+83
+84
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
+85
assert(window != NULL);
+86
+87
[window->context.nsgl.object setValues:&interval
+88
forParameter:NSOpenGLContextParameterSwapInterval];
+89
+90
} // autoreleasepool
+91
}
+92
+93
static int extensionSupportedNSGL(const char* extension)
+94
{
+95
// There are no NSGL extensions
+96
return GLFW_FALSE;
+97
}
+98
+99
static GLFWglproc getProcAddressNSGL(const char* procname)
+100
{
+101
CFStringRef symbolName = CFStringCreateWithCString(kCFAllocatorDefault,
+102
procname,
+103
kCFStringEncodingASCII);
+104
+105
GLFWglproc symbol = CFBundleGetFunctionPointerForName(_glfw.nsgl.framework,
+106
symbolName);
+107
+108
CFRelease(symbolName);
+109
+110
return symbol;
+111
}
+112
+113
static void destroyContextNSGL(_GLFWwindow* window)
+114
{
+115
@autoreleasepool {
+116
+117
[window->context.nsgl.pixelFormat release];
+118
window->context.nsgl.pixelFormat = nil;
+119
+120
[window->context.nsgl.object release];
+121
window->context.nsgl.object = nil;
+122
+123
} // autoreleasepool
+124
}
+125
+126
+127
//////////////////////////////////////////////////////////////////////////
+128
////// GLFW internal API //////
+129
//////////////////////////////////////////////////////////////////////////
+130
+131
GLFWbool _glfwInitNSGL(void)
+132
{
+133
if (_glfw.nsgl.framework)
+134
return GLFW_TRUE;
+135
+136
_glfw.nsgl.framework =
+137
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
+138
if (_glfw.nsgl.framework == NULL)
+139
{
+140
_glfwInputError(GLFW_API_UNAVAILABLE,
+141
"NSGL: Failed to locate OpenGL framework");
+142
return GLFW_FALSE;
+143
}
+144
+145
return GLFW_TRUE;
+146
}
+147
+148
void _glfwTerminateNSGL(void)
+149
{
+150
}
+151
+152
GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
+153
const _GLFWctxconfig* ctxconfig,
+154
const _GLFWfbconfig* fbconfig)
+155
{
+156
if (ctxconfig->client == GLFW_OPENGL_ES_API)
+157
{
+158
_glfwInputError(GLFW_API_UNAVAILABLE,
+159
"NSGL: OpenGL ES is not available via NSGL");
+160
return GLFW_FALSE;
+161
}
+162
+163
if (ctxconfig->major > 2)
+164
{
+165
if (ctxconfig->major == 3 && ctxconfig->minor < 2)
+166
{
+167
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
+168
"NSGL: The targeted version of macOS does not support OpenGL 3.0 or 3.1 but may support 3.2 and above");
+169
return GLFW_FALSE;
+170
}
+171
}
+172
+173
if (ctxconfig->major >= 3 && ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
+174
{
+175
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
+176
"NSGL: The compatibility profile is not available on macOS");
+177
return GLFW_FALSE;
+178
}
+179
+180
// Context robustness modes (GL_KHR_robustness) are not supported by
+181
// macOS but are not a hard constraint, so ignore and continue
+182
+183
// Context release behaviors (GL_KHR_context_flush_control) are not
+184
// supported by macOS but are not a hard constraint, so ignore and continue
+185
+186
// Debug contexts (GL_KHR_debug) are not supported by macOS but are not
+187
// a hard constraint, so ignore and continue
+188
+189
// No-error contexts (GL_KHR_no_error) are not supported by macOS but
+190
// are not a hard constraint, so ignore and continue
+191
+192
#define ADD_ATTRIB(a) \
+193
{ \
+194
assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \
+195
attribs[index++] = a; \
+196
}
+197
#define SET_ATTRIB(a, v) { ADD_ATTRIB(a); ADD_ATTRIB(v); }
+198
+199
NSOpenGLPixelFormatAttribute attribs[40];
+200
int index = 0;
+201
+202
ADD_ATTRIB(NSOpenGLPFAAccelerated);
+203
ADD_ATTRIB(NSOpenGLPFAClosestPolicy);
+204
+205
if (ctxconfig->nsgl.offline)
+206
{
+207
ADD_ATTRIB(NSOpenGLPFAAllowOfflineRenderers);
+208
// NOTE: This replaces the NSSupportsAutomaticGraphicsSwitching key in
+209
// Info.plist for unbundled applications
+210
// HACK: This assumes that NSOpenGLPixelFormat will remain
+211
// a straightforward wrapper of its CGL counterpart
+212
ADD_ATTRIB(kCGLPFASupportsAutomaticGraphicsSwitching);
+213
}
+214
+215
if (ctxconfig->major >= 4)
+216
{
+217
SET_ATTRIB(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core);
+218
}
+219
else if (ctxconfig->major >= 3)
+220
{
+221
SET_ATTRIB(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
+222
}
+223
+224
if (ctxconfig->major <= 2)
+225
{
+226
if (fbconfig->auxBuffers != GLFW_DONT_CARE)
+227
SET_ATTRIB(NSOpenGLPFAAuxBuffers, fbconfig->auxBuffers);
+228
+229
if (fbconfig->accumRedBits != GLFW_DONT_CARE &&
+230
fbconfig->accumGreenBits != GLFW_DONT_CARE &&
+231
fbconfig->accumBlueBits != GLFW_DONT_CARE &&
+232
fbconfig->accumAlphaBits != GLFW_DONT_CARE)
+233
{
+234
const int accumBits = fbconfig->accumRedBits +
+235
fbconfig->accumGreenBits +
+236
fbconfig->accumBlueBits +
+237
fbconfig->accumAlphaBits;
+238
+239
SET_ATTRIB(NSOpenGLPFAAccumSize, accumBits);
+240
}
+241
}
+242
+243
if (fbconfig->redBits != GLFW_DONT_CARE &&
+244
fbconfig->greenBits != GLFW_DONT_CARE &&
+245
fbconfig->blueBits != GLFW_DONT_CARE)
+246
{
+247
int colorBits = fbconfig->redBits +
+248
fbconfig->greenBits +
+249
fbconfig->blueBits;
+250
+251
// macOS needs non-zero color size, so set reasonable values
+252
if (colorBits == 0)
+253
colorBits = 24;
+254
else if (colorBits < 15)
+255
colorBits = 15;
+256
+257
SET_ATTRIB(NSOpenGLPFAColorSize, colorBits);
+258
}
+259
+260
if (fbconfig->alphaBits != GLFW_DONT_CARE)
+261
SET_ATTRIB(NSOpenGLPFAAlphaSize, fbconfig->alphaBits);
+262
+263
if (fbconfig->depthBits != GLFW_DONT_CARE)
+264
SET_ATTRIB(NSOpenGLPFADepthSize, fbconfig->depthBits);
+265
+266
if (fbconfig->stencilBits != GLFW_DONT_CARE)
+267
SET_ATTRIB(NSOpenGLPFAStencilSize, fbconfig->stencilBits);
+268
+269
if (fbconfig->stereo)
+270
{
+271
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
+272
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
+273
"NSGL: Stereo rendering is deprecated");
+274
return GLFW_FALSE;
+275
#else
+276
ADD_ATTRIB(NSOpenGLPFAStereo);
+277
#endif
+278
}
+279
+280
if (fbconfig->doublebuffer)
+281
ADD_ATTRIB(NSOpenGLPFADoubleBuffer);
+282
+283
if (fbconfig->samples != GLFW_DONT_CARE)
+284
{
+285
if (fbconfig->samples == 0)
+286
{
+287
SET_ATTRIB(NSOpenGLPFASampleBuffers, 0);
+288
}
+289
else
+290
{
+291
SET_ATTRIB(NSOpenGLPFASampleBuffers, 1);
+292
SET_ATTRIB(NSOpenGLPFASamples, fbconfig->samples);
+293
}
+294
}
+295
+296
// NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB
+297
// framebuffer, so there's no need (and no way) to request it
+298
+299
ADD_ATTRIB(0);
+300
+301
#undef ADD_ATTRIB
+302
#undef SET_ATTRIB
+303
+304
window->context.nsgl.pixelFormat =
+305
[[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
+306
if (window->context.nsgl.pixelFormat == nil)
+307
{
+308
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
+309
"NSGL: Failed to find a suitable pixel format");
+310
return GLFW_FALSE;
+311
}
+312
+313
NSOpenGLContext* share = nil;
+314
+315
if (ctxconfig->share)
+316
share = ctxconfig->share->context.nsgl.object;
+317
+318
window->context.nsgl.object =
+319
[[NSOpenGLContext alloc] initWithFormat:window->context.nsgl.pixelFormat
+320
shareContext:share];
+321
if (window->context.nsgl.object == nil)
+322
{
+323
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
+324
"NSGL: Failed to create OpenGL context");
+325
return GLFW_FALSE;
+326
}
+327
+328
if (fbconfig->transparent)
+329
{
+330
GLint opaque = 0;
+331
[window->context.nsgl.object setValues:&opaque
+332
forParameter:NSOpenGLContextParameterSurfaceOpacity];
+333
}
+334
+335
[window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.scaleFramebuffer];
+336
+337
[window->context.nsgl.object setView:window->ns.view];
+338
+339
window->context.makeCurrent = makeContextCurrentNSGL;
+340
window->context.swapBuffers = swapBuffersNSGL;
+341
window->context.swapInterval = swapIntervalNSGL;
+342
window->context.extensionSupported = extensionSupportedNSGL;
+343
window->context.getProcAddress = getProcAddressNSGL;
+344
window->context.destroy = destroyContextNSGL;
+345
+346
return GLFW_TRUE;
+347
}
+348
+349
+350
//////////////////////////////////////////////////////////////////////////
+351
////// GLFW native API //////
+352
//////////////////////////////////////////////////////////////////////////
+353
+354
GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
+355
{
+356
_GLFW_REQUIRE_INIT_OR_RETURN(nil);
+357
+358
if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
+359
{
+360
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
+361
"NSGL: Platform not initialized");
+362
return nil;
+363
}
+364
+365
_GLFWwindow* window = (_GLFWwindow*) handle;
+366
assert(window != NULL);
+367
+368
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
+369
{
+370
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
+371
return nil;
+372
}
+373
+374
return window->context.nsgl.object;
+375
}
+376
+377
#endif // _GLFW_COCOA
+378
vendor/glfw/src/null_init.cadded
@@ -0,0 +1,265 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2016 Google Inc.
+5
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#include <stdlib.h>
+31
#include <string.h>
+32
+33
+34
//////////////////////////////////////////////////////////////////////////
+35
////// GLFW platform API //////
+36
//////////////////////////////////////////////////////////////////////////
+37
+38
GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform)
+39
{
+40
const _GLFWplatform null =
+41
{
+42
.platformID = GLFW_PLATFORM_NULL,
+43
.init = _glfwInitNull,
+44
.terminate = _glfwTerminateNull,
+45
.getCursorPos = _glfwGetCursorPosNull,
+46
.setCursorPos = _glfwSetCursorPosNull,
+47
.setCursorMode = _glfwSetCursorModeNull,
+48
.setRawMouseMotion = _glfwSetRawMouseMotionNull,
+49
.rawMouseMotionSupported = _glfwRawMouseMotionSupportedNull,
+50
.createCursor = _glfwCreateCursorNull,
+51
.createStandardCursor = _glfwCreateStandardCursorNull,
+52
.destroyCursor = _glfwDestroyCursorNull,
+53
.setCursor = _glfwSetCursorNull,
+54
.getScancodeName = _glfwGetScancodeNameNull,
+55
.getKeyScancode = _glfwGetKeyScancodeNull,
+56
.setClipboardString = _glfwSetClipboardStringNull,
+57
.getClipboardString = _glfwGetClipboardStringNull,
+58
.initJoysticks = _glfwInitJoysticksNull,
+59
.terminateJoysticks = _glfwTerminateJoysticksNull,
+60
.pollJoystick = _glfwPollJoystickNull,
+61
.getMappingName = _glfwGetMappingNameNull,
+62
.updateGamepadGUID = _glfwUpdateGamepadGUIDNull,
+63
.freeMonitor = _glfwFreeMonitorNull,
+64
.getMonitorPos = _glfwGetMonitorPosNull,
+65
.getMonitorContentScale = _glfwGetMonitorContentScaleNull,
+66
.getMonitorWorkarea = _glfwGetMonitorWorkareaNull,
+67
.getVideoModes = _glfwGetVideoModesNull,
+68
.getVideoMode = _glfwGetVideoModeNull,
+69
.getGammaRamp = _glfwGetGammaRampNull,
+70
.setGammaRamp = _glfwSetGammaRampNull,
+71
.createWindow = _glfwCreateWindowNull,
+72
.destroyWindow = _glfwDestroyWindowNull,
+73
.setWindowTitle = _glfwSetWindowTitleNull,
+74
.setWindowIcon = _glfwSetWindowIconNull,
+75
.getWindowPos = _glfwGetWindowPosNull,
+76
.setWindowPos = _glfwSetWindowPosNull,
+77
.getWindowSize = _glfwGetWindowSizeNull,
+78
.setWindowSize = _glfwSetWindowSizeNull,
+79
.setWindowSizeLimits = _glfwSetWindowSizeLimitsNull,
+80
.setWindowAspectRatio = _glfwSetWindowAspectRatioNull,
+81
.getFramebufferSize = _glfwGetFramebufferSizeNull,
+82
.getWindowFrameSize = _glfwGetWindowFrameSizeNull,
+83
.getWindowContentScale = _glfwGetWindowContentScaleNull,
+84
.iconifyWindow = _glfwIconifyWindowNull,
+85
.restoreWindow = _glfwRestoreWindowNull,
+86
.maximizeWindow = _glfwMaximizeWindowNull,
+87
.showWindow = _glfwShowWindowNull,
+88
.hideWindow = _glfwHideWindowNull,
+89
.requestWindowAttention = _glfwRequestWindowAttentionNull,
+90
.focusWindow = _glfwFocusWindowNull,
+91
.setWindowMonitor = _glfwSetWindowMonitorNull,
+92
.windowFocused = _glfwWindowFocusedNull,
+93
.windowIconified = _glfwWindowIconifiedNull,
+94
.windowVisible = _glfwWindowVisibleNull,
+95
.windowMaximized = _glfwWindowMaximizedNull,
+96
.windowHovered = _glfwWindowHoveredNull,
+97
.framebufferTransparent = _glfwFramebufferTransparentNull,
+98
.getWindowOpacity = _glfwGetWindowOpacityNull,
+99
.setWindowResizable = _glfwSetWindowResizableNull,
+100
.setWindowDecorated = _glfwSetWindowDecoratedNull,
+101
.setWindowFloating = _glfwSetWindowFloatingNull,
+102
.setWindowOpacity = _glfwSetWindowOpacityNull,
+103
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughNull,
+104
.pollEvents = _glfwPollEventsNull,
+105
.waitEvents = _glfwWaitEventsNull,
+106
.waitEventsTimeout = _glfwWaitEventsTimeoutNull,
+107
.postEmptyEvent = _glfwPostEmptyEventNull,
+108
.getEGLPlatform = _glfwGetEGLPlatformNull,
+109
.getEGLNativeDisplay = _glfwGetEGLNativeDisplayNull,
+110
.getEGLNativeWindow = _glfwGetEGLNativeWindowNull,
+111
.getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsNull,
+112
.getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportNull,
+113
.createWindowSurface = _glfwCreateWindowSurfaceNull
+114
};
+115
+116
*platform = null;
+117
return GLFW_TRUE;
+118
}
+119
+120
int _glfwInitNull(void)
+121
{
+122
int scancode;
+123
+124
memset(_glfw.null.keycodes, -1, sizeof(_glfw.null.keycodes));
+125
memset(_glfw.null.scancodes, -1, sizeof(_glfw.null.scancodes));
+126
+127
_glfw.null.keycodes[GLFW_NULL_SC_SPACE] = GLFW_KEY_SPACE;
+128
_glfw.null.keycodes[GLFW_NULL_SC_APOSTROPHE] = GLFW_KEY_APOSTROPHE;
+129
_glfw.null.keycodes[GLFW_NULL_SC_COMMA] = GLFW_KEY_COMMA;
+130
_glfw.null.keycodes[GLFW_NULL_SC_MINUS] = GLFW_KEY_MINUS;
+131
_glfw.null.keycodes[GLFW_NULL_SC_PERIOD] = GLFW_KEY_PERIOD;
+132
_glfw.null.keycodes[GLFW_NULL_SC_SLASH] = GLFW_KEY_SLASH;
+133
_glfw.null.keycodes[GLFW_NULL_SC_0] = GLFW_KEY_0;
+134
_glfw.null.keycodes[GLFW_NULL_SC_1] = GLFW_KEY_1;
+135
_glfw.null.keycodes[GLFW_NULL_SC_2] = GLFW_KEY_2;
+136
_glfw.null.keycodes[GLFW_NULL_SC_3] = GLFW_KEY_3;
+137
_glfw.null.keycodes[GLFW_NULL_SC_4] = GLFW_KEY_4;
+138
_glfw.null.keycodes[GLFW_NULL_SC_5] = GLFW_KEY_5;
+139
_glfw.null.keycodes[GLFW_NULL_SC_6] = GLFW_KEY_6;
+140
_glfw.null.keycodes[GLFW_NULL_SC_7] = GLFW_KEY_7;
+141
_glfw.null.keycodes[GLFW_NULL_SC_8] = GLFW_KEY_8;
+142
_glfw.null.keycodes[GLFW_NULL_SC_9] = GLFW_KEY_9;
+143
_glfw.null.keycodes[GLFW_NULL_SC_SEMICOLON] = GLFW_KEY_SEMICOLON;
+144
_glfw.null.keycodes[GLFW_NULL_SC_EQUAL] = GLFW_KEY_EQUAL;
+145
_glfw.null.keycodes[GLFW_NULL_SC_A] = GLFW_KEY_A;
+146
_glfw.null.keycodes[GLFW_NULL_SC_B] = GLFW_KEY_B;
+147
_glfw.null.keycodes[GLFW_NULL_SC_C] = GLFW_KEY_C;
+148
_glfw.null.keycodes[GLFW_NULL_SC_D] = GLFW_KEY_D;
+149
_glfw.null.keycodes[GLFW_NULL_SC_E] = GLFW_KEY_E;
+150
_glfw.null.keycodes[GLFW_NULL_SC_F] = GLFW_KEY_F;
+151
_glfw.null.keycodes[GLFW_NULL_SC_G] = GLFW_KEY_G;
+152
_glfw.null.keycodes[GLFW_NULL_SC_H] = GLFW_KEY_H;
+153
_glfw.null.keycodes[GLFW_NULL_SC_I] = GLFW_KEY_I;
+154
_glfw.null.keycodes[GLFW_NULL_SC_J] = GLFW_KEY_J;
+155
_glfw.null.keycodes[GLFW_NULL_SC_K] = GLFW_KEY_K;
+156
_glfw.null.keycodes[GLFW_NULL_SC_L] = GLFW_KEY_L;
+157
_glfw.null.keycodes[GLFW_NULL_SC_M] = GLFW_KEY_M;
+158
_glfw.null.keycodes[GLFW_NULL_SC_N] = GLFW_KEY_N;
+159
_glfw.null.keycodes[GLFW_NULL_SC_O] = GLFW_KEY_O;
+160
_glfw.null.keycodes[GLFW_NULL_SC_P] = GLFW_KEY_P;
+161
_glfw.null.keycodes[GLFW_NULL_SC_Q] = GLFW_KEY_Q;
+162
_glfw.null.keycodes[GLFW_NULL_SC_R] = GLFW_KEY_R;
+163
_glfw.null.keycodes[GLFW_NULL_SC_S] = GLFW_KEY_S;
+164
_glfw.null.keycodes[GLFW_NULL_SC_T] = GLFW_KEY_T;
+165
_glfw.null.keycodes[GLFW_NULL_SC_U] = GLFW_KEY_U;
+166
_glfw.null.keycodes[GLFW_NULL_SC_V] = GLFW_KEY_V;
+167
_glfw.null.keycodes[GLFW_NULL_SC_W] = GLFW_KEY_W;
+168
_glfw.null.keycodes[GLFW_NULL_SC_X] = GLFW_KEY_X;
+169
_glfw.null.keycodes[GLFW_NULL_SC_Y] = GLFW_KEY_Y;
+170
_glfw.null.keycodes[GLFW_NULL_SC_Z] = GLFW_KEY_Z;
+171
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_BRACKET] = GLFW_KEY_LEFT_BRACKET;
+172
_glfw.null.keycodes[GLFW_NULL_SC_BACKSLASH] = GLFW_KEY_BACKSLASH;
+173
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_BRACKET] = GLFW_KEY_RIGHT_BRACKET;
+174
_glfw.null.keycodes[GLFW_NULL_SC_GRAVE_ACCENT] = GLFW_KEY_GRAVE_ACCENT;
+175
_glfw.null.keycodes[GLFW_NULL_SC_WORLD_1] = GLFW_KEY_WORLD_1;
+176
_glfw.null.keycodes[GLFW_NULL_SC_WORLD_2] = GLFW_KEY_WORLD_2;
+177
_glfw.null.keycodes[GLFW_NULL_SC_ESCAPE] = GLFW_KEY_ESCAPE;
+178
_glfw.null.keycodes[GLFW_NULL_SC_ENTER] = GLFW_KEY_ENTER;
+179
_glfw.null.keycodes[GLFW_NULL_SC_TAB] = GLFW_KEY_TAB;
+180
_glfw.null.keycodes[GLFW_NULL_SC_BACKSPACE] = GLFW_KEY_BACKSPACE;
+181
_glfw.null.keycodes[GLFW_NULL_SC_INSERT] = GLFW_KEY_INSERT;
+182
_glfw.null.keycodes[GLFW_NULL_SC_DELETE] = GLFW_KEY_DELETE;
+183
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT] = GLFW_KEY_RIGHT;
+184
_glfw.null.keycodes[GLFW_NULL_SC_LEFT] = GLFW_KEY_LEFT;
+185
_glfw.null.keycodes[GLFW_NULL_SC_DOWN] = GLFW_KEY_DOWN;
+186
_glfw.null.keycodes[GLFW_NULL_SC_UP] = GLFW_KEY_UP;
+187
_glfw.null.keycodes[GLFW_NULL_SC_PAGE_UP] = GLFW_KEY_PAGE_UP;
+188
_glfw.null.keycodes[GLFW_NULL_SC_PAGE_DOWN] = GLFW_KEY_PAGE_DOWN;
+189
_glfw.null.keycodes[GLFW_NULL_SC_HOME] = GLFW_KEY_HOME;
+190
_glfw.null.keycodes[GLFW_NULL_SC_END] = GLFW_KEY_END;
+191
_glfw.null.keycodes[GLFW_NULL_SC_CAPS_LOCK] = GLFW_KEY_CAPS_LOCK;
+192
_glfw.null.keycodes[GLFW_NULL_SC_SCROLL_LOCK] = GLFW_KEY_SCROLL_LOCK;
+193
_glfw.null.keycodes[GLFW_NULL_SC_NUM_LOCK] = GLFW_KEY_NUM_LOCK;
+194
_glfw.null.keycodes[GLFW_NULL_SC_PRINT_SCREEN] = GLFW_KEY_PRINT_SCREEN;
+195
_glfw.null.keycodes[GLFW_NULL_SC_PAUSE] = GLFW_KEY_PAUSE;
+196
_glfw.null.keycodes[GLFW_NULL_SC_F1] = GLFW_KEY_F1;
+197
_glfw.null.keycodes[GLFW_NULL_SC_F2] = GLFW_KEY_F2;
+198
_glfw.null.keycodes[GLFW_NULL_SC_F3] = GLFW_KEY_F3;
+199
_glfw.null.keycodes[GLFW_NULL_SC_F4] = GLFW_KEY_F4;
+200
_glfw.null.keycodes[GLFW_NULL_SC_F5] = GLFW_KEY_F5;
+201
_glfw.null.keycodes[GLFW_NULL_SC_F6] = GLFW_KEY_F6;
+202
_glfw.null.keycodes[GLFW_NULL_SC_F7] = GLFW_KEY_F7;
+203
_glfw.null.keycodes[GLFW_NULL_SC_F8] = GLFW_KEY_F8;
+204
_glfw.null.keycodes[GLFW_NULL_SC_F9] = GLFW_KEY_F9;
+205
_glfw.null.keycodes[GLFW_NULL_SC_F10] = GLFW_KEY_F10;
+206
_glfw.null.keycodes[GLFW_NULL_SC_F11] = GLFW_KEY_F11;
+207
_glfw.null.keycodes[GLFW_NULL_SC_F12] = GLFW_KEY_F12;
+208
_glfw.null.keycodes[GLFW_NULL_SC_F13] = GLFW_KEY_F13;
+209
_glfw.null.keycodes[GLFW_NULL_SC_F14] = GLFW_KEY_F14;
+210
_glfw.null.keycodes[GLFW_NULL_SC_F15] = GLFW_KEY_F15;
+211
_glfw.null.keycodes[GLFW_NULL_SC_F16] = GLFW_KEY_F16;
+212
_glfw.null.keycodes[GLFW_NULL_SC_F17] = GLFW_KEY_F17;
+213
_glfw.null.keycodes[GLFW_NULL_SC_F18] = GLFW_KEY_F18;
+214
_glfw.null.keycodes[GLFW_NULL_SC_F19] = GLFW_KEY_F19;
+215
_glfw.null.keycodes[GLFW_NULL_SC_F20] = GLFW_KEY_F20;
+216
_glfw.null.keycodes[GLFW_NULL_SC_F21] = GLFW_KEY_F21;
+217
_glfw.null.keycodes[GLFW_NULL_SC_F22] = GLFW_KEY_F22;
+218
_glfw.null.keycodes[GLFW_NULL_SC_F23] = GLFW_KEY_F23;
+219
_glfw.null.keycodes[GLFW_NULL_SC_F24] = GLFW_KEY_F24;
+220
_glfw.null.keycodes[GLFW_NULL_SC_F25] = GLFW_KEY_F25;
+221
_glfw.null.keycodes[GLFW_NULL_SC_KP_0] = GLFW_KEY_KP_0;
+222
_glfw.null.keycodes[GLFW_NULL_SC_KP_1] = GLFW_KEY_KP_1;
+223
_glfw.null.keycodes[GLFW_NULL_SC_KP_2] = GLFW_KEY_KP_2;
+224
_glfw.null.keycodes[GLFW_NULL_SC_KP_3] = GLFW_KEY_KP_3;
+225
_glfw.null.keycodes[GLFW_NULL_SC_KP_4] = GLFW_KEY_KP_4;
+226
_glfw.null.keycodes[GLFW_NULL_SC_KP_5] = GLFW_KEY_KP_5;
+227
_glfw.null.keycodes[GLFW_NULL_SC_KP_6] = GLFW_KEY_KP_6;
+228
_glfw.null.keycodes[GLFW_NULL_SC_KP_7] = GLFW_KEY_KP_7;
+229
_glfw.null.keycodes[GLFW_NULL_SC_KP_8] = GLFW_KEY_KP_8;
+230
_glfw.null.keycodes[GLFW_NULL_SC_KP_9] = GLFW_KEY_KP_9;
+231
_glfw.null.keycodes[GLFW_NULL_SC_KP_DECIMAL] = GLFW_KEY_KP_DECIMAL;
+232
_glfw.null.keycodes[GLFW_NULL_SC_KP_DIVIDE] = GLFW_KEY_KP_DIVIDE;
+233
_glfw.null.keycodes[GLFW_NULL_SC_KP_MULTIPLY] = GLFW_KEY_KP_MULTIPLY;
+234
_glfw.null.keycodes[GLFW_NULL_SC_KP_SUBTRACT] = GLFW_KEY_KP_SUBTRACT;
+235
_glfw.null.keycodes[GLFW_NULL_SC_KP_ADD] = GLFW_KEY_KP_ADD;
+236
_glfw.null.keycodes[GLFW_NULL_SC_KP_ENTER] = GLFW_KEY_KP_ENTER;
+237
_glfw.null.keycodes[GLFW_NULL_SC_KP_EQUAL] = GLFW_KEY_KP_EQUAL;
+238
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_SHIFT] = GLFW_KEY_LEFT_SHIFT;
+239
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_CONTROL] = GLFW_KEY_LEFT_CONTROL;
+240
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_ALT] = GLFW_KEY_LEFT_ALT;
+241
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_SUPER] = GLFW_KEY_LEFT_SUPER;
+242
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_SHIFT] = GLFW_KEY_RIGHT_SHIFT;
+243
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_CONTROL] = GLFW_KEY_RIGHT_CONTROL;
+244
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_ALT] = GLFW_KEY_RIGHT_ALT;
+245
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_SUPER] = GLFW_KEY_RIGHT_SUPER;
+246
_glfw.null.keycodes[GLFW_NULL_SC_MENU] = GLFW_KEY_MENU;
+247
+248
for (scancode = GLFW_NULL_SC_FIRST; scancode < GLFW_NULL_SC_LAST; scancode++)
+249
{
+250
if (_glfw.null.keycodes[scancode] > 0)
+251
_glfw.null.scancodes[_glfw.null.keycodes[scancode]] = scancode;
+252
}
+253
+254
_glfwPollMonitorsNull();
+255
return GLFW_TRUE;
+256
}
+257
+258
void _glfwTerminateNull(void)
+259
{
+260
free(_glfw.null.clipboardString);
+261
_glfwTerminateOSMesa();
+262
_glfwTerminateEGL();
+263
memset(&_glfw.null, 0, sizeof(_glfw.null));
+264
}
+265
vendor/glfw/src/null_joystick.cadded
@@ -0,0 +1,56 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
+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 "internal.h"
+28
+29
+30
//////////////////////////////////////////////////////////////////////////
+31
////// GLFW platform API //////
+32
//////////////////////////////////////////////////////////////////////////
+33
+34
GLFWbool _glfwInitJoysticksNull(void)
+35
{
+36
return GLFW_TRUE;
+37
}
+38
+39
void _glfwTerminateJoysticksNull(void)
+40
{
+41
}
+42
+43
GLFWbool _glfwPollJoystickNull(_GLFWjoystick* js, int mode)
+44
{
+45
return GLFW_FALSE;
+46
}
+47
+48
const char* _glfwGetMappingNameNull(void)
+49
{
+50
return "";
+51
}
+52
+53
void _glfwUpdateGamepadGUIDNull(char* guid)
+54
{
+55
}
+56
vendor/glfw/src/null_joystick.hadded
@@ -0,0 +1,32 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+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
GLFWbool _glfwInitJoysticksNull(void);
+28
void _glfwTerminateJoysticksNull(void);
+29
GLFWbool _glfwPollJoystickNull(_GLFWjoystick* js, int mode);
+30
const char* _glfwGetMappingNameNull(void);
+31
void _glfwUpdateGamepadGUIDNull(char* guid);
+32
vendor/glfw/src/null_monitor.cadded
@@ -0,0 +1,160 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2016 Google Inc.
+5
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#include <stdlib.h>
+31
#include <string.h>
+32
#include <math.h>
+33
+34
// The the sole (fake) video mode of our (sole) fake monitor
+35
//
+36
static GLFWvidmode getVideoMode(void)
+37
{
+38
GLFWvidmode mode;
+39
mode.width = 1920;
+40
mode.height = 1080;
+41
mode.redBits = 8;
+42
mode.greenBits = 8;
+43
mode.blueBits = 8;
+44
mode.refreshRate = 60;
+45
return mode;
+46
}
+47
+48
//////////////////////////////////////////////////////////////////////////
+49
////// GLFW internal API //////
+50
//////////////////////////////////////////////////////////////////////////
+51
+52
void _glfwPollMonitorsNull(void)
+53
{
+54
const float dpi = 141.f;
+55
const GLFWvidmode mode = getVideoMode();
+56
_GLFWmonitor* monitor = _glfwAllocMonitor("Null SuperNoop 0",
+57
(int) (mode.width * 25.4f / dpi),
+58
(int) (mode.height * 25.4f / dpi));
+59
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_FIRST);
+60
}
+61
+62
//////////////////////////////////////////////////////////////////////////
+63
////// GLFW platform API //////
+64
//////////////////////////////////////////////////////////////////////////
+65
+66
void _glfwFreeMonitorNull(_GLFWmonitor* monitor)
+67
{
+68
_glfwFreeGammaArrays(&monitor->null.ramp);
+69
}
+70
+71
void _glfwGetMonitorPosNull(_GLFWmonitor* monitor, int* xpos, int* ypos)
+72
{
+73
if (xpos)
+74
*xpos = 0;
+75
if (ypos)
+76
*ypos = 0;
+77
}
+78
+79
void _glfwGetMonitorContentScaleNull(_GLFWmonitor* monitor,
+80
float* xscale, float* yscale)
+81
{
+82
if (xscale)
+83
*xscale = 1.f;
+84
if (yscale)
+85
*yscale = 1.f;
+86
}
+87
+88
void _glfwGetMonitorWorkareaNull(_GLFWmonitor* monitor,
+89
int* xpos, int* ypos,
+90
int* width, int* height)
+91
{
+92
const GLFWvidmode mode = getVideoMode();
+93
+94
if (xpos)
+95
*xpos = 0;
+96
if (ypos)
+97
*ypos = 10;
+98
if (width)
+99
*width = mode.width;
+100
if (height)
+101
*height = mode.height - 10;
+102
}
+103
+104
GLFWvidmode* _glfwGetVideoModesNull(_GLFWmonitor* monitor, int* found)
+105
{
+106
GLFWvidmode* mode = _glfw_calloc(1, sizeof(GLFWvidmode));
+107
*mode = getVideoMode();
+108
*found = 1;
+109
return mode;
+110
}
+111
+112
GLFWbool _glfwGetVideoModeNull(_GLFWmonitor* monitor, GLFWvidmode* mode)
+113
{
+114
*mode = getVideoMode();
+115
return GLFW_TRUE;
+116
}
+117
+118
GLFWbool _glfwGetGammaRampNull(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
+119
{
+120
if (!monitor->null.ramp.size)
+121
{
+122
unsigned int i;
+123
+124
_glfwAllocGammaArrays(&monitor->null.ramp, 256);
+125
+126
for (i = 0; i < monitor->null.ramp.size; i++)
+127
{
+128
const float gamma = 2.2f;
+129
float value;
+130
value = i / (float) (monitor->null.ramp.size - 1);
+131
value = powf(value, 1.f / gamma) * 65535.f + 0.5f;
+132
value = fminf(value, 65535.f);
+133
+134
monitor->null.ramp.red[i] = (unsigned short) value;
+135
monitor->null.ramp.green[i] = (unsigned short) value;
+136
monitor->null.ramp.blue[i] = (unsigned short) value;
+137
}
+138
}
+139
+140
_glfwAllocGammaArrays(ramp, monitor->null.ramp.size);
+141
memcpy(ramp->red, monitor->null.ramp.red, sizeof(short) * ramp->size);
+142
memcpy(ramp->green, monitor->null.ramp.green, sizeof(short) * ramp->size);
+143
memcpy(ramp->blue, monitor->null.ramp.blue, sizeof(short) * ramp->size);
+144
return GLFW_TRUE;
+145
}
+146
+147
void _glfwSetGammaRampNull(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
+148
{
+149
if (monitor->null.ramp.size != ramp->size)
+150
{
+151
_glfwInputError(GLFW_PLATFORM_ERROR,
+152
"Null: Gamma ramp size must match current ramp size");
+153
return;
+154
}
+155
+156
memcpy(monitor->null.ramp.red, ramp->red, sizeof(short) * ramp->size);
+157
memcpy(monitor->null.ramp.green, ramp->green, sizeof(short) * ramp->size);
+158
memcpy(monitor->null.ramp.blue, ramp->blue, sizeof(short) * ramp->size);
+159
}
+160
vendor/glfw/src/null_platform.hadded
@@ -0,0 +1,282 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2016 Google Inc.
+5
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#define GLFW_NULL_WINDOW_STATE _GLFWwindowNull null;
+29
#define GLFW_NULL_LIBRARY_WINDOW_STATE _GLFWlibraryNull null;
+30
#define GLFW_NULL_MONITOR_STATE _GLFWmonitorNull null;
+31
+32
#define GLFW_NULL_CONTEXT_STATE
+33
#define GLFW_NULL_CURSOR_STATE
+34
#define GLFW_NULL_LIBRARY_CONTEXT_STATE
+35
+36
#define GLFW_NULL_SC_FIRST GLFW_NULL_SC_SPACE
+37
#define GLFW_NULL_SC_SPACE 1
+38
#define GLFW_NULL_SC_APOSTROPHE 2
+39
#define GLFW_NULL_SC_COMMA 3
+40
#define GLFW_NULL_SC_MINUS 4
+41
#define GLFW_NULL_SC_PERIOD 5
+42
#define GLFW_NULL_SC_SLASH 6
+43
#define GLFW_NULL_SC_0 7
+44
#define GLFW_NULL_SC_1 8
+45
#define GLFW_NULL_SC_2 9
+46
#define GLFW_NULL_SC_3 10
+47
#define GLFW_NULL_SC_4 11
+48
#define GLFW_NULL_SC_5 12
+49
#define GLFW_NULL_SC_6 13
+50
#define GLFW_NULL_SC_7 14
+51
#define GLFW_NULL_SC_8 15
+52
#define GLFW_NULL_SC_9 16
+53
#define GLFW_NULL_SC_SEMICOLON 17
+54
#define GLFW_NULL_SC_EQUAL 18
+55
#define GLFW_NULL_SC_LEFT_BRACKET 19
+56
#define GLFW_NULL_SC_BACKSLASH 20
+57
#define GLFW_NULL_SC_RIGHT_BRACKET 21
+58
#define GLFW_NULL_SC_GRAVE_ACCENT 22
+59
#define GLFW_NULL_SC_WORLD_1 23
+60
#define GLFW_NULL_SC_WORLD_2 24
+61
#define GLFW_NULL_SC_ESCAPE 25
+62
#define GLFW_NULL_SC_ENTER 26
+63
#define GLFW_NULL_SC_TAB 27
+64
#define GLFW_NULL_SC_BACKSPACE 28
+65
#define GLFW_NULL_SC_INSERT 29
+66
#define GLFW_NULL_SC_DELETE 30
+67
#define GLFW_NULL_SC_RIGHT 31
+68
#define GLFW_NULL_SC_LEFT 32
+69
#define GLFW_NULL_SC_DOWN 33
+70
#define GLFW_NULL_SC_UP 34
+71
#define GLFW_NULL_SC_PAGE_UP 35
+72
#define GLFW_NULL_SC_PAGE_DOWN 36
+73
#define GLFW_NULL_SC_HOME 37
+74
#define GLFW_NULL_SC_END 38
+75
#define GLFW_NULL_SC_CAPS_LOCK 39
+76
#define GLFW_NULL_SC_SCROLL_LOCK 40
+77
#define GLFW_NULL_SC_NUM_LOCK 41
+78
#define GLFW_NULL_SC_PRINT_SCREEN 42
+79
#define GLFW_NULL_SC_PAUSE 43
+80
#define GLFW_NULL_SC_A 44
+81
#define GLFW_NULL_SC_B 45
+82
#define GLFW_NULL_SC_C 46
+83
#define GLFW_NULL_SC_D 47
+84
#define GLFW_NULL_SC_E 48
+85
#define GLFW_NULL_SC_F 49
+86
#define GLFW_NULL_SC_G 50
+87
#define GLFW_NULL_SC_H 51
+88
#define GLFW_NULL_SC_I 52
+89
#define GLFW_NULL_SC_J 53
+90
#define GLFW_NULL_SC_K 54
+91
#define GLFW_NULL_SC_L 55
+92
#define GLFW_NULL_SC_M 56
+93
#define GLFW_NULL_SC_N 57
+94
#define GLFW_NULL_SC_O 58
+95
#define GLFW_NULL_SC_P 59
+96
#define GLFW_NULL_SC_Q 60
+97
#define GLFW_NULL_SC_R 61
+98
#define GLFW_NULL_SC_S 62
+99
#define GLFW_NULL_SC_T 63
+100
#define GLFW_NULL_SC_U 64
+101
#define GLFW_NULL_SC_V 65
+102
#define GLFW_NULL_SC_W 66
+103
#define GLFW_NULL_SC_X 67
+104
#define GLFW_NULL_SC_Y 68
+105
#define GLFW_NULL_SC_Z 69
+106
#define GLFW_NULL_SC_F1 70
+107
#define GLFW_NULL_SC_F2 71
+108
#define GLFW_NULL_SC_F3 72
+109
#define GLFW_NULL_SC_F4 73
+110
#define GLFW_NULL_SC_F5 74
+111
#define GLFW_NULL_SC_F6 75
+112
#define GLFW_NULL_SC_F7 76
+113
#define GLFW_NULL_SC_F8 77
+114
#define GLFW_NULL_SC_F9 78
+115
#define GLFW_NULL_SC_F10 79
+116
#define GLFW_NULL_SC_F11 80
+117
#define GLFW_NULL_SC_F12 81
+118
#define GLFW_NULL_SC_F13 82
+119
#define GLFW_NULL_SC_F14 83
+120
#define GLFW_NULL_SC_F15 84
+121
#define GLFW_NULL_SC_F16 85
+122
#define GLFW_NULL_SC_F17 86
+123
#define GLFW_NULL_SC_F18 87
+124
#define GLFW_NULL_SC_F19 88
+125
#define GLFW_NULL_SC_F20 89
+126
#define GLFW_NULL_SC_F21 90
+127
#define GLFW_NULL_SC_F22 91
+128
#define GLFW_NULL_SC_F23 92
+129
#define GLFW_NULL_SC_F24 93
+130
#define GLFW_NULL_SC_F25 94
+131
#define GLFW_NULL_SC_KP_0 95
+132
#define GLFW_NULL_SC_KP_1 96
+133
#define GLFW_NULL_SC_KP_2 97
+134
#define GLFW_NULL_SC_KP_3 98
+135
#define GLFW_NULL_SC_KP_4 99
+136
#define GLFW_NULL_SC_KP_5 100
+137
#define GLFW_NULL_SC_KP_6 101
+138
#define GLFW_NULL_SC_KP_7 102
+139
#define GLFW_NULL_SC_KP_8 103
+140
#define GLFW_NULL_SC_KP_9 104
+141
#define GLFW_NULL_SC_KP_DECIMAL 105
+142
#define GLFW_NULL_SC_KP_DIVIDE 106
+143
#define GLFW_NULL_SC_KP_MULTIPLY 107
+144
#define GLFW_NULL_SC_KP_SUBTRACT 108
+145
#define GLFW_NULL_SC_KP_ADD 109
+146
#define GLFW_NULL_SC_KP_ENTER 110
+147
#define GLFW_NULL_SC_KP_EQUAL 111
+148
#define GLFW_NULL_SC_LEFT_SHIFT 112
+149
#define GLFW_NULL_SC_LEFT_CONTROL 113
+150
#define GLFW_NULL_SC_LEFT_ALT 114
+151
#define GLFW_NULL_SC_LEFT_SUPER 115
+152
#define GLFW_NULL_SC_RIGHT_SHIFT 116
+153
#define GLFW_NULL_SC_RIGHT_CONTROL 117
+154
#define GLFW_NULL_SC_RIGHT_ALT 118
+155
#define GLFW_NULL_SC_RIGHT_SUPER 119
+156
#define GLFW_NULL_SC_MENU 120
+157
#define GLFW_NULL_SC_LAST GLFW_NULL_SC_MENU
+158
+159
typedef VkFlags VkHeadlessSurfaceCreateFlagsEXT;
+160
+161
typedef struct VkHeadlessSurfaceCreateInfoEXT
+162
{
+163
VkStructureType sType;
+164
const void* pNext;
+165
VkHeadlessSurfaceCreateFlagsEXT flags;
+166
} VkHeadlessSurfaceCreateInfoEXT;
+167
+168
typedef VkResult (APIENTRY *PFN_vkCreateHeadlessSurfaceEXT)(VkInstance,const VkHeadlessSurfaceCreateInfoEXT*,const VkAllocationCallbacks*,VkSurfaceKHR*);
+169
+170
// Null-specific per-window data
+171
//
+172
typedef struct _GLFWwindowNull
+173
{
+174
int xpos;
+175
int ypos;
+176
int width;
+177
int height;
+178
GLFWbool visible;
+179
GLFWbool iconified;
+180
GLFWbool maximized;
+181
GLFWbool resizable;
+182
GLFWbool decorated;
+183
GLFWbool floating;
+184
GLFWbool transparent;
+185
float opacity;
+186
} _GLFWwindowNull;
+187
+188
// Null-specific per-monitor data
+189
//
+190
typedef struct _GLFWmonitorNull
+191
{
+192
GLFWgammaramp ramp;
+193
} _GLFWmonitorNull;
+194
+195
// Null-specific global data
+196
//
+197
typedef struct _GLFWlibraryNull
+198
{
+199
int xcursor;
+200
int ycursor;
+201
char* clipboardString;
+202
_GLFWwindow* focusedWindow;
+203
uint16_t keycodes[GLFW_NULL_SC_LAST + 1];
+204
uint8_t scancodes[GLFW_KEY_LAST + 1];
+205
} _GLFWlibraryNull;
+206
+207
void _glfwPollMonitorsNull(void);
+208
+209
GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform);
+210
int _glfwInitNull(void);
+211
void _glfwTerminateNull(void);
+212
+213
void _glfwFreeMonitorNull(_GLFWmonitor* monitor);
+214
void _glfwGetMonitorPosNull(_GLFWmonitor* monitor, int* xpos, int* ypos);
+215
void _glfwGetMonitorContentScaleNull(_GLFWmonitor* monitor, float* xscale, float* yscale);
+216
void _glfwGetMonitorWorkareaNull(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
+217
GLFWvidmode* _glfwGetVideoModesNull(_GLFWmonitor* monitor, int* found);
+218
GLFWbool _glfwGetVideoModeNull(_GLFWmonitor* monitor, GLFWvidmode* mode);
+219
GLFWbool _glfwGetGammaRampNull(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
+220
void _glfwSetGammaRampNull(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
+221
+222
GLFWbool _glfwCreateWindowNull(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
+223
void _glfwDestroyWindowNull(_GLFWwindow* window);
+224
void _glfwSetWindowTitleNull(_GLFWwindow* window, const char* title);
+225
void _glfwSetWindowIconNull(_GLFWwindow* window, int count, const GLFWimage* images);
+226
void _glfwSetWindowMonitorNull(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
+227
void _glfwGetWindowPosNull(_GLFWwindow* window, int* xpos, int* ypos);
+228
void _glfwSetWindowPosNull(_GLFWwindow* window, int xpos, int ypos);
+229
void _glfwGetWindowSizeNull(_GLFWwindow* window, int* width, int* height);
+230
void _glfwSetWindowSizeNull(_GLFWwindow* window, int width, int height);
+231
void _glfwSetWindowSizeLimitsNull(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
+232
void _glfwSetWindowAspectRatioNull(_GLFWwindow* window, int n, int d);
+233
void _glfwGetFramebufferSizeNull(_GLFWwindow* window, int* width, int* height);
+234
void _glfwGetWindowFrameSizeNull(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
+235
void _glfwGetWindowContentScaleNull(_GLFWwindow* window, float* xscale, float* yscale);
+236
void _glfwIconifyWindowNull(_GLFWwindow* window);
+237
void _glfwRestoreWindowNull(_GLFWwindow* window);
+238
void _glfwMaximizeWindowNull(_GLFWwindow* window);
+239
GLFWbool _glfwWindowMaximizedNull(_GLFWwindow* window);
+240
GLFWbool _glfwWindowHoveredNull(_GLFWwindow* window);
+241
GLFWbool _glfwFramebufferTransparentNull(_GLFWwindow* window);
+242
void _glfwSetWindowResizableNull(_GLFWwindow* window, GLFWbool enabled);
+243
void _glfwSetWindowDecoratedNull(_GLFWwindow* window, GLFWbool enabled);
+244
void _glfwSetWindowFloatingNull(_GLFWwindow* window, GLFWbool enabled);
+245
void _glfwSetWindowMousePassthroughNull(_GLFWwindow* window, GLFWbool enabled);
+246
float _glfwGetWindowOpacityNull(_GLFWwindow* window);
+247
void _glfwSetWindowOpacityNull(_GLFWwindow* window, float opacity);
+248
void _glfwSetRawMouseMotionNull(_GLFWwindow *window, GLFWbool enabled);
+249
GLFWbool _glfwRawMouseMotionSupportedNull(void);
+250
void _glfwShowWindowNull(_GLFWwindow* window);
+251
void _glfwRequestWindowAttentionNull(_GLFWwindow* window);
+252
void _glfwHideWindowNull(_GLFWwindow* window);
+253
void _glfwFocusWindowNull(_GLFWwindow* window);
+254
GLFWbool _glfwWindowFocusedNull(_GLFWwindow* window);
+255
GLFWbool _glfwWindowIconifiedNull(_GLFWwindow* window);
+256
GLFWbool _glfwWindowVisibleNull(_GLFWwindow* window);
+257
void _glfwPollEventsNull(void);
+258
void _glfwWaitEventsNull(void);
+259
void _glfwWaitEventsTimeoutNull(double timeout);
+260
void _glfwPostEmptyEventNull(void);
+261
void _glfwGetCursorPosNull(_GLFWwindow* window, double* xpos, double* ypos);
+262
void _glfwSetCursorPosNull(_GLFWwindow* window, double x, double y);
+263
void _glfwSetCursorModeNull(_GLFWwindow* window, int mode);
+264
GLFWbool _glfwCreateCursorNull(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
+265
GLFWbool _glfwCreateStandardCursorNull(_GLFWcursor* cursor, int shape);
+266
void _glfwDestroyCursorNull(_GLFWcursor* cursor);
+267
void _glfwSetCursorNull(_GLFWwindow* window, _GLFWcursor* cursor);
+268
void _glfwSetClipboardStringNull(const char* string);
+269
const char* _glfwGetClipboardStringNull(void);
+270
const char* _glfwGetScancodeNameNull(int scancode);
+271
int _glfwGetKeyScancodeNull(int key);
+272
+273
EGLenum _glfwGetEGLPlatformNull(EGLint** attribs);
+274
EGLNativeDisplayType _glfwGetEGLNativeDisplayNull(void);
+275
EGLNativeWindowType _glfwGetEGLNativeWindowNull(_GLFWwindow* window);
+276
+277
void _glfwGetRequiredInstanceExtensionsNull(char** extensions);
+278
GLFWbool _glfwGetPhysicalDevicePresentationSupportNull(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
+279
VkResult _glfwCreateWindowSurfaceNull(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
+280
+281
void _glfwPollMonitorsNull(void);
+282
vendor/glfw/src/null_window.cadded
@@ -0,0 +1,749 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2016 Google Inc.
+5
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#include <stdlib.h>
+31
#include <string.h>
+32
+33
static void applySizeLimits(_GLFWwindow* window, int* width, int* height)
+34
{
+35
if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE)
+36
{
+37
const float ratio = (float) window->numer / (float) window->denom;
+38
*height = (int) (*width / ratio);
+39
}
+40
+41
if (window->minwidth != GLFW_DONT_CARE)
+42
*width = _glfw_max(*width, window->minwidth);
+43
else if (window->maxwidth != GLFW_DONT_CARE)
+44
*width = _glfw_min(*width, window->maxwidth);
+45
+46
if (window->minheight != GLFW_DONT_CARE)
+47
*height = _glfw_min(*height, window->minheight);
+48
else if (window->maxheight != GLFW_DONT_CARE)
+49
*height = _glfw_max(*height, window->maxheight);
+50
}
+51
+52
static void fitToMonitor(_GLFWwindow* window)
+53
{
+54
GLFWvidmode mode;
+55
_glfwGetVideoModeNull(window->monitor, &mode);
+56
_glfwGetMonitorPosNull(window->monitor,
+57
&window->null.xpos,
+58
&window->null.ypos);
+59
window->null.width = mode.width;
+60
window->null.height = mode.height;
+61
}
+62
+63
static void acquireMonitor(_GLFWwindow* window)
+64
{
+65
_glfwInputMonitorWindow(window->monitor, window);
+66
}
+67
+68
static void releaseMonitor(_GLFWwindow* window)
+69
{
+70
if (window->monitor->window != window)
+71
return;
+72
+73
_glfwInputMonitorWindow(window->monitor, NULL);
+74
}
+75
+76
static int createNativeWindow(_GLFWwindow* window,
+77
const _GLFWwndconfig* wndconfig,
+78
const _GLFWfbconfig* fbconfig)
+79
{
+80
if (window->monitor)
+81
fitToMonitor(window);
+82
else
+83
{
+84
if (wndconfig->xpos == GLFW_ANY_POSITION && wndconfig->ypos == GLFW_ANY_POSITION)
+85
{
+86
window->null.xpos = 17;
+87
window->null.ypos = 17;
+88
}
+89
else
+90
{
+91
window->null.xpos = wndconfig->xpos;
+92
window->null.ypos = wndconfig->ypos;
+93
}
+94
+95
window->null.width = wndconfig->width;
+96
window->null.height = wndconfig->height;
+97
}
+98
+99
window->null.visible = wndconfig->visible;
+100
window->null.decorated = wndconfig->decorated;
+101
window->null.maximized = wndconfig->maximized;
+102
window->null.floating = wndconfig->floating;
+103
window->null.transparent = fbconfig->transparent;
+104
window->null.opacity = 1.f;
+105
+106
return GLFW_TRUE;
+107
}
+108
+109
+110
//////////////////////////////////////////////////////////////////////////
+111
////// GLFW platform API //////
+112
//////////////////////////////////////////////////////////////////////////
+113
+114
GLFWbool _glfwCreateWindowNull(_GLFWwindow* window,
+115
const _GLFWwndconfig* wndconfig,
+116
const _GLFWctxconfig* ctxconfig,
+117
const _GLFWfbconfig* fbconfig)
+118
{
+119
if (!createNativeWindow(window, wndconfig, fbconfig))
+120
return GLFW_FALSE;
+121
+122
if (ctxconfig->client != GLFW_NO_API)
+123
{
+124
if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API ||
+125
ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
+126
{
+127
if (!_glfwInitOSMesa())
+128
return GLFW_FALSE;
+129
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
+130
return GLFW_FALSE;
+131
}
+132
else if (ctxconfig->source == GLFW_EGL_CONTEXT_API)
+133
{
+134
if (!_glfwInitEGL())
+135
return GLFW_FALSE;
+136
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
+137
return GLFW_FALSE;
+138
}
+139
+140
if (!_glfwRefreshContextAttribs(window, ctxconfig))
+141
return GLFW_FALSE;
+142
}
+143
+144
if (wndconfig->mousePassthrough)
+145
_glfwSetWindowMousePassthroughNull(window, GLFW_TRUE);
+146
+147
if (window->monitor)
+148
{
+149
_glfwShowWindowNull(window);
+150
_glfwFocusWindowNull(window);
+151
acquireMonitor(window);
+152
+153
if (wndconfig->centerCursor)
+154
_glfwCenterCursorInContentArea(window);
+155
}
+156
else
+157
{
+158
if (wndconfig->visible)
+159
{
+160
_glfwShowWindowNull(window);
+161
if (wndconfig->focused)
+162
_glfwFocusWindowNull(window);
+163
}
+164
}
+165
+166
return GLFW_TRUE;
+167
}
+168
+169
void _glfwDestroyWindowNull(_GLFWwindow* window)
+170
{
+171
if (window->monitor)
+172
releaseMonitor(window);
+173
+174
if (_glfw.null.focusedWindow == window)
+175
_glfw.null.focusedWindow = NULL;
+176
+177
if (window->context.destroy)
+178
window->context.destroy(window);
+179
}
+180
+181
void _glfwSetWindowTitleNull(_GLFWwindow* window, const char* title)
+182
{
+183
}
+184
+185
void _glfwSetWindowIconNull(_GLFWwindow* window, int count, const GLFWimage* images)
+186
{
+187
}
+188
+189
void _glfwSetWindowMonitorNull(_GLFWwindow* window,
+190
_GLFWmonitor* monitor,
+191
int xpos, int ypos,
+192
int width, int height,
+193
int refreshRate)
+194
{
+195
if (window->monitor == monitor)
+196
{
+197
if (!monitor)
+198
{
+199
_glfwSetWindowPosNull(window, xpos, ypos);
+200
_glfwSetWindowSizeNull(window, width, height);
+201
}
+202
+203
return;
+204
}
+205
+206
if (window->monitor)
+207
releaseMonitor(window);
+208
+209
_glfwInputWindowMonitor(window, monitor);
+210
+211
if (window->monitor)
+212
{
+213
window->null.visible = GLFW_TRUE;
+214
acquireMonitor(window);
+215
fitToMonitor(window);
+216
}
+217
else
+218
{
+219
_glfwSetWindowPosNull(window, xpos, ypos);
+220
_glfwSetWindowSizeNull(window, width, height);
+221
}
+222
}
+223
+224
void _glfwGetWindowPosNull(_GLFWwindow* window, int* xpos, int* ypos)
+225
{
+226
if (xpos)
+227
*xpos = window->null.xpos;
+228
if (ypos)
+229
*ypos = window->null.ypos;
+230
}
+231
+232
void _glfwSetWindowPosNull(_GLFWwindow* window, int xpos, int ypos)
+233
{
+234
if (window->monitor)
+235
return;
+236
+237
if (window->null.xpos != xpos || window->null.ypos != ypos)
+238
{
+239
window->null.xpos = xpos;
+240
window->null.ypos = ypos;
+241
_glfwInputWindowPos(window, xpos, ypos);
+242
}
+243
}
+244
+245
void _glfwGetWindowSizeNull(_GLFWwindow* window, int* width, int* height)
+246
{
+247
if (width)
+248
*width = window->null.width;
+249
if (height)
+250
*height = window->null.height;
+251
}
+252
+253
void _glfwSetWindowSizeNull(_GLFWwindow* window, int width, int height)
+254
{
+255
if (window->monitor)
+256
return;
+257
+258
if (window->null.width != width || window->null.height != height)
+259
{
+260
window->null.width = width;
+261
window->null.height = height;
+262
_glfwInputFramebufferSize(window, width, height);
+263
_glfwInputWindowDamage(window);
+264
_glfwInputWindowSize(window, width, height);
+265
}
+266
}
+267
+268
void _glfwSetWindowSizeLimitsNull(_GLFWwindow* window,
+269
int minwidth, int minheight,
+270
int maxwidth, int maxheight)
+271
{
+272
int width = window->null.width;
+273
int height = window->null.height;
+274
applySizeLimits(window, &width, &height);
+275
_glfwSetWindowSizeNull(window, width, height);
+276
}
+277
+278
void _glfwSetWindowAspectRatioNull(_GLFWwindow* window, int n, int d)
+279
{
+280
int width = window->null.width;
+281
int height = window->null.height;
+282
applySizeLimits(window, &width, &height);
+283
_glfwSetWindowSizeNull(window, width, height);
+284
}
+285
+286
void _glfwGetFramebufferSizeNull(_GLFWwindow* window, int* width, int* height)
+287
{
+288
if (width)
+289
*width = window->null.width;
+290
if (height)
+291
*height = window->null.height;
+292
}
+293
+294
void _glfwGetWindowFrameSizeNull(_GLFWwindow* window,
+295
int* left, int* top,
+296
int* right, int* bottom)
+297
{
+298
if (window->null.decorated && !window->monitor)
+299
{
+300
if (left)
+301
*left = 1;
+302
if (top)
+303
*top = 10;
+304
if (right)
+305
*right = 1;
+306
if (bottom)
+307
*bottom = 1;
+308
}
+309
else
+310
{
+311
if (left)
+312
*left = 0;
+313
if (top)
+314
*top = 0;
+315
if (right)
+316
*right = 0;
+317
if (bottom)
+318
*bottom = 0;
+319
}
+320
}
+321
+322
void _glfwGetWindowContentScaleNull(_GLFWwindow* window, float* xscale, float* yscale)
+323
{
+324
if (xscale)
+325
*xscale = 1.f;
+326
if (yscale)
+327
*yscale = 1.f;
+328
}
+329
+330
void _glfwIconifyWindowNull(_GLFWwindow* window)
+331
{
+332
if (_glfw.null.focusedWindow == window)
+333
{
+334
_glfw.null.focusedWindow = NULL;
+335
_glfwInputWindowFocus(window, GLFW_FALSE);
+336
}
+337
+338
if (!window->null.iconified)
+339
{
+340
window->null.iconified = GLFW_TRUE;
+341
_glfwInputWindowIconify(window, GLFW_TRUE);
+342
+343
if (window->monitor)
+344
releaseMonitor(window);
+345
}
+346
}
+347
+348
void _glfwRestoreWindowNull(_GLFWwindow* window)
+349
{
+350
if (window->null.iconified)
+351
{
+352
window->null.iconified = GLFW_FALSE;
+353
_glfwInputWindowIconify(window, GLFW_FALSE);
+354
+355
if (window->monitor)
+356
acquireMonitor(window);
+357
}
+358
else if (window->null.maximized)
+359
{
+360
window->null.maximized = GLFW_FALSE;
+361
_glfwInputWindowMaximize(window, GLFW_FALSE);
+362
}
+363
}
+364
+365
void _glfwMaximizeWindowNull(_GLFWwindow* window)
+366
{
+367
if (!window->null.maximized)
+368
{
+369
window->null.maximized = GLFW_TRUE;
+370
_glfwInputWindowMaximize(window, GLFW_TRUE);
+371
}
+372
}
+373
+374
GLFWbool _glfwWindowMaximizedNull(_GLFWwindow* window)
+375
{
+376
return window->null.maximized;
+377
}
+378
+379
GLFWbool _glfwWindowHoveredNull(_GLFWwindow* window)
+380
{
+381
return _glfw.null.xcursor >= window->null.xpos &&
+382
_glfw.null.ycursor >= window->null.ypos &&
+383
_glfw.null.xcursor <= window->null.xpos + window->null.width - 1 &&
+384
_glfw.null.ycursor <= window->null.ypos + window->null.height - 1;
+385
}
+386
+387
GLFWbool _glfwFramebufferTransparentNull(_GLFWwindow* window)
+388
{
+389
return window->null.transparent;
+390
}
+391
+392
void _glfwSetWindowResizableNull(_GLFWwindow* window, GLFWbool enabled)
+393
{
+394
window->null.resizable = enabled;
+395
}
+396
+397
void _glfwSetWindowDecoratedNull(_GLFWwindow* window, GLFWbool enabled)
+398
{
+399
window->null.decorated = enabled;
+400
}
+401
+402
void _glfwSetWindowFloatingNull(_GLFWwindow* window, GLFWbool enabled)
+403
{
+404
window->null.floating = enabled;
+405
}
+406
+407
void _glfwSetWindowMousePassthroughNull(_GLFWwindow* window, GLFWbool enabled)
+408
{
+409
}
+410
+411
float _glfwGetWindowOpacityNull(_GLFWwindow* window)
+412
{
+413
return window->null.opacity;
+414
}
+415
+416
void _glfwSetWindowOpacityNull(_GLFWwindow* window, float opacity)
+417
{
+418
window->null.opacity = opacity;
+419
}
+420
+421
void _glfwSetRawMouseMotionNull(_GLFWwindow *window, GLFWbool enabled)
+422
{
+423
}
+424
+425
GLFWbool _glfwRawMouseMotionSupportedNull(void)
+426
{
+427
return GLFW_TRUE;
+428
}
+429
+430
void _glfwShowWindowNull(_GLFWwindow* window)
+431
{
+432
window->null.visible = GLFW_TRUE;
+433
}
+434
+435
void _glfwRequestWindowAttentionNull(_GLFWwindow* window)
+436
{
+437
}
+438
+439
void _glfwHideWindowNull(_GLFWwindow* window)
+440
{
+441
if (_glfw.null.focusedWindow == window)
+442
{
+443
_glfw.null.focusedWindow = NULL;
+444
_glfwInputWindowFocus(window, GLFW_FALSE);
+445
}
+446
+447
window->null.visible = GLFW_FALSE;
+448
}
+449
+450
void _glfwFocusWindowNull(_GLFWwindow* window)
+451
{
+452
_GLFWwindow* previous;
+453
+454
if (_glfw.null.focusedWindow == window)
+455
return;
+456
+457
if (!window->null.visible)
+458
return;
+459
+460
previous = _glfw.null.focusedWindow;
+461
_glfw.null.focusedWindow = window;
+462
+463
if (previous)
+464
{
+465
_glfwInputWindowFocus(previous, GLFW_FALSE);
+466
if (previous->monitor && previous->autoIconify)
+467
_glfwIconifyWindowNull(previous);
+468
}
+469
+470
_glfwInputWindowFocus(window, GLFW_TRUE);
+471
}
+472
+473
GLFWbool _glfwWindowFocusedNull(_GLFWwindow* window)
+474
{
+475
return _glfw.null.focusedWindow == window;
+476
}
+477
+478
GLFWbool _glfwWindowIconifiedNull(_GLFWwindow* window)
+479
{
+480
return window->null.iconified;
+481
}
+482
+483
GLFWbool _glfwWindowVisibleNull(_GLFWwindow* window)
+484
{
+485
return window->null.visible;
+486
}
+487
+488
void _glfwPollEventsNull(void)
+489
{
+490
}
+491
+492
void _glfwWaitEventsNull(void)
+493
{
+494
}
+495
+496
void _glfwWaitEventsTimeoutNull(double timeout)
+497
{
+498
}
+499

Showing the first 500 of 750 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/osmesa_context.cadded
@@ -0,0 +1,384 @@
+1
//========================================================================
+2
// GLFW 3.5 OSMesa - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2016 Google Inc.
+5
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#include <stdlib.h>
+31
#include <string.h>
+32
#include <assert.h>
+33
+34
static void makeContextCurrentOSMesa(_GLFWwindow* window)
+35
{
+36
if (window)
+37
{
+38
int width, height;
+39
_glfw.platform.getFramebufferSize(window, &width, &height);
+40
+41
// Check to see if we need to allocate a new buffer
+42
if ((window->context.osmesa.buffer == NULL) ||
+43
(width != window->context.osmesa.width) ||
+44
(height != window->context.osmesa.height))
+45
{
+46
_glfw_free(window->context.osmesa.buffer);
+47
+48
// Allocate the new buffer (width * height * 8-bit RGBA)
+49
window->context.osmesa.buffer = _glfw_calloc(4, (size_t) width * height);
+50
window->context.osmesa.width = width;
+51
window->context.osmesa.height = height;
+52
}
+53
+54
if (!OSMesaMakeCurrent(window->context.osmesa.handle,
+55
window->context.osmesa.buffer,
+56
GL_UNSIGNED_BYTE,
+57
width, height))
+58
{
+59
_glfwInputError(GLFW_PLATFORM_ERROR,
+60
"OSMesa: Failed to make context current");
+61
return;
+62
}
+63
}
+64
+65
_glfwPlatformSetTls(&_glfw.contextSlot, window);
+66
}
+67
+68
static GLFWglproc getProcAddressOSMesa(const char* procname)
+69
{
+70
return (GLFWglproc) OSMesaGetProcAddress(procname);
+71
}
+72
+73
static void destroyContextOSMesa(_GLFWwindow* window)
+74
{
+75
if (window->context.osmesa.handle)
+76
{
+77
OSMesaDestroyContext(window->context.osmesa.handle);
+78
window->context.osmesa.handle = NULL;
+79
}
+80
+81
if (window->context.osmesa.buffer)
+82
{
+83
_glfw_free(window->context.osmesa.buffer);
+84
window->context.osmesa.width = 0;
+85
window->context.osmesa.height = 0;
+86
}
+87
}
+88
+89
static void swapBuffersOSMesa(_GLFWwindow* window)
+90
{
+91
// No double buffering on OSMesa
+92
}
+93
+94
static void swapIntervalOSMesa(int interval)
+95
{
+96
// No swap interval on OSMesa
+97
}
+98
+99
static int extensionSupportedOSMesa(const char* extension)
+100
{
+101
// OSMesa does not have extensions
+102
return GLFW_FALSE;
+103
}
+104
+105
+106
//////////////////////////////////////////////////////////////////////////
+107
////// GLFW internal API //////
+108
//////////////////////////////////////////////////////////////////////////
+109
+110
GLFWbool _glfwInitOSMesa(void)
+111
{
+112
int i;
+113
const char* sonames[] =
+114
{
+115
#if defined(_GLFW_OSMESA_LIBRARY)
+116
_GLFW_OSMESA_LIBRARY,
+117
#elif defined(_WIN32)
+118
"libOSMesa.dll",
+119
"OSMesa.dll",
+120
#elif defined(__APPLE__)
+121
"libOSMesa.8.dylib",
+122
#elif defined(__CYGWIN__)
+123
"libOSMesa-8.so",
+124
#elif defined(__OpenBSD__) || defined(__NetBSD__)
+125
"libOSMesa.so",
+126
#else
+127
"libOSMesa.so.8",
+128
"libOSMesa.so.6",
+129
#endif
+130
NULL
+131
};
+132
+133
if (_glfw.osmesa.handle)
+134
return GLFW_TRUE;
+135
+136
for (i = 0; sonames[i]; i++)
+137
{
+138
_glfw.osmesa.handle = _glfwPlatformLoadModule(sonames[i]);
+139
if (_glfw.osmesa.handle)
+140
break;
+141
}
+142
+143
if (!_glfw.osmesa.handle)
+144
{
+145
_glfwInputError(GLFW_API_UNAVAILABLE, "OSMesa: Library not found");
+146
return GLFW_FALSE;
+147
}
+148
+149
_glfw.osmesa.CreateContextExt = (PFN_OSMesaCreateContextExt)
+150
_glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaCreateContextExt");
+151
_glfw.osmesa.CreateContextAttribs = (PFN_OSMesaCreateContextAttribs)
+152
_glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaCreateContextAttribs");
+153
_glfw.osmesa.DestroyContext = (PFN_OSMesaDestroyContext)
+154
_glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaDestroyContext");
+155
_glfw.osmesa.MakeCurrent = (PFN_OSMesaMakeCurrent)
+156
_glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaMakeCurrent");
+157
_glfw.osmesa.GetColorBuffer = (PFN_OSMesaGetColorBuffer)
+158
_glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaGetColorBuffer");
+159
_glfw.osmesa.GetDepthBuffer = (PFN_OSMesaGetDepthBuffer)
+160
_glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaGetDepthBuffer");
+161
_glfw.osmesa.GetProcAddress = (PFN_OSMesaGetProcAddress)
+162
_glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaGetProcAddress");
+163
+164
if (!_glfw.osmesa.CreateContextExt ||
+165
!_glfw.osmesa.DestroyContext ||
+166
!_glfw.osmesa.MakeCurrent ||
+167
!_glfw.osmesa.GetColorBuffer ||
+168
!_glfw.osmesa.GetDepthBuffer ||
+169
!_glfw.osmesa.GetProcAddress)
+170
{
+171
_glfwInputError(GLFW_PLATFORM_ERROR,
+172
"OSMesa: Failed to load required entry points");
+173
+174
_glfwTerminateOSMesa();
+175
return GLFW_FALSE;
+176
}
+177
+178
return GLFW_TRUE;
+179
}
+180
+181
void _glfwTerminateOSMesa(void)
+182
{
+183
_glfwPlatformFreeModule(_glfw.osmesa.handle);
+184
_glfw.osmesa.handle = NULL;
+185
}
+186
+187
#define SET_ATTRIB(a, v) \
+188
{ \
+189
assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
+190
attribs[index++] = a; \
+191
attribs[index++] = v; \
+192
}
+193
+194
GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window,
+195
const _GLFWctxconfig* ctxconfig,
+196
const _GLFWfbconfig* fbconfig)
+197
{
+198
OSMesaContext share = NULL;
+199
const int accumBits = fbconfig->accumRedBits +
+200
fbconfig->accumGreenBits +
+201
fbconfig->accumBlueBits +
+202
fbconfig->accumAlphaBits;
+203
+204
if (ctxconfig->client == GLFW_OPENGL_ES_API)
+205
{
+206
_glfwInputError(GLFW_API_UNAVAILABLE,
+207
"OSMesa: OpenGL ES is not available on OSMesa");
+208
return GLFW_FALSE;
+209
}
+210
+211
if (ctxconfig->share)
+212
share = ctxconfig->share->context.osmesa.handle;
+213
+214
if (OSMesaCreateContextAttribs)
+215
{
+216
int index = 0, attribs[40];
+217
+218
SET_ATTRIB(OSMESA_FORMAT, OSMESA_RGBA);
+219
SET_ATTRIB(OSMESA_DEPTH_BITS, fbconfig->depthBits);
+220
SET_ATTRIB(OSMESA_STENCIL_BITS, fbconfig->stencilBits);
+221
SET_ATTRIB(OSMESA_ACCUM_BITS, accumBits);
+222
+223
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
+224
{
+225
SET_ATTRIB(OSMESA_PROFILE, OSMESA_CORE_PROFILE);
+226
}
+227
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
+228
{
+229
SET_ATTRIB(OSMESA_PROFILE, OSMESA_COMPAT_PROFILE);
+230
}
+231
+232
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
+233
{
+234
SET_ATTRIB(OSMESA_CONTEXT_MAJOR_VERSION, ctxconfig->major);
+235
SET_ATTRIB(OSMESA_CONTEXT_MINOR_VERSION, ctxconfig->minor);
+236
}
+237
+238
if (ctxconfig->forward)
+239
{
+240
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
+241
"OSMesa: Forward-compatible contexts not supported");
+242
return GLFW_FALSE;
+243
}
+244
+245
SET_ATTRIB(0, 0);
+246
+247
window->context.osmesa.handle =
+248
OSMesaCreateContextAttribs(attribs, share);
+249
}
+250
else
+251
{
+252
if (ctxconfig->profile)
+253
{
+254
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
+255
"OSMesa: OpenGL profiles unavailable");
+256
return GLFW_FALSE;
+257
}
+258
+259
window->context.osmesa.handle =
+260
OSMesaCreateContextExt(OSMESA_RGBA,
+261
fbconfig->depthBits,
+262
fbconfig->stencilBits,
+263
accumBits,
+264
share);
+265
}
+266
+267
if (window->context.osmesa.handle == NULL)
+268
{
+269
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
+270
"OSMesa: Failed to create context");
+271
return GLFW_FALSE;
+272
}
+273
+274
window->context.makeCurrent = makeContextCurrentOSMesa;
+275
window->context.swapBuffers = swapBuffersOSMesa;
+276
window->context.swapInterval = swapIntervalOSMesa;
+277
window->context.extensionSupported = extensionSupportedOSMesa;
+278
window->context.getProcAddress = getProcAddressOSMesa;
+279
window->context.destroy = destroyContextOSMesa;
+280
+281
return GLFW_TRUE;
+282
}
+283
+284
#undef SET_ATTRIB
+285
+286
+287
//////////////////////////////////////////////////////////////////////////
+288
////// GLFW native API //////
+289
//////////////////////////////////////////////////////////////////////////
+290
+291
GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* handle, int* width,
+292
int* height, int* format, void** buffer)
+293
{
+294
void* mesaBuffer;
+295
GLint mesaWidth, mesaHeight, mesaFormat;
+296
+297
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
+298
+299
_GLFWwindow* window = (_GLFWwindow*) handle;
+300
assert(window != NULL);
+301
+302
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
+303
{
+304
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
+305
return GLFW_FALSE;
+306
}
+307
+308
if (!OSMesaGetColorBuffer(window->context.osmesa.handle,
+309
&mesaWidth, &mesaHeight,
+310
&mesaFormat, &mesaBuffer))
+311
{
+312
_glfwInputError(GLFW_PLATFORM_ERROR,
+313
"OSMesa: Failed to retrieve color buffer");
+314
return GLFW_FALSE;
+315
}
+316
+317
if (width)
+318
*width = mesaWidth;
+319
if (height)
+320
*height = mesaHeight;
+321
if (format)
+322
*format = mesaFormat;
+323
if (buffer)
+324
*buffer = mesaBuffer;
+325
+326
return GLFW_TRUE;
+327
}
+328
+329
GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* handle,
+330
int* width, int* height,
+331
int* bytesPerValue,
+332
void** buffer)
+333
{
+334
void* mesaBuffer;
+335
GLint mesaWidth, mesaHeight, mesaBytes;
+336
+337
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
+338
+339
_GLFWwindow* window = (_GLFWwindow*) handle;
+340
assert(window != NULL);
+341
+342
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
+343
{
+344
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
+345
return GLFW_FALSE;
+346
}
+347
+348
if (!OSMesaGetDepthBuffer(window->context.osmesa.handle,
+349
&mesaWidth, &mesaHeight,
+350
&mesaBytes, &mesaBuffer))
+351
{
+352
_glfwInputError(GLFW_PLATFORM_ERROR,
+353
"OSMesa: Failed to retrieve depth buffer");
+354
return GLFW_FALSE;
+355
}
+356
+357
if (width)
+358
*width = mesaWidth;
+359
if (height)
+360
*height = mesaHeight;
+361
if (bytesPerValue)
+362
*bytesPerValue = mesaBytes;
+363
if (buffer)
+364
*buffer = mesaBuffer;
+365
+366
return GLFW_TRUE;
+367
}
+368
+369
GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* handle)
+370
{
+371
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+372
+373
_GLFWwindow* window = (_GLFWwindow*) handle;
+374
assert(window != NULL);
+375
+376
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
+377
{
+378
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
+379
return NULL;
+380
}
+381
+382
return window->context.osmesa.handle;
+383
}
+384
vendor/glfw/src/platform.cadded
@@ -0,0 +1,210 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#include <string.h>
+31
#include <stdlib.h>
+32
+33
// These construct a string literal from individual numeric constants
+34
#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r
+35
#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r)
+36
+37
//////////////////////////////////////////////////////////////////////////
+38
////// GLFW internal API //////
+39
//////////////////////////////////////////////////////////////////////////
+40
+41
static const struct
+42
{
+43
int ID;
+44
GLFWbool (*connect)(int,_GLFWplatform*);
+45
} supportedPlatforms[] =
+46
{
+47
#if defined(_GLFW_WIN32)
+48
{ GLFW_PLATFORM_WIN32, _glfwConnectWin32 },
+49
#endif
+50
#if defined(_GLFW_COCOA)
+51
{ GLFW_PLATFORM_COCOA, _glfwConnectCocoa },
+52
#endif
+53
#if defined(_GLFW_WAYLAND)
+54
{ GLFW_PLATFORM_WAYLAND, _glfwConnectWayland },
+55
#endif
+56
#if defined(_GLFW_X11)
+57
{ GLFW_PLATFORM_X11, _glfwConnectX11 },
+58
#endif
+59
};
+60
+61
GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)
+62
{
+63
const size_t count = sizeof(supportedPlatforms) / sizeof(supportedPlatforms[0]);
+64
size_t i;
+65
+66
if (desiredID != GLFW_ANY_PLATFORM &&
+67
desiredID != GLFW_PLATFORM_WIN32 &&
+68
desiredID != GLFW_PLATFORM_COCOA &&
+69
desiredID != GLFW_PLATFORM_WAYLAND &&
+70
desiredID != GLFW_PLATFORM_X11 &&
+71
desiredID != GLFW_PLATFORM_NULL)
+72
{
+73
_glfwInputError(GLFW_INVALID_ENUM, "Invalid platform ID 0x%08X", desiredID);
+74
return GLFW_FALSE;
+75
}
+76
+77
// Only allow the Null platform if specifically requested
+78
if (desiredID == GLFW_PLATFORM_NULL)
+79
return _glfwConnectNull(desiredID, platform);
+80
else if (count == 0)
+81
{
+82
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "This binary only supports the Null platform");
+83
return GLFW_FALSE;
+84
}
+85
+86
#if defined(_GLFW_WAYLAND) && defined(_GLFW_X11)
+87
if (desiredID == GLFW_ANY_PLATFORM)
+88
{
+89
const char* const session = getenv("XDG_SESSION_TYPE");
+90
if (session)
+91
{
+92
// Only follow XDG_SESSION_TYPE if it is set correctly and the
+93
// environment looks plausble; otherwise fall back to detection
+94
if (strcmp(session, "wayland") == 0 && getenv("WAYLAND_DISPLAY"))
+95
desiredID = GLFW_PLATFORM_WAYLAND;
+96
else if (strcmp(session, "x11") == 0 && getenv("DISPLAY"))
+97
desiredID = GLFW_PLATFORM_X11;
+98
}
+99
}
+100
#endif
+101
+102
if (desiredID == GLFW_ANY_PLATFORM)
+103
{
+104
// If there is exactly one platform available for auto-selection, let it emit the
+105
// error on failure as the platform-specific error description may be more helpful
+106
if (count == 1)
+107
return supportedPlatforms[0].connect(supportedPlatforms[0].ID, platform);
+108
+109
for (i = 0; i < count; i++)
+110
{
+111
if (supportedPlatforms[i].connect(desiredID, platform))
+112
return GLFW_TRUE;
+113
}
+114
+115
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Failed to detect any supported platform");
+116
}
+117
else
+118
{
+119
for (i = 0; i < count; i++)
+120
{
+121
if (supportedPlatforms[i].ID == desiredID)
+122
return supportedPlatforms[i].connect(desiredID, platform);
+123
}
+124
+125
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "The requested platform is not supported");
+126
}
+127
+128
return GLFW_FALSE;
+129
}
+130
+131
//////////////////////////////////////////////////////////////////////////
+132
////// GLFW public API //////
+133
//////////////////////////////////////////////////////////////////////////
+134
+135
GLFWAPI int glfwGetPlatform(void)
+136
{
+137
_GLFW_REQUIRE_INIT_OR_RETURN(0);
+138
return _glfw.platform.platformID;
+139
}
+140
+141
GLFWAPI int glfwPlatformSupported(int platformID)
+142
{
+143
const size_t count = sizeof(supportedPlatforms) / sizeof(supportedPlatforms[0]);
+144
size_t i;
+145
+146
if (platformID != GLFW_PLATFORM_WIN32 &&
+147
platformID != GLFW_PLATFORM_COCOA &&
+148
platformID != GLFW_PLATFORM_WAYLAND &&
+149
platformID != GLFW_PLATFORM_X11 &&
+150
platformID != GLFW_PLATFORM_NULL)
+151
{
+152
_glfwInputError(GLFW_INVALID_ENUM, "Invalid platform ID 0x%08X", platformID);
+153
return GLFW_FALSE;
+154
}
+155
+156
if (platformID == GLFW_PLATFORM_NULL)
+157
return GLFW_TRUE;
+158
+159
for (i = 0; i < count; i++)
+160
{
+161
if (platformID == supportedPlatforms[i].ID)
+162
return GLFW_TRUE;
+163
}
+164
+165
return GLFW_FALSE;
+166
}
+167
+168
GLFWAPI const char* glfwGetVersionString(void)
+169
{
+170
return _GLFW_MAKE_VERSION(GLFW_VERSION_MAJOR,
+171
GLFW_VERSION_MINOR,
+172
GLFW_VERSION_REVISION)
+173
#if defined(_GLFW_WIN32)
+174
" Win32 WGL"
+175
#endif
+176
#if defined(_GLFW_COCOA)
+177
" Cocoa NSGL"
+178
#endif
+179
#if defined(_GLFW_WAYLAND)
+180
" Wayland"
+181
#endif
+182
#if defined(_GLFW_X11)
+183
" X11 GLX"
+184
#endif
+185
" Null"
+186
" EGL"
+187
" OSMesa"
+188
#if defined(__MINGW64_VERSION_MAJOR)
+189
" MinGW-w64"
+190
#elif defined(_MSC_VER)
+191
" VisualC"
+192
#endif
+193
#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
+194
" hybrid-GPU"
+195
#endif
+196
#if defined(_POSIX_MONOTONIC_CLOCK)
+197
" monotonic"
+198
#endif
+199
#if defined(_GLFW_BUILD_DLL)
+200
#if defined(_WIN32)
+201
" DLL"
+202
#elif defined(__APPLE__)
+203
" dynamic"
+204
#else
+205
" shared"
+206
#endif
+207
#endif
+208
;
+209
}
+210
vendor/glfw/src/platform.hadded
@@ -0,0 +1,213 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#if defined(GLFW_BUILD_WIN32_TIMER) || \
+29
defined(GLFW_BUILD_WIN32_MODULE) || \
+30
defined(GLFW_BUILD_WIN32_THREAD) || \
+31
defined(GLFW_BUILD_MACOS_TIMER) || \
+32
defined(GLFW_BUILD_POSIX_TIMER) || \
+33
defined(GLFW_BUILD_POSIX_MODULE) || \
+34
defined(GLFW_BUILD_POSIX_THREAD) || \
+35
defined(GLFW_BUILD_POSIX_POLL) || \
+36
defined(GLFW_BUILD_LINUX_JOYSTICK)
+37
#error "You must not define these; define zero or more _GLFW_<platform> macros instead"
+38
#endif
+39
+40
#include "null_platform.h"
+41
#define GLFW_EXPOSE_NATIVE_EGL
+42
#define GLFW_EXPOSE_NATIVE_OSMESA
+43
+44
#if defined(_GLFW_WIN32)
+45
#include "win32_platform.h"
+46
#define GLFW_EXPOSE_NATIVE_WIN32
+47
#define GLFW_EXPOSE_NATIVE_WGL
+48
#else
+49
#define GLFW_WIN32_WINDOW_STATE
+50
#define GLFW_WIN32_MONITOR_STATE
+51
#define GLFW_WIN32_CURSOR_STATE
+52
#define GLFW_WIN32_LIBRARY_WINDOW_STATE
+53
#define GLFW_WGL_CONTEXT_STATE
+54
#define GLFW_WGL_LIBRARY_CONTEXT_STATE
+55
#endif
+56
+57
#if defined(_GLFW_COCOA)
+58
#include "cocoa_platform.h"
+59
#define GLFW_EXPOSE_NATIVE_COCOA
+60
#define GLFW_EXPOSE_NATIVE_NSGL
+61
#else
+62
#define GLFW_COCOA_WINDOW_STATE
+63
#define GLFW_COCOA_MONITOR_STATE
+64
#define GLFW_COCOA_CURSOR_STATE
+65
#define GLFW_COCOA_LIBRARY_WINDOW_STATE
+66
#define GLFW_NSGL_CONTEXT_STATE
+67
#define GLFW_NSGL_LIBRARY_CONTEXT_STATE
+68
#endif
+69
+70
#if defined(_GLFW_WAYLAND)
+71
#include "wl_platform.h"
+72
#define GLFW_EXPOSE_NATIVE_WAYLAND
+73
#else
+74
#define GLFW_WAYLAND_WINDOW_STATE
+75
#define GLFW_WAYLAND_MONITOR_STATE
+76
#define GLFW_WAYLAND_CURSOR_STATE
+77
#define GLFW_WAYLAND_LIBRARY_WINDOW_STATE
+78
#endif
+79
+80
#if defined(_GLFW_X11)
+81
#include "x11_platform.h"
+82
#define GLFW_EXPOSE_NATIVE_X11
+83
#define GLFW_EXPOSE_NATIVE_GLX
+84
#else
+85
#define GLFW_X11_WINDOW_STATE
+86
#define GLFW_X11_MONITOR_STATE
+87
#define GLFW_X11_CURSOR_STATE
+88
#define GLFW_X11_LIBRARY_WINDOW_STATE
+89
#define GLFW_GLX_CONTEXT_STATE
+90
#define GLFW_GLX_LIBRARY_CONTEXT_STATE
+91
#endif
+92
+93
#include "null_joystick.h"
+94
+95
#if defined(_GLFW_WIN32)
+96
#include "win32_joystick.h"
+97
#else
+98
#define GLFW_WIN32_JOYSTICK_STATE
+99
#define GLFW_WIN32_LIBRARY_JOYSTICK_STATE
+100
#endif
+101
+102
#if defined(_GLFW_COCOA)
+103
#include "cocoa_joystick.h"
+104
#else
+105
#define GLFW_COCOA_JOYSTICK_STATE
+106
#define GLFW_COCOA_LIBRARY_JOYSTICK_STATE
+107
#endif
+108
+109
#if (defined(_GLFW_X11) || defined(_GLFW_WAYLAND)) && defined(__linux__)
+110
#define GLFW_BUILD_LINUX_JOYSTICK
+111
#endif
+112
+113
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
+114
#include "linux_joystick.h"
+115
#else
+116
#define GLFW_LINUX_JOYSTICK_STATE
+117
#define GLFW_LINUX_LIBRARY_JOYSTICK_STATE
+118
#endif
+119
+120
#define GLFW_PLATFORM_WINDOW_STATE \
+121
GLFW_WIN32_WINDOW_STATE \
+122
GLFW_COCOA_WINDOW_STATE \
+123
GLFW_WAYLAND_WINDOW_STATE \
+124
GLFW_X11_WINDOW_STATE \
+125
GLFW_NULL_WINDOW_STATE \
+126
+127
#define GLFW_PLATFORM_MONITOR_STATE \
+128
GLFW_WIN32_MONITOR_STATE \
+129
GLFW_COCOA_MONITOR_STATE \
+130
GLFW_WAYLAND_MONITOR_STATE \
+131
GLFW_X11_MONITOR_STATE \
+132
GLFW_NULL_MONITOR_STATE \
+133
+134
#define GLFW_PLATFORM_CURSOR_STATE \
+135
GLFW_WIN32_CURSOR_STATE \
+136
GLFW_COCOA_CURSOR_STATE \
+137
GLFW_WAYLAND_CURSOR_STATE \
+138
GLFW_X11_CURSOR_STATE \
+139
GLFW_NULL_CURSOR_STATE \
+140
+141
#define GLFW_PLATFORM_JOYSTICK_STATE \
+142
GLFW_WIN32_JOYSTICK_STATE \
+143
GLFW_COCOA_JOYSTICK_STATE \
+144
GLFW_LINUX_JOYSTICK_STATE
+145
+146
#define GLFW_PLATFORM_LIBRARY_WINDOW_STATE \
+147
GLFW_WIN32_LIBRARY_WINDOW_STATE \
+148
GLFW_COCOA_LIBRARY_WINDOW_STATE \
+149
GLFW_WAYLAND_LIBRARY_WINDOW_STATE \
+150
GLFW_X11_LIBRARY_WINDOW_STATE \
+151
GLFW_NULL_LIBRARY_WINDOW_STATE \
+152
+153
#define GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \
+154
GLFW_WIN32_LIBRARY_JOYSTICK_STATE \
+155
GLFW_COCOA_LIBRARY_JOYSTICK_STATE \
+156
GLFW_LINUX_LIBRARY_JOYSTICK_STATE
+157
+158
#define GLFW_PLATFORM_CONTEXT_STATE \
+159
GLFW_WGL_CONTEXT_STATE \
+160
GLFW_NSGL_CONTEXT_STATE \
+161
GLFW_GLX_CONTEXT_STATE
+162
+163
#define GLFW_PLATFORM_LIBRARY_CONTEXT_STATE \
+164
GLFW_WGL_LIBRARY_CONTEXT_STATE \
+165
GLFW_NSGL_LIBRARY_CONTEXT_STATE \
+166
GLFW_GLX_LIBRARY_CONTEXT_STATE
+167
+168
#if defined(_WIN32)
+169
#define GLFW_BUILD_WIN32_THREAD
+170
#else
+171
#define GLFW_BUILD_POSIX_THREAD
+172
#endif
+173
+174
#if defined(GLFW_BUILD_WIN32_THREAD)
+175
#include "win32_thread.h"
+176
#define GLFW_PLATFORM_TLS_STATE GLFW_WIN32_TLS_STATE
+177
#define GLFW_PLATFORM_MUTEX_STATE GLFW_WIN32_MUTEX_STATE
+178
#elif defined(GLFW_BUILD_POSIX_THREAD)
+179
#include "posix_thread.h"
+180
#define GLFW_PLATFORM_TLS_STATE GLFW_POSIX_TLS_STATE
+181
#define GLFW_PLATFORM_MUTEX_STATE GLFW_POSIX_MUTEX_STATE
+182
#endif
+183
+184
#if defined(_WIN32)
+185
#define GLFW_BUILD_WIN32_TIMER
+186
#elif defined(__APPLE__)
+187
#define GLFW_BUILD_MACOS_TIMER
+188
#else
+189
#define GLFW_BUILD_POSIX_TIMER
+190
#endif
+191
+192
#if defined(GLFW_BUILD_WIN32_TIMER)
+193
#include "win32_time.h"
+194
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_WIN32_LIBRARY_TIMER_STATE
+195
#elif defined(GLFW_BUILD_MACOS_TIMER)
+196
#include "macos_time.h"
+197
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_MACOS_LIBRARY_TIMER_STATE
+198
#elif defined(GLFW_BUILD_POSIX_TIMER)
+199
#include "posix_time.h"
+200
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_POSIX_LIBRARY_TIMER_STATE
+201
#endif
+202
+203
#if defined(_WIN32)
+204
#define GLFW_BUILD_WIN32_MODULE
+205
#else
+206
#define GLFW_BUILD_POSIX_MODULE
+207
#endif
+208
+209
#if defined(_GLFW_WAYLAND) || defined(_GLFW_X11)
+210
#include "posix_poll.h"
+211
#define GLFW_BUILD_POSIX_POLL
+212
#endif
+213
vendor/glfw/src/posix_module.cadded
@@ -0,0 +1,54 @@
+1
//========================================================================
+2
// GLFW 3.5 POSIX - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2021 Camilla Löwy <elmindreda@glfw.org>
+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 "internal.h"
+28
+29
#if defined(GLFW_BUILD_POSIX_MODULE)
+30
+31
#include <dlfcn.h>
+32
+33
//////////////////////////////////////////////////////////////////////////
+34
////// GLFW platform API //////
+35
//////////////////////////////////////////////////////////////////////////
+36
+37
void* _glfwPlatformLoadModule(const char* path)
+38
{
+39
return dlopen(path, RTLD_LAZY | RTLD_LOCAL);
+40
}
+41
+42
void _glfwPlatformFreeModule(void* module)
+43
{
+44
if (module)
+45
dlclose(module);
+46
}
+47
+48
GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name)
+49
{
+50
return dlsym(module, name);
+51
}
+52
+53
#endif // GLFW_BUILD_POSIX_MODULE
+54
vendor/glfw/src/posix_poll.cadded
@@ -0,0 +1,83 @@
+1
//========================================================================
+2
// GLFW 3.5 POSIX - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2022 Camilla Löwy <elmindreda@glfw.org>
+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
#define _GNU_SOURCE
+28
+29
#include "internal.h"
+30
+31
#if defined(GLFW_BUILD_POSIX_POLL)
+32
+33
#include <signal.h>
+34
#include <time.h>
+35
#include <errno.h>
+36
+37
GLFWbool _glfwPollPOSIX(struct pollfd* fds, nfds_t count, double* timeout)
+38
{
+39
for (;;)
+40
{
+41
if (timeout)
+42
{
+43
const uint64_t base = _glfwPlatformGetTimerValue();
+44
+45
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
+46
const time_t seconds = (time_t) *timeout;
+47
const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
+48
const struct timespec ts = { seconds, nanoseconds };
+49
const int result = ppoll(fds, count, &ts, NULL);
+50
#elif defined(__NetBSD__)
+51
const time_t seconds = (time_t) *timeout;
+52
const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
+53
const struct timespec ts = { seconds, nanoseconds };
+54
const int result = pollts(fds, count, &ts, NULL);
+55
#else
+56
const int milliseconds = (int) (*timeout * 1e3);
+57
const int result = poll(fds, count, milliseconds);
+58
#endif
+59
const int error = errno; // clock_gettime may overwrite our error
+60
+61
*timeout -= (_glfwPlatformGetTimerValue() - base) /
+62
(double) _glfwPlatformGetTimerFrequency();
+63
+64
if (result > 0)
+65
return GLFW_TRUE;
+66
else if (result == -1 && error != EINTR && error != EAGAIN)
+67
return GLFW_FALSE;
+68
else if (*timeout <= 0.0)
+69
return GLFW_FALSE;
+70
}
+71
else
+72
{
+73
const int result = poll(fds, count, -1);
+74
if (result > 0)
+75
return GLFW_TRUE;
+76
else if (result == -1 && errno != EINTR && errno != EAGAIN)
+77
return GLFW_FALSE;
+78
}
+79
}
+80
}
+81
+82
#endif // GLFW_BUILD_POSIX_POLL
+83
vendor/glfw/src/posix_poll.hadded
@@ -0,0 +1,30 @@
+1
//========================================================================
+2
// GLFW 3.5 POSIX - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2022 Camilla Löwy <elmindreda@glfw.org>
+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 <poll.h>
+28
+29
GLFWbool _glfwPollPOSIX(struct pollfd* fds, nfds_t count, double* timeout);
+30
vendor/glfw/src/posix_thread.cadded
@@ -0,0 +1,107 @@
+1
//========================================================================
+2
// GLFW 3.5 POSIX - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(GLFW_BUILD_POSIX_THREAD)
+31
+32
#include <assert.h>
+33
#include <string.h>
+34
+35
+36
//////////////////////////////////////////////////////////////////////////
+37
////// GLFW platform API //////
+38
//////////////////////////////////////////////////////////////////////////
+39
+40
GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls)
+41
{
+42
assert(tls->posix.allocated == GLFW_FALSE);
+43
+44
if (pthread_key_create(&tls->posix.key, NULL) != 0)
+45
{
+46
_glfwInputError(GLFW_PLATFORM_ERROR,
+47
"POSIX: Failed to create context TLS");
+48
return GLFW_FALSE;
+49
}
+50
+51
tls->posix.allocated = GLFW_TRUE;
+52
return GLFW_TRUE;
+53
}
+54
+55
void _glfwPlatformDestroyTls(_GLFWtls* tls)
+56
{
+57
if (tls->posix.allocated)
+58
pthread_key_delete(tls->posix.key);
+59
memset(tls, 0, sizeof(_GLFWtls));
+60
}
+61
+62
void* _glfwPlatformGetTls(_GLFWtls* tls)
+63
{
+64
assert(tls->posix.allocated == GLFW_TRUE);
+65
return pthread_getspecific(tls->posix.key);
+66
}
+67
+68
void _glfwPlatformSetTls(_GLFWtls* tls, void* value)
+69
{
+70
assert(tls->posix.allocated == GLFW_TRUE);
+71
pthread_setspecific(tls->posix.key, value);
+72
}
+73
+74
GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex)
+75
{
+76
assert(mutex->posix.allocated == GLFW_FALSE);
+77
+78
if (pthread_mutex_init(&mutex->posix.handle, NULL) != 0)
+79
{
+80
_glfwInputError(GLFW_PLATFORM_ERROR, "POSIX: Failed to create mutex");
+81
return GLFW_FALSE;
+82
}
+83
+84
return mutex->posix.allocated = GLFW_TRUE;
+85
}
+86
+87
void _glfwPlatformDestroyMutex(_GLFWmutex* mutex)
+88
{
+89
if (mutex->posix.allocated)
+90
pthread_mutex_destroy(&mutex->posix.handle);
+91
memset(mutex, 0, sizeof(_GLFWmutex));
+92
}
+93
+94
void _glfwPlatformLockMutex(_GLFWmutex* mutex)
+95
{
+96
assert(mutex->posix.allocated == GLFW_TRUE);
+97
pthread_mutex_lock(&mutex->posix.handle);
+98
}
+99
+100
void _glfwPlatformUnlockMutex(_GLFWmutex* mutex)
+101
{
+102
assert(mutex->posix.allocated == GLFW_TRUE);
+103
pthread_mutex_unlock(&mutex->posix.handle);
+104
}
+105
+106
#endif // GLFW_BUILD_POSIX_THREAD
+107
vendor/glfw/src/posix_thread.hadded
@@ -0,0 +1,49 @@
+1
//========================================================================
+2
// GLFW 3.5 POSIX - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include <pthread.h>
+29
+30
#define GLFW_POSIX_TLS_STATE _GLFWtlsPOSIX posix;
+31
#define GLFW_POSIX_MUTEX_STATE _GLFWmutexPOSIX posix;
+32
+33
+34
// POSIX-specific thread local storage data
+35
//
+36
typedef struct _GLFWtlsPOSIX
+37
{
+38
GLFWbool allocated;
+39
pthread_key_t key;
+40
} _GLFWtlsPOSIX;
+41
+42
// POSIX-specific mutex data
+43
//
+44
typedef struct _GLFWmutexPOSIX
+45
{
+46
GLFWbool allocated;
+47
pthread_mutex_t handle;
+48
} _GLFWmutexPOSIX;
+49
vendor/glfw/src/posix_time.cadded
@@ -0,0 +1,65 @@
+1
//========================================================================
+2
// GLFW 3.5 POSIX - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(GLFW_BUILD_POSIX_TIMER)
+31
+32
#include <unistd.h>
+33
#include <sys/time.h>
+34
+35
+36
//////////////////////////////////////////////////////////////////////////
+37
////// GLFW platform API //////
+38
//////////////////////////////////////////////////////////////////////////
+39
+40
void _glfwPlatformInitTimer(void)
+41
{
+42
_glfw.timer.posix.clock = CLOCK_REALTIME;
+43
_glfw.timer.posix.frequency = 1000000000;
+44
+45
#if defined(_POSIX_MONOTONIC_CLOCK)
+46
struct timespec ts;
+47
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
+48
_glfw.timer.posix.clock = CLOCK_MONOTONIC;
+49
#endif
+50
}
+51
+52
uint64_t _glfwPlatformGetTimerValue(void)
+53
{
+54
struct timespec ts;
+55
clock_gettime(_glfw.timer.posix.clock, &ts);
+56
return (uint64_t) ts.tv_sec * _glfw.timer.posix.frequency + (uint64_t) ts.tv_nsec;
+57
}
+58
+59
uint64_t _glfwPlatformGetTimerFrequency(void)
+60
{
+61
return _glfw.timer.posix.frequency;
+62
}
+63
+64
#endif // GLFW_BUILD_POSIX_TIMER
+65
vendor/glfw/src/posix_time.hadded
@@ -0,0 +1,41 @@
+1
//========================================================================
+2
// GLFW 3.5 POSIX - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#define GLFW_POSIX_LIBRARY_TIMER_STATE _GLFWtimerPOSIX posix;
+29
+30
#include <stdint.h>
+31
#include <time.h>
+32
+33
+34
// POSIX-specific global timer data
+35
//
+36
typedef struct _GLFWtimerPOSIX
+37
{
+38
clockid_t clock;
+39
uint64_t frequency;
+40
} _GLFWtimerPOSIX;
+41
vendor/glfw/src/vulkan.cadded
@@ -0,0 +1,365 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#include <assert.h>
+31
#include <string.h>
+32
#include <stdlib.h>
+33
+34
#define _GLFW_FIND_LOADER 1
+35
#define _GLFW_REQUIRE_LOADER 2
+36
+37
#if defined(__APPLE__)
+38
+39
#include <CoreFoundation/CoreFoundation.h>
+40
+41
static void* loadLocalVulkanLoaderMacOS(void)
+42
{
+43
CFBundleRef bundle = CFBundleGetMainBundle();
+44
if (!bundle)
+45
return NULL;
+46
+47
CFURLRef frameworksUrl = CFBundleCopyPrivateFrameworksURL(bundle);
+48
if (!frameworksUrl)
+49
return NULL;
+50
+51
CFURLRef loaderUrl = CFURLCreateCopyAppendingPathComponent(
+52
kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false);
+53
if (!loaderUrl)
+54
{
+55
CFRelease(frameworksUrl);
+56
return NULL;
+57
}
+58
+59
char path[PATH_MAX];
+60
void* handle = NULL;
+61
+62
if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1))
+63
handle = _glfwPlatformLoadModule(path);
+64
+65
CFRelease(loaderUrl);
+66
CFRelease(frameworksUrl);
+67
return handle;
+68
}
+69
+70
#endif // __APPLE__
+71
+72
//////////////////////////////////////////////////////////////////////////
+73
////// GLFW internal API //////
+74
//////////////////////////////////////////////////////////////////////////
+75
+76
GLFWbool _glfwInitVulkan(int mode)
+77
{
+78
VkResult err;
+79
VkExtensionProperties* ep;
+80
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
+81
uint32_t i, count;
+82
+83
if (_glfw.vk.available)
+84
return GLFW_TRUE;
+85
+86
if (_glfw.hints.init.vulkanLoader)
+87
_glfw.vk.GetInstanceProcAddr = _glfw.hints.init.vulkanLoader;
+88
else
+89
{
+90
#if defined(_GLFW_VULKAN_LIBRARY)
+91
_glfw.vk.handle = _glfwPlatformLoadModule(_GLFW_VULKAN_LIBRARY);
+92
#elif defined(_WIN32)
+93
_glfw.vk.handle = _glfwPlatformLoadModule("vulkan-1.dll");
+94
#elif defined(__APPLE__)
+95
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.1.dylib");
+96
if (!_glfw.vk.handle)
+97
_glfw.vk.handle = loadLocalVulkanLoaderMacOS();
+98
#elif defined(__OpenBSD__) || defined(__NetBSD__)
+99
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.so");
+100
#else
+101
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.so.1");
+102
#endif
+103
if (!_glfw.vk.handle)
+104
{
+105
if (mode == _GLFW_REQUIRE_LOADER)
+106
_glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Loader not found");
+107
+108
return GLFW_FALSE;
+109
}
+110
+111
_glfw.vk.GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)
+112
_glfwPlatformGetModuleSymbol(_glfw.vk.handle, "vkGetInstanceProcAddr");
+113
if (!_glfw.vk.GetInstanceProcAddr)
+114
{
+115
_glfwInputError(GLFW_API_UNAVAILABLE,
+116
"Vulkan: Loader does not export vkGetInstanceProcAddr");
+117
+118
_glfwTerminateVulkan();
+119
return GLFW_FALSE;
+120
}
+121
}
+122
+123
vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties)
+124
vkGetInstanceProcAddr(NULL, "vkEnumerateInstanceExtensionProperties");
+125
if (!vkEnumerateInstanceExtensionProperties)
+126
{
+127
_glfwInputError(GLFW_API_UNAVAILABLE,
+128
"Vulkan: Failed to retrieve vkEnumerateInstanceExtensionProperties");
+129
+130
_glfwTerminateVulkan();
+131
return GLFW_FALSE;
+132
}
+133
+134
err = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL);
+135
if (err)
+136
{
+137
// NOTE: This happens on systems with a loader but without any Vulkan ICD
+138
if (mode == _GLFW_REQUIRE_LOADER)
+139
{
+140
_glfwInputError(GLFW_API_UNAVAILABLE,
+141
"Vulkan: Failed to query instance extension count: %s",
+142
_glfwGetVulkanResultString(err));
+143
}
+144
+145
_glfwTerminateVulkan();
+146
return GLFW_FALSE;
+147
}
+148
+149
ep = _glfw_calloc(count, sizeof(VkExtensionProperties));
+150
+151
err = vkEnumerateInstanceExtensionProperties(NULL, &count, ep);
+152
if (err)
+153
{
+154
_glfwInputError(GLFW_API_UNAVAILABLE,
+155
"Vulkan: Failed to query instance extensions: %s",
+156
_glfwGetVulkanResultString(err));
+157
+158
_glfw_free(ep);
+159
_glfwTerminateVulkan();
+160
return GLFW_FALSE;
+161
}
+162
+163
for (i = 0; i < count; i++)
+164
{
+165
if (strcmp(ep[i].extensionName, "VK_KHR_surface") == 0)
+166
_glfw.vk.KHR_surface = true;
+167
else if (strcmp(ep[i].extensionName, "VK_KHR_win32_surface") == 0)
+168
_glfw.vk.KHR_win32_surface = true;
+169
else if (strcmp(ep[i].extensionName, "VK_MVK_macos_surface") == 0)
+170
_glfw.vk.MVK_macos_surface = true;
+171
else if (strcmp(ep[i].extensionName, "VK_EXT_metal_surface") == 0)
+172
_glfw.vk.EXT_metal_surface = true;
+173
else if (strcmp(ep[i].extensionName, "VK_KHR_xlib_surface") == 0)
+174
_glfw.vk.KHR_xlib_surface = true;
+175
else if (strcmp(ep[i].extensionName, "VK_KHR_xcb_surface") == 0)
+176
_glfw.vk.KHR_xcb_surface = true;
+177
else if (strcmp(ep[i].extensionName, "VK_KHR_wayland_surface") == 0)
+178
_glfw.vk.KHR_wayland_surface = true;
+179
else if (strcmp(ep[i].extensionName, "VK_EXT_headless_surface") == 0)
+180
_glfw.vk.EXT_headless_surface = true;
+181
}
+182
+183
_glfw_free(ep);
+184
+185
_glfw.vk.available = GLFW_TRUE;
+186
+187
_glfw.platform.getRequiredInstanceExtensions(_glfw.vk.extensions);
+188
+189
return GLFW_TRUE;
+190
}
+191
+192
void _glfwTerminateVulkan(void)
+193
{
+194
_glfwPlatformFreeModule(_glfw.vk.handle);
+195
_glfw.vk.handle = NULL;
+196
}
+197
+198
const char* _glfwGetVulkanResultString(VkResult result)
+199
{
+200
switch (result)
+201
{
+202
case VK_SUCCESS:
+203
return "Success";
+204
case VK_NOT_READY:
+205
return "A fence or query has not yet completed";
+206
case VK_TIMEOUT:
+207
return "A wait operation has not completed in the specified time";
+208
case VK_EVENT_SET:
+209
return "An event is signaled";
+210
case VK_EVENT_RESET:
+211
return "An event is unsignaled";
+212
case VK_INCOMPLETE:
+213
return "A return array was too small for the result";
+214
case VK_ERROR_OUT_OF_HOST_MEMORY:
+215
return "A host memory allocation has failed";
+216
case VK_ERROR_OUT_OF_DEVICE_MEMORY:
+217
return "A device memory allocation has failed";
+218
case VK_ERROR_INITIALIZATION_FAILED:
+219
return "Initialization of an object could not be completed for implementation-specific reasons";
+220
case VK_ERROR_DEVICE_LOST:
+221
return "The logical or physical device has been lost";
+222
case VK_ERROR_MEMORY_MAP_FAILED:
+223
return "Mapping of a memory object has failed";
+224
case VK_ERROR_LAYER_NOT_PRESENT:
+225
return "A requested layer is not present or could not be loaded";
+226
case VK_ERROR_EXTENSION_NOT_PRESENT:
+227
return "A requested extension is not supported";
+228
case VK_ERROR_FEATURE_NOT_PRESENT:
+229
return "A requested feature is not supported";
+230
case VK_ERROR_INCOMPATIBLE_DRIVER:
+231
return "The requested version of Vulkan is not supported by the driver or is otherwise incompatible";
+232
case VK_ERROR_TOO_MANY_OBJECTS:
+233
return "Too many objects of the type have already been created";
+234
case VK_ERROR_FORMAT_NOT_SUPPORTED:
+235
return "A requested format is not supported on this device";
+236
case VK_ERROR_SURFACE_LOST_KHR:
+237
return "A surface is no longer available";
+238
case VK_SUBOPTIMAL_KHR:
+239
return "A swapchain no longer matches the surface properties exactly, but can still be used";
+240
case VK_ERROR_OUT_OF_DATE_KHR:
+241
return "A surface has changed in such a way that it is no longer compatible with the swapchain";
+242
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
+243
return "The display used by a swapchain does not use the same presentable image layout";
+244
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
+245
return "The requested window is already connected to a VkSurfaceKHR, or to some other non-Vulkan API";
+246
case VK_ERROR_VALIDATION_FAILED_EXT:
+247
return "A validation layer found an error";
+248
default:
+249
return "ERROR: UNKNOWN VULKAN ERROR";
+250
}
+251
}
+252
+253
+254
//////////////////////////////////////////////////////////////////////////
+255
////// GLFW public API //////
+256
//////////////////////////////////////////////////////////////////////////
+257
+258
GLFWAPI int glfwVulkanSupported(void)
+259
{
+260
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
+261
return _glfwInitVulkan(_GLFW_FIND_LOADER);
+262
}
+263
+264
GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count)
+265
{
+266
assert(count != NULL);
+267
+268
*count = 0;
+269
+270
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+271
+272
if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER))
+273
return NULL;
+274
+275
if (!_glfw.vk.extensions[0])
+276
return NULL;
+277
+278
*count = 2;
+279
return (const char**) _glfw.vk.extensions;
+280
}
+281
+282
GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance,
+283
const char* procname)
+284
{
+285
GLFWvkproc proc;
+286
assert(procname != NULL);
+287
+288
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+289
+290
if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER))
+291
return NULL;
+292
+293
// NOTE: Vulkan 1.0 and 1.1 vkGetInstanceProcAddr cannot return itself
+294
if (strcmp(procname, "vkGetInstanceProcAddr") == 0)
+295
return (GLFWvkproc) vkGetInstanceProcAddr;
+296
+297
proc = (GLFWvkproc) vkGetInstanceProcAddr(instance, procname);
+298
if (!proc)
+299
{
+300
if (_glfw.vk.handle)
+301
proc = (GLFWvkproc) _glfwPlatformGetModuleSymbol(_glfw.vk.handle, procname);
+302
}
+303
+304
return proc;
+305
}
+306
+307
GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance,
+308
VkPhysicalDevice device,
+309
uint32_t queuefamily)
+310
{
+311
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
+312
+313
assert(instance != VK_NULL_HANDLE);
+314
assert(device != VK_NULL_HANDLE);
+315
+316
if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER))
+317
return GLFW_FALSE;
+318
+319
if (!_glfw.vk.extensions[0])
+320
{
+321
_glfwInputError(GLFW_API_UNAVAILABLE,
+322
"Vulkan: Window surface creation extensions not found");
+323
return GLFW_FALSE;
+324
}
+325
+326
return _glfw.platform.getPhysicalDevicePresentationSupport(instance,
+327
device,
+328
queuefamily);
+329
}
+330
+331
GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance,
+332
GLFWwindow* handle,
+333
const VkAllocationCallbacks* allocator,
+334
VkSurfaceKHR* surface)
+335
{
+336
assert(surface != NULL);
+337
+338
*surface = VK_NULL_HANDLE;
+339
+340
_GLFW_REQUIRE_INIT_OR_RETURN(VK_ERROR_INITIALIZATION_FAILED);
+341
+342
_GLFWwindow* window = (_GLFWwindow*) handle;
+343
assert(window != NULL);
+344
assert(instance != VK_NULL_HANDLE);
+345
+346
if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER))
+347
return VK_ERROR_INITIALIZATION_FAILED;
+348
+349
if (!_glfw.vk.extensions[0])
+350
{
+351
_glfwInputError(GLFW_API_UNAVAILABLE,
+352
"Vulkan: Window surface creation extensions not found");
+353
return VK_ERROR_EXTENSION_NOT_PRESENT;
+354
}
+355
+356
if (window->context.client != GLFW_NO_API)
+357
{
+358
_glfwInputError(GLFW_INVALID_VALUE,
+359
"Vulkan: Window surface creation requires the window to have the client API set to GLFW_NO_API");
+360
return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR;
+361
}
+362
+363
return _glfw.platform.createWindowSurface(instance, window, allocator, surface);
+364
}
+365
vendor/glfw/src/wayland-protocols/fractional-scale-v1-client-protocol-code.hadded
@@ -0,0 +1,74 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
/*
+4
* Copyright © 2022 Kenny Levinsen
+5
*
+6
* Permission is hereby granted, free of charge, to any person obtaining a
+7
* copy of this software and associated documentation files (the "Software"),
+8
* to deal in the Software without restriction, including without limitation
+9
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+10
* and/or sell copies of the Software, and to permit persons to whom the
+11
* Software is furnished to do so, subject to the following conditions:
+12
*
+13
* The above copyright notice and this permission notice (including the next
+14
* paragraph) shall be included in all copies or substantial portions of the
+15
* Software.
+16
*
+17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+18
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+19
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+20
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+21
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+22
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+23
* DEALINGS IN THE SOFTWARE.
+24
*/
+25
+26
#include <stdbool.h>
+27
#include <stdlib.h>
+28
#include <stdint.h>
+29
#include "wayland-util.h"
+30
+31
#ifndef __has_attribute
+32
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+33
#endif
+34
+35
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
+36
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
+37
#else
+38
#define WL_PRIVATE
+39
#endif
+40
+41
extern const struct wl_interface wl_surface_interface;
+42
extern const struct wl_interface wp_fractional_scale_v1_interface;
+43
+44
static const struct wl_interface *fractional_scale_v1_types[] = {
+45
NULL,
+46
&wp_fractional_scale_v1_interface,
+47
&wl_surface_interface,
+48
};
+49
+50
static const struct wl_message wp_fractional_scale_manager_v1_requests[] = {
+51
{ "destroy", "", fractional_scale_v1_types + 0 },
+52
{ "get_fractional_scale", "no", fractional_scale_v1_types + 1 },
+53
};
+54
+55
WL_PRIVATE const struct wl_interface wp_fractional_scale_manager_v1_interface = {
+56
"wp_fractional_scale_manager_v1", 1,
+57
2, wp_fractional_scale_manager_v1_requests,
+58
0, NULL,
+59
};
+60
+61
static const struct wl_message wp_fractional_scale_v1_requests[] = {
+62
{ "destroy", "", fractional_scale_v1_types + 0 },
+63
};
+64
+65
static const struct wl_message wp_fractional_scale_v1_events[] = {
+66
{ "preferred_scale", "u", fractional_scale_v1_types + 0 },
+67
};
+68
+69
WL_PRIVATE const struct wl_interface wp_fractional_scale_v1_interface = {
+70
"wp_fractional_scale_v1", 1,
+71
1, wp_fractional_scale_v1_requests,
+72
1, wp_fractional_scale_v1_events,
+73
};
+74
vendor/glfw/src/wayland-protocols/fractional-scale-v1-client-protocol.hadded
@@ -0,0 +1,264 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
#ifndef FRACTIONAL_SCALE_V1_CLIENT_PROTOCOL_H
+4
#define FRACTIONAL_SCALE_V1_CLIENT_PROTOCOL_H
+5
+6
#include <stdint.h>
+7
#include <stddef.h>
+8
#include "wayland-client.h"
+9
+10
#ifdef __cplusplus
+11
extern "C" {
+12
#endif
+13
+14
/**
+15
* @page page_fractional_scale_v1 The fractional_scale_v1 protocol
+16
* Protocol for requesting fractional surface scales
+17
*
+18
* @section page_desc_fractional_scale_v1 Description
+19
*
+20
* This protocol allows a compositor to suggest for surfaces to render at
+21
* fractional scales.
+22
*
+23
* A client can submit scaled content by utilizing wp_viewport. This is done by
+24
* creating a wp_viewport object for the surface and setting the destination
+25
* rectangle to the surface size before the scale factor is applied.
+26
*
+27
* The buffer size is calculated by multiplying the surface size by the
+28
* intended scale.
+29
*
+30
* The wl_surface buffer scale should remain set to 1.
+31
*
+32
* If a surface has a surface-local size of 100 px by 50 px and wishes to
+33
* submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
+34
* be used and the wp_viewport destination rectangle should be 100 px by 50 px.
+35
*
+36
* For toplevel surfaces, the size is rounded halfway away from zero. The
+37
* rounding algorithm for subsurface position and size is not defined.
+38
*
+39
* @section page_ifaces_fractional_scale_v1 Interfaces
+40
* - @subpage page_iface_wp_fractional_scale_manager_v1 - fractional surface scale information
+41
* - @subpage page_iface_wp_fractional_scale_v1 - fractional scale interface to a wl_surface
+42
* @section page_copyright_fractional_scale_v1 Copyright
+43
* <pre>
+44
*
+45
* Copyright © 2022 Kenny Levinsen
+46
*
+47
* Permission is hereby granted, free of charge, to any person obtaining a
+48
* copy of this software and associated documentation files (the "Software"),
+49
* to deal in the Software without restriction, including without limitation
+50
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+51
* and/or sell copies of the Software, and to permit persons to whom the
+52
* Software is furnished to do so, subject to the following conditions:
+53
*
+54
* The above copyright notice and this permission notice (including the next
+55
* paragraph) shall be included in all copies or substantial portions of the
+56
* Software.
+57
*
+58
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+59
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+60
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+61
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+62
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+63
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+64
* DEALINGS IN THE SOFTWARE.
+65
* </pre>
+66
*/
+67
struct wl_surface;
+68
struct wp_fractional_scale_manager_v1;
+69
struct wp_fractional_scale_v1;
+70
+71
#ifndef WP_FRACTIONAL_SCALE_MANAGER_V1_INTERFACE
+72
#define WP_FRACTIONAL_SCALE_MANAGER_V1_INTERFACE
+73
/**
+74
* @page page_iface_wp_fractional_scale_manager_v1 wp_fractional_scale_manager_v1
+75
* @section page_iface_wp_fractional_scale_manager_v1_desc Description
+76
*
+77
* A global interface for requesting surfaces to use fractional scales.
+78
* @section page_iface_wp_fractional_scale_manager_v1_api API
+79
* See @ref iface_wp_fractional_scale_manager_v1.
+80
*/
+81
/**
+82
* @defgroup iface_wp_fractional_scale_manager_v1 The wp_fractional_scale_manager_v1 interface
+83
*
+84
* A global interface for requesting surfaces to use fractional scales.
+85
*/
+86
extern const struct wl_interface wp_fractional_scale_manager_v1_interface;
+87
#endif
+88
#ifndef WP_FRACTIONAL_SCALE_V1_INTERFACE
+89
#define WP_FRACTIONAL_SCALE_V1_INTERFACE
+90
/**
+91
* @page page_iface_wp_fractional_scale_v1 wp_fractional_scale_v1
+92
* @section page_iface_wp_fractional_scale_v1_desc Description
+93
*
+94
* An additional interface to a wl_surface object which allows the compositor
+95
* to inform the client of the preferred scale.
+96
* @section page_iface_wp_fractional_scale_v1_api API
+97
* See @ref iface_wp_fractional_scale_v1.
+98
*/
+99
/**
+100
* @defgroup iface_wp_fractional_scale_v1 The wp_fractional_scale_v1 interface
+101
*
+102
* An additional interface to a wl_surface object which allows the compositor
+103
* to inform the client of the preferred scale.
+104
*/
+105
extern const struct wl_interface wp_fractional_scale_v1_interface;
+106
#endif
+107
+108
#ifndef WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_ENUM
+109
#define WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_ENUM
+110
enum wp_fractional_scale_manager_v1_error {
+111
/**
+112
* the surface already has a fractional_scale object associated
+113
*/
+114
WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_FRACTIONAL_SCALE_EXISTS = 0,
+115
};
+116
#endif /* WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_ENUM */
+117
+118
#define WP_FRACTIONAL_SCALE_MANAGER_V1_DESTROY 0
+119
#define WP_FRACTIONAL_SCALE_MANAGER_V1_GET_FRACTIONAL_SCALE 1
+120
+121
+122
/**
+123
* @ingroup iface_wp_fractional_scale_manager_v1
+124
*/
+125
#define WP_FRACTIONAL_SCALE_MANAGER_V1_DESTROY_SINCE_VERSION 1
+126
/**
+127
* @ingroup iface_wp_fractional_scale_manager_v1
+128
*/
+129
#define WP_FRACTIONAL_SCALE_MANAGER_V1_GET_FRACTIONAL_SCALE_SINCE_VERSION 1
+130
+131
/** @ingroup iface_wp_fractional_scale_manager_v1 */
+132
static inline void
+133
wp_fractional_scale_manager_v1_set_user_data(struct wp_fractional_scale_manager_v1 *wp_fractional_scale_manager_v1, void *user_data)
+134
{
+135
wl_proxy_set_user_data((struct wl_proxy *) wp_fractional_scale_manager_v1, user_data);
+136
}
+137
+138
/** @ingroup iface_wp_fractional_scale_manager_v1 */
+139
static inline void *
+140
wp_fractional_scale_manager_v1_get_user_data(struct wp_fractional_scale_manager_v1 *wp_fractional_scale_manager_v1)
+141
{
+142
return wl_proxy_get_user_data((struct wl_proxy *) wp_fractional_scale_manager_v1);
+143
}
+144
+145
static inline uint32_t
+146
wp_fractional_scale_manager_v1_get_version(struct wp_fractional_scale_manager_v1 *wp_fractional_scale_manager_v1)
+147
{
+148
return wl_proxy_get_version((struct wl_proxy *) wp_fractional_scale_manager_v1);
+149
}
+150
+151
/**
+152
* @ingroup iface_wp_fractional_scale_manager_v1
+153
*
+154
* Informs the server that the client will not be using this protocol
+155
* object anymore. This does not affect any other objects,
+156
* wp_fractional_scale_v1 objects included.
+157
*/
+158
static inline void
+159
wp_fractional_scale_manager_v1_destroy(struct wp_fractional_scale_manager_v1 *wp_fractional_scale_manager_v1)
+160
{
+161
wl_proxy_marshal_flags((struct wl_proxy *) wp_fractional_scale_manager_v1,
+162
WP_FRACTIONAL_SCALE_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_fractional_scale_manager_v1), WL_MARSHAL_FLAG_DESTROY);
+163
}
+164
+165
/**
+166
* @ingroup iface_wp_fractional_scale_manager_v1
+167
*
+168
* Create an add-on object for the the wl_surface to let the compositor
+169
* request fractional scales. If the given wl_surface already has a
+170
* wp_fractional_scale_v1 object associated, the fractional_scale_exists
+171
* protocol error is raised.
+172
*/
+173
static inline struct wp_fractional_scale_v1 *
+174
wp_fractional_scale_manager_v1_get_fractional_scale(struct wp_fractional_scale_manager_v1 *wp_fractional_scale_manager_v1, struct wl_surface *surface)
+175
{
+176
struct wl_proxy *id;
+177
+178
id = wl_proxy_marshal_flags((struct wl_proxy *) wp_fractional_scale_manager_v1,
+179
WP_FRACTIONAL_SCALE_MANAGER_V1_GET_FRACTIONAL_SCALE, &wp_fractional_scale_v1_interface, wl_proxy_get_version((struct wl_proxy *) wp_fractional_scale_manager_v1), 0, NULL, surface);
+180
+181
return (struct wp_fractional_scale_v1 *) id;
+182
}
+183
+184
/**
+185
* @ingroup iface_wp_fractional_scale_v1
+186
* @struct wp_fractional_scale_v1_listener
+187
*/
+188
struct wp_fractional_scale_v1_listener {
+189
/**
+190
* notify of new preferred scale
+191
*
+192
* Notification of a new preferred scale for this surface that
+193
* the compositor suggests that the client should use.
+194
*
+195
* The sent scale is the numerator of a fraction with a denominator
+196
* of 120.
+197
* @param scale the new preferred scale
+198
*/
+199
void (*preferred_scale)(void *data,
+200
struct wp_fractional_scale_v1 *wp_fractional_scale_v1,
+201
uint32_t scale);
+202
};
+203
+204
/**
+205
* @ingroup iface_wp_fractional_scale_v1
+206
*/
+207
static inline int
+208
wp_fractional_scale_v1_add_listener(struct wp_fractional_scale_v1 *wp_fractional_scale_v1,
+209
const struct wp_fractional_scale_v1_listener *listener, void *data)
+210
{
+211
return wl_proxy_add_listener((struct wl_proxy *) wp_fractional_scale_v1,
+212
(void (**)(void)) listener, data);
+213
}
+214
+215
#define WP_FRACTIONAL_SCALE_V1_DESTROY 0
+216
+217
/**
+218
* @ingroup iface_wp_fractional_scale_v1
+219
*/
+220
#define WP_FRACTIONAL_SCALE_V1_PREFERRED_SCALE_SINCE_VERSION 1
+221
+222
/**
+223
* @ingroup iface_wp_fractional_scale_v1
+224
*/
+225
#define WP_FRACTIONAL_SCALE_V1_DESTROY_SINCE_VERSION 1
+226
+227
/** @ingroup iface_wp_fractional_scale_v1 */
+228
static inline void
+229
wp_fractional_scale_v1_set_user_data(struct wp_fractional_scale_v1 *wp_fractional_scale_v1, void *user_data)
+230
{
+231
wl_proxy_set_user_data((struct wl_proxy *) wp_fractional_scale_v1, user_data);
+232
}
+233
+234
/** @ingroup iface_wp_fractional_scale_v1 */
+235
static inline void *
+236
wp_fractional_scale_v1_get_user_data(struct wp_fractional_scale_v1 *wp_fractional_scale_v1)
+237
{
+238
return wl_proxy_get_user_data((struct wl_proxy *) wp_fractional_scale_v1);
+239
}
+240
+241
static inline uint32_t
+242
wp_fractional_scale_v1_get_version(struct wp_fractional_scale_v1 *wp_fractional_scale_v1)
+243
{
+244
return wl_proxy_get_version((struct wl_proxy *) wp_fractional_scale_v1);
+245
}
+246
+247
/**
+248
* @ingroup iface_wp_fractional_scale_v1
+249
*
+250
* Destroy the fractional scale object. When this object is destroyed,
+251
* preferred_scale events will no longer be sent.
+252
*/
+253
static inline void
+254
wp_fractional_scale_v1_destroy(struct wp_fractional_scale_v1 *wp_fractional_scale_v1)
+255
{
+256
wl_proxy_marshal_flags((struct wl_proxy *) wp_fractional_scale_v1,
+257
WP_FRACTIONAL_SCALE_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_fractional_scale_v1), WL_MARSHAL_FLAG_DESTROY);
+258
}
+259
+260
#ifdef __cplusplus
+261
}
+262
#endif
+263
+264
#endif
vendor/glfw/src/wayland-protocols/idle-inhibit-unstable-v1-client-protocol-code.hadded
@@ -0,0 +1,69 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
/*
+4
* Copyright © 2015 Samsung Electronics Co., Ltd
+5
*
+6
* Permission is hereby granted, free of charge, to any person obtaining a
+7
* copy of this software and associated documentation files (the "Software"),
+8
* to deal in the Software without restriction, including without limitation
+9
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+10
* and/or sell copies of the Software, and to permit persons to whom the
+11
* Software is furnished to do so, subject to the following conditions:
+12
*
+13
* The above copyright notice and this permission notice (including the next
+14
* paragraph) shall be included in all copies or substantial portions of the
+15
* Software.
+16
*
+17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+18
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+19
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+20
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+21
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+22
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+23
* DEALINGS IN THE SOFTWARE.
+24
*/
+25
+26
#include <stdbool.h>
+27
#include <stdlib.h>
+28
#include <stdint.h>
+29
#include "wayland-util.h"
+30
+31
#ifndef __has_attribute
+32
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+33
#endif
+34
+35
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
+36
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
+37
#else
+38
#define WL_PRIVATE
+39
#endif
+40
+41
extern const struct wl_interface wl_surface_interface;
+42
extern const struct wl_interface zwp_idle_inhibitor_v1_interface;
+43
+44
static const struct wl_interface *idle_inhibit_unstable_v1_types[] = {
+45
&zwp_idle_inhibitor_v1_interface,
+46
&wl_surface_interface,
+47
};
+48
+49
static const struct wl_message zwp_idle_inhibit_manager_v1_requests[] = {
+50
{ "destroy", "", idle_inhibit_unstable_v1_types + 0 },
+51
{ "create_inhibitor", "no", idle_inhibit_unstable_v1_types + 0 },
+52
};
+53
+54
WL_PRIVATE const struct wl_interface zwp_idle_inhibit_manager_v1_interface = {
+55
"zwp_idle_inhibit_manager_v1", 1,
+56
2, zwp_idle_inhibit_manager_v1_requests,
+57
0, NULL,
+58
};
+59
+60
static const struct wl_message zwp_idle_inhibitor_v1_requests[] = {
+61
{ "destroy", "", idle_inhibit_unstable_v1_types + 0 },
+62
};
+63
+64
WL_PRIVATE const struct wl_interface zwp_idle_inhibitor_v1_interface = {
+65
"zwp_idle_inhibitor_v1", 1,
+66
1, zwp_idle_inhibitor_v1_requests,
+67
0, NULL,
+68
};
+69
vendor/glfw/src/wayland-protocols/idle-inhibit-unstable-v1-client-protocol.hadded
@@ -0,0 +1,232 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
#ifndef IDLE_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H
+4
#define IDLE_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H
+5
+6
#include <stdint.h>
+7
#include <stddef.h>
+8
#include "wayland-client.h"
+9
+10
#ifdef __cplusplus
+11
extern "C" {
+12
#endif
+13
+14
/**
+15
* @page page_idle_inhibit_unstable_v1 The idle_inhibit_unstable_v1 protocol
+16
* @section page_ifaces_idle_inhibit_unstable_v1 Interfaces
+17
* - @subpage page_iface_zwp_idle_inhibit_manager_v1 - control behavior when display idles
+18
* - @subpage page_iface_zwp_idle_inhibitor_v1 - context object for inhibiting idle behavior
+19
* @section page_copyright_idle_inhibit_unstable_v1 Copyright
+20
* <pre>
+21
*
+22
* Copyright © 2015 Samsung Electronics Co., Ltd
+23
*
+24
* Permission is hereby granted, free of charge, to any person obtaining a
+25
* copy of this software and associated documentation files (the "Software"),
+26
* to deal in the Software without restriction, including without limitation
+27
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+28
* and/or sell copies of the Software, and to permit persons to whom the
+29
* Software is furnished to do so, subject to the following conditions:
+30
*
+31
* The above copyright notice and this permission notice (including the next
+32
* paragraph) shall be included in all copies or substantial portions of the
+33
* Software.
+34
*
+35
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+36
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+37
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+38
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+39
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+40
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+41
* DEALINGS IN THE SOFTWARE.
+42
* </pre>
+43
*/
+44
struct wl_surface;
+45
struct zwp_idle_inhibit_manager_v1;
+46
struct zwp_idle_inhibitor_v1;
+47
+48
#ifndef ZWP_IDLE_INHIBIT_MANAGER_V1_INTERFACE
+49
#define ZWP_IDLE_INHIBIT_MANAGER_V1_INTERFACE
+50
/**
+51
* @page page_iface_zwp_idle_inhibit_manager_v1 zwp_idle_inhibit_manager_v1
+52
* @section page_iface_zwp_idle_inhibit_manager_v1_desc Description
+53
*
+54
* This interface permits inhibiting the idle behavior such as screen
+55
* blanking, locking, and screensaving. The client binds the idle manager
+56
* globally, then creates idle-inhibitor objects for each surface.
+57
*
+58
* Warning! The protocol described in this file is experimental and
+59
* backward incompatible changes may be made. Backward compatible changes
+60
* may be added together with the corresponding interface version bump.
+61
* Backward incompatible changes are done by bumping the version number in
+62
* the protocol and interface names and resetting the interface version.
+63
* Once the protocol is to be declared stable, the 'z' prefix and the
+64
* version number in the protocol and interface names are removed and the
+65
* interface version number is reset.
+66
* @section page_iface_zwp_idle_inhibit_manager_v1_api API
+67
* See @ref iface_zwp_idle_inhibit_manager_v1.
+68
*/
+69
/**
+70
* @defgroup iface_zwp_idle_inhibit_manager_v1 The zwp_idle_inhibit_manager_v1 interface
+71
*
+72
* This interface permits inhibiting the idle behavior such as screen
+73
* blanking, locking, and screensaving. The client binds the idle manager
+74
* globally, then creates idle-inhibitor objects for each surface.
+75
*
+76
* Warning! The protocol described in this file is experimental and
+77
* backward incompatible changes may be made. Backward compatible changes
+78
* may be added together with the corresponding interface version bump.
+79
* Backward incompatible changes are done by bumping the version number in
+80
* the protocol and interface names and resetting the interface version.
+81
* Once the protocol is to be declared stable, the 'z' prefix and the
+82
* version number in the protocol and interface names are removed and the
+83
* interface version number is reset.
+84
*/
+85
extern const struct wl_interface zwp_idle_inhibit_manager_v1_interface;
+86
#endif
+87
#ifndef ZWP_IDLE_INHIBITOR_V1_INTERFACE
+88
#define ZWP_IDLE_INHIBITOR_V1_INTERFACE
+89
/**
+90
* @page page_iface_zwp_idle_inhibitor_v1 zwp_idle_inhibitor_v1
+91
* @section page_iface_zwp_idle_inhibitor_v1_desc Description
+92
*
+93
* An idle inhibitor prevents the output that the associated surface is
+94
* visible on from being set to a state where it is not visually usable due
+95
* to lack of user interaction (e.g. blanked, dimmed, locked, set to power
+96
* save, etc.) Any screensaver processes are also blocked from displaying.
+97
*
+98
* If the surface is destroyed, unmapped, becomes occluded, loses
+99
* visibility, or otherwise becomes not visually relevant for the user, the
+100
* idle inhibitor will not be honored by the compositor; if the surface
+101
* subsequently regains visibility the inhibitor takes effect once again.
+102
* Likewise, the inhibitor isn't honored if the system was already idled at
+103
* the time the inhibitor was established, although if the system later
+104
* de-idles and re-idles the inhibitor will take effect.
+105
* @section page_iface_zwp_idle_inhibitor_v1_api API
+106
* See @ref iface_zwp_idle_inhibitor_v1.
+107
*/
+108
/**
+109
* @defgroup iface_zwp_idle_inhibitor_v1 The zwp_idle_inhibitor_v1 interface
+110
*
+111
* An idle inhibitor prevents the output that the associated surface is
+112
* visible on from being set to a state where it is not visually usable due
+113
* to lack of user interaction (e.g. blanked, dimmed, locked, set to power
+114
* save, etc.) Any screensaver processes are also blocked from displaying.
+115
*
+116
* If the surface is destroyed, unmapped, becomes occluded, loses
+117
* visibility, or otherwise becomes not visually relevant for the user, the
+118
* idle inhibitor will not be honored by the compositor; if the surface
+119
* subsequently regains visibility the inhibitor takes effect once again.
+120
* Likewise, the inhibitor isn't honored if the system was already idled at
+121
* the time the inhibitor was established, although if the system later
+122
* de-idles and re-idles the inhibitor will take effect.
+123
*/
+124
extern const struct wl_interface zwp_idle_inhibitor_v1_interface;
+125
#endif
+126
+127
#define ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY 0
+128
#define ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR 1
+129
+130
+131
/**
+132
* @ingroup iface_zwp_idle_inhibit_manager_v1
+133
*/
+134
#define ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY_SINCE_VERSION 1
+135
/**
+136
* @ingroup iface_zwp_idle_inhibit_manager_v1
+137
*/
+138
#define ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR_SINCE_VERSION 1
+139
+140
/** @ingroup iface_zwp_idle_inhibit_manager_v1 */
+141
static inline void
+142
zwp_idle_inhibit_manager_v1_set_user_data(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1, void *user_data)
+143
{
+144
wl_proxy_set_user_data((struct wl_proxy *) zwp_idle_inhibit_manager_v1, user_data);
+145
}
+146
+147
/** @ingroup iface_zwp_idle_inhibit_manager_v1 */
+148
static inline void *
+149
zwp_idle_inhibit_manager_v1_get_user_data(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
+150
{
+151
return wl_proxy_get_user_data((struct wl_proxy *) zwp_idle_inhibit_manager_v1);
+152
}
+153
+154
static inline uint32_t
+155
zwp_idle_inhibit_manager_v1_get_version(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
+156
{
+157
return wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibit_manager_v1);
+158
}
+159
+160
/**
+161
* @ingroup iface_zwp_idle_inhibit_manager_v1
+162
*
+163
* Destroy the inhibit manager.
+164
*/
+165
static inline void
+166
zwp_idle_inhibit_manager_v1_destroy(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
+167
{
+168
wl_proxy_marshal_flags((struct wl_proxy *) zwp_idle_inhibit_manager_v1,
+169
ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibit_manager_v1), WL_MARSHAL_FLAG_DESTROY);
+170
}
+171
+172
/**
+173
* @ingroup iface_zwp_idle_inhibit_manager_v1
+174
*
+175
* Create a new inhibitor object associated with the given surface.
+176
*/
+177
static inline struct zwp_idle_inhibitor_v1 *
+178
zwp_idle_inhibit_manager_v1_create_inhibitor(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1, struct wl_surface *surface)
+179
{
+180
struct wl_proxy *id;
+181
+182
id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_idle_inhibit_manager_v1,
+183
ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR, &zwp_idle_inhibitor_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibit_manager_v1), 0, NULL, surface);
+184
+185
return (struct zwp_idle_inhibitor_v1 *) id;
+186
}
+187
+188
#define ZWP_IDLE_INHIBITOR_V1_DESTROY 0
+189
+190
+191
/**
+192
* @ingroup iface_zwp_idle_inhibitor_v1
+193
*/
+194
#define ZWP_IDLE_INHIBITOR_V1_DESTROY_SINCE_VERSION 1
+195
+196
/** @ingroup iface_zwp_idle_inhibitor_v1 */
+197
static inline void
+198
zwp_idle_inhibitor_v1_set_user_data(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1, void *user_data)
+199
{
+200
wl_proxy_set_user_data((struct wl_proxy *) zwp_idle_inhibitor_v1, user_data);
+201
}
+202
+203
/** @ingroup iface_zwp_idle_inhibitor_v1 */
+204
static inline void *
+205
zwp_idle_inhibitor_v1_get_user_data(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
+206
{
+207
return wl_proxy_get_user_data((struct wl_proxy *) zwp_idle_inhibitor_v1);
+208
}
+209
+210
static inline uint32_t
+211
zwp_idle_inhibitor_v1_get_version(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
+212
{
+213
return wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibitor_v1);
+214
}
+215
+216
/**
+217
* @ingroup iface_zwp_idle_inhibitor_v1
+218
*
+219
* Remove the inhibitor effect from the associated wl_surface.
+220
*/
+221
static inline void
+222
zwp_idle_inhibitor_v1_destroy(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
+223
{
+224
wl_proxy_marshal_flags((struct wl_proxy *) zwp_idle_inhibitor_v1,
+225
ZWP_IDLE_INHIBITOR_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibitor_v1), WL_MARSHAL_FLAG_DESTROY);
+226
}
+227
+228
#ifdef __cplusplus
+229
}
+230
#endif
+231
+232
#endif
vendor/glfw/src/wayland-protocols/pointer-constraints-unstable-v1-client-protocol-code.hadded
@@ -0,0 +1,109 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
/*
+4
* Copyright © 2014 Jonas Ådahl
+5
* Copyright © 2015 Red Hat Inc.
+6
*
+7
* Permission is hereby granted, free of charge, to any person obtaining a
+8
* copy of this software and associated documentation files (the "Software"),
+9
* to deal in the Software without restriction, including without limitation
+10
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+11
* and/or sell copies of the Software, and to permit persons to whom the
+12
* Software is furnished to do so, subject to the following conditions:
+13
*
+14
* The above copyright notice and this permission notice (including the next
+15
* paragraph) shall be included in all copies or substantial portions of the
+16
* Software.
+17
*
+18
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+19
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+20
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+21
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+22
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+23
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+24
* DEALINGS IN THE SOFTWARE.
+25
*/
+26
+27
#include <stdbool.h>
+28
#include <stdlib.h>
+29
#include <stdint.h>
+30
#include "wayland-util.h"
+31
+32
#ifndef __has_attribute
+33
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+34
#endif
+35
+36
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
+37
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
+38
#else
+39
#define WL_PRIVATE
+40
#endif
+41
+42
extern const struct wl_interface wl_pointer_interface;
+43
extern const struct wl_interface wl_region_interface;
+44
extern const struct wl_interface wl_surface_interface;
+45
extern const struct wl_interface zwp_confined_pointer_v1_interface;
+46
extern const struct wl_interface zwp_locked_pointer_v1_interface;
+47
+48
static const struct wl_interface *pointer_constraints_unstable_v1_types[] = {
+49
NULL,
+50
NULL,
+51
&zwp_locked_pointer_v1_interface,
+52
&wl_surface_interface,
+53
&wl_pointer_interface,
+54
&wl_region_interface,
+55
NULL,
+56
&zwp_confined_pointer_v1_interface,
+57
&wl_surface_interface,
+58
&wl_pointer_interface,
+59
&wl_region_interface,
+60
NULL,
+61
&wl_region_interface,
+62
&wl_region_interface,
+63
};
+64
+65
static const struct wl_message zwp_pointer_constraints_v1_requests[] = {
+66
{ "destroy", "", pointer_constraints_unstable_v1_types + 0 },
+67
{ "lock_pointer", "noo?ou", pointer_constraints_unstable_v1_types + 2 },
+68
{ "confine_pointer", "noo?ou", pointer_constraints_unstable_v1_types + 7 },
+69
};
+70
+71
WL_PRIVATE const struct wl_interface zwp_pointer_constraints_v1_interface = {
+72
"zwp_pointer_constraints_v1", 1,
+73
3, zwp_pointer_constraints_v1_requests,
+74
0, NULL,
+75
};
+76
+77
static const struct wl_message zwp_locked_pointer_v1_requests[] = {
+78
{ "destroy", "", pointer_constraints_unstable_v1_types + 0 },
+79
{ "set_cursor_position_hint", "ff", pointer_constraints_unstable_v1_types + 0 },
+80
{ "set_region", "?o", pointer_constraints_unstable_v1_types + 12 },
+81
};
+82
+83
static const struct wl_message zwp_locked_pointer_v1_events[] = {
+84
{ "locked", "", pointer_constraints_unstable_v1_types + 0 },
+85
{ "unlocked", "", pointer_constraints_unstable_v1_types + 0 },
+86
};
+87
+88
WL_PRIVATE const struct wl_interface zwp_locked_pointer_v1_interface = {
+89
"zwp_locked_pointer_v1", 1,
+90
3, zwp_locked_pointer_v1_requests,
+91
2, zwp_locked_pointer_v1_events,
+92
};
+93
+94
static const struct wl_message zwp_confined_pointer_v1_requests[] = {
+95
{ "destroy", "", pointer_constraints_unstable_v1_types + 0 },
+96
{ "set_region", "?o", pointer_constraints_unstable_v1_types + 13 },
+97
};
+98
+99
static const struct wl_message zwp_confined_pointer_v1_events[] = {
+100
{ "confined", "", pointer_constraints_unstable_v1_types + 0 },
+101
{ "unconfined", "", pointer_constraints_unstable_v1_types + 0 },
+102
};
+103
+104
WL_PRIVATE const struct wl_interface zwp_confined_pointer_v1_interface = {
+105
"zwp_confined_pointer_v1", 1,
+106
2, zwp_confined_pointer_v1_requests,
+107
2, zwp_confined_pointer_v1_events,
+108
};
+109
vendor/glfw/src/wayland-protocols/pointer-constraints-unstable-v1-client-protocol.hadded
@@ -0,0 +1,667 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
#ifndef POINTER_CONSTRAINTS_UNSTABLE_V1_CLIENT_PROTOCOL_H
+4
#define POINTER_CONSTRAINTS_UNSTABLE_V1_CLIENT_PROTOCOL_H
+5
+6
#include <stdint.h>
+7
#include <stddef.h>
+8
#include "wayland-client.h"
+9
+10
#ifdef __cplusplus
+11
extern "C" {
+12
#endif
+13
+14
/**
+15
* @page page_pointer_constraints_unstable_v1 The pointer_constraints_unstable_v1 protocol
+16
* protocol for constraining pointer motions
+17
*
+18
* @section page_desc_pointer_constraints_unstable_v1 Description
+19
*
+20
* This protocol specifies a set of interfaces used for adding constraints to
+21
* the motion of a pointer. Possible constraints include confining pointer
+22
* motions to a given region, or locking it to its current position.
+23
*
+24
* In order to constrain the pointer, a client must first bind the global
+25
* interface "wp_pointer_constraints" which, if a compositor supports pointer
+26
* constraints, is exposed by the registry. Using the bound global object, the
+27
* client uses the request that corresponds to the type of constraint it wants
+28
* to make. See wp_pointer_constraints for more details.
+29
*
+30
* Warning! The protocol described in this file is experimental and backward
+31
* incompatible changes may be made. Backward compatible changes may be added
+32
* together with the corresponding interface version bump. Backward
+33
* incompatible changes are done by bumping the version number in the protocol
+34
* and interface names and resetting the interface version. Once the protocol
+35
* is to be declared stable, the 'z' prefix and the version number in the
+36
* protocol and interface names are removed and the interface version number is
+37
* reset.
+38
*
+39
* @section page_ifaces_pointer_constraints_unstable_v1 Interfaces
+40
* - @subpage page_iface_zwp_pointer_constraints_v1 - constrain the movement of a pointer
+41
* - @subpage page_iface_zwp_locked_pointer_v1 - receive relative pointer motion events
+42
* - @subpage page_iface_zwp_confined_pointer_v1 - confined pointer object
+43
* @section page_copyright_pointer_constraints_unstable_v1 Copyright
+44
* <pre>
+45
*
+46
* Copyright © 2014 Jonas Ådahl
+47
* Copyright © 2015 Red Hat Inc.
+48
*
+49
* Permission is hereby granted, free of charge, to any person obtaining a
+50
* copy of this software and associated documentation files (the "Software"),
+51
* to deal in the Software without restriction, including without limitation
+52
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+53
* and/or sell copies of the Software, and to permit persons to whom the
+54
* Software is furnished to do so, subject to the following conditions:
+55
*
+56
* The above copyright notice and this permission notice (including the next
+57
* paragraph) shall be included in all copies or substantial portions of the
+58
* Software.
+59
*
+60
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+61
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+62
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+63
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+64
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+65
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+66
* DEALINGS IN THE SOFTWARE.
+67
* </pre>
+68
*/
+69
struct wl_pointer;
+70
struct wl_region;
+71
struct wl_surface;
+72
struct zwp_confined_pointer_v1;
+73
struct zwp_locked_pointer_v1;
+74
struct zwp_pointer_constraints_v1;
+75
+76
#ifndef ZWP_POINTER_CONSTRAINTS_V1_INTERFACE
+77
#define ZWP_POINTER_CONSTRAINTS_V1_INTERFACE
+78
/**
+79
* @page page_iface_zwp_pointer_constraints_v1 zwp_pointer_constraints_v1
+80
* @section page_iface_zwp_pointer_constraints_v1_desc Description
+81
*
+82
* The global interface exposing pointer constraining functionality. It
+83
* exposes two requests: lock_pointer for locking the pointer to its
+84
* position, and confine_pointer for locking the pointer to a region.
+85
*
+86
* The lock_pointer and confine_pointer requests create the objects
+87
* wp_locked_pointer and wp_confined_pointer respectively, and the client can
+88
* use these objects to interact with the lock.
+89
*
+90
* For any surface, only one lock or confinement may be active across all
+91
* wl_pointer objects of the same seat. If a lock or confinement is requested
+92
* when another lock or confinement is active or requested on the same surface
+93
* and with any of the wl_pointer objects of the same seat, an
+94
* 'already_constrained' error will be raised.
+95
* @section page_iface_zwp_pointer_constraints_v1_api API
+96
* See @ref iface_zwp_pointer_constraints_v1.
+97
*/
+98
/**
+99
* @defgroup iface_zwp_pointer_constraints_v1 The zwp_pointer_constraints_v1 interface
+100
*
+101
* The global interface exposing pointer constraining functionality. It
+102
* exposes two requests: lock_pointer for locking the pointer to its
+103
* position, and confine_pointer for locking the pointer to a region.
+104
*
+105
* The lock_pointer and confine_pointer requests create the objects
+106
* wp_locked_pointer and wp_confined_pointer respectively, and the client can
+107
* use these objects to interact with the lock.
+108
*
+109
* For any surface, only one lock or confinement may be active across all
+110
* wl_pointer objects of the same seat. If a lock or confinement is requested
+111
* when another lock or confinement is active or requested on the same surface
+112
* and with any of the wl_pointer objects of the same seat, an
+113
* 'already_constrained' error will be raised.
+114
*/
+115
extern const struct wl_interface zwp_pointer_constraints_v1_interface;
+116
#endif
+117
#ifndef ZWP_LOCKED_POINTER_V1_INTERFACE
+118
#define ZWP_LOCKED_POINTER_V1_INTERFACE
+119
/**
+120
* @page page_iface_zwp_locked_pointer_v1 zwp_locked_pointer_v1
+121
* @section page_iface_zwp_locked_pointer_v1_desc Description
+122
*
+123
* The wp_locked_pointer interface represents a locked pointer state.
+124
*
+125
* While the lock of this object is active, the wl_pointer objects of the
+126
* associated seat will not emit any wl_pointer.motion events.
+127
*
+128
* This object will send the event 'locked' when the lock is activated.
+129
* Whenever the lock is activated, it is guaranteed that the locked surface
+130
* will already have received pointer focus and that the pointer will be
+131
* within the region passed to the request creating this object.
+132
*
+133
* To unlock the pointer, send the destroy request. This will also destroy
+134
* the wp_locked_pointer object.
+135
*
+136
* If the compositor decides to unlock the pointer the unlocked event is
+137
* sent. See wp_locked_pointer.unlock for details.
+138
*
+139
* When unlocking, the compositor may warp the cursor position to the set
+140
* cursor position hint. If it does, it will not result in any relative
+141
* motion events emitted via wp_relative_pointer.
+142
*
+143
* If the surface the lock was requested on is destroyed and the lock is not
+144
* yet activated, the wp_locked_pointer object is now defunct and must be
+145
* destroyed.
+146
* @section page_iface_zwp_locked_pointer_v1_api API
+147
* See @ref iface_zwp_locked_pointer_v1.
+148
*/
+149
/**
+150
* @defgroup iface_zwp_locked_pointer_v1 The zwp_locked_pointer_v1 interface
+151
*
+152
* The wp_locked_pointer interface represents a locked pointer state.
+153
*
+154
* While the lock of this object is active, the wl_pointer objects of the
+155
* associated seat will not emit any wl_pointer.motion events.
+156
*
+157
* This object will send the event 'locked' when the lock is activated.
+158
* Whenever the lock is activated, it is guaranteed that the locked surface
+159
* will already have received pointer focus and that the pointer will be
+160
* within the region passed to the request creating this object.
+161
*
+162
* To unlock the pointer, send the destroy request. This will also destroy
+163
* the wp_locked_pointer object.
+164
*
+165
* If the compositor decides to unlock the pointer the unlocked event is
+166
* sent. See wp_locked_pointer.unlock for details.
+167
*
+168
* When unlocking, the compositor may warp the cursor position to the set
+169
* cursor position hint. If it does, it will not result in any relative
+170
* motion events emitted via wp_relative_pointer.
+171
*
+172
* If the surface the lock was requested on is destroyed and the lock is not
+173
* yet activated, the wp_locked_pointer object is now defunct and must be
+174
* destroyed.
+175
*/
+176
extern const struct wl_interface zwp_locked_pointer_v1_interface;
+177
#endif
+178
#ifndef ZWP_CONFINED_POINTER_V1_INTERFACE
+179
#define ZWP_CONFINED_POINTER_V1_INTERFACE
+180
/**
+181
* @page page_iface_zwp_confined_pointer_v1 zwp_confined_pointer_v1
+182
* @section page_iface_zwp_confined_pointer_v1_desc Description
+183
*
+184
* The wp_confined_pointer interface represents a confined pointer state.
+185
*
+186
* This object will send the event 'confined' when the confinement is
+187
* activated. Whenever the confinement is activated, it is guaranteed that
+188
* the surface the pointer is confined to will already have received pointer
+189
* focus and that the pointer will be within the region passed to the request
+190
* creating this object. It is up to the compositor to decide whether this
+191
* requires some user interaction and if the pointer will warp to within the
+192
* passed region if outside.
+193
*
+194
* To unconfine the pointer, send the destroy request. This will also destroy
+195
* the wp_confined_pointer object.
+196
*
+197
* If the compositor decides to unconfine the pointer the unconfined event is
+198
* sent. The wp_confined_pointer object is at this point defunct and should
+199
* be destroyed.
+200
* @section page_iface_zwp_confined_pointer_v1_api API
+201
* See @ref iface_zwp_confined_pointer_v1.
+202
*/
+203
/**
+204
* @defgroup iface_zwp_confined_pointer_v1 The zwp_confined_pointer_v1 interface
+205
*
+206
* The wp_confined_pointer interface represents a confined pointer state.
+207
*
+208
* This object will send the event 'confined' when the confinement is
+209
* activated. Whenever the confinement is activated, it is guaranteed that
+210
* the surface the pointer is confined to will already have received pointer
+211
* focus and that the pointer will be within the region passed to the request
+212
* creating this object. It is up to the compositor to decide whether this
+213
* requires some user interaction and if the pointer will warp to within the
+214
* passed region if outside.
+215
*
+216
* To unconfine the pointer, send the destroy request. This will also destroy
+217
* the wp_confined_pointer object.
+218
*
+219
* If the compositor decides to unconfine the pointer the unconfined event is
+220
* sent. The wp_confined_pointer object is at this point defunct and should
+221
* be destroyed.
+222
*/
+223
extern const struct wl_interface zwp_confined_pointer_v1_interface;
+224
#endif
+225
+226
#ifndef ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM
+227
#define ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM
+228
/**
+229
* @ingroup iface_zwp_pointer_constraints_v1
+230
* wp_pointer_constraints error values
+231
*
+232
* These errors can be emitted in response to wp_pointer_constraints
+233
* requests.
+234
*/
+235
enum zwp_pointer_constraints_v1_error {
+236
/**
+237
* pointer constraint already requested on that surface
+238
*/
+239
ZWP_POINTER_CONSTRAINTS_V1_ERROR_ALREADY_CONSTRAINED = 1,
+240
};
+241
#endif /* ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM */
+242
+243
#ifndef ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM
+244
#define ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM
+245
/**
+246
* @ingroup iface_zwp_pointer_constraints_v1
+247
* constraint lifetime
+248
*
+249
* These values represent different lifetime semantics. They are passed
+250
* as arguments to the factory requests to specify how the constraint
+251
* lifetimes should be managed.
+252
*/
+253
enum zwp_pointer_constraints_v1_lifetime {
+254
/**
+255
* the pointer constraint is defunct once deactivated
+256
*
+257
* A oneshot pointer constraint will never reactivate once it has
+258
* been deactivated. See the corresponding deactivation event
+259
* (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined)
+260
* for details.
+261
*/
+262
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT = 1,
+263
/**
+264
* the pointer constraint may reactivate
+265
*
+266
* A persistent pointer constraint may again reactivate once it
+267
* has been deactivated. See the corresponding deactivation event
+268
* (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined)
+269
* for details.
+270
*/
+271
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT = 2,
+272
};
+273
#endif /* ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM */
+274
+275
#define ZWP_POINTER_CONSTRAINTS_V1_DESTROY 0
+276
#define ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER 1
+277
#define ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER 2
+278
+279
+280
/**
+281
* @ingroup iface_zwp_pointer_constraints_v1
+282
*/
+283
#define ZWP_POINTER_CONSTRAINTS_V1_DESTROY_SINCE_VERSION 1
+284
/**
+285
* @ingroup iface_zwp_pointer_constraints_v1
+286
*/
+287
#define ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER_SINCE_VERSION 1
+288
/**
+289
* @ingroup iface_zwp_pointer_constraints_v1
+290
*/
+291
#define ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER_SINCE_VERSION 1
+292
+293
/** @ingroup iface_zwp_pointer_constraints_v1 */
+294
static inline void
+295
zwp_pointer_constraints_v1_set_user_data(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1, void *user_data)
+296
{
+297
wl_proxy_set_user_data((struct wl_proxy *) zwp_pointer_constraints_v1, user_data);
+298
}
+299
+300
/** @ingroup iface_zwp_pointer_constraints_v1 */
+301
static inline void *
+302
zwp_pointer_constraints_v1_get_user_data(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1)
+303
{
+304
return wl_proxy_get_user_data((struct wl_proxy *) zwp_pointer_constraints_v1);
+305
}
+306
+307
static inline uint32_t
+308
zwp_pointer_constraints_v1_get_version(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1)
+309
{
+310
return wl_proxy_get_version((struct wl_proxy *) zwp_pointer_constraints_v1);
+311
}
+312
+313
/**
+314
* @ingroup iface_zwp_pointer_constraints_v1
+315
*
+316
* Used by the client to notify the server that it will no longer use this
+317
* pointer constraints object.
+318
*/
+319
static inline void
+320
zwp_pointer_constraints_v1_destroy(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1)
+321
{
+322
wl_proxy_marshal_flags((struct wl_proxy *) zwp_pointer_constraints_v1,
+323
ZWP_POINTER_CONSTRAINTS_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_pointer_constraints_v1), WL_MARSHAL_FLAG_DESTROY);
+324
}
+325
+326
/**
+327
* @ingroup iface_zwp_pointer_constraints_v1
+328
*
+329
* The lock_pointer request lets the client request to disable movements of
+330
* the virtual pointer (i.e. the cursor), effectively locking the pointer
+331
* to a position. This request may not take effect immediately; in the
+332
* future, when the compositor deems implementation-specific constraints
+333
* are satisfied, the pointer lock will be activated and the compositor
+334
* sends a locked event.
+335
*
+336
* The protocol provides no guarantee that the constraints are ever
+337
* satisfied, and does not require the compositor to send an error if the
+338
* constraints cannot ever be satisfied. It is thus possible to request a
+339
* lock that will never activate.
+340
*
+341
* There may not be another pointer constraint of any kind requested or
+342
* active on the surface for any of the wl_pointer objects of the seat of
+343
* the passed pointer when requesting a lock. If there is, an error will be
+344
* raised. See general pointer lock documentation for more details.
+345
*
+346
* The intersection of the region passed with this request and the input
+347
* region of the surface is used to determine where the pointer must be
+348
* in order for the lock to activate. It is up to the compositor whether to
+349
* warp the pointer or require some kind of user interaction for the lock
+350
* to activate. If the region is null the surface input region is used.
+351
*
+352
* A surface may receive pointer focus without the lock being activated.
+353
*
+354
* The request creates a new object wp_locked_pointer which is used to
+355
* interact with the lock as well as receive updates about its state. See
+356
* the the description of wp_locked_pointer for further information.
+357
*
+358
* Note that while a pointer is locked, the wl_pointer objects of the
+359
* corresponding seat will not emit any wl_pointer.motion events, but
+360
* relative motion events will still be emitted via wp_relative_pointer
+361
* objects of the same seat. wl_pointer.axis and wl_pointer.button events
+362
* are unaffected.
+363
*/
+364
static inline struct zwp_locked_pointer_v1 *
+365
zwp_pointer_constraints_v1_lock_pointer(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1, struct wl_surface *surface, struct wl_pointer *pointer, struct wl_region *region, uint32_t lifetime)
+366
{
+367
struct wl_proxy *id;
+368
+369
id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_pointer_constraints_v1,
+370
ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER, &zwp_locked_pointer_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_pointer_constraints_v1), 0, NULL, surface, pointer, region, lifetime);
+371
+372
return (struct zwp_locked_pointer_v1 *) id;
+373
}
+374
+375
/**
+376
* @ingroup iface_zwp_pointer_constraints_v1
+377
*
+378
* The confine_pointer request lets the client request to confine the
+379
* pointer cursor to a given region. This request may not take effect
+380
* immediately; in the future, when the compositor deems implementation-
+381
* specific constraints are satisfied, the pointer confinement will be
+382
* activated and the compositor sends a confined event.
+383
*
+384
* The intersection of the region passed with this request and the input
+385
* region of the surface is used to determine where the pointer must be
+386
* in order for the confinement to activate. It is up to the compositor
+387
* whether to warp the pointer or require some kind of user interaction for
+388
* the confinement to activate. If the region is null the surface input
+389
* region is used.
+390
*
+391
* The request will create a new object wp_confined_pointer which is used
+392
* to interact with the confinement as well as receive updates about its
+393
* state. See the the description of wp_confined_pointer for further
+394
* information.
+395
*/
+396
static inline struct zwp_confined_pointer_v1 *
+397
zwp_pointer_constraints_v1_confine_pointer(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1, struct wl_surface *surface, struct wl_pointer *pointer, struct wl_region *region, uint32_t lifetime)
+398
{
+399
struct wl_proxy *id;
+400
+401
id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_pointer_constraints_v1,
+402
ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER, &zwp_confined_pointer_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_pointer_constraints_v1), 0, NULL, surface, pointer, region, lifetime);
+403
+404
return (struct zwp_confined_pointer_v1 *) id;
+405
}
+406
+407
/**
+408
* @ingroup iface_zwp_locked_pointer_v1
+409
* @struct zwp_locked_pointer_v1_listener
+410
*/
+411
struct zwp_locked_pointer_v1_listener {
+412
/**
+413
* lock activation event
+414
*
+415
* Notification that the pointer lock of the seat's pointer is
+416
* activated.
+417
*/
+418
void (*locked)(void *data,
+419
struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1);
+420
/**
+421
* lock deactivation event
+422
*
+423
* Notification that the pointer lock of the seat's pointer is no
+424
* longer active. If this is a oneshot pointer lock (see
+425
* wp_pointer_constraints.lifetime) this object is now defunct and
+426
* should be destroyed. If this is a persistent pointer lock (see
+427
* wp_pointer_constraints.lifetime) this pointer lock may again
+428
* reactivate in the future.
+429
*/
+430
void (*unlocked)(void *data,
+431
struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1);
+432
};
+433
+434
/**
+435
* @ingroup iface_zwp_locked_pointer_v1
+436
*/
+437
static inline int
+438
zwp_locked_pointer_v1_add_listener(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1,
+439
const struct zwp_locked_pointer_v1_listener *listener, void *data)
+440
{
+441
return wl_proxy_add_listener((struct wl_proxy *) zwp_locked_pointer_v1,
+442
(void (**)(void)) listener, data);
+443
}
+444
+445
#define ZWP_LOCKED_POINTER_V1_DESTROY 0
+446
#define ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT 1
+447
#define ZWP_LOCKED_POINTER_V1_SET_REGION 2
+448
+449
/**
+450
* @ingroup iface_zwp_locked_pointer_v1
+451
*/
+452
#define ZWP_LOCKED_POINTER_V1_LOCKED_SINCE_VERSION 1
+453
/**
+454
* @ingroup iface_zwp_locked_pointer_v1
+455
*/
+456
#define ZWP_LOCKED_POINTER_V1_UNLOCKED_SINCE_VERSION 1
+457
+458
/**
+459
* @ingroup iface_zwp_locked_pointer_v1
+460
*/
+461
#define ZWP_LOCKED_POINTER_V1_DESTROY_SINCE_VERSION 1
+462
/**
+463
* @ingroup iface_zwp_locked_pointer_v1
+464
*/
+465
#define ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT_SINCE_VERSION 1
+466
/**
+467
* @ingroup iface_zwp_locked_pointer_v1
+468
*/
+469
#define ZWP_LOCKED_POINTER_V1_SET_REGION_SINCE_VERSION 1
+470
+471
/** @ingroup iface_zwp_locked_pointer_v1 */
+472
static inline void
+473
zwp_locked_pointer_v1_set_user_data(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1, void *user_data)
+474
{
+475
wl_proxy_set_user_data((struct wl_proxy *) zwp_locked_pointer_v1, user_data);
+476
}
+477
+478
/** @ingroup iface_zwp_locked_pointer_v1 */
+479
static inline void *
+480
zwp_locked_pointer_v1_get_user_data(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1)
+481
{
+482
return wl_proxy_get_user_data((struct wl_proxy *) zwp_locked_pointer_v1);
+483
}
+484
+485
static inline uint32_t
+486
zwp_locked_pointer_v1_get_version(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1)
+487
{
+488
return wl_proxy_get_version((struct wl_proxy *) zwp_locked_pointer_v1);
+489
}
+490
+491
/**
+492
* @ingroup iface_zwp_locked_pointer_v1
+493
*
+494
* Destroy the locked pointer object. If applicable, the compositor will
+495
* unlock the pointer.
+496
*/
+497
static inline void
+498
zwp_locked_pointer_v1_destroy(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1)
+499
{

Showing the first 500 of 668 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/wayland-protocols/relative-pointer-unstable-v1-client-protocol-code.hadded
@@ -0,0 +1,80 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
/*
+4
* Copyright © 2014 Jonas Ådahl
+5
* Copyright © 2015 Red Hat Inc.
+6
*
+7
* Permission is hereby granted, free of charge, to any person obtaining a
+8
* copy of this software and associated documentation files (the "Software"),
+9
* to deal in the Software without restriction, including without limitation
+10
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+11
* and/or sell copies of the Software, and to permit persons to whom the
+12
* Software is furnished to do so, subject to the following conditions:
+13
*
+14
* The above copyright notice and this permission notice (including the next
+15
* paragraph) shall be included in all copies or substantial portions of the
+16
* Software.
+17
*
+18
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+19
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+20
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+21
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+22
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+23
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+24
* DEALINGS IN THE SOFTWARE.
+25
*/
+26
+27
#include <stdbool.h>
+28
#include <stdlib.h>
+29
#include <stdint.h>
+30
#include "wayland-util.h"
+31
+32
#ifndef __has_attribute
+33
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+34
#endif
+35
+36
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
+37
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
+38
#else
+39
#define WL_PRIVATE
+40
#endif
+41
+42
extern const struct wl_interface wl_pointer_interface;
+43
extern const struct wl_interface zwp_relative_pointer_v1_interface;
+44
+45
static const struct wl_interface *relative_pointer_unstable_v1_types[] = {
+46
NULL,
+47
NULL,
+48
NULL,
+49
NULL,
+50
NULL,
+51
NULL,
+52
&zwp_relative_pointer_v1_interface,
+53
&wl_pointer_interface,
+54
};
+55
+56
static const struct wl_message zwp_relative_pointer_manager_v1_requests[] = {
+57
{ "destroy", "", relative_pointer_unstable_v1_types + 0 },
+58
{ "get_relative_pointer", "no", relative_pointer_unstable_v1_types + 6 },
+59
};
+60
+61
WL_PRIVATE const struct wl_interface zwp_relative_pointer_manager_v1_interface = {
+62
"zwp_relative_pointer_manager_v1", 1,
+63
2, zwp_relative_pointer_manager_v1_requests,
+64
0, NULL,
+65
};
+66
+67
static const struct wl_message zwp_relative_pointer_v1_requests[] = {
+68
{ "destroy", "", relative_pointer_unstable_v1_types + 0 },
+69
};
+70
+71
static const struct wl_message zwp_relative_pointer_v1_events[] = {
+72
{ "relative_motion", "uuffff", relative_pointer_unstable_v1_types + 0 },
+73
};
+74
+75
WL_PRIVATE const struct wl_interface zwp_relative_pointer_v1_interface = {
+76
"zwp_relative_pointer_v1", 1,
+77
1, zwp_relative_pointer_v1_requests,
+78
1, zwp_relative_pointer_v1_events,
+79
};
+80
vendor/glfw/src/wayland-protocols/relative-pointer-unstable-v1-client-protocol.hadded
@@ -0,0 +1,297 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
#ifndef RELATIVE_POINTER_UNSTABLE_V1_CLIENT_PROTOCOL_H
+4
#define RELATIVE_POINTER_UNSTABLE_V1_CLIENT_PROTOCOL_H
+5
+6
#include <stdint.h>
+7
#include <stddef.h>
+8
#include "wayland-client.h"
+9
+10
#ifdef __cplusplus
+11
extern "C" {
+12
#endif
+13
+14
/**
+15
* @page page_relative_pointer_unstable_v1 The relative_pointer_unstable_v1 protocol
+16
* protocol for relative pointer motion events
+17
*
+18
* @section page_desc_relative_pointer_unstable_v1 Description
+19
*
+20
* This protocol specifies a set of interfaces used for making clients able to
+21
* receive relative pointer events not obstructed by barriers (such as the
+22
* monitor edge or other pointer barriers).
+23
*
+24
* To start receiving relative pointer events, a client must first bind the
+25
* global interface "wp_relative_pointer_manager" which, if a compositor
+26
* supports relative pointer motion events, is exposed by the registry. After
+27
* having created the relative pointer manager proxy object, the client uses
+28
* it to create the actual relative pointer object using the
+29
* "get_relative_pointer" request given a wl_pointer. The relative pointer
+30
* motion events will then, when applicable, be transmitted via the proxy of
+31
* the newly created relative pointer object. See the documentation of the
+32
* relative pointer interface for more details.
+33
*
+34
* Warning! The protocol described in this file is experimental and backward
+35
* incompatible changes may be made. Backward compatible changes may be added
+36
* together with the corresponding interface version bump. Backward
+37
* incompatible changes are done by bumping the version number in the protocol
+38
* and interface names and resetting the interface version. Once the protocol
+39
* is to be declared stable, the 'z' prefix and the version number in the
+40
* protocol and interface names are removed and the interface version number is
+41
* reset.
+42
*
+43
* @section page_ifaces_relative_pointer_unstable_v1 Interfaces
+44
* - @subpage page_iface_zwp_relative_pointer_manager_v1 - get relative pointer objects
+45
* - @subpage page_iface_zwp_relative_pointer_v1 - relative pointer object
+46
* @section page_copyright_relative_pointer_unstable_v1 Copyright
+47
* <pre>
+48
*
+49
* Copyright © 2014 Jonas Ådahl
+50
* Copyright © 2015 Red Hat Inc.
+51
*
+52
* Permission is hereby granted, free of charge, to any person obtaining a
+53
* copy of this software and associated documentation files (the "Software"),
+54
* to deal in the Software without restriction, including without limitation
+55
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+56
* and/or sell copies of the Software, and to permit persons to whom the
+57
* Software is furnished to do so, subject to the following conditions:
+58
*
+59
* The above copyright notice and this permission notice (including the next
+60
* paragraph) shall be included in all copies or substantial portions of the
+61
* Software.
+62
*
+63
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+64
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+65
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+66
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+67
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+68
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+69
* DEALINGS IN THE SOFTWARE.
+70
* </pre>
+71
*/
+72
struct wl_pointer;
+73
struct zwp_relative_pointer_manager_v1;
+74
struct zwp_relative_pointer_v1;
+75
+76
#ifndef ZWP_RELATIVE_POINTER_MANAGER_V1_INTERFACE
+77
#define ZWP_RELATIVE_POINTER_MANAGER_V1_INTERFACE
+78
/**
+79
* @page page_iface_zwp_relative_pointer_manager_v1 zwp_relative_pointer_manager_v1
+80
* @section page_iface_zwp_relative_pointer_manager_v1_desc Description
+81
*
+82
* A global interface used for getting the relative pointer object for a
+83
* given pointer.
+84
* @section page_iface_zwp_relative_pointer_manager_v1_api API
+85
* See @ref iface_zwp_relative_pointer_manager_v1.
+86
*/
+87
/**
+88
* @defgroup iface_zwp_relative_pointer_manager_v1 The zwp_relative_pointer_manager_v1 interface
+89
*
+90
* A global interface used for getting the relative pointer object for a
+91
* given pointer.
+92
*/
+93
extern const struct wl_interface zwp_relative_pointer_manager_v1_interface;
+94
#endif
+95
#ifndef ZWP_RELATIVE_POINTER_V1_INTERFACE
+96
#define ZWP_RELATIVE_POINTER_V1_INTERFACE
+97
/**
+98
* @page page_iface_zwp_relative_pointer_v1 zwp_relative_pointer_v1
+99
* @section page_iface_zwp_relative_pointer_v1_desc Description
+100
*
+101
* A wp_relative_pointer object is an extension to the wl_pointer interface
+102
* used for emitting relative pointer events. It shares the same focus as
+103
* wl_pointer objects of the same seat and will only emit events when it has
+104
* focus.
+105
* @section page_iface_zwp_relative_pointer_v1_api API
+106
* See @ref iface_zwp_relative_pointer_v1.
+107
*/
+108
/**
+109
* @defgroup iface_zwp_relative_pointer_v1 The zwp_relative_pointer_v1 interface
+110
*
+111
* A wp_relative_pointer object is an extension to the wl_pointer interface
+112
* used for emitting relative pointer events. It shares the same focus as
+113
* wl_pointer objects of the same seat and will only emit events when it has
+114
* focus.
+115
*/
+116
extern const struct wl_interface zwp_relative_pointer_v1_interface;
+117
#endif
+118
+119
#define ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY 0
+120
#define ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER 1
+121
+122
+123
/**
+124
* @ingroup iface_zwp_relative_pointer_manager_v1
+125
*/
+126
#define ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY_SINCE_VERSION 1
+127
/**
+128
* @ingroup iface_zwp_relative_pointer_manager_v1
+129
*/
+130
#define ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER_SINCE_VERSION 1
+131
+132
/** @ingroup iface_zwp_relative_pointer_manager_v1 */
+133
static inline void
+134
zwp_relative_pointer_manager_v1_set_user_data(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1, void *user_data)
+135
{
+136
wl_proxy_set_user_data((struct wl_proxy *) zwp_relative_pointer_manager_v1, user_data);
+137
}
+138
+139
/** @ingroup iface_zwp_relative_pointer_manager_v1 */
+140
static inline void *
+141
zwp_relative_pointer_manager_v1_get_user_data(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1)
+142
{
+143
return wl_proxy_get_user_data((struct wl_proxy *) zwp_relative_pointer_manager_v1);
+144
}
+145
+146
static inline uint32_t
+147
zwp_relative_pointer_manager_v1_get_version(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1)
+148
{
+149
return wl_proxy_get_version((struct wl_proxy *) zwp_relative_pointer_manager_v1);
+150
}
+151
+152
/**
+153
* @ingroup iface_zwp_relative_pointer_manager_v1
+154
*
+155
* Used by the client to notify the server that it will no longer use this
+156
* relative pointer manager object.
+157
*/
+158
static inline void
+159
zwp_relative_pointer_manager_v1_destroy(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1)
+160
{
+161
wl_proxy_marshal_flags((struct wl_proxy *) zwp_relative_pointer_manager_v1,
+162
ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_relative_pointer_manager_v1), WL_MARSHAL_FLAG_DESTROY);
+163
}
+164
+165
/**
+166
* @ingroup iface_zwp_relative_pointer_manager_v1
+167
*
+168
* Create a relative pointer interface given a wl_pointer object. See the
+169
* wp_relative_pointer interface for more details.
+170
*/
+171
static inline struct zwp_relative_pointer_v1 *
+172
zwp_relative_pointer_manager_v1_get_relative_pointer(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1, struct wl_pointer *pointer)
+173
{
+174
struct wl_proxy *id;
+175
+176
id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_relative_pointer_manager_v1,
+177
ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER, &zwp_relative_pointer_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_relative_pointer_manager_v1), 0, NULL, pointer);
+178
+179
return (struct zwp_relative_pointer_v1 *) id;
+180
}
+181
+182
/**
+183
* @ingroup iface_zwp_relative_pointer_v1
+184
* @struct zwp_relative_pointer_v1_listener
+185
*/
+186
struct zwp_relative_pointer_v1_listener {
+187
/**
+188
* relative pointer motion
+189
*
+190
* Relative x/y pointer motion from the pointer of the seat
+191
* associated with this object.
+192
*
+193
* A relative motion is in the same dimension as regular wl_pointer
+194
* motion events, except they do not represent an absolute
+195
* position. For example, moving a pointer from (x, y) to (x', y')
+196
* would have the equivalent relative motion (x' - x, y' - y). If a
+197
* pointer motion caused the absolute pointer position to be
+198
* clipped by for example the edge of the monitor, the relative
+199
* motion is unaffected by the clipping and will represent the
+200
* unclipped motion.
+201
*
+202
* This event also contains non-accelerated motion deltas. The
+203
* non-accelerated delta is, when applicable, the regular pointer
+204
* motion delta as it was before having applied motion acceleration
+205
* and other transformations such as normalization.
+206
*
+207
* Note that the non-accelerated delta does not represent 'raw'
+208
* events as they were read from some device. Pointer motion
+209
* acceleration is device- and configuration-specific and
+210
* non-accelerated deltas and accelerated deltas may have the same
+211
* value on some devices.
+212
*
+213
* Relative motions are not coupled to wl_pointer.motion events,
+214
* and can be sent in combination with such events, but also
+215
* independently. There may also be scenarios where
+216
* wl_pointer.motion is sent, but there is no relative motion. The
+217
* order of an absolute and relative motion event originating from
+218
* the same physical motion is not guaranteed.
+219
*
+220
* If the client needs button events or focus state, it can receive
+221
* them from a wl_pointer object of the same seat that the
+222
* wp_relative_pointer object is associated with.
+223
* @param utime_hi high 32 bits of a 64 bit timestamp with microsecond granularity
+224
* @param utime_lo low 32 bits of a 64 bit timestamp with microsecond granularity
+225
* @param dx the x component of the motion vector
+226
* @param dy the y component of the motion vector
+227
* @param dx_unaccel the x component of the unaccelerated motion vector
+228
* @param dy_unaccel the y component of the unaccelerated motion vector
+229
*/
+230
void (*relative_motion)(void *data,
+231
struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1,
+232
uint32_t utime_hi,
+233
uint32_t utime_lo,
+234
wl_fixed_t dx,
+235
wl_fixed_t dy,
+236
wl_fixed_t dx_unaccel,
+237
wl_fixed_t dy_unaccel);
+238
};
+239
+240
/**
+241
* @ingroup iface_zwp_relative_pointer_v1
+242
*/
+243
static inline int
+244
zwp_relative_pointer_v1_add_listener(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1,
+245
const struct zwp_relative_pointer_v1_listener *listener, void *data)
+246
{
+247
return wl_proxy_add_listener((struct wl_proxy *) zwp_relative_pointer_v1,
+248
(void (**)(void)) listener, data);
+249
}
+250
+251
#define ZWP_RELATIVE_POINTER_V1_DESTROY 0
+252
+253
/**
+254
* @ingroup iface_zwp_relative_pointer_v1
+255
*/
+256
#define ZWP_RELATIVE_POINTER_V1_RELATIVE_MOTION_SINCE_VERSION 1
+257
+258
/**
+259
* @ingroup iface_zwp_relative_pointer_v1
+260
*/
+261
#define ZWP_RELATIVE_POINTER_V1_DESTROY_SINCE_VERSION 1
+262
+263
/** @ingroup iface_zwp_relative_pointer_v1 */
+264
static inline void
+265
zwp_relative_pointer_v1_set_user_data(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1, void *user_data)
+266
{
+267
wl_proxy_set_user_data((struct wl_proxy *) zwp_relative_pointer_v1, user_data);
+268
}
+269
+270
/** @ingroup iface_zwp_relative_pointer_v1 */
+271
static inline void *
+272
zwp_relative_pointer_v1_get_user_data(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1)
+273
{
+274
return wl_proxy_get_user_data((struct wl_proxy *) zwp_relative_pointer_v1);
+275
}
+276
+277
static inline uint32_t
+278
zwp_relative_pointer_v1_get_version(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1)
+279
{
+280
return wl_proxy_get_version((struct wl_proxy *) zwp_relative_pointer_v1);
+281
}
+282
+283
/**
+284
* @ingroup iface_zwp_relative_pointer_v1
+285
*/
+286
static inline void
+287
zwp_relative_pointer_v1_destroy(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1)
+288
{
+289
wl_proxy_marshal_flags((struct wl_proxy *) zwp_relative_pointer_v1,
+290
ZWP_RELATIVE_POINTER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_relative_pointer_v1), WL_MARSHAL_FLAG_DESTROY);
+291
}
+292
+293
#ifdef __cplusplus
+294
}
+295
#endif
+296
+297
#endif
vendor/glfw/src/wayland-protocols/viewporter-client-protocol-code.hadded
@@ -0,0 +1,75 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
/*
+4
* Copyright © 2013-2016 Collabora, Ltd.
+5
*
+6
* Permission is hereby granted, free of charge, to any person obtaining a
+7
* copy of this software and associated documentation files (the "Software"),
+8
* to deal in the Software without restriction, including without limitation
+9
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+10
* and/or sell copies of the Software, and to permit persons to whom the
+11
* Software is furnished to do so, subject to the following conditions:
+12
*
+13
* The above copyright notice and this permission notice (including the next
+14
* paragraph) shall be included in all copies or substantial portions of the
+15
* Software.
+16
*
+17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+18
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+19
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+20
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+21
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+22
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+23
* DEALINGS IN THE SOFTWARE.
+24
*/
+25
+26
#include <stdbool.h>
+27
#include <stdlib.h>
+28
#include <stdint.h>
+29
#include "wayland-util.h"
+30
+31
#ifndef __has_attribute
+32
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+33
#endif
+34
+35
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
+36
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
+37
#else
+38
#define WL_PRIVATE
+39
#endif
+40
+41
extern const struct wl_interface wl_surface_interface;
+42
extern const struct wl_interface wp_viewport_interface;
+43
+44
static const struct wl_interface *viewporter_types[] = {
+45
NULL,
+46
NULL,
+47
NULL,
+48
NULL,
+49
&wp_viewport_interface,
+50
&wl_surface_interface,
+51
};
+52
+53
static const struct wl_message wp_viewporter_requests[] = {
+54
{ "destroy", "", viewporter_types + 0 },
+55
{ "get_viewport", "no", viewporter_types + 4 },
+56
};
+57
+58
WL_PRIVATE const struct wl_interface wp_viewporter_interface = {
+59
"wp_viewporter", 1,
+60
2, wp_viewporter_requests,
+61
0, NULL,
+62
};
+63
+64
static const struct wl_message wp_viewport_requests[] = {
+65
{ "destroy", "", viewporter_types + 0 },
+66
{ "set_source", "ffff", viewporter_types + 0 },
+67
{ "set_destination", "ii", viewporter_types + 0 },
+68
};
+69
+70
WL_PRIVATE const struct wl_interface wp_viewport_interface = {
+71
"wp_viewport", 1,
+72
3, wp_viewport_requests,
+73
0, NULL,
+74
};
+75
vendor/glfw/src/wayland-protocols/viewporter-client-protocol.hadded
@@ -0,0 +1,398 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
#ifndef VIEWPORTER_CLIENT_PROTOCOL_H
+4
#define VIEWPORTER_CLIENT_PROTOCOL_H
+5
+6
#include <stdint.h>
+7
#include <stddef.h>
+8
#include "wayland-client.h"
+9
+10
#ifdef __cplusplus
+11
extern "C" {
+12
#endif
+13
+14
/**
+15
* @page page_viewporter The viewporter protocol
+16
* @section page_ifaces_viewporter Interfaces
+17
* - @subpage page_iface_wp_viewporter - surface cropping and scaling
+18
* - @subpage page_iface_wp_viewport - crop and scale interface to a wl_surface
+19
* @section page_copyright_viewporter Copyright
+20
* <pre>
+21
*
+22
* Copyright © 2013-2016 Collabora, Ltd.
+23
*
+24
* Permission is hereby granted, free of charge, to any person obtaining a
+25
* copy of this software and associated documentation files (the "Software"),
+26
* to deal in the Software without restriction, including without limitation
+27
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+28
* and/or sell copies of the Software, and to permit persons to whom the
+29
* Software is furnished to do so, subject to the following conditions:
+30
*
+31
* The above copyright notice and this permission notice (including the next
+32
* paragraph) shall be included in all copies or substantial portions of the
+33
* Software.
+34
*
+35
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+36
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+37
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+38
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+39
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+40
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+41
* DEALINGS IN THE SOFTWARE.
+42
* </pre>
+43
*/
+44
struct wl_surface;
+45
struct wp_viewport;
+46
struct wp_viewporter;
+47
+48
#ifndef WP_VIEWPORTER_INTERFACE
+49
#define WP_VIEWPORTER_INTERFACE
+50
/**
+51
* @page page_iface_wp_viewporter wp_viewporter
+52
* @section page_iface_wp_viewporter_desc Description
+53
*
+54
* The global interface exposing surface cropping and scaling
+55
* capabilities is used to instantiate an interface extension for a
+56
* wl_surface object. This extended interface will then allow
+57
* cropping and scaling the surface contents, effectively
+58
* disconnecting the direct relationship between the buffer and the
+59
* surface size.
+60
* @section page_iface_wp_viewporter_api API
+61
* See @ref iface_wp_viewporter.
+62
*/
+63
/**
+64
* @defgroup iface_wp_viewporter The wp_viewporter interface
+65
*
+66
* The global interface exposing surface cropping and scaling
+67
* capabilities is used to instantiate an interface extension for a
+68
* wl_surface object. This extended interface will then allow
+69
* cropping and scaling the surface contents, effectively
+70
* disconnecting the direct relationship between the buffer and the
+71
* surface size.
+72
*/
+73
extern const struct wl_interface wp_viewporter_interface;
+74
#endif
+75
#ifndef WP_VIEWPORT_INTERFACE
+76
#define WP_VIEWPORT_INTERFACE
+77
/**
+78
* @page page_iface_wp_viewport wp_viewport
+79
* @section page_iface_wp_viewport_desc Description
+80
*
+81
* An additional interface to a wl_surface object, which allows the
+82
* client to specify the cropping and scaling of the surface
+83
* contents.
+84
*
+85
* This interface works with two concepts: the source rectangle (src_x,
+86
* src_y, src_width, src_height), and the destination size (dst_width,
+87
* dst_height). The contents of the source rectangle are scaled to the
+88
* destination size, and content outside the source rectangle is ignored.
+89
* This state is double-buffered, and is applied on the next
+90
* wl_surface.commit.
+91
*
+92
* The two parts of crop and scale state are independent: the source
+93
* rectangle, and the destination size. Initially both are unset, that
+94
* is, no scaling is applied. The whole of the current wl_buffer is
+95
* used as the source, and the surface size is as defined in
+96
* wl_surface.attach.
+97
*
+98
* If the destination size is set, it causes the surface size to become
+99
* dst_width, dst_height. The source (rectangle) is scaled to exactly
+100
* this size. This overrides whatever the attached wl_buffer size is,
+101
* unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
+102
* has no content and therefore no size. Otherwise, the size is always
+103
* at least 1x1 in surface local coordinates.
+104
*
+105
* If the source rectangle is set, it defines what area of the wl_buffer is
+106
* taken as the source. If the source rectangle is set and the destination
+107
* size is not set, then src_width and src_height must be integers, and the
+108
* surface size becomes the source rectangle size. This results in cropping
+109
* without scaling. If src_width or src_height are not integers and
+110
* destination size is not set, the bad_size protocol error is raised when
+111
* the surface state is applied.
+112
*
+113
* The coordinate transformations from buffer pixel coordinates up to
+114
* the surface-local coordinates happen in the following order:
+115
* 1. buffer_transform (wl_surface.set_buffer_transform)
+116
* 2. buffer_scale (wl_surface.set_buffer_scale)
+117
* 3. crop and scale (wp_viewport.set*)
+118
* This means, that the source rectangle coordinates of crop and scale
+119
* are given in the coordinates after the buffer transform and scale,
+120
* i.e. in the coordinates that would be the surface-local coordinates
+121
* if the crop and scale was not applied.
+122
*
+123
* If src_x or src_y are negative, the bad_value protocol error is raised.
+124
* Otherwise, if the source rectangle is partially or completely outside of
+125
* the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
+126
* when the surface state is applied. A NULL wl_buffer does not raise the
+127
* out_of_buffer error.
+128
*
+129
* If the wl_surface associated with the wp_viewport is destroyed,
+130
* all wp_viewport requests except 'destroy' raise the protocol error
+131
* no_surface.
+132
*
+133
* If the wp_viewport object is destroyed, the crop and scale
+134
* state is removed from the wl_surface. The change will be applied
+135
* on the next wl_surface.commit.
+136
* @section page_iface_wp_viewport_api API
+137
* See @ref iface_wp_viewport.
+138
*/
+139
/**
+140
* @defgroup iface_wp_viewport The wp_viewport interface
+141
*
+142
* An additional interface to a wl_surface object, which allows the
+143
* client to specify the cropping and scaling of the surface
+144
* contents.
+145
*
+146
* This interface works with two concepts: the source rectangle (src_x,
+147
* src_y, src_width, src_height), and the destination size (dst_width,
+148
* dst_height). The contents of the source rectangle are scaled to the
+149
* destination size, and content outside the source rectangle is ignored.
+150
* This state is double-buffered, and is applied on the next
+151
* wl_surface.commit.
+152
*
+153
* The two parts of crop and scale state are independent: the source
+154
* rectangle, and the destination size. Initially both are unset, that
+155
* is, no scaling is applied. The whole of the current wl_buffer is
+156
* used as the source, and the surface size is as defined in
+157
* wl_surface.attach.
+158
*
+159
* If the destination size is set, it causes the surface size to become
+160
* dst_width, dst_height. The source (rectangle) is scaled to exactly
+161
* this size. This overrides whatever the attached wl_buffer size is,
+162
* unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
+163
* has no content and therefore no size. Otherwise, the size is always
+164
* at least 1x1 in surface local coordinates.
+165
*
+166
* If the source rectangle is set, it defines what area of the wl_buffer is
+167
* taken as the source. If the source rectangle is set and the destination
+168
* size is not set, then src_width and src_height must be integers, and the
+169
* surface size becomes the source rectangle size. This results in cropping
+170
* without scaling. If src_width or src_height are not integers and
+171
* destination size is not set, the bad_size protocol error is raised when
+172
* the surface state is applied.
+173
*
+174
* The coordinate transformations from buffer pixel coordinates up to
+175
* the surface-local coordinates happen in the following order:
+176
* 1. buffer_transform (wl_surface.set_buffer_transform)
+177
* 2. buffer_scale (wl_surface.set_buffer_scale)
+178
* 3. crop and scale (wp_viewport.set*)
+179
* This means, that the source rectangle coordinates of crop and scale
+180
* are given in the coordinates after the buffer transform and scale,
+181
* i.e. in the coordinates that would be the surface-local coordinates
+182
* if the crop and scale was not applied.
+183
*
+184
* If src_x or src_y are negative, the bad_value protocol error is raised.
+185
* Otherwise, if the source rectangle is partially or completely outside of
+186
* the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
+187
* when the surface state is applied. A NULL wl_buffer does not raise the
+188
* out_of_buffer error.
+189
*
+190
* If the wl_surface associated with the wp_viewport is destroyed,
+191
* all wp_viewport requests except 'destroy' raise the protocol error
+192
* no_surface.
+193
*
+194
* If the wp_viewport object is destroyed, the crop and scale
+195
* state is removed from the wl_surface. The change will be applied
+196
* on the next wl_surface.commit.
+197
*/
+198
extern const struct wl_interface wp_viewport_interface;
+199
#endif
+200
+201
#ifndef WP_VIEWPORTER_ERROR_ENUM
+202
#define WP_VIEWPORTER_ERROR_ENUM
+203
enum wp_viewporter_error {
+204
/**
+205
* the surface already has a viewport object associated
+206
*/
+207
WP_VIEWPORTER_ERROR_VIEWPORT_EXISTS = 0,
+208
};
+209
#endif /* WP_VIEWPORTER_ERROR_ENUM */
+210
+211
#define WP_VIEWPORTER_DESTROY 0
+212
#define WP_VIEWPORTER_GET_VIEWPORT 1
+213
+214
+215
/**
+216
* @ingroup iface_wp_viewporter
+217
*/
+218
#define WP_VIEWPORTER_DESTROY_SINCE_VERSION 1
+219
/**
+220
* @ingroup iface_wp_viewporter
+221
*/
+222
#define WP_VIEWPORTER_GET_VIEWPORT_SINCE_VERSION 1
+223
+224
/** @ingroup iface_wp_viewporter */
+225
static inline void
+226
wp_viewporter_set_user_data(struct wp_viewporter *wp_viewporter, void *user_data)
+227
{
+228
wl_proxy_set_user_data((struct wl_proxy *) wp_viewporter, user_data);
+229
}
+230
+231
/** @ingroup iface_wp_viewporter */
+232
static inline void *
+233
wp_viewporter_get_user_data(struct wp_viewporter *wp_viewporter)
+234
{
+235
return wl_proxy_get_user_data((struct wl_proxy *) wp_viewporter);
+236
}
+237
+238
static inline uint32_t
+239
wp_viewporter_get_version(struct wp_viewporter *wp_viewporter)
+240
{
+241
return wl_proxy_get_version((struct wl_proxy *) wp_viewporter);
+242
}
+243
+244
/**
+245
* @ingroup iface_wp_viewporter
+246
*
+247
* Informs the server that the client will not be using this
+248
* protocol object anymore. This does not affect any other objects,
+249
* wp_viewport objects included.
+250
*/
+251
static inline void
+252
wp_viewporter_destroy(struct wp_viewporter *wp_viewporter)
+253
{
+254
wl_proxy_marshal_flags((struct wl_proxy *) wp_viewporter,
+255
WP_VIEWPORTER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewporter), WL_MARSHAL_FLAG_DESTROY);
+256
}
+257
+258
/**
+259
* @ingroup iface_wp_viewporter
+260
*
+261
* Instantiate an interface extension for the given wl_surface to
+262
* crop and scale its content. If the given wl_surface already has
+263
* a wp_viewport object associated, the viewport_exists
+264
* protocol error is raised.
+265
*/
+266
static inline struct wp_viewport *
+267
wp_viewporter_get_viewport(struct wp_viewporter *wp_viewporter, struct wl_surface *surface)
+268
{
+269
struct wl_proxy *id;
+270
+271
id = wl_proxy_marshal_flags((struct wl_proxy *) wp_viewporter,
+272
WP_VIEWPORTER_GET_VIEWPORT, &wp_viewport_interface, wl_proxy_get_version((struct wl_proxy *) wp_viewporter), 0, NULL, surface);
+273
+274
return (struct wp_viewport *) id;
+275
}
+276
+277
#ifndef WP_VIEWPORT_ERROR_ENUM
+278
#define WP_VIEWPORT_ERROR_ENUM
+279
enum wp_viewport_error {
+280
/**
+281
* negative or zero values in width or height
+282
*/
+283
WP_VIEWPORT_ERROR_BAD_VALUE = 0,
+284
/**
+285
* destination size is not integer
+286
*/
+287
WP_VIEWPORT_ERROR_BAD_SIZE = 1,
+288
/**
+289
* source rectangle extends outside of the content area
+290
*/
+291
WP_VIEWPORT_ERROR_OUT_OF_BUFFER = 2,
+292
/**
+293
* the wl_surface was destroyed
+294
*/
+295
WP_VIEWPORT_ERROR_NO_SURFACE = 3,
+296
};
+297
#endif /* WP_VIEWPORT_ERROR_ENUM */
+298
+299
#define WP_VIEWPORT_DESTROY 0
+300
#define WP_VIEWPORT_SET_SOURCE 1
+301
#define WP_VIEWPORT_SET_DESTINATION 2
+302
+303
+304
/**
+305
* @ingroup iface_wp_viewport
+306
*/
+307
#define WP_VIEWPORT_DESTROY_SINCE_VERSION 1
+308
/**
+309
* @ingroup iface_wp_viewport
+310
*/
+311
#define WP_VIEWPORT_SET_SOURCE_SINCE_VERSION 1
+312
/**
+313
* @ingroup iface_wp_viewport
+314
*/
+315
#define WP_VIEWPORT_SET_DESTINATION_SINCE_VERSION 1
+316
+317
/** @ingroup iface_wp_viewport */
+318
static inline void
+319
wp_viewport_set_user_data(struct wp_viewport *wp_viewport, void *user_data)
+320
{
+321
wl_proxy_set_user_data((struct wl_proxy *) wp_viewport, user_data);
+322
}
+323
+324
/** @ingroup iface_wp_viewport */
+325
static inline void *
+326
wp_viewport_get_user_data(struct wp_viewport *wp_viewport)
+327
{
+328
return wl_proxy_get_user_data((struct wl_proxy *) wp_viewport);
+329
}
+330
+331
static inline uint32_t
+332
wp_viewport_get_version(struct wp_viewport *wp_viewport)
+333
{
+334
return wl_proxy_get_version((struct wl_proxy *) wp_viewport);
+335
}
+336
+337
/**
+338
* @ingroup iface_wp_viewport
+339
*
+340
* The associated wl_surface's crop and scale state is removed.
+341
* The change is applied on the next wl_surface.commit.
+342
*/
+343
static inline void
+344
wp_viewport_destroy(struct wp_viewport *wp_viewport)
+345
{
+346
wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
+347
WP_VIEWPORT_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), WL_MARSHAL_FLAG_DESTROY);
+348
}
+349
+350
/**
+351
* @ingroup iface_wp_viewport
+352
*
+353
* Set the source rectangle of the associated wl_surface. See
+354
* wp_viewport for the description, and relation to the wl_buffer
+355
* size.
+356
*
+357
* If all of x, y, width and height are -1.0, the source rectangle is
+358
* unset instead. Any other set of values where width or height are zero
+359
* or negative, or x or y are negative, raise the bad_value protocol
+360
* error.
+361
*
+362
* The crop and scale state is double-buffered state, and will be
+363
* applied on the next wl_surface.commit.
+364
*/
+365
static inline void
+366
wp_viewport_set_source(struct wp_viewport *wp_viewport, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height)
+367
{
+368
wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
+369
WP_VIEWPORT_SET_SOURCE, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), 0, x, y, width, height);
+370
}
+371
+372
/**
+373
* @ingroup iface_wp_viewport
+374
*
+375
* Set the destination size of the associated wl_surface. See
+376
* wp_viewport for the description, and relation to the wl_buffer
+377
* size.
+378
*
+379
* If width is -1 and height is -1, the destination size is unset
+380
* instead. Any other pair of values for width and height that
+381
* contains zero or negative values raises the bad_value protocol
+382
* error.
+383
*
+384
* The crop and scale state is double-buffered state, and will be
+385
* applied on the next wl_surface.commit.
+386
*/
+387
static inline void
+388
wp_viewport_set_destination(struct wp_viewport *wp_viewport, int32_t width, int32_t height)
+389
{
+390
wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
+391
WP_VIEWPORT_SET_DESTINATION, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), 0, width, height);
+392
}
+393
+394
#ifdef __cplusplus
+395
}
+396
#endif
+397
+398
#endif
vendor/glfw/src/wayland-protocols/wayland-client-protocol-code.hadded
@@ -0,0 +1,525 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
/*
+4
* Copyright © 2008-2011 Kristian Høgsberg
+5
* Copyright © 2010-2011 Intel Corporation
+6
* Copyright © 2012-2013 Collabora, Ltd.
+7
*
+8
* Permission is hereby granted, free of charge, to any person
+9
* obtaining a copy of this software and associated documentation files
+10
* (the "Software"), to deal in the Software without restriction,
+11
* including without limitation the rights to use, copy, modify, merge,
+12
* publish, distribute, sublicense, and/or sell copies of the Software,
+13
* and to permit persons to whom the Software is furnished to do so,
+14
* subject to the following conditions:
+15
*
+16
* The above copyright notice and this permission notice (including the
+17
* next paragraph) shall be included in all copies or substantial
+18
* portions of the Software.
+19
*
+20
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+21
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+22
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+23
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+24
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+25
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+26
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+27
* SOFTWARE.
+28
*/
+29
+30
#include <stdbool.h>
+31
#include <stdlib.h>
+32
#include <stdint.h>
+33
#include "wayland-util.h"
+34
+35
#ifndef __has_attribute
+36
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+37
#endif
+38
+39
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
+40
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
+41
#else
+42
#define WL_PRIVATE
+43
#endif
+44
+45
extern const struct wl_interface wl_buffer_interface;
+46
extern const struct wl_interface wl_callback_interface;
+47
extern const struct wl_interface wl_data_device_interface;
+48
extern const struct wl_interface wl_data_offer_interface;
+49
extern const struct wl_interface wl_data_source_interface;
+50
extern const struct wl_interface wl_keyboard_interface;
+51
extern const struct wl_interface wl_output_interface;
+52
extern const struct wl_interface wl_pointer_interface;
+53
extern const struct wl_interface wl_region_interface;
+54
extern const struct wl_interface wl_registry_interface;
+55
extern const struct wl_interface wl_seat_interface;
+56
extern const struct wl_interface wl_shell_surface_interface;
+57
extern const struct wl_interface wl_shm_pool_interface;
+58
extern const struct wl_interface wl_subsurface_interface;
+59
extern const struct wl_interface wl_surface_interface;
+60
extern const struct wl_interface wl_touch_interface;
+61
+62
static const struct wl_interface *wayland_types[] = {
+63
NULL,
+64
NULL,
+65
NULL,
+66
NULL,
+67
NULL,
+68
NULL,
+69
NULL,
+70
NULL,
+71
&wl_callback_interface,
+72
&wl_registry_interface,
+73
&wl_surface_interface,
+74
&wl_region_interface,
+75
&wl_buffer_interface,
+76
NULL,
+77
NULL,
+78
NULL,
+79
NULL,
+80
NULL,
+81
&wl_shm_pool_interface,
+82
NULL,
+83
NULL,
+84
&wl_data_source_interface,
+85
&wl_surface_interface,
+86
&wl_surface_interface,
+87
NULL,
+88
&wl_data_source_interface,
+89
NULL,
+90
&wl_data_offer_interface,
+91
NULL,
+92
&wl_surface_interface,
+93
NULL,
+94
NULL,
+95
&wl_data_offer_interface,
+96
&wl_data_offer_interface,
+97
&wl_data_source_interface,
+98
&wl_data_device_interface,
+99
&wl_seat_interface,
+100
&wl_shell_surface_interface,
+101
&wl_surface_interface,
+102
&wl_seat_interface,
+103
NULL,
+104
&wl_seat_interface,
+105
NULL,
+106
NULL,
+107
&wl_surface_interface,
+108
NULL,
+109
NULL,
+110
NULL,
+111
NULL,
+112
NULL,
+113
&wl_output_interface,
+114
&wl_seat_interface,
+115
NULL,
+116
&wl_surface_interface,
+117
NULL,
+118
NULL,
+119
NULL,
+120
&wl_output_interface,
+121
&wl_buffer_interface,
+122
NULL,
+123
NULL,
+124
&wl_callback_interface,
+125
&wl_region_interface,
+126
&wl_region_interface,
+127
&wl_output_interface,
+128
&wl_output_interface,
+129
&wl_pointer_interface,
+130
&wl_keyboard_interface,
+131
&wl_touch_interface,
+132
NULL,
+133
&wl_surface_interface,
+134
NULL,
+135
NULL,
+136
NULL,
+137
&wl_surface_interface,
+138
NULL,
+139
NULL,
+140
NULL,
+141
&wl_surface_interface,
+142
NULL,
+143
&wl_surface_interface,
+144
NULL,
+145
NULL,
+146
&wl_surface_interface,
+147
NULL,
+148
NULL,
+149
&wl_surface_interface,
+150
NULL,
+151
NULL,
+152
NULL,
+153
&wl_subsurface_interface,
+154
&wl_surface_interface,
+155
&wl_surface_interface,
+156
&wl_surface_interface,
+157
&wl_surface_interface,
+158
};
+159
+160
static const struct wl_message wl_display_requests[] = {
+161
{ "sync", "n", wayland_types + 8 },
+162
{ "get_registry", "n", wayland_types + 9 },
+163
};
+164
+165
static const struct wl_message wl_display_events[] = {
+166
{ "error", "ous", wayland_types + 0 },
+167
{ "delete_id", "u", wayland_types + 0 },
+168
};
+169
+170
WL_PRIVATE const struct wl_interface wl_display_interface = {
+171
"wl_display", 1,
+172
2, wl_display_requests,
+173
2, wl_display_events,
+174
};
+175
+176
static const struct wl_message wl_registry_requests[] = {
+177
{ "bind", "usun", wayland_types + 0 },
+178
};
+179
+180
static const struct wl_message wl_registry_events[] = {
+181
{ "global", "usu", wayland_types + 0 },
+182
{ "global_remove", "u", wayland_types + 0 },
+183
};
+184
+185
WL_PRIVATE const struct wl_interface wl_registry_interface = {
+186
"wl_registry", 1,
+187
1, wl_registry_requests,
+188
2, wl_registry_events,
+189
};
+190
+191
static const struct wl_message wl_callback_events[] = {
+192
{ "done", "u", wayland_types + 0 },
+193
};
+194
+195
WL_PRIVATE const struct wl_interface wl_callback_interface = {
+196
"wl_callback", 1,
+197
0, NULL,
+198
1, wl_callback_events,
+199
};
+200
+201
static const struct wl_message wl_compositor_requests[] = {
+202
{ "create_surface", "n", wayland_types + 10 },
+203
{ "create_region", "n", wayland_types + 11 },
+204
};
+205
+206
WL_PRIVATE const struct wl_interface wl_compositor_interface = {
+207
"wl_compositor", 6,
+208
2, wl_compositor_requests,
+209
0, NULL,
+210
};
+211
+212
static const struct wl_message wl_shm_pool_requests[] = {
+213
{ "create_buffer", "niiiiu", wayland_types + 12 },
+214
{ "destroy", "", wayland_types + 0 },
+215
{ "resize", "i", wayland_types + 0 },
+216
};
+217
+218
WL_PRIVATE const struct wl_interface wl_shm_pool_interface = {
+219
"wl_shm_pool", 1,
+220
3, wl_shm_pool_requests,
+221
0, NULL,
+222
};
+223
+224
static const struct wl_message wl_shm_requests[] = {
+225
{ "create_pool", "nhi", wayland_types + 18 },
+226
};
+227
+228
static const struct wl_message wl_shm_events[] = {
+229
{ "format", "u", wayland_types + 0 },
+230
};
+231
+232
WL_PRIVATE const struct wl_interface wl_shm_interface = {
+233
"wl_shm", 1,
+234
1, wl_shm_requests,
+235
1, wl_shm_events,
+236
};
+237
+238
static const struct wl_message wl_buffer_requests[] = {
+239
{ "destroy", "", wayland_types + 0 },
+240
};
+241
+242
static const struct wl_message wl_buffer_events[] = {
+243
{ "release", "", wayland_types + 0 },
+244
};
+245
+246
WL_PRIVATE const struct wl_interface wl_buffer_interface = {
+247
"wl_buffer", 1,
+248
1, wl_buffer_requests,
+249
1, wl_buffer_events,
+250
};
+251
+252
static const struct wl_message wl_data_offer_requests[] = {
+253
{ "accept", "u?s", wayland_types + 0 },
+254
{ "receive", "sh", wayland_types + 0 },
+255
{ "destroy", "", wayland_types + 0 },
+256
{ "finish", "3", wayland_types + 0 },
+257
{ "set_actions", "3uu", wayland_types + 0 },
+258
};
+259
+260
static const struct wl_message wl_data_offer_events[] = {
+261
{ "offer", "s", wayland_types + 0 },
+262
{ "source_actions", "3u", wayland_types + 0 },
+263
{ "action", "3u", wayland_types + 0 },
+264
};
+265
+266
WL_PRIVATE const struct wl_interface wl_data_offer_interface = {
+267
"wl_data_offer", 3,
+268
5, wl_data_offer_requests,
+269
3, wl_data_offer_events,
+270
};
+271
+272
static const struct wl_message wl_data_source_requests[] = {
+273
{ "offer", "s", wayland_types + 0 },
+274
{ "destroy", "", wayland_types + 0 },
+275
{ "set_actions", "3u", wayland_types + 0 },
+276
};
+277
+278
static const struct wl_message wl_data_source_events[] = {
+279
{ "target", "?s", wayland_types + 0 },
+280
{ "send", "sh", wayland_types + 0 },
+281
{ "cancelled", "", wayland_types + 0 },
+282
{ "dnd_drop_performed", "3", wayland_types + 0 },
+283
{ "dnd_finished", "3", wayland_types + 0 },
+284
{ "action", "3u", wayland_types + 0 },
+285
};
+286
+287
WL_PRIVATE const struct wl_interface wl_data_source_interface = {
+288
"wl_data_source", 3,
+289
3, wl_data_source_requests,
+290
6, wl_data_source_events,
+291
};
+292
+293
static const struct wl_message wl_data_device_requests[] = {
+294
{ "start_drag", "?oo?ou", wayland_types + 21 },
+295
{ "set_selection", "?ou", wayland_types + 25 },
+296
{ "release", "2", wayland_types + 0 },
+297
};
+298
+299
static const struct wl_message wl_data_device_events[] = {
+300
{ "data_offer", "n", wayland_types + 27 },
+301
{ "enter", "uoff?o", wayland_types + 28 },
+302
{ "leave", "", wayland_types + 0 },
+303
{ "motion", "uff", wayland_types + 0 },
+304
{ "drop", "", wayland_types + 0 },
+305
{ "selection", "?o", wayland_types + 33 },
+306
};
+307
+308
WL_PRIVATE const struct wl_interface wl_data_device_interface = {
+309
"wl_data_device", 3,
+310
3, wl_data_device_requests,
+311
6, wl_data_device_events,
+312
};
+313
+314
static const struct wl_message wl_data_device_manager_requests[] = {
+315
{ "create_data_source", "n", wayland_types + 34 },
+316
{ "get_data_device", "no", wayland_types + 35 },
+317
};
+318
+319
WL_PRIVATE const struct wl_interface wl_data_device_manager_interface = {
+320
"wl_data_device_manager", 3,
+321
2, wl_data_device_manager_requests,
+322
0, NULL,
+323
};
+324
+325
static const struct wl_message wl_shell_requests[] = {
+326
{ "get_shell_surface", "no", wayland_types + 37 },
+327
};
+328
+329
WL_PRIVATE const struct wl_interface wl_shell_interface = {
+330
"wl_shell", 1,
+331
1, wl_shell_requests,
+332
0, NULL,
+333
};
+334
+335
static const struct wl_message wl_shell_surface_requests[] = {
+336
{ "pong", "u", wayland_types + 0 },
+337
{ "move", "ou", wayland_types + 39 },
+338
{ "resize", "ouu", wayland_types + 41 },
+339
{ "set_toplevel", "", wayland_types + 0 },
+340
{ "set_transient", "oiiu", wayland_types + 44 },
+341
{ "set_fullscreen", "uu?o", wayland_types + 48 },
+342
{ "set_popup", "ouoiiu", wayland_types + 51 },
+343
{ "set_maximized", "?o", wayland_types + 57 },
+344
{ "set_title", "s", wayland_types + 0 },
+345
{ "set_class", "s", wayland_types + 0 },
+346
};
+347
+348
static const struct wl_message wl_shell_surface_events[] = {
+349
{ "ping", "u", wayland_types + 0 },
+350
{ "configure", "uii", wayland_types + 0 },
+351
{ "popup_done", "", wayland_types + 0 },
+352
};
+353
+354
WL_PRIVATE const struct wl_interface wl_shell_surface_interface = {
+355
"wl_shell_surface", 1,
+356
10, wl_shell_surface_requests,
+357
3, wl_shell_surface_events,
+358
};
+359
+360
static const struct wl_message wl_surface_requests[] = {
+361
{ "destroy", "", wayland_types + 0 },
+362
{ "attach", "?oii", wayland_types + 58 },
+363
{ "damage", "iiii", wayland_types + 0 },
+364
{ "frame", "n", wayland_types + 61 },
+365
{ "set_opaque_region", "?o", wayland_types + 62 },
+366
{ "set_input_region", "?o", wayland_types + 63 },
+367
{ "commit", "", wayland_types + 0 },
+368
{ "set_buffer_transform", "2i", wayland_types + 0 },
+369
{ "set_buffer_scale", "3i", wayland_types + 0 },
+370
{ "damage_buffer", "4iiii", wayland_types + 0 },
+371
{ "offset", "5ii", wayland_types + 0 },
+372
};
+373
+374
static const struct wl_message wl_surface_events[] = {
+375
{ "enter", "o", wayland_types + 64 },
+376
{ "leave", "o", wayland_types + 65 },
+377
{ "preferred_buffer_scale", "6i", wayland_types + 0 },
+378
{ "preferred_buffer_transform", "6u", wayland_types + 0 },
+379
};
+380
+381
WL_PRIVATE const struct wl_interface wl_surface_interface = {
+382
"wl_surface", 6,
+383
11, wl_surface_requests,
+384
4, wl_surface_events,
+385
};
+386
+387
static const struct wl_message wl_seat_requests[] = {
+388
{ "get_pointer", "n", wayland_types + 66 },
+389
{ "get_keyboard", "n", wayland_types + 67 },
+390
{ "get_touch", "n", wayland_types + 68 },
+391
{ "release", "5", wayland_types + 0 },
+392
};
+393
+394
static const struct wl_message wl_seat_events[] = {
+395
{ "capabilities", "u", wayland_types + 0 },
+396
{ "name", "2s", wayland_types + 0 },
+397
};
+398
+399
WL_PRIVATE const struct wl_interface wl_seat_interface = {
+400
"wl_seat", 9,
+401
4, wl_seat_requests,
+402
2, wl_seat_events,
+403
};
+404
+405
static const struct wl_message wl_pointer_requests[] = {
+406
{ "set_cursor", "u?oii", wayland_types + 69 },
+407
{ "release", "3", wayland_types + 0 },
+408
};
+409
+410
static const struct wl_message wl_pointer_events[] = {
+411
{ "enter", "uoff", wayland_types + 73 },
+412
{ "leave", "uo", wayland_types + 77 },
+413
{ "motion", "uff", wayland_types + 0 },
+414
{ "button", "uuuu", wayland_types + 0 },
+415
{ "axis", "uuf", wayland_types + 0 },
+416
{ "frame", "5", wayland_types + 0 },
+417
{ "axis_source", "5u", wayland_types + 0 },
+418
{ "axis_stop", "5uu", wayland_types + 0 },
+419
{ "axis_discrete", "5ui", wayland_types + 0 },
+420
{ "axis_value120", "8ui", wayland_types + 0 },
+421
{ "axis_relative_direction", "9uu", wayland_types + 0 },
+422
};
+423
+424
WL_PRIVATE const struct wl_interface wl_pointer_interface = {
+425
"wl_pointer", 9,
+426
2, wl_pointer_requests,
+427
11, wl_pointer_events,
+428
};
+429
+430
static const struct wl_message wl_keyboard_requests[] = {
+431
{ "release", "3", wayland_types + 0 },
+432
};
+433
+434
static const struct wl_message wl_keyboard_events[] = {
+435
{ "keymap", "uhu", wayland_types + 0 },
+436
{ "enter", "uoa", wayland_types + 79 },
+437
{ "leave", "uo", wayland_types + 82 },
+438
{ "key", "uuuu", wayland_types + 0 },
+439
{ "modifiers", "uuuuu", wayland_types + 0 },
+440
{ "repeat_info", "4ii", wayland_types + 0 },
+441
};
+442
+443
WL_PRIVATE const struct wl_interface wl_keyboard_interface = {
+444
"wl_keyboard", 9,
+445
1, wl_keyboard_requests,
+446
6, wl_keyboard_events,
+447
};
+448
+449
static const struct wl_message wl_touch_requests[] = {
+450
{ "release", "3", wayland_types + 0 },
+451
};
+452
+453
static const struct wl_message wl_touch_events[] = {
+454
{ "down", "uuoiff", wayland_types + 84 },
+455
{ "up", "uui", wayland_types + 0 },
+456
{ "motion", "uiff", wayland_types + 0 },
+457
{ "frame", "", wayland_types + 0 },
+458
{ "cancel", "", wayland_types + 0 },
+459
{ "shape", "6iff", wayland_types + 0 },
+460
{ "orientation", "6if", wayland_types + 0 },
+461
};
+462
+463
WL_PRIVATE const struct wl_interface wl_touch_interface = {
+464
"wl_touch", 9,
+465
1, wl_touch_requests,
+466
7, wl_touch_events,
+467
};
+468
+469
static const struct wl_message wl_output_requests[] = {
+470
{ "release", "3", wayland_types + 0 },
+471
};
+472
+473
static const struct wl_message wl_output_events[] = {
+474
{ "geometry", "iiiiissi", wayland_types + 0 },
+475
{ "mode", "uiii", wayland_types + 0 },
+476
{ "done", "2", wayland_types + 0 },
+477
{ "scale", "2i", wayland_types + 0 },
+478
{ "name", "4s", wayland_types + 0 },
+479
{ "description", "4s", wayland_types + 0 },
+480
};
+481
+482
WL_PRIVATE const struct wl_interface wl_output_interface = {
+483
"wl_output", 4,
+484
1, wl_output_requests,
+485
6, wl_output_events,
+486
};
+487
+488
static const struct wl_message wl_region_requests[] = {
+489
{ "destroy", "", wayland_types + 0 },
+490
{ "add", "iiii", wayland_types + 0 },
+491
{ "subtract", "iiii", wayland_types + 0 },
+492
};
+493
+494
WL_PRIVATE const struct wl_interface wl_region_interface = {
+495
"wl_region", 1,
+496
3, wl_region_requests,
+497
0, NULL,
+498
};
+499

Showing the first 500 of 526 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/wayland-protocols/wayland-client-protocol.hadded
@@ -0,0 +1,6236 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
#ifndef WAYLAND_CLIENT_PROTOCOL_H
+4
#define WAYLAND_CLIENT_PROTOCOL_H
+5
+6
#include <stdint.h>
+7
#include <stddef.h>
+8
#include "wayland-client.h"
+9
+10
#ifdef __cplusplus
+11
extern "C" {
+12
#endif
+13
+14
/**
+15
* @page page_wayland The wayland protocol
+16
* @section page_ifaces_wayland Interfaces
+17
* - @subpage page_iface_wl_display - core global object
+18
* - @subpage page_iface_wl_registry - global registry object
+19
* - @subpage page_iface_wl_callback - callback object
+20
* - @subpage page_iface_wl_compositor - the compositor singleton
+21
* - @subpage page_iface_wl_shm_pool - a shared memory pool
+22
* - @subpage page_iface_wl_shm - shared memory support
+23
* - @subpage page_iface_wl_buffer - content for a wl_surface
+24
* - @subpage page_iface_wl_data_offer - offer to transfer data
+25
* - @subpage page_iface_wl_data_source - offer to transfer data
+26
* - @subpage page_iface_wl_data_device - data transfer device
+27
* - @subpage page_iface_wl_data_device_manager - data transfer interface
+28
* - @subpage page_iface_wl_shell - create desktop-style surfaces
+29
* - @subpage page_iface_wl_shell_surface - desktop-style metadata interface
+30
* - @subpage page_iface_wl_surface - an onscreen surface
+31
* - @subpage page_iface_wl_seat - group of input devices
+32
* - @subpage page_iface_wl_pointer - pointer input device
+33
* - @subpage page_iface_wl_keyboard - keyboard input device
+34
* - @subpage page_iface_wl_touch - touchscreen input device
+35
* - @subpage page_iface_wl_output - compositor output region
+36
* - @subpage page_iface_wl_region - region interface
+37
* - @subpage page_iface_wl_subcompositor - sub-surface compositing
+38
* - @subpage page_iface_wl_subsurface - sub-surface interface to a wl_surface
+39
* @section page_copyright_wayland Copyright
+40
* <pre>
+41
*
+42
* Copyright © 2008-2011 Kristian Høgsberg
+43
* Copyright © 2010-2011 Intel Corporation
+44
* Copyright © 2012-2013 Collabora, Ltd.
+45
*
+46
* Permission is hereby granted, free of charge, to any person
+47
* obtaining a copy of this software and associated documentation files
+48
* (the "Software"), to deal in the Software without restriction,
+49
* including without limitation the rights to use, copy, modify, merge,
+50
* publish, distribute, sublicense, and/or sell copies of the Software,
+51
* and to permit persons to whom the Software is furnished to do so,
+52
* subject to the following conditions:
+53
*
+54
* The above copyright notice and this permission notice (including the
+55
* next paragraph) shall be included in all copies or substantial
+56
* portions of the Software.
+57
*
+58
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+59
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+60
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+61
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+62
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+63
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+64
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+65
* SOFTWARE.
+66
* </pre>
+67
*/
+68
struct wl_buffer;
+69
struct wl_callback;
+70
struct wl_compositor;
+71
struct wl_data_device;
+72
struct wl_data_device_manager;
+73
struct wl_data_offer;
+74
struct wl_data_source;
+75
struct wl_display;
+76
struct wl_keyboard;
+77
struct wl_output;
+78
struct wl_pointer;
+79
struct wl_region;
+80
struct wl_registry;
+81
struct wl_seat;
+82
struct wl_shell;
+83
struct wl_shell_surface;
+84
struct wl_shm;
+85
struct wl_shm_pool;
+86
struct wl_subcompositor;
+87
struct wl_subsurface;
+88
struct wl_surface;
+89
struct wl_touch;
+90
+91
#ifndef WL_DISPLAY_INTERFACE
+92
#define WL_DISPLAY_INTERFACE
+93
/**
+94
* @page page_iface_wl_display wl_display
+95
* @section page_iface_wl_display_desc Description
+96
*
+97
* The core global object. This is a special singleton object. It
+98
* is used for internal Wayland protocol features.
+99
* @section page_iface_wl_display_api API
+100
* See @ref iface_wl_display.
+101
*/
+102
/**
+103
* @defgroup iface_wl_display The wl_display interface
+104
*
+105
* The core global object. This is a special singleton object. It
+106
* is used for internal Wayland protocol features.
+107
*/
+108
extern const struct wl_interface wl_display_interface;
+109
#endif
+110
#ifndef WL_REGISTRY_INTERFACE
+111
#define WL_REGISTRY_INTERFACE
+112
/**
+113
* @page page_iface_wl_registry wl_registry
+114
* @section page_iface_wl_registry_desc Description
+115
*
+116
* The singleton global registry object. The server has a number of
+117
* global objects that are available to all clients. These objects
+118
* typically represent an actual object in the server (for example,
+119
* an input device) or they are singleton objects that provide
+120
* extension functionality.
+121
*
+122
* When a client creates a registry object, the registry object
+123
* will emit a global event for each global currently in the
+124
* registry. Globals come and go as a result of device or
+125
* monitor hotplugs, reconfiguration or other events, and the
+126
* registry will send out global and global_remove events to
+127
* keep the client up to date with the changes. To mark the end
+128
* of the initial burst of events, the client can use the
+129
* wl_display.sync request immediately after calling
+130
* wl_display.get_registry.
+131
*
+132
* A client can bind to a global object by using the bind
+133
* request. This creates a client-side handle that lets the object
+134
* emit events to the client and lets the client invoke requests on
+135
* the object.
+136
* @section page_iface_wl_registry_api API
+137
* See @ref iface_wl_registry.
+138
*/
+139
/**
+140
* @defgroup iface_wl_registry The wl_registry interface
+141
*
+142
* The singleton global registry object. The server has a number of
+143
* global objects that are available to all clients. These objects
+144
* typically represent an actual object in the server (for example,
+145
* an input device) or they are singleton objects that provide
+146
* extension functionality.
+147
*
+148
* When a client creates a registry object, the registry object
+149
* will emit a global event for each global currently in the
+150
* registry. Globals come and go as a result of device or
+151
* monitor hotplugs, reconfiguration or other events, and the
+152
* registry will send out global and global_remove events to
+153
* keep the client up to date with the changes. To mark the end
+154
* of the initial burst of events, the client can use the
+155
* wl_display.sync request immediately after calling
+156
* wl_display.get_registry.
+157
*
+158
* A client can bind to a global object by using the bind
+159
* request. This creates a client-side handle that lets the object
+160
* emit events to the client and lets the client invoke requests on
+161
* the object.
+162
*/
+163
extern const struct wl_interface wl_registry_interface;
+164
#endif
+165
#ifndef WL_CALLBACK_INTERFACE
+166
#define WL_CALLBACK_INTERFACE
+167
/**
+168
* @page page_iface_wl_callback wl_callback
+169
* @section page_iface_wl_callback_desc Description
+170
*
+171
* Clients can handle the 'done' event to get notified when
+172
* the related request is done.
+173
*
+174
* Note, because wl_callback objects are created from multiple independent
+175
* factory interfaces, the wl_callback interface is frozen at version 1.
+176
* @section page_iface_wl_callback_api API
+177
* See @ref iface_wl_callback.
+178
*/
+179
/**
+180
* @defgroup iface_wl_callback The wl_callback interface
+181
*
+182
* Clients can handle the 'done' event to get notified when
+183
* the related request is done.
+184
*
+185
* Note, because wl_callback objects are created from multiple independent
+186
* factory interfaces, the wl_callback interface is frozen at version 1.
+187
*/
+188
extern const struct wl_interface wl_callback_interface;
+189
#endif
+190
#ifndef WL_COMPOSITOR_INTERFACE
+191
#define WL_COMPOSITOR_INTERFACE
+192
/**
+193
* @page page_iface_wl_compositor wl_compositor
+194
* @section page_iface_wl_compositor_desc Description
+195
*
+196
* A compositor. This object is a singleton global. The
+197
* compositor is in charge of combining the contents of multiple
+198
* surfaces into one displayable output.
+199
* @section page_iface_wl_compositor_api API
+200
* See @ref iface_wl_compositor.
+201
*/
+202
/**
+203
* @defgroup iface_wl_compositor The wl_compositor interface
+204
*
+205
* A compositor. This object is a singleton global. The
+206
* compositor is in charge of combining the contents of multiple
+207
* surfaces into one displayable output.
+208
*/
+209
extern const struct wl_interface wl_compositor_interface;
+210
#endif
+211
#ifndef WL_SHM_POOL_INTERFACE
+212
#define WL_SHM_POOL_INTERFACE
+213
/**
+214
* @page page_iface_wl_shm_pool wl_shm_pool
+215
* @section page_iface_wl_shm_pool_desc Description
+216
*
+217
* The wl_shm_pool object encapsulates a piece of memory shared
+218
* between the compositor and client. Through the wl_shm_pool
+219
* object, the client can allocate shared memory wl_buffer objects.
+220
* All objects created through the same pool share the same
+221
* underlying mapped memory. Reusing the mapped memory avoids the
+222
* setup/teardown overhead and is useful when interactively resizing
+223
* a surface or for many small buffers.
+224
* @section page_iface_wl_shm_pool_api API
+225
* See @ref iface_wl_shm_pool.
+226
*/
+227
/**
+228
* @defgroup iface_wl_shm_pool The wl_shm_pool interface
+229
*
+230
* The wl_shm_pool object encapsulates a piece of memory shared
+231
* between the compositor and client. Through the wl_shm_pool
+232
* object, the client can allocate shared memory wl_buffer objects.
+233
* All objects created through the same pool share the same
+234
* underlying mapped memory. Reusing the mapped memory avoids the
+235
* setup/teardown overhead and is useful when interactively resizing
+236
* a surface or for many small buffers.
+237
*/
+238
extern const struct wl_interface wl_shm_pool_interface;
+239
#endif
+240
#ifndef WL_SHM_INTERFACE
+241
#define WL_SHM_INTERFACE
+242
/**
+243
* @page page_iface_wl_shm wl_shm
+244
* @section page_iface_wl_shm_desc Description
+245
*
+246
* A singleton global object that provides support for shared
+247
* memory.
+248
*
+249
* Clients can create wl_shm_pool objects using the create_pool
+250
* request.
+251
*
+252
* On binding the wl_shm object one or more format events
+253
* are emitted to inform clients about the valid pixel formats
+254
* that can be used for buffers.
+255
* @section page_iface_wl_shm_api API
+256
* See @ref iface_wl_shm.
+257
*/
+258
/**
+259
* @defgroup iface_wl_shm The wl_shm interface
+260
*
+261
* A singleton global object that provides support for shared
+262
* memory.
+263
*
+264
* Clients can create wl_shm_pool objects using the create_pool
+265
* request.
+266
*
+267
* On binding the wl_shm object one or more format events
+268
* are emitted to inform clients about the valid pixel formats
+269
* that can be used for buffers.
+270
*/
+271
extern const struct wl_interface wl_shm_interface;
+272
#endif
+273
#ifndef WL_BUFFER_INTERFACE
+274
#define WL_BUFFER_INTERFACE
+275
/**
+276
* @page page_iface_wl_buffer wl_buffer
+277
* @section page_iface_wl_buffer_desc Description
+278
*
+279
* A buffer provides the content for a wl_surface. Buffers are
+280
* created through factory interfaces such as wl_shm, wp_linux_buffer_params
+281
* (from the linux-dmabuf protocol extension) or similar. It has a width and
+282
* a height and can be attached to a wl_surface, but the mechanism by which a
+283
* client provides and updates the contents is defined by the buffer factory
+284
* interface.
+285
*
+286
* If the buffer uses a format that has an alpha channel, the alpha channel
+287
* is assumed to be premultiplied in the color channels unless otherwise
+288
* specified.
+289
*
+290
* Note, because wl_buffer objects are created from multiple independent
+291
* factory interfaces, the wl_buffer interface is frozen at version 1.
+292
* @section page_iface_wl_buffer_api API
+293
* See @ref iface_wl_buffer.
+294
*/
+295
/**
+296
* @defgroup iface_wl_buffer The wl_buffer interface
+297
*
+298
* A buffer provides the content for a wl_surface. Buffers are
+299
* created through factory interfaces such as wl_shm, wp_linux_buffer_params
+300
* (from the linux-dmabuf protocol extension) or similar. It has a width and
+301
* a height and can be attached to a wl_surface, but the mechanism by which a
+302
* client provides and updates the contents is defined by the buffer factory
+303
* interface.
+304
*
+305
* If the buffer uses a format that has an alpha channel, the alpha channel
+306
* is assumed to be premultiplied in the color channels unless otherwise
+307
* specified.
+308
*
+309
* Note, because wl_buffer objects are created from multiple independent
+310
* factory interfaces, the wl_buffer interface is frozen at version 1.
+311
*/
+312
extern const struct wl_interface wl_buffer_interface;
+313
#endif
+314
#ifndef WL_DATA_OFFER_INTERFACE
+315
#define WL_DATA_OFFER_INTERFACE
+316
/**
+317
* @page page_iface_wl_data_offer wl_data_offer
+318
* @section page_iface_wl_data_offer_desc Description
+319
*
+320
* A wl_data_offer represents a piece of data offered for transfer
+321
* by another client (the source client). It is used by the
+322
* copy-and-paste and drag-and-drop mechanisms. The offer
+323
* describes the different mime types that the data can be
+324
* converted to and provides the mechanism for transferring the
+325
* data directly from the source client.
+326
* @section page_iface_wl_data_offer_api API
+327
* See @ref iface_wl_data_offer.
+328
*/
+329
/**
+330
* @defgroup iface_wl_data_offer The wl_data_offer interface
+331
*
+332
* A wl_data_offer represents a piece of data offered for transfer
+333
* by another client (the source client). It is used by the
+334
* copy-and-paste and drag-and-drop mechanisms. The offer
+335
* describes the different mime types that the data can be
+336
* converted to and provides the mechanism for transferring the
+337
* data directly from the source client.
+338
*/
+339
extern const struct wl_interface wl_data_offer_interface;
+340
#endif
+341
#ifndef WL_DATA_SOURCE_INTERFACE
+342
#define WL_DATA_SOURCE_INTERFACE
+343
/**
+344
* @page page_iface_wl_data_source wl_data_source
+345
* @section page_iface_wl_data_source_desc Description
+346
*
+347
* The wl_data_source object is the source side of a wl_data_offer.
+348
* It is created by the source client in a data transfer and
+349
* provides a way to describe the offered data and a way to respond
+350
* to requests to transfer the data.
+351
* @section page_iface_wl_data_source_api API
+352
* See @ref iface_wl_data_source.
+353
*/
+354
/**
+355
* @defgroup iface_wl_data_source The wl_data_source interface
+356
*
+357
* The wl_data_source object is the source side of a wl_data_offer.
+358
* It is created by the source client in a data transfer and
+359
* provides a way to describe the offered data and a way to respond
+360
* to requests to transfer the data.
+361
*/
+362
extern const struct wl_interface wl_data_source_interface;
+363
#endif
+364
#ifndef WL_DATA_DEVICE_INTERFACE
+365
#define WL_DATA_DEVICE_INTERFACE
+366
/**
+367
* @page page_iface_wl_data_device wl_data_device
+368
* @section page_iface_wl_data_device_desc Description
+369
*
+370
* There is one wl_data_device per seat which can be obtained
+371
* from the global wl_data_device_manager singleton.
+372
*
+373
* A wl_data_device provides access to inter-client data transfer
+374
* mechanisms such as copy-and-paste and drag-and-drop.
+375
* @section page_iface_wl_data_device_api API
+376
* See @ref iface_wl_data_device.
+377
*/
+378
/**
+379
* @defgroup iface_wl_data_device The wl_data_device interface
+380
*
+381
* There is one wl_data_device per seat which can be obtained
+382
* from the global wl_data_device_manager singleton.
+383
*
+384
* A wl_data_device provides access to inter-client data transfer
+385
* mechanisms such as copy-and-paste and drag-and-drop.
+386
*/
+387
extern const struct wl_interface wl_data_device_interface;
+388
#endif
+389
#ifndef WL_DATA_DEVICE_MANAGER_INTERFACE
+390
#define WL_DATA_DEVICE_MANAGER_INTERFACE
+391
/**
+392
* @page page_iface_wl_data_device_manager wl_data_device_manager
+393
* @section page_iface_wl_data_device_manager_desc Description
+394
*
+395
* The wl_data_device_manager is a singleton global object that
+396
* provides access to inter-client data transfer mechanisms such as
+397
* copy-and-paste and drag-and-drop. These mechanisms are tied to
+398
* a wl_seat and this interface lets a client get a wl_data_device
+399
* corresponding to a wl_seat.
+400
*
+401
* Depending on the version bound, the objects created from the bound
+402
* wl_data_device_manager object will have different requirements for
+403
* functioning properly. See wl_data_source.set_actions,
+404
* wl_data_offer.accept and wl_data_offer.finish for details.
+405
* @section page_iface_wl_data_device_manager_api API
+406
* See @ref iface_wl_data_device_manager.
+407
*/
+408
/**
+409
* @defgroup iface_wl_data_device_manager The wl_data_device_manager interface
+410
*
+411
* The wl_data_device_manager is a singleton global object that
+412
* provides access to inter-client data transfer mechanisms such as
+413
* copy-and-paste and drag-and-drop. These mechanisms are tied to
+414
* a wl_seat and this interface lets a client get a wl_data_device
+415
* corresponding to a wl_seat.
+416
*
+417
* Depending on the version bound, the objects created from the bound
+418
* wl_data_device_manager object will have different requirements for
+419
* functioning properly. See wl_data_source.set_actions,
+420
* wl_data_offer.accept and wl_data_offer.finish for details.
+421
*/
+422
extern const struct wl_interface wl_data_device_manager_interface;
+423
#endif
+424
#ifndef WL_SHELL_INTERFACE
+425
#define WL_SHELL_INTERFACE
+426
/**
+427
* @page page_iface_wl_shell wl_shell
+428
* @section page_iface_wl_shell_desc Description
+429
*
+430
* This interface is implemented by servers that provide
+431
* desktop-style user interfaces.
+432
*
+433
* It allows clients to associate a wl_shell_surface with
+434
* a basic surface.
+435
*
+436
* Note! This protocol is deprecated and not intended for production use.
+437
* For desktop-style user interfaces, use xdg_shell. Compositors and clients
+438
* should not implement this interface.
+439
* @section page_iface_wl_shell_api API
+440
* See @ref iface_wl_shell.
+441
*/
+442
/**
+443
* @defgroup iface_wl_shell The wl_shell interface
+444
*
+445
* This interface is implemented by servers that provide
+446
* desktop-style user interfaces.
+447
*
+448
* It allows clients to associate a wl_shell_surface with
+449
* a basic surface.
+450
*
+451
* Note! This protocol is deprecated and not intended for production use.
+452
* For desktop-style user interfaces, use xdg_shell. Compositors and clients
+453
* should not implement this interface.
+454
*/
+455
extern const struct wl_interface wl_shell_interface;
+456
#endif
+457
#ifndef WL_SHELL_SURFACE_INTERFACE
+458
#define WL_SHELL_SURFACE_INTERFACE
+459
/**
+460
* @page page_iface_wl_shell_surface wl_shell_surface
+461
* @section page_iface_wl_shell_surface_desc Description
+462
*
+463
* An interface that may be implemented by a wl_surface, for
+464
* implementations that provide a desktop-style user interface.
+465
*
+466
* It provides requests to treat surfaces like toplevel, fullscreen
+467
* or popup windows, move, resize or maximize them, associate
+468
* metadata like title and class, etc.
+469
*
+470
* On the server side the object is automatically destroyed when
+471
* the related wl_surface is destroyed. On the client side,
+472
* wl_shell_surface_destroy() must be called before destroying
+473
* the wl_surface object.
+474
* @section page_iface_wl_shell_surface_api API
+475
* See @ref iface_wl_shell_surface.
+476
*/
+477
/**
+478
* @defgroup iface_wl_shell_surface The wl_shell_surface interface
+479
*
+480
* An interface that may be implemented by a wl_surface, for
+481
* implementations that provide a desktop-style user interface.
+482
*
+483
* It provides requests to treat surfaces like toplevel, fullscreen
+484
* or popup windows, move, resize or maximize them, associate
+485
* metadata like title and class, etc.
+486
*
+487
* On the server side the object is automatically destroyed when
+488
* the related wl_surface is destroyed. On the client side,
+489
* wl_shell_surface_destroy() must be called before destroying
+490
* the wl_surface object.
+491
*/
+492
extern const struct wl_interface wl_shell_surface_interface;
+493
#endif
+494
#ifndef WL_SURFACE_INTERFACE
+495
#define WL_SURFACE_INTERFACE
+496
/**
+497
* @page page_iface_wl_surface wl_surface
+498
* @section page_iface_wl_surface_desc Description
+499
*

Showing the first 500 of 6237 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/wayland-protocols/xdg-activation-v1-client-protocol-code.hadded
@@ -0,0 +1,85 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
/*
+4
* Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
+5
* Copyright © 2020 Carlos Garnacho <carlosg@gnome.org>
+6
*
+7
* Permission is hereby granted, free of charge, to any person obtaining a
+8
* copy of this software and associated documentation files (the "Software"),
+9
* to deal in the Software without restriction, including without limitation
+10
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+11
* and/or sell copies of the Software, and to permit persons to whom the
+12
* Software is furnished to do so, subject to the following conditions:
+13
*
+14
* The above copyright notice and this permission notice (including the next
+15
* paragraph) shall be included in all copies or substantial portions of the
+16
* Software.
+17
*
+18
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+19
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+20
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+21
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+22
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+23
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+24
* DEALINGS IN THE SOFTWARE.
+25
*/
+26
+27
#include <stdbool.h>
+28
#include <stdlib.h>
+29
#include <stdint.h>
+30
#include "wayland-util.h"
+31
+32
#ifndef __has_attribute
+33
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+34
#endif
+35
+36
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
+37
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
+38
#else
+39
#define WL_PRIVATE
+40
#endif
+41
+42
extern const struct wl_interface wl_seat_interface;
+43
extern const struct wl_interface wl_surface_interface;
+44
extern const struct wl_interface xdg_activation_token_v1_interface;
+45
+46
static const struct wl_interface *xdg_activation_v1_types[] = {
+47
NULL,
+48
&xdg_activation_token_v1_interface,
+49
NULL,
+50
&wl_surface_interface,
+51
NULL,
+52
&wl_seat_interface,
+53
&wl_surface_interface,
+54
};
+55
+56
static const struct wl_message xdg_activation_v1_requests[] = {
+57
{ "destroy", "", xdg_activation_v1_types + 0 },
+58
{ "get_activation_token", "n", xdg_activation_v1_types + 1 },
+59
{ "activate", "so", xdg_activation_v1_types + 2 },
+60
};
+61
+62
WL_PRIVATE const struct wl_interface xdg_activation_v1_interface = {
+63
"xdg_activation_v1", 1,
+64
3, xdg_activation_v1_requests,
+65
0, NULL,
+66
};
+67
+68
static const struct wl_message xdg_activation_token_v1_requests[] = {
+69
{ "set_serial", "uo", xdg_activation_v1_types + 4 },
+70
{ "set_app_id", "s", xdg_activation_v1_types + 0 },
+71
{ "set_surface", "o", xdg_activation_v1_types + 6 },
+72
{ "commit", "", xdg_activation_v1_types + 0 },
+73
{ "destroy", "", xdg_activation_v1_types + 0 },
+74
};
+75
+76
static const struct wl_message xdg_activation_token_v1_events[] = {
+77
{ "done", "s", xdg_activation_v1_types + 0 },
+78
};
+79
+80
WL_PRIVATE const struct wl_interface xdg_activation_token_v1_interface = {
+81
"xdg_activation_token_v1", 1,
+82
5, xdg_activation_token_v1_requests,
+83
1, xdg_activation_token_v1_events,
+84
};
+85
vendor/glfw/src/wayland-protocols/xdg-activation-v1-client-protocol.hadded
@@ -0,0 +1,415 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
#ifndef XDG_ACTIVATION_V1_CLIENT_PROTOCOL_H
+4
#define XDG_ACTIVATION_V1_CLIENT_PROTOCOL_H
+5
+6
#include <stdint.h>
+7
#include <stddef.h>
+8
#include "wayland-client.h"
+9
+10
#ifdef __cplusplus
+11
extern "C" {
+12
#endif
+13
+14
/**
+15
* @page page_xdg_activation_v1 The xdg_activation_v1 protocol
+16
* Protocol for requesting activation of surfaces
+17
*
+18
* @section page_desc_xdg_activation_v1 Description
+19
*
+20
* The way for a client to pass focus to another toplevel is as follows.
+21
*
+22
* The client that intends to activate another toplevel uses the
+23
* xdg_activation_v1.get_activation_token request to get an activation token.
+24
* This token is then forwarded to the client, which is supposed to activate
+25
* one of its surfaces, through a separate band of communication.
+26
*
+27
* One established way of doing this is through the XDG_ACTIVATION_TOKEN
+28
* environment variable of a newly launched child process. The child process
+29
* should unset the environment variable again right after reading it out in
+30
* order to avoid propagating it to other child processes.
+31
*
+32
* Another established way exists for Applications implementing the D-Bus
+33
* interface org.freedesktop.Application, which should get their token under
+34
* activation-token on their platform_data.
+35
*
+36
* In general activation tokens may be transferred across clients through
+37
* means not described in this protocol.
+38
*
+39
* The client to be activated will then pass the token
+40
* it received to the xdg_activation_v1.activate request. The compositor can
+41
* then use this token to decide how to react to the activation request.
+42
*
+43
* The token the activating client gets may be ineffective either already at
+44
* the time it receives it, for example if it was not focused, for focus
+45
* stealing prevention. The activating client will have no way to discover
+46
* the validity of the token, and may still forward it to the to be activated
+47
* client.
+48
*
+49
* The created activation token may optionally get information attached to it
+50
* that can be used by the compositor to identify the application that we
+51
* intend to activate. This can for example be used to display a visual hint
+52
* about what application is being started.
+53
*
+54
* Warning! The protocol described in this file is currently in the testing
+55
* phase. Backward compatible changes may be added together with the
+56
* corresponding interface version bump. Backward incompatible changes can
+57
* only be done by creating a new major version of the extension.
+58
*
+59
* @section page_ifaces_xdg_activation_v1 Interfaces
+60
* - @subpage page_iface_xdg_activation_v1 - interface for activating surfaces
+61
* - @subpage page_iface_xdg_activation_token_v1 - an exported activation handle
+62
* @section page_copyright_xdg_activation_v1 Copyright
+63
* <pre>
+64
*
+65
* Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
+66
* Copyright © 2020 Carlos Garnacho <carlosg@gnome.org>
+67
*
+68
* Permission is hereby granted, free of charge, to any person obtaining a
+69
* copy of this software and associated documentation files (the "Software"),
+70
* to deal in the Software without restriction, including without limitation
+71
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+72
* and/or sell copies of the Software, and to permit persons to whom the
+73
* Software is furnished to do so, subject to the following conditions:
+74
*
+75
* The above copyright notice and this permission notice (including the next
+76
* paragraph) shall be included in all copies or substantial portions of the
+77
* Software.
+78
*
+79
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+80
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+81
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+82
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+83
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+84
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+85
* DEALINGS IN THE SOFTWARE.
+86
* </pre>
+87
*/
+88
struct wl_seat;
+89
struct wl_surface;
+90
struct xdg_activation_token_v1;
+91
struct xdg_activation_v1;
+92
+93
#ifndef XDG_ACTIVATION_V1_INTERFACE
+94
#define XDG_ACTIVATION_V1_INTERFACE
+95
/**
+96
* @page page_iface_xdg_activation_v1 xdg_activation_v1
+97
* @section page_iface_xdg_activation_v1_desc Description
+98
*
+99
* A global interface used for informing the compositor about applications
+100
* being activated or started, or for applications to request to be
+101
* activated.
+102
* @section page_iface_xdg_activation_v1_api API
+103
* See @ref iface_xdg_activation_v1.
+104
*/
+105
/**
+106
* @defgroup iface_xdg_activation_v1 The xdg_activation_v1 interface
+107
*
+108
* A global interface used for informing the compositor about applications
+109
* being activated or started, or for applications to request to be
+110
* activated.
+111
*/
+112
extern const struct wl_interface xdg_activation_v1_interface;
+113
#endif
+114
#ifndef XDG_ACTIVATION_TOKEN_V1_INTERFACE
+115
#define XDG_ACTIVATION_TOKEN_V1_INTERFACE
+116
/**
+117
* @page page_iface_xdg_activation_token_v1 xdg_activation_token_v1
+118
* @section page_iface_xdg_activation_token_v1_desc Description
+119
*
+120
* An object for setting up a token and receiving a token handle that can
+121
* be passed as an activation token to another client.
+122
*
+123
* The object is created using the xdg_activation_v1.get_activation_token
+124
* request. This object should then be populated with the app_id, surface
+125
* and serial information and committed. The compositor shall then issue a
+126
* done event with the token. In case the request's parameters are invalid,
+127
* the compositor will provide an invalid token.
+128
* @section page_iface_xdg_activation_token_v1_api API
+129
* See @ref iface_xdg_activation_token_v1.
+130
*/
+131
/**
+132
* @defgroup iface_xdg_activation_token_v1 The xdg_activation_token_v1 interface
+133
*
+134
* An object for setting up a token and receiving a token handle that can
+135
* be passed as an activation token to another client.
+136
*
+137
* The object is created using the xdg_activation_v1.get_activation_token
+138
* request. This object should then be populated with the app_id, surface
+139
* and serial information and committed. The compositor shall then issue a
+140
* done event with the token. In case the request's parameters are invalid,
+141
* the compositor will provide an invalid token.
+142
*/
+143
extern const struct wl_interface xdg_activation_token_v1_interface;
+144
#endif
+145
+146
#define XDG_ACTIVATION_V1_DESTROY 0
+147
#define XDG_ACTIVATION_V1_GET_ACTIVATION_TOKEN 1
+148
#define XDG_ACTIVATION_V1_ACTIVATE 2
+149
+150
+151
/**
+152
* @ingroup iface_xdg_activation_v1
+153
*/
+154
#define XDG_ACTIVATION_V1_DESTROY_SINCE_VERSION 1
+155
/**
+156
* @ingroup iface_xdg_activation_v1
+157
*/
+158
#define XDG_ACTIVATION_V1_GET_ACTIVATION_TOKEN_SINCE_VERSION 1
+159
/**
+160
* @ingroup iface_xdg_activation_v1
+161
*/
+162
#define XDG_ACTIVATION_V1_ACTIVATE_SINCE_VERSION 1
+163
+164
/** @ingroup iface_xdg_activation_v1 */
+165
static inline void
+166
xdg_activation_v1_set_user_data(struct xdg_activation_v1 *xdg_activation_v1, void *user_data)
+167
{
+168
wl_proxy_set_user_data((struct wl_proxy *) xdg_activation_v1, user_data);
+169
}
+170
+171
/** @ingroup iface_xdg_activation_v1 */
+172
static inline void *
+173
xdg_activation_v1_get_user_data(struct xdg_activation_v1 *xdg_activation_v1)
+174
{
+175
return wl_proxy_get_user_data((struct wl_proxy *) xdg_activation_v1);
+176
}
+177
+178
static inline uint32_t
+179
xdg_activation_v1_get_version(struct xdg_activation_v1 *xdg_activation_v1)
+180
{
+181
return wl_proxy_get_version((struct wl_proxy *) xdg_activation_v1);
+182
}
+183
+184
/**
+185
* @ingroup iface_xdg_activation_v1
+186
*
+187
* Notify the compositor that the xdg_activation object will no longer be
+188
* used.
+189
*
+190
* The child objects created via this interface are unaffected and should
+191
* be destroyed separately.
+192
*/
+193
static inline void
+194
xdg_activation_v1_destroy(struct xdg_activation_v1 *xdg_activation_v1)
+195
{
+196
wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_v1,
+197
XDG_ACTIVATION_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_v1), WL_MARSHAL_FLAG_DESTROY);
+198
}
+199
+200
/**
+201
* @ingroup iface_xdg_activation_v1
+202
*
+203
* Creates an xdg_activation_token_v1 object that will provide
+204
* the initiating client with a unique token for this activation. This
+205
* token should be offered to the clients to be activated.
+206
*/
+207
static inline struct xdg_activation_token_v1 *
+208
xdg_activation_v1_get_activation_token(struct xdg_activation_v1 *xdg_activation_v1)
+209
{
+210
struct wl_proxy *id;
+211
+212
id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_v1,
+213
XDG_ACTIVATION_V1_GET_ACTIVATION_TOKEN, &xdg_activation_token_v1_interface, wl_proxy_get_version((struct wl_proxy *) xdg_activation_v1), 0, NULL);
+214
+215
return (struct xdg_activation_token_v1 *) id;
+216
}
+217
+218
/**
+219
* @ingroup iface_xdg_activation_v1
+220
*
+221
* Requests surface activation. It's up to the compositor to display
+222
* this information as desired, for example by placing the surface above
+223
* the rest.
+224
*
+225
* The compositor may know who requested this by checking the activation
+226
* token and might decide not to follow through with the activation if it's
+227
* considered unwanted.
+228
*
+229
* Compositors can ignore unknown activation tokens when an invalid
+230
* token is passed.
+231
*/
+232
static inline void
+233
xdg_activation_v1_activate(struct xdg_activation_v1 *xdg_activation_v1, const char *token, struct wl_surface *surface)
+234
{
+235
wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_v1,
+236
XDG_ACTIVATION_V1_ACTIVATE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_v1), 0, token, surface);
+237
}
+238
+239
#ifndef XDG_ACTIVATION_TOKEN_V1_ERROR_ENUM
+240
#define XDG_ACTIVATION_TOKEN_V1_ERROR_ENUM
+241
enum xdg_activation_token_v1_error {
+242
/**
+243
* The token has already been used previously
+244
*/
+245
XDG_ACTIVATION_TOKEN_V1_ERROR_ALREADY_USED = 0,
+246
};
+247
#endif /* XDG_ACTIVATION_TOKEN_V1_ERROR_ENUM */
+248
+249
/**
+250
* @ingroup iface_xdg_activation_token_v1
+251
* @struct xdg_activation_token_v1_listener
+252
*/
+253
struct xdg_activation_token_v1_listener {
+254
/**
+255
* the exported activation token
+256
*
+257
* The 'done' event contains the unique token of this activation
+258
* request and notifies that the provider is done.
+259
* @param token the exported activation token
+260
*/
+261
void (*done)(void *data,
+262
struct xdg_activation_token_v1 *xdg_activation_token_v1,
+263
const char *token);
+264
};
+265
+266
/**
+267
* @ingroup iface_xdg_activation_token_v1
+268
*/
+269
static inline int
+270
xdg_activation_token_v1_add_listener(struct xdg_activation_token_v1 *xdg_activation_token_v1,
+271
const struct xdg_activation_token_v1_listener *listener, void *data)
+272
{
+273
return wl_proxy_add_listener((struct wl_proxy *) xdg_activation_token_v1,
+274
(void (**)(void)) listener, data);
+275
}
+276
+277
#define XDG_ACTIVATION_TOKEN_V1_SET_SERIAL 0
+278
#define XDG_ACTIVATION_TOKEN_V1_SET_APP_ID 1
+279
#define XDG_ACTIVATION_TOKEN_V1_SET_SURFACE 2
+280
#define XDG_ACTIVATION_TOKEN_V1_COMMIT 3
+281
#define XDG_ACTIVATION_TOKEN_V1_DESTROY 4
+282
+283
/**
+284
* @ingroup iface_xdg_activation_token_v1
+285
*/
+286
#define XDG_ACTIVATION_TOKEN_V1_DONE_SINCE_VERSION 1
+287
+288
/**
+289
* @ingroup iface_xdg_activation_token_v1
+290
*/
+291
#define XDG_ACTIVATION_TOKEN_V1_SET_SERIAL_SINCE_VERSION 1
+292
/**
+293
* @ingroup iface_xdg_activation_token_v1
+294
*/
+295
#define XDG_ACTIVATION_TOKEN_V1_SET_APP_ID_SINCE_VERSION 1
+296
/**
+297
* @ingroup iface_xdg_activation_token_v1
+298
*/
+299
#define XDG_ACTIVATION_TOKEN_V1_SET_SURFACE_SINCE_VERSION 1
+300
/**
+301
* @ingroup iface_xdg_activation_token_v1
+302
*/
+303
#define XDG_ACTIVATION_TOKEN_V1_COMMIT_SINCE_VERSION 1
+304
/**
+305
* @ingroup iface_xdg_activation_token_v1
+306
*/
+307
#define XDG_ACTIVATION_TOKEN_V1_DESTROY_SINCE_VERSION 1
+308
+309
/** @ingroup iface_xdg_activation_token_v1 */
+310
static inline void
+311
xdg_activation_token_v1_set_user_data(struct xdg_activation_token_v1 *xdg_activation_token_v1, void *user_data)
+312
{
+313
wl_proxy_set_user_data((struct wl_proxy *) xdg_activation_token_v1, user_data);
+314
}
+315
+316
/** @ingroup iface_xdg_activation_token_v1 */
+317
static inline void *
+318
xdg_activation_token_v1_get_user_data(struct xdg_activation_token_v1 *xdg_activation_token_v1)
+319
{
+320
return wl_proxy_get_user_data((struct wl_proxy *) xdg_activation_token_v1);
+321
}
+322
+323
static inline uint32_t
+324
xdg_activation_token_v1_get_version(struct xdg_activation_token_v1 *xdg_activation_token_v1)
+325
{
+326
return wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1);
+327
}
+328
+329
/**
+330
* @ingroup iface_xdg_activation_token_v1
+331
*
+332
* Provides information about the seat and serial event that requested the
+333
* token.
+334
*
+335
* The serial can come from an input or focus event. For instance, if a
+336
* click triggers the launch of a third-party client, the launcher client
+337
* should send a set_serial request with the serial and seat from the
+338
* wl_pointer.button event.
+339
*
+340
* Some compositors might refuse to activate toplevels when the token
+341
* doesn't have a valid and recent enough event serial.
+342
*
+343
* Must be sent before commit. This information is optional.
+344
*/
+345
static inline void
+346
xdg_activation_token_v1_set_serial(struct xdg_activation_token_v1 *xdg_activation_token_v1, uint32_t serial, struct wl_seat *seat)
+347
{
+348
wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_token_v1,
+349
XDG_ACTIVATION_TOKEN_V1_SET_SERIAL, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1), 0, serial, seat);
+350
}
+351
+352
/**
+353
* @ingroup iface_xdg_activation_token_v1
+354
*
+355
* The requesting client can specify an app_id to associate the token
+356
* being created with it.
+357
*
+358
* Must be sent before commit. This information is optional.
+359
*/
+360
static inline void
+361
xdg_activation_token_v1_set_app_id(struct xdg_activation_token_v1 *xdg_activation_token_v1, const char *app_id)
+362
{
+363
wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_token_v1,
+364
XDG_ACTIVATION_TOKEN_V1_SET_APP_ID, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1), 0, app_id);
+365
}
+366
+367
/**
+368
* @ingroup iface_xdg_activation_token_v1
+369
*
+370
* This request sets the surface requesting the activation. Note, this is
+371
* different from the surface that will be activated.
+372
*
+373
* Some compositors might refuse to activate toplevels when the token
+374
* doesn't have a requesting surface.
+375
*
+376
* Must be sent before commit. This information is optional.
+377
*/
+378
static inline void
+379
xdg_activation_token_v1_set_surface(struct xdg_activation_token_v1 *xdg_activation_token_v1, struct wl_surface *surface)
+380
{
+381
wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_token_v1,
+382
XDG_ACTIVATION_TOKEN_V1_SET_SURFACE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1), 0, surface);
+383
}
+384
+385
/**
+386
* @ingroup iface_xdg_activation_token_v1
+387
*
+388
* Requests an activation token based on the different parameters that
+389
* have been offered through set_serial, set_surface and set_app_id.
+390
*/
+391
static inline void
+392
xdg_activation_token_v1_commit(struct xdg_activation_token_v1 *xdg_activation_token_v1)
+393
{
+394
wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_token_v1,
+395
XDG_ACTIVATION_TOKEN_V1_COMMIT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1), 0);
+396
}
+397
+398
/**
+399
* @ingroup iface_xdg_activation_token_v1
+400
*
+401
* Notify the compositor that the xdg_activation_token_v1 object will no
+402
* longer be used. The received token stays valid.
+403
*/
+404
static inline void
+405
xdg_activation_token_v1_destroy(struct xdg_activation_token_v1 *xdg_activation_token_v1)
+406
{
+407
wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_token_v1,
+408
XDG_ACTIVATION_TOKEN_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1), WL_MARSHAL_FLAG_DESTROY);
+409
}
+410
+411
#ifdef __cplusplus
+412
}
+413
#endif
+414
+415
#endif
vendor/glfw/src/wayland-protocols/xdg-decoration-unstable-v1-client-protocol-code.hadded
@@ -0,0 +1,76 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
/*
+4
* Copyright © 2018 Simon Ser
+5
*
+6
* Permission is hereby granted, free of charge, to any person obtaining a
+7
* copy of this software and associated documentation files (the "Software"),
+8
* to deal in the Software without restriction, including without limitation
+9
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+10
* and/or sell copies of the Software, and to permit persons to whom the
+11
* Software is furnished to do so, subject to the following conditions:
+12
*
+13
* The above copyright notice and this permission notice (including the next
+14
* paragraph) shall be included in all copies or substantial portions of the
+15
* Software.
+16
*
+17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+18
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+19
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+20
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+21
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+22
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+23
* DEALINGS IN THE SOFTWARE.
+24
*/
+25
+26
#include <stdbool.h>
+27
#include <stdlib.h>
+28
#include <stdint.h>
+29
#include "wayland-util.h"
+30
+31
#ifndef __has_attribute
+32
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+33
#endif
+34
+35
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
+36
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
+37
#else
+38
#define WL_PRIVATE
+39
#endif
+40
+41
extern const struct wl_interface xdg_toplevel_interface;
+42
extern const struct wl_interface zxdg_toplevel_decoration_v1_interface;
+43
+44
static const struct wl_interface *xdg_decoration_unstable_v1_types[] = {
+45
NULL,
+46
&zxdg_toplevel_decoration_v1_interface,
+47
&xdg_toplevel_interface,
+48
};
+49
+50
static const struct wl_message zxdg_decoration_manager_v1_requests[] = {
+51
{ "destroy", "", xdg_decoration_unstable_v1_types + 0 },
+52
{ "get_toplevel_decoration", "no", xdg_decoration_unstable_v1_types + 1 },
+53
};
+54
+55
WL_PRIVATE const struct wl_interface zxdg_decoration_manager_v1_interface = {
+56
"zxdg_decoration_manager_v1", 1,
+57
2, zxdg_decoration_manager_v1_requests,
+58
0, NULL,
+59
};
+60
+61
static const struct wl_message zxdg_toplevel_decoration_v1_requests[] = {
+62
{ "destroy", "", xdg_decoration_unstable_v1_types + 0 },
+63
{ "set_mode", "u", xdg_decoration_unstable_v1_types + 0 },
+64
{ "unset_mode", "", xdg_decoration_unstable_v1_types + 0 },
+65
};
+66
+67
static const struct wl_message zxdg_toplevel_decoration_v1_events[] = {
+68
{ "configure", "u", xdg_decoration_unstable_v1_types + 0 },
+69
};
+70
+71
WL_PRIVATE const struct wl_interface zxdg_toplevel_decoration_v1_interface = {
+72
"zxdg_toplevel_decoration_v1", 1,
+73
3, zxdg_toplevel_decoration_v1_requests,
+74
1, zxdg_toplevel_decoration_v1_events,
+75
};
+76
vendor/glfw/src/wayland-protocols/xdg-decoration-unstable-v1-client-protocol.hadded
@@ -0,0 +1,378 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
#ifndef XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H
+4
#define XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H
+5
+6
#include <stdint.h>
+7
#include <stddef.h>
+8
#include "wayland-client.h"
+9
+10
#ifdef __cplusplus
+11
extern "C" {
+12
#endif
+13
+14
/**
+15
* @page page_xdg_decoration_unstable_v1 The xdg_decoration_unstable_v1 protocol
+16
* @section page_ifaces_xdg_decoration_unstable_v1 Interfaces
+17
* - @subpage page_iface_zxdg_decoration_manager_v1 - window decoration manager
+18
* - @subpage page_iface_zxdg_toplevel_decoration_v1 - decoration object for a toplevel surface
+19
* @section page_copyright_xdg_decoration_unstable_v1 Copyright
+20
* <pre>
+21
*
+22
* Copyright © 2018 Simon Ser
+23
*
+24
* Permission is hereby granted, free of charge, to any person obtaining a
+25
* copy of this software and associated documentation files (the "Software"),
+26
* to deal in the Software without restriction, including without limitation
+27
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+28
* and/or sell copies of the Software, and to permit persons to whom the
+29
* Software is furnished to do so, subject to the following conditions:
+30
*
+31
* The above copyright notice and this permission notice (including the next
+32
* paragraph) shall be included in all copies or substantial portions of the
+33
* Software.
+34
*
+35
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+36
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+37
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+38
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+39
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+40
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+41
* DEALINGS IN THE SOFTWARE.
+42
* </pre>
+43
*/
+44
struct xdg_toplevel;
+45
struct zxdg_decoration_manager_v1;
+46
struct zxdg_toplevel_decoration_v1;
+47
+48
#ifndef ZXDG_DECORATION_MANAGER_V1_INTERFACE
+49
#define ZXDG_DECORATION_MANAGER_V1_INTERFACE
+50
/**
+51
* @page page_iface_zxdg_decoration_manager_v1 zxdg_decoration_manager_v1
+52
* @section page_iface_zxdg_decoration_manager_v1_desc Description
+53
*
+54
* This interface allows a compositor to announce support for server-side
+55
* decorations.
+56
*
+57
* A window decoration is a set of window controls as deemed appropriate by
+58
* the party managing them, such as user interface components used to move,
+59
* resize and change a window's state.
+60
*
+61
* A client can use this protocol to request being decorated by a supporting
+62
* compositor.
+63
*
+64
* If compositor and client do not negotiate the use of a server-side
+65
* decoration using this protocol, clients continue to self-decorate as they
+66
* see fit.
+67
*
+68
* Warning! The protocol described in this file is experimental and
+69
* backward incompatible changes may be made. Backward compatible changes
+70
* may be added together with the corresponding interface version bump.
+71
* Backward incompatible changes are done by bumping the version number in
+72
* the protocol and interface names and resetting the interface version.
+73
* Once the protocol is to be declared stable, the 'z' prefix and the
+74
* version number in the protocol and interface names are removed and the
+75
* interface version number is reset.
+76
* @section page_iface_zxdg_decoration_manager_v1_api API
+77
* See @ref iface_zxdg_decoration_manager_v1.
+78
*/
+79
/**
+80
* @defgroup iface_zxdg_decoration_manager_v1 The zxdg_decoration_manager_v1 interface
+81
*
+82
* This interface allows a compositor to announce support for server-side
+83
* decorations.
+84
*
+85
* A window decoration is a set of window controls as deemed appropriate by
+86
* the party managing them, such as user interface components used to move,
+87
* resize and change a window's state.
+88
*
+89
* A client can use this protocol to request being decorated by a supporting
+90
* compositor.
+91
*
+92
* If compositor and client do not negotiate the use of a server-side
+93
* decoration using this protocol, clients continue to self-decorate as they
+94
* see fit.
+95
*
+96
* Warning! The protocol described in this file is experimental and
+97
* backward incompatible changes may be made. Backward compatible changes
+98
* may be added together with the corresponding interface version bump.
+99
* Backward incompatible changes are done by bumping the version number in
+100
* the protocol and interface names and resetting the interface version.
+101
* Once the protocol is to be declared stable, the 'z' prefix and the
+102
* version number in the protocol and interface names are removed and the
+103
* interface version number is reset.
+104
*/
+105
extern const struct wl_interface zxdg_decoration_manager_v1_interface;
+106
#endif
+107
#ifndef ZXDG_TOPLEVEL_DECORATION_V1_INTERFACE
+108
#define ZXDG_TOPLEVEL_DECORATION_V1_INTERFACE
+109
/**
+110
* @page page_iface_zxdg_toplevel_decoration_v1 zxdg_toplevel_decoration_v1
+111
* @section page_iface_zxdg_toplevel_decoration_v1_desc Description
+112
*
+113
* The decoration object allows the compositor to toggle server-side window
+114
* decorations for a toplevel surface. The client can request to switch to
+115
* another mode.
+116
*
+117
* The xdg_toplevel_decoration object must be destroyed before its
+118
* xdg_toplevel.
+119
* @section page_iface_zxdg_toplevel_decoration_v1_api API
+120
* See @ref iface_zxdg_toplevel_decoration_v1.
+121
*/
+122
/**
+123
* @defgroup iface_zxdg_toplevel_decoration_v1 The zxdg_toplevel_decoration_v1 interface
+124
*
+125
* The decoration object allows the compositor to toggle server-side window
+126
* decorations for a toplevel surface. The client can request to switch to
+127
* another mode.
+128
*
+129
* The xdg_toplevel_decoration object must be destroyed before its
+130
* xdg_toplevel.
+131
*/
+132
extern const struct wl_interface zxdg_toplevel_decoration_v1_interface;
+133
#endif
+134
+135
#define ZXDG_DECORATION_MANAGER_V1_DESTROY 0
+136
#define ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION 1
+137
+138
+139
/**
+140
* @ingroup iface_zxdg_decoration_manager_v1
+141
*/
+142
#define ZXDG_DECORATION_MANAGER_V1_DESTROY_SINCE_VERSION 1
+143
/**
+144
* @ingroup iface_zxdg_decoration_manager_v1
+145
*/
+146
#define ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION_SINCE_VERSION 1
+147
+148
/** @ingroup iface_zxdg_decoration_manager_v1 */
+149
static inline void
+150
zxdg_decoration_manager_v1_set_user_data(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1, void *user_data)
+151
{
+152
wl_proxy_set_user_data((struct wl_proxy *) zxdg_decoration_manager_v1, user_data);
+153
}
+154
+155
/** @ingroup iface_zxdg_decoration_manager_v1 */
+156
static inline void *
+157
zxdg_decoration_manager_v1_get_user_data(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
+158
{
+159
return wl_proxy_get_user_data((struct wl_proxy *) zxdg_decoration_manager_v1);
+160
}
+161
+162
static inline uint32_t
+163
zxdg_decoration_manager_v1_get_version(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
+164
{
+165
return wl_proxy_get_version((struct wl_proxy *) zxdg_decoration_manager_v1);
+166
}
+167
+168
/**
+169
* @ingroup iface_zxdg_decoration_manager_v1
+170
*
+171
* Destroy the decoration manager. This doesn't destroy objects created
+172
* with the manager.
+173
*/
+174
static inline void
+175
zxdg_decoration_manager_v1_destroy(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
+176
{
+177
wl_proxy_marshal_flags((struct wl_proxy *) zxdg_decoration_manager_v1,
+178
ZXDG_DECORATION_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_decoration_manager_v1), WL_MARSHAL_FLAG_DESTROY);
+179
}
+180
+181
/**
+182
* @ingroup iface_zxdg_decoration_manager_v1
+183
*
+184
* Create a new decoration object associated with the given toplevel.
+185
*
+186
* Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
+187
* buffer attached or committed is a client error, and any attempts by a
+188
* client to attach or manipulate a buffer prior to the first
+189
* xdg_toplevel_decoration.configure event must also be treated as
+190
* errors.
+191
*/
+192
static inline struct zxdg_toplevel_decoration_v1 *
+193
zxdg_decoration_manager_v1_get_toplevel_decoration(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1, struct xdg_toplevel *toplevel)
+194
{
+195
struct wl_proxy *id;
+196
+197
id = wl_proxy_marshal_flags((struct wl_proxy *) zxdg_decoration_manager_v1,
+198
ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION, &zxdg_toplevel_decoration_v1_interface, wl_proxy_get_version((struct wl_proxy *) zxdg_decoration_manager_v1), 0, NULL, toplevel);
+199
+200
return (struct zxdg_toplevel_decoration_v1 *) id;
+201
}
+202
+203
#ifndef ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM
+204
#define ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM
+205
enum zxdg_toplevel_decoration_v1_error {
+206
/**
+207
* xdg_toplevel has a buffer attached before configure
+208
*/
+209
ZXDG_TOPLEVEL_DECORATION_V1_ERROR_UNCONFIGURED_BUFFER = 0,
+210
/**
+211
* xdg_toplevel already has a decoration object
+212
*/
+213
ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ALREADY_CONSTRUCTED = 1,
+214
/**
+215
* xdg_toplevel destroyed before the decoration object
+216
*/
+217
ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ORPHANED = 2,
+218
};
+219
#endif /* ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM */
+220
+221
#ifndef ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM
+222
#define ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM
+223
/**
+224
* @ingroup iface_zxdg_toplevel_decoration_v1
+225
* window decoration modes
+226
*
+227
* These values describe window decoration modes.
+228
*/
+229
enum zxdg_toplevel_decoration_v1_mode {
+230
/**
+231
* no server-side window decoration
+232
*/
+233
ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE = 1,
+234
/**
+235
* server-side window decoration
+236
*/
+237
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE = 2,
+238
};
+239
#endif /* ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM */
+240
+241
/**
+242
* @ingroup iface_zxdg_toplevel_decoration_v1
+243
* @struct zxdg_toplevel_decoration_v1_listener
+244
*/
+245
struct zxdg_toplevel_decoration_v1_listener {
+246
/**
+247
* suggest a surface change
+248
*
+249
* The configure event asks the client to change its decoration
+250
* mode. The configured state should not be applied immediately.
+251
* Clients must send an ack_configure in response to this event.
+252
* See xdg_surface.configure and xdg_surface.ack_configure for
+253
* details.
+254
*
+255
* A configure event can be sent at any time. The specified mode
+256
* must be obeyed by the client.
+257
* @param mode the decoration mode
+258
*/
+259
void (*configure)(void *data,
+260
struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1,
+261
uint32_t mode);
+262
};
+263
+264
/**
+265
* @ingroup iface_zxdg_toplevel_decoration_v1
+266
*/
+267
static inline int
+268
zxdg_toplevel_decoration_v1_add_listener(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1,
+269
const struct zxdg_toplevel_decoration_v1_listener *listener, void *data)
+270
{
+271
return wl_proxy_add_listener((struct wl_proxy *) zxdg_toplevel_decoration_v1,
+272
(void (**)(void)) listener, data);
+273
}
+274
+275
#define ZXDG_TOPLEVEL_DECORATION_V1_DESTROY 0
+276
#define ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE 1
+277
#define ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE 2
+278
+279
/**
+280
* @ingroup iface_zxdg_toplevel_decoration_v1
+281
*/
+282
#define ZXDG_TOPLEVEL_DECORATION_V1_CONFIGURE_SINCE_VERSION 1
+283
+284
/**
+285
* @ingroup iface_zxdg_toplevel_decoration_v1
+286
*/
+287
#define ZXDG_TOPLEVEL_DECORATION_V1_DESTROY_SINCE_VERSION 1
+288
/**
+289
* @ingroup iface_zxdg_toplevel_decoration_v1
+290
*/
+291
#define ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE_SINCE_VERSION 1
+292
/**
+293
* @ingroup iface_zxdg_toplevel_decoration_v1
+294
*/
+295
#define ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE_SINCE_VERSION 1
+296
+297
/** @ingroup iface_zxdg_toplevel_decoration_v1 */
+298
static inline void
+299
zxdg_toplevel_decoration_v1_set_user_data(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, void *user_data)
+300
{
+301
wl_proxy_set_user_data((struct wl_proxy *) zxdg_toplevel_decoration_v1, user_data);
+302
}
+303
+304
/** @ingroup iface_zxdg_toplevel_decoration_v1 */
+305
static inline void *
+306
zxdg_toplevel_decoration_v1_get_user_data(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
+307
{
+308
return wl_proxy_get_user_data((struct wl_proxy *) zxdg_toplevel_decoration_v1);
+309
}
+310
+311
static inline uint32_t
+312
zxdg_toplevel_decoration_v1_get_version(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
+313
{
+314
return wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_decoration_v1);
+315
}
+316
+317
/**
+318
* @ingroup iface_zxdg_toplevel_decoration_v1
+319
*
+320
* Switch back to a mode without any server-side decorations at the next
+321
* commit.
+322
*/
+323
static inline void
+324
zxdg_toplevel_decoration_v1_destroy(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
+325
{
+326
wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_decoration_v1,
+327
ZXDG_TOPLEVEL_DECORATION_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_decoration_v1), WL_MARSHAL_FLAG_DESTROY);
+328
}
+329
+330
/**
+331
* @ingroup iface_zxdg_toplevel_decoration_v1
+332
*
+333
* Set the toplevel surface decoration mode. This informs the compositor
+334
* that the client prefers the provided decoration mode.
+335
*
+336
* After requesting a decoration mode, the compositor will respond by
+337
* emitting an xdg_surface.configure event. The client should then update
+338
* its content, drawing it without decorations if the received mode is
+339
* server-side decorations. The client must also acknowledge the configure
+340
* when committing the new content (see xdg_surface.ack_configure).
+341
*
+342
* The compositor can decide not to use the client's mode and enforce a
+343
* different mode instead.
+344
*
+345
* Clients whose decoration mode depend on the xdg_toplevel state may send
+346
* a set_mode request in response to an xdg_surface.configure event and wait
+347
* for the next xdg_surface.configure event to prevent unwanted state.
+348
* Such clients are responsible for preventing configure loops and must
+349
* make sure not to send multiple successive set_mode requests with the
+350
* same decoration mode.
+351
*/
+352
static inline void
+353
zxdg_toplevel_decoration_v1_set_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, uint32_t mode)
+354
{
+355
wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_decoration_v1,
+356
ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_decoration_v1), 0, mode);
+357
}
+358
+359
/**
+360
* @ingroup iface_zxdg_toplevel_decoration_v1
+361
*
+362
* Unset the toplevel surface decoration mode. This informs the compositor
+363
* that the client doesn't prefer a particular decoration mode.
+364
*
+365
* This request has the same semantics as set_mode.
+366
*/
+367
static inline void
+368
zxdg_toplevel_decoration_v1_unset_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
+369
{
+370
wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_decoration_v1,
+371
ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_decoration_v1), 0);
+372
}
+373
+374
#ifdef __cplusplus
+375
}
+376
#endif
+377
+378
#endif
vendor/glfw/src/wayland-protocols/xdg-shell-client-protocol-code.hadded
@@ -0,0 +1,184 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
/*
+4
* Copyright © 2008-2013 Kristian Høgsberg
+5
* Copyright © 2013 Rafael Antognolli
+6
* Copyright © 2013 Jasper St. Pierre
+7
* Copyright © 2010-2013 Intel Corporation
+8
* Copyright © 2015-2017 Samsung Electronics Co., Ltd
+9
* Copyright © 2015-2017 Red Hat Inc.
+10
*
+11
* Permission is hereby granted, free of charge, to any person obtaining a
+12
* copy of this software and associated documentation files (the "Software"),
+13
* to deal in the Software without restriction, including without limitation
+14
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+15
* and/or sell copies of the Software, and to permit persons to whom the
+16
* Software is furnished to do so, subject to the following conditions:
+17
*
+18
* The above copyright notice and this permission notice (including the next
+19
* paragraph) shall be included in all copies or substantial portions of the
+20
* Software.
+21
*
+22
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+23
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+24
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+25
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+26
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+27
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+28
* DEALINGS IN THE SOFTWARE.
+29
*/
+30
+31
#include <stdbool.h>
+32
#include <stdlib.h>
+33
#include <stdint.h>
+34
#include "wayland-util.h"
+35
+36
#ifndef __has_attribute
+37
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+38
#endif
+39
+40
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
+41
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
+42
#else
+43
#define WL_PRIVATE
+44
#endif
+45
+46
extern const struct wl_interface wl_output_interface;
+47
extern const struct wl_interface wl_seat_interface;
+48
extern const struct wl_interface wl_surface_interface;
+49
extern const struct wl_interface xdg_popup_interface;
+50
extern const struct wl_interface xdg_positioner_interface;
+51
extern const struct wl_interface xdg_surface_interface;
+52
extern const struct wl_interface xdg_toplevel_interface;
+53
+54
static const struct wl_interface *xdg_shell_types[] = {
+55
NULL,
+56
NULL,
+57
NULL,
+58
NULL,
+59
&xdg_positioner_interface,
+60
&xdg_surface_interface,
+61
&wl_surface_interface,
+62
&xdg_toplevel_interface,
+63
&xdg_popup_interface,
+64
&xdg_surface_interface,
+65
&xdg_positioner_interface,
+66
&xdg_toplevel_interface,
+67
&wl_seat_interface,
+68
NULL,
+69
NULL,
+70
NULL,
+71
&wl_seat_interface,
+72
NULL,
+73
&wl_seat_interface,
+74
NULL,
+75
NULL,
+76
&wl_output_interface,
+77
&wl_seat_interface,
+78
NULL,
+79
&xdg_positioner_interface,
+80
NULL,
+81
};
+82
+83
static const struct wl_message xdg_wm_base_requests[] = {
+84
{ "destroy", "", xdg_shell_types + 0 },
+85
{ "create_positioner", "n", xdg_shell_types + 4 },
+86
{ "get_xdg_surface", "no", xdg_shell_types + 5 },
+87
{ "pong", "u", xdg_shell_types + 0 },
+88
};
+89
+90
static const struct wl_message xdg_wm_base_events[] = {
+91
{ "ping", "u", xdg_shell_types + 0 },
+92
};
+93
+94
WL_PRIVATE const struct wl_interface xdg_wm_base_interface = {
+95
"xdg_wm_base", 6,
+96
4, xdg_wm_base_requests,
+97
1, xdg_wm_base_events,
+98
};
+99
+100
static const struct wl_message xdg_positioner_requests[] = {
+101
{ "destroy", "", xdg_shell_types + 0 },
+102
{ "set_size", "ii", xdg_shell_types + 0 },
+103
{ "set_anchor_rect", "iiii", xdg_shell_types + 0 },
+104
{ "set_anchor", "u", xdg_shell_types + 0 },
+105
{ "set_gravity", "u", xdg_shell_types + 0 },
+106
{ "set_constraint_adjustment", "u", xdg_shell_types + 0 },
+107
{ "set_offset", "ii", xdg_shell_types + 0 },
+108
{ "set_reactive", "3", xdg_shell_types + 0 },
+109
{ "set_parent_size", "3ii", xdg_shell_types + 0 },
+110
{ "set_parent_configure", "3u", xdg_shell_types + 0 },
+111
};
+112
+113
WL_PRIVATE const struct wl_interface xdg_positioner_interface = {
+114
"xdg_positioner", 6,
+115
10, xdg_positioner_requests,
+116
0, NULL,
+117
};
+118
+119
static const struct wl_message xdg_surface_requests[] = {
+120
{ "destroy", "", xdg_shell_types + 0 },
+121
{ "get_toplevel", "n", xdg_shell_types + 7 },
+122
{ "get_popup", "n?oo", xdg_shell_types + 8 },
+123
{ "set_window_geometry", "iiii", xdg_shell_types + 0 },
+124
{ "ack_configure", "u", xdg_shell_types + 0 },
+125
};
+126
+127
static const struct wl_message xdg_surface_events[] = {
+128
{ "configure", "u", xdg_shell_types + 0 },
+129
};
+130
+131
WL_PRIVATE const struct wl_interface xdg_surface_interface = {
+132
"xdg_surface", 6,
+133
5, xdg_surface_requests,
+134
1, xdg_surface_events,
+135
};
+136
+137
static const struct wl_message xdg_toplevel_requests[] = {
+138
{ "destroy", "", xdg_shell_types + 0 },
+139
{ "set_parent", "?o", xdg_shell_types + 11 },
+140
{ "set_title", "s", xdg_shell_types + 0 },
+141
{ "set_app_id", "s", xdg_shell_types + 0 },
+142
{ "show_window_menu", "ouii", xdg_shell_types + 12 },
+143
{ "move", "ou", xdg_shell_types + 16 },
+144
{ "resize", "ouu", xdg_shell_types + 18 },
+145
{ "set_max_size", "ii", xdg_shell_types + 0 },
+146
{ "set_min_size", "ii", xdg_shell_types + 0 },
+147
{ "set_maximized", "", xdg_shell_types + 0 },
+148
{ "unset_maximized", "", xdg_shell_types + 0 },
+149
{ "set_fullscreen", "?o", xdg_shell_types + 21 },
+150
{ "unset_fullscreen", "", xdg_shell_types + 0 },
+151
{ "set_minimized", "", xdg_shell_types + 0 },
+152
};
+153
+154
static const struct wl_message xdg_toplevel_events[] = {
+155
{ "configure", "iia", xdg_shell_types + 0 },
+156
{ "close", "", xdg_shell_types + 0 },
+157
{ "configure_bounds", "4ii", xdg_shell_types + 0 },
+158
{ "wm_capabilities", "5a", xdg_shell_types + 0 },
+159
};
+160
+161
WL_PRIVATE const struct wl_interface xdg_toplevel_interface = {
+162
"xdg_toplevel", 6,
+163
14, xdg_toplevel_requests,
+164
4, xdg_toplevel_events,
+165
};
+166
+167
static const struct wl_message xdg_popup_requests[] = {
+168
{ "destroy", "", xdg_shell_types + 0 },
+169
{ "grab", "ou", xdg_shell_types + 22 },
+170
{ "reposition", "3ou", xdg_shell_types + 24 },
+171
};
+172
+173
static const struct wl_message xdg_popup_events[] = {
+174
{ "configure", "iiii", xdg_shell_types + 0 },
+175
{ "popup_done", "", xdg_shell_types + 0 },
+176
{ "repositioned", "3u", xdg_shell_types + 0 },
+177
};
+178
+179
WL_PRIVATE const struct wl_interface xdg_popup_interface = {
+180
"xdg_popup", 6,
+181
3, xdg_popup_requests,
+182
3, xdg_popup_events,
+183
};
+184
vendor/glfw/src/wayland-protocols/xdg-shell-client-protocol.hadded
@@ -0,0 +1,2307 @@
+1
/* Generated by wayland-scanner 1.24.0 */
+2
+3
#ifndef XDG_SHELL_CLIENT_PROTOCOL_H
+4
#define XDG_SHELL_CLIENT_PROTOCOL_H
+5
+6
#include <stdint.h>
+7
#include <stddef.h>
+8
#include "wayland-client.h"
+9
+10
#ifdef __cplusplus
+11
extern "C" {
+12
#endif
+13
+14
/**
+15
* @page page_xdg_shell The xdg_shell protocol
+16
* @section page_ifaces_xdg_shell Interfaces
+17
* - @subpage page_iface_xdg_wm_base - create desktop-style surfaces
+18
* - @subpage page_iface_xdg_positioner - child surface positioner
+19
* - @subpage page_iface_xdg_surface - desktop user interface surface base interface
+20
* - @subpage page_iface_xdg_toplevel - toplevel surface
+21
* - @subpage page_iface_xdg_popup - short-lived, popup surfaces for menus
+22
* @section page_copyright_xdg_shell Copyright
+23
* <pre>
+24
*
+25
* Copyright © 2008-2013 Kristian Høgsberg
+26
* Copyright © 2013 Rafael Antognolli
+27
* Copyright © 2013 Jasper St. Pierre
+28
* Copyright © 2010-2013 Intel Corporation
+29
* Copyright © 2015-2017 Samsung Electronics Co., Ltd
+30
* Copyright © 2015-2017 Red Hat Inc.
+31
*
+32
* Permission is hereby granted, free of charge, to any person obtaining a
+33
* copy of this software and associated documentation files (the "Software"),
+34
* to deal in the Software without restriction, including without limitation
+35
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+36
* and/or sell copies of the Software, and to permit persons to whom the
+37
* Software is furnished to do so, subject to the following conditions:
+38
*
+39
* The above copyright notice and this permission notice (including the next
+40
* paragraph) shall be included in all copies or substantial portions of the
+41
* Software.
+42
*
+43
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+44
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+45
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+46
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+47
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+48
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+49
* DEALINGS IN THE SOFTWARE.
+50
* </pre>
+51
*/
+52
struct wl_output;
+53
struct wl_seat;
+54
struct wl_surface;
+55
struct xdg_popup;
+56
struct xdg_positioner;
+57
struct xdg_surface;
+58
struct xdg_toplevel;
+59
struct xdg_wm_base;
+60
+61
#ifndef XDG_WM_BASE_INTERFACE
+62
#define XDG_WM_BASE_INTERFACE
+63
/**
+64
* @page page_iface_xdg_wm_base xdg_wm_base
+65
* @section page_iface_xdg_wm_base_desc Description
+66
*
+67
* The xdg_wm_base interface is exposed as a global object enabling clients
+68
* to turn their wl_surfaces into windows in a desktop environment. It
+69
* defines the basic functionality needed for clients and the compositor to
+70
* create windows that can be dragged, resized, maximized, etc, as well as
+71
* creating transient windows such as popup menus.
+72
* @section page_iface_xdg_wm_base_api API
+73
* See @ref iface_xdg_wm_base.
+74
*/
+75
/**
+76
* @defgroup iface_xdg_wm_base The xdg_wm_base interface
+77
*
+78
* The xdg_wm_base interface is exposed as a global object enabling clients
+79
* to turn their wl_surfaces into windows in a desktop environment. It
+80
* defines the basic functionality needed for clients and the compositor to
+81
* create windows that can be dragged, resized, maximized, etc, as well as
+82
* creating transient windows such as popup menus.
+83
*/
+84
extern const struct wl_interface xdg_wm_base_interface;
+85
#endif
+86
#ifndef XDG_POSITIONER_INTERFACE
+87
#define XDG_POSITIONER_INTERFACE
+88
/**
+89
* @page page_iface_xdg_positioner xdg_positioner
+90
* @section page_iface_xdg_positioner_desc Description
+91
*
+92
* The xdg_positioner provides a collection of rules for the placement of a
+93
* child surface relative to a parent surface. Rules can be defined to ensure
+94
* the child surface remains within the visible area's borders, and to
+95
* specify how the child surface changes its position, such as sliding along
+96
* an axis, or flipping around a rectangle. These positioner-created rules are
+97
* constrained by the requirement that a child surface must intersect with or
+98
* be at least partially adjacent to its parent surface.
+99
*
+100
* See the various requests for details about possible rules.
+101
*
+102
* At the time of the request, the compositor makes a copy of the rules
+103
* specified by the xdg_positioner. Thus, after the request is complete the
+104
* xdg_positioner object can be destroyed or reused; further changes to the
+105
* object will have no effect on previous usages.
+106
*
+107
* For an xdg_positioner object to be considered complete, it must have a
+108
* non-zero size set by set_size, and a non-zero anchor rectangle set by
+109
* set_anchor_rect. Passing an incomplete xdg_positioner object when
+110
* positioning a surface raises an invalid_positioner error.
+111
* @section page_iface_xdg_positioner_api API
+112
* See @ref iface_xdg_positioner.
+113
*/
+114
/**
+115
* @defgroup iface_xdg_positioner The xdg_positioner interface
+116
*
+117
* The xdg_positioner provides a collection of rules for the placement of a
+118
* child surface relative to a parent surface. Rules can be defined to ensure
+119
* the child surface remains within the visible area's borders, and to
+120
* specify how the child surface changes its position, such as sliding along
+121
* an axis, or flipping around a rectangle. These positioner-created rules are
+122
* constrained by the requirement that a child surface must intersect with or
+123
* be at least partially adjacent to its parent surface.
+124
*
+125
* See the various requests for details about possible rules.
+126
*
+127
* At the time of the request, the compositor makes a copy of the rules
+128
* specified by the xdg_positioner. Thus, after the request is complete the
+129
* xdg_positioner object can be destroyed or reused; further changes to the
+130
* object will have no effect on previous usages.
+131
*
+132
* For an xdg_positioner object to be considered complete, it must have a
+133
* non-zero size set by set_size, and a non-zero anchor rectangle set by
+134
* set_anchor_rect. Passing an incomplete xdg_positioner object when
+135
* positioning a surface raises an invalid_positioner error.
+136
*/
+137
extern const struct wl_interface xdg_positioner_interface;
+138
#endif
+139
#ifndef XDG_SURFACE_INTERFACE
+140
#define XDG_SURFACE_INTERFACE
+141
/**
+142
* @page page_iface_xdg_surface xdg_surface
+143
* @section page_iface_xdg_surface_desc Description
+144
*
+145
* An interface that may be implemented by a wl_surface, for
+146
* implementations that provide a desktop-style user interface.
+147
*
+148
* It provides a base set of functionality required to construct user
+149
* interface elements requiring management by the compositor, such as
+150
* toplevel windows, menus, etc. The types of functionality are split into
+151
* xdg_surface roles.
+152
*
+153
* Creating an xdg_surface does not set the role for a wl_surface. In order
+154
* to map an xdg_surface, the client must create a role-specific object
+155
* using, e.g., get_toplevel, get_popup. The wl_surface for any given
+156
* xdg_surface can have at most one role, and may not be assigned any role
+157
* not based on xdg_surface.
+158
*
+159
* A role must be assigned before any other requests are made to the
+160
* xdg_surface object.
+161
*
+162
* The client must call wl_surface.commit on the corresponding wl_surface
+163
* for the xdg_surface state to take effect.
+164
*
+165
* Creating an xdg_surface from a wl_surface which has a buffer attached or
+166
* committed is a client error, and any attempts by a client to attach or
+167
* manipulate a buffer prior to the first xdg_surface.configure call must
+168
* also be treated as errors.
+169
*
+170
* After creating a role-specific object and setting it up, the client must
+171
* perform an initial commit without any buffer attached. The compositor
+172
* will reply with initial wl_surface state such as
+173
* wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
+174
* event. The client must acknowledge it and is then allowed to attach a
+175
* buffer to map the surface.
+176
*
+177
* Mapping an xdg_surface-based role surface is defined as making it
+178
* possible for the surface to be shown by the compositor. Note that
+179
* a mapped surface is not guaranteed to be visible once it is mapped.
+180
*
+181
* For an xdg_surface to be mapped by the compositor, the following
+182
* conditions must be met:
+183
* (1) the client has assigned an xdg_surface-based role to the surface
+184
* (2) the client has set and committed the xdg_surface state and the
+185
* role-dependent state to the surface
+186
* (3) the client has committed a buffer to the surface
+187
*
+188
* A newly-unmapped surface is considered to have met condition (1) out
+189
* of the 3 required conditions for mapping a surface if its role surface
+190
* has not been destroyed, i.e. the client must perform the initial commit
+191
* again before attaching a buffer.
+192
* @section page_iface_xdg_surface_api API
+193
* See @ref iface_xdg_surface.
+194
*/
+195
/**
+196
* @defgroup iface_xdg_surface The xdg_surface interface
+197
*
+198
* An interface that may be implemented by a wl_surface, for
+199
* implementations that provide a desktop-style user interface.
+200
*
+201
* It provides a base set of functionality required to construct user
+202
* interface elements requiring management by the compositor, such as
+203
* toplevel windows, menus, etc. The types of functionality are split into
+204
* xdg_surface roles.
+205
*
+206
* Creating an xdg_surface does not set the role for a wl_surface. In order
+207
* to map an xdg_surface, the client must create a role-specific object
+208
* using, e.g., get_toplevel, get_popup. The wl_surface for any given
+209
* xdg_surface can have at most one role, and may not be assigned any role
+210
* not based on xdg_surface.
+211
*
+212
* A role must be assigned before any other requests are made to the
+213
* xdg_surface object.
+214
*
+215
* The client must call wl_surface.commit on the corresponding wl_surface
+216
* for the xdg_surface state to take effect.
+217
*
+218
* Creating an xdg_surface from a wl_surface which has a buffer attached or
+219
* committed is a client error, and any attempts by a client to attach or
+220
* manipulate a buffer prior to the first xdg_surface.configure call must
+221
* also be treated as errors.
+222
*
+223
* After creating a role-specific object and setting it up, the client must
+224
* perform an initial commit without any buffer attached. The compositor
+225
* will reply with initial wl_surface state such as
+226
* wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
+227
* event. The client must acknowledge it and is then allowed to attach a
+228
* buffer to map the surface.
+229
*
+230
* Mapping an xdg_surface-based role surface is defined as making it
+231
* possible for the surface to be shown by the compositor. Note that
+232
* a mapped surface is not guaranteed to be visible once it is mapped.
+233
*
+234
* For an xdg_surface to be mapped by the compositor, the following
+235
* conditions must be met:
+236
* (1) the client has assigned an xdg_surface-based role to the surface
+237
* (2) the client has set and committed the xdg_surface state and the
+238
* role-dependent state to the surface
+239
* (3) the client has committed a buffer to the surface
+240
*
+241
* A newly-unmapped surface is considered to have met condition (1) out
+242
* of the 3 required conditions for mapping a surface if its role surface
+243
* has not been destroyed, i.e. the client must perform the initial commit
+244
* again before attaching a buffer.
+245
*/
+246
extern const struct wl_interface xdg_surface_interface;
+247
#endif
+248
#ifndef XDG_TOPLEVEL_INTERFACE
+249
#define XDG_TOPLEVEL_INTERFACE
+250
/**
+251
* @page page_iface_xdg_toplevel xdg_toplevel
+252
* @section page_iface_xdg_toplevel_desc Description
+253
*
+254
* This interface defines an xdg_surface role which allows a surface to,
+255
* among other things, set window-like properties such as maximize,
+256
* fullscreen, and minimize, set application-specific metadata like title and
+257
* id, and well as trigger user interactive operations such as interactive
+258
* resize and move.
+259
*
+260
* Unmapping an xdg_toplevel means that the surface cannot be shown
+261
* by the compositor until it is explicitly mapped again.
+262
* All active operations (e.g., move, resize) are canceled and all
+263
* attributes (e.g. title, state, stacking, ...) are discarded for
+264
* an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
+265
* the state it had right after xdg_surface.get_toplevel. The client
+266
* can re-map the toplevel by perfoming a commit without any buffer
+267
* attached, waiting for a configure event and handling it as usual (see
+268
* xdg_surface description).
+269
*
+270
* Attaching a null buffer to a toplevel unmaps the surface.
+271
* @section page_iface_xdg_toplevel_api API
+272
* See @ref iface_xdg_toplevel.
+273
*/
+274
/**
+275
* @defgroup iface_xdg_toplevel The xdg_toplevel interface
+276
*
+277
* This interface defines an xdg_surface role which allows a surface to,
+278
* among other things, set window-like properties such as maximize,
+279
* fullscreen, and minimize, set application-specific metadata like title and
+280
* id, and well as trigger user interactive operations such as interactive
+281
* resize and move.
+282
*
+283
* Unmapping an xdg_toplevel means that the surface cannot be shown
+284
* by the compositor until it is explicitly mapped again.
+285
* All active operations (e.g., move, resize) are canceled and all
+286
* attributes (e.g. title, state, stacking, ...) are discarded for
+287
* an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
+288
* the state it had right after xdg_surface.get_toplevel. The client
+289
* can re-map the toplevel by perfoming a commit without any buffer
+290
* attached, waiting for a configure event and handling it as usual (see
+291
* xdg_surface description).
+292
*
+293
* Attaching a null buffer to a toplevel unmaps the surface.
+294
*/
+295
extern const struct wl_interface xdg_toplevel_interface;
+296
#endif
+297
#ifndef XDG_POPUP_INTERFACE
+298
#define XDG_POPUP_INTERFACE
+299
/**
+300
* @page page_iface_xdg_popup xdg_popup
+301
* @section page_iface_xdg_popup_desc Description
+302
*
+303
* A popup surface is a short-lived, temporary surface. It can be used to
+304
* implement for example menus, popovers, tooltips and other similar user
+305
* interface concepts.
+306
*
+307
* A popup can be made to take an explicit grab. See xdg_popup.grab for
+308
* details.
+309
*
+310
* When the popup is dismissed, a popup_done event will be sent out, and at
+311
* the same time the surface will be unmapped. See the xdg_popup.popup_done
+312
* event for details.
+313
*
+314
* Explicitly destroying the xdg_popup object will also dismiss the popup and
+315
* unmap the surface. Clients that want to dismiss the popup when another
+316
* surface of their own is clicked should dismiss the popup using the destroy
+317
* request.
+318
*
+319
* A newly created xdg_popup will be stacked on top of all previously created
+320
* xdg_popup surfaces associated with the same xdg_toplevel.
+321
*
+322
* The parent of an xdg_popup must be mapped (see the xdg_surface
+323
* description) before the xdg_popup itself.
+324
*
+325
* The client must call wl_surface.commit on the corresponding wl_surface
+326
* for the xdg_popup state to take effect.
+327
* @section page_iface_xdg_popup_api API
+328
* See @ref iface_xdg_popup.
+329
*/
+330
/**
+331
* @defgroup iface_xdg_popup The xdg_popup interface
+332
*
+333
* A popup surface is a short-lived, temporary surface. It can be used to
+334
* implement for example menus, popovers, tooltips and other similar user
+335
* interface concepts.
+336
*
+337
* A popup can be made to take an explicit grab. See xdg_popup.grab for
+338
* details.
+339
*
+340
* When the popup is dismissed, a popup_done event will be sent out, and at
+341
* the same time the surface will be unmapped. See the xdg_popup.popup_done
+342
* event for details.
+343
*
+344
* Explicitly destroying the xdg_popup object will also dismiss the popup and
+345
* unmap the surface. Clients that want to dismiss the popup when another
+346
* surface of their own is clicked should dismiss the popup using the destroy
+347
* request.
+348
*
+349
* A newly created xdg_popup will be stacked on top of all previously created
+350
* xdg_popup surfaces associated with the same xdg_toplevel.
+351
*
+352
* The parent of an xdg_popup must be mapped (see the xdg_surface
+353
* description) before the xdg_popup itself.
+354
*
+355
* The client must call wl_surface.commit on the corresponding wl_surface
+356
* for the xdg_popup state to take effect.
+357
*/
+358
extern const struct wl_interface xdg_popup_interface;
+359
#endif
+360
+361
#ifndef XDG_WM_BASE_ERROR_ENUM
+362
#define XDG_WM_BASE_ERROR_ENUM
+363
enum xdg_wm_base_error {
+364
/**
+365
* given wl_surface has another role
+366
*/
+367
XDG_WM_BASE_ERROR_ROLE = 0,
+368
/**
+369
* xdg_wm_base was destroyed before children
+370
*/
+371
XDG_WM_BASE_ERROR_DEFUNCT_SURFACES = 1,
+372
/**
+373
* the client tried to map or destroy a non-topmost popup
+374
*/
+375
XDG_WM_BASE_ERROR_NOT_THE_TOPMOST_POPUP = 2,
+376
/**
+377
* the client specified an invalid popup parent surface
+378
*/
+379
XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT = 3,
+380
/**
+381
* the client provided an invalid surface state
+382
*/
+383
XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE = 4,
+384
/**
+385
* the client provided an invalid positioner
+386
*/
+387
XDG_WM_BASE_ERROR_INVALID_POSITIONER = 5,
+388
/**
+389
* the client didn’t respond to a ping event in time
+390
*/
+391
XDG_WM_BASE_ERROR_UNRESPONSIVE = 6,
+392
};
+393
#endif /* XDG_WM_BASE_ERROR_ENUM */
+394
+395
/**
+396
* @ingroup iface_xdg_wm_base
+397
* @struct xdg_wm_base_listener
+398
*/
+399
struct xdg_wm_base_listener {
+400
/**
+401
* check if the client is alive
+402
*
+403
* The ping event asks the client if it's still alive. Pass the
+404
* serial specified in the event back to the compositor by sending
+405
* a "pong" request back with the specified serial. See
+406
* xdg_wm_base.pong.
+407
*
+408
* Compositors can use this to determine if the client is still
+409
* alive. It's unspecified what will happen if the client doesn't
+410
* respond to the ping request, or in what timeframe. Clients
+411
* should try to respond in a reasonable amount of time. The
+412
* “unresponsive” error is provided for compositors that wish
+413
* to disconnect unresponsive clients.
+414
*
+415
* A compositor is free to ping in any way it wants, but a client
+416
* must always respond to any xdg_wm_base object it created.
+417
* @param serial pass this to the pong request
+418
*/
+419
void (*ping)(void *data,
+420
struct xdg_wm_base *xdg_wm_base,
+421
uint32_t serial);
+422
};
+423
+424
/**
+425
* @ingroup iface_xdg_wm_base
+426
*/
+427
static inline int
+428
xdg_wm_base_add_listener(struct xdg_wm_base *xdg_wm_base,
+429
const struct xdg_wm_base_listener *listener, void *data)
+430
{
+431
return wl_proxy_add_listener((struct wl_proxy *) xdg_wm_base,
+432
(void (**)(void)) listener, data);
+433
}
+434
+435
#define XDG_WM_BASE_DESTROY 0
+436
#define XDG_WM_BASE_CREATE_POSITIONER 1
+437
#define XDG_WM_BASE_GET_XDG_SURFACE 2
+438
#define XDG_WM_BASE_PONG 3
+439
+440
/**
+441
* @ingroup iface_xdg_wm_base
+442
*/
+443
#define XDG_WM_BASE_PING_SINCE_VERSION 1
+444
+445
/**
+446
* @ingroup iface_xdg_wm_base
+447
*/
+448
#define XDG_WM_BASE_DESTROY_SINCE_VERSION 1
+449
/**
+450
* @ingroup iface_xdg_wm_base
+451
*/
+452
#define XDG_WM_BASE_CREATE_POSITIONER_SINCE_VERSION 1
+453
/**
+454
* @ingroup iface_xdg_wm_base
+455
*/
+456
#define XDG_WM_BASE_GET_XDG_SURFACE_SINCE_VERSION 1
+457
/**
+458
* @ingroup iface_xdg_wm_base
+459
*/
+460
#define XDG_WM_BASE_PONG_SINCE_VERSION 1
+461
+462
/** @ingroup iface_xdg_wm_base */
+463
static inline void
+464
xdg_wm_base_set_user_data(struct xdg_wm_base *xdg_wm_base, void *user_data)
+465
{
+466
wl_proxy_set_user_data((struct wl_proxy *) xdg_wm_base, user_data);
+467
}
+468
+469
/** @ingroup iface_xdg_wm_base */
+470
static inline void *
+471
xdg_wm_base_get_user_data(struct xdg_wm_base *xdg_wm_base)
+472
{
+473
return wl_proxy_get_user_data((struct wl_proxy *) xdg_wm_base);
+474
}
+475
+476
static inline uint32_t
+477
xdg_wm_base_get_version(struct xdg_wm_base *xdg_wm_base)
+478
{
+479
return wl_proxy_get_version((struct wl_proxy *) xdg_wm_base);
+480
}
+481
+482
/**
+483
* @ingroup iface_xdg_wm_base
+484
*
+485
* Destroy this xdg_wm_base object.
+486
*
+487
* Destroying a bound xdg_wm_base object while there are surfaces
+488
* still alive created by this xdg_wm_base object instance is illegal
+489
* and will result in a defunct_surfaces error.
+490
*/
+491
static inline void
+492
xdg_wm_base_destroy(struct xdg_wm_base *xdg_wm_base)
+493
{
+494
wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
+495
XDG_WM_BASE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), WL_MARSHAL_FLAG_DESTROY);
+496
}
+497
+498
/**
+499
* @ingroup iface_xdg_wm_base

Showing the first 500 of 2308 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/wgl_context.cadded
@@ -0,0 +1,786 @@
+1
//========================================================================
+2
// GLFW 3.5 WGL - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_WIN32)
+31
+32
#include <stdlib.h>
+33
#include <assert.h>
+34
+35
// Return the value corresponding to the specified attribute
+36
//
+37
static int findPixelFormatAttribValueWGL(const int* attribs,
+38
int attribCount,
+39
const int* values,
+40
int attrib)
+41
{
+42
int i;
+43
+44
for (i = 0; i < attribCount; i++)
+45
{
+46
if (attribs[i] == attrib)
+47
return values[i];
+48
}
+49
+50
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+51
"WGL: Unknown pixel format attribute requested");
+52
return 0;
+53
}
+54
+55
#define ADD_ATTRIB(a) \
+56
{ \
+57
assert((size_t) attribCount < sizeof(attribs) / sizeof(attribs[0])); \
+58
attribs[attribCount++] = a; \
+59
}
+60
#define FIND_ATTRIB_VALUE(a) \
+61
findPixelFormatAttribValueWGL(attribs, attribCount, values, a)
+62
+63
// Return a list of available and usable framebuffer configs
+64
//
+65
static int choosePixelFormatWGL(_GLFWwindow* window,
+66
const _GLFWctxconfig* ctxconfig,
+67
const _GLFWfbconfig* fbconfig)
+68
{
+69
_GLFWfbconfig* usableConfigs;
+70
const _GLFWfbconfig* closest;
+71
int i, pixelFormat, nativeCount, usableCount = 0, attribCount = 0;
+72
int attribs[40];
+73
int values[sizeof(attribs) / sizeof(attribs[0])];
+74
+75
nativeCount = DescribePixelFormat(window->context.wgl.dc,
+76
1,
+77
sizeof(PIXELFORMATDESCRIPTOR),
+78
NULL);
+79
+80
if (_glfw.wgl.ARB_pixel_format)
+81
{
+82
ADD_ATTRIB(WGL_SUPPORT_OPENGL_ARB);
+83
ADD_ATTRIB(WGL_DRAW_TO_WINDOW_ARB);
+84
ADD_ATTRIB(WGL_PIXEL_TYPE_ARB);
+85
ADD_ATTRIB(WGL_ACCELERATION_ARB);
+86
ADD_ATTRIB(WGL_RED_BITS_ARB);
+87
ADD_ATTRIB(WGL_RED_SHIFT_ARB);
+88
ADD_ATTRIB(WGL_GREEN_BITS_ARB);
+89
ADD_ATTRIB(WGL_GREEN_SHIFT_ARB);
+90
ADD_ATTRIB(WGL_BLUE_BITS_ARB);
+91
ADD_ATTRIB(WGL_BLUE_SHIFT_ARB);
+92
ADD_ATTRIB(WGL_ALPHA_BITS_ARB);
+93
ADD_ATTRIB(WGL_ALPHA_SHIFT_ARB);
+94
ADD_ATTRIB(WGL_DEPTH_BITS_ARB);
+95
ADD_ATTRIB(WGL_STENCIL_BITS_ARB);
+96
ADD_ATTRIB(WGL_ACCUM_BITS_ARB);
+97
ADD_ATTRIB(WGL_ACCUM_RED_BITS_ARB);
+98
ADD_ATTRIB(WGL_ACCUM_GREEN_BITS_ARB);
+99
ADD_ATTRIB(WGL_ACCUM_BLUE_BITS_ARB);
+100
ADD_ATTRIB(WGL_ACCUM_ALPHA_BITS_ARB);
+101
ADD_ATTRIB(WGL_AUX_BUFFERS_ARB);
+102
ADD_ATTRIB(WGL_STEREO_ARB);
+103
ADD_ATTRIB(WGL_DOUBLE_BUFFER_ARB);
+104
+105
if (_glfw.wgl.ARB_multisample)
+106
ADD_ATTRIB(WGL_SAMPLES_ARB);
+107
+108
if (ctxconfig->client == GLFW_OPENGL_API)
+109
{
+110
if (_glfw.wgl.ARB_framebuffer_sRGB || _glfw.wgl.EXT_framebuffer_sRGB)
+111
ADD_ATTRIB(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
+112
}
+113
else
+114
{
+115
if (_glfw.wgl.EXT_colorspace)
+116
ADD_ATTRIB(WGL_COLORSPACE_EXT);
+117
}
+118
+119
// NOTE: In a Parallels VM WGL_ARB_pixel_format returns fewer pixel formats than
+120
// DescribePixelFormat, violating the guarantees of the extension spec
+121
// HACK: Iterate through the minimum of both counts
+122
+123
const int attrib = WGL_NUMBER_PIXEL_FORMATS_ARB;
+124
int extensionCount;
+125
+126
if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
+127
1, 0, 1, &attrib, &extensionCount))
+128
{
+129
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+130
"WGL: Failed to retrieve pixel format attribute");
+131
return 0;
+132
}
+133
+134
nativeCount = _glfw_min(nativeCount, extensionCount);
+135
}
+136
+137
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
+138
+139
for (i = 0; i < nativeCount; i++)
+140
{
+141
_GLFWfbconfig* u = usableConfigs + usableCount;
+142
pixelFormat = i + 1;
+143
+144
if (_glfw.wgl.ARB_pixel_format)
+145
{
+146
// Get pixel format attributes through "modern" extension
+147
+148
if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
+149
pixelFormat, 0,
+150
attribCount,
+151
attribs, values))
+152
{
+153
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+154
"WGL: Failed to retrieve pixel format attributes");
+155
+156
_glfw_free(usableConfigs);
+157
return 0;
+158
}
+159
+160
if (!FIND_ATTRIB_VALUE(WGL_SUPPORT_OPENGL_ARB) ||
+161
!FIND_ATTRIB_VALUE(WGL_DRAW_TO_WINDOW_ARB))
+162
{
+163
continue;
+164
}
+165
+166
if (FIND_ATTRIB_VALUE(WGL_PIXEL_TYPE_ARB) != WGL_TYPE_RGBA_ARB)
+167
continue;
+168
+169
if (FIND_ATTRIB_VALUE(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
+170
continue;
+171
+172
if (FIND_ATTRIB_VALUE(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer)
+173
continue;
+174
+175
u->redBits = FIND_ATTRIB_VALUE(WGL_RED_BITS_ARB);
+176
u->greenBits = FIND_ATTRIB_VALUE(WGL_GREEN_BITS_ARB);
+177
u->blueBits = FIND_ATTRIB_VALUE(WGL_BLUE_BITS_ARB);
+178
u->alphaBits = FIND_ATTRIB_VALUE(WGL_ALPHA_BITS_ARB);
+179
+180
u->depthBits = FIND_ATTRIB_VALUE(WGL_DEPTH_BITS_ARB);
+181
u->stencilBits = FIND_ATTRIB_VALUE(WGL_STENCIL_BITS_ARB);
+182
+183
u->accumRedBits = FIND_ATTRIB_VALUE(WGL_ACCUM_RED_BITS_ARB);
+184
u->accumGreenBits = FIND_ATTRIB_VALUE(WGL_ACCUM_GREEN_BITS_ARB);
+185
u->accumBlueBits = FIND_ATTRIB_VALUE(WGL_ACCUM_BLUE_BITS_ARB);
+186
u->accumAlphaBits = FIND_ATTRIB_VALUE(WGL_ACCUM_ALPHA_BITS_ARB);
+187
+188
u->auxBuffers = FIND_ATTRIB_VALUE(WGL_AUX_BUFFERS_ARB);
+189
u->stereo = FIND_ATTRIB_VALUE(WGL_STEREO_ARB);
+190
+191
if (_glfw.wgl.ARB_multisample)
+192
u->samples = FIND_ATTRIB_VALUE(WGL_SAMPLES_ARB);
+193
+194
if (ctxconfig->client == GLFW_OPENGL_API)
+195
{
+196
if (_glfw.wgl.ARB_framebuffer_sRGB || _glfw.wgl.EXT_framebuffer_sRGB)
+197
u->sRGB = FIND_ATTRIB_VALUE(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
+198
}
+199
else
+200
{
+201
if (_glfw.wgl.EXT_colorspace)
+202
{
+203
if (FIND_ATTRIB_VALUE(WGL_COLORSPACE_EXT) == WGL_COLORSPACE_SRGB_EXT)
+204
u->sRGB = true;
+205
}
+206
}
+207
}
+208
else
+209
{
+210
// Get pixel format attributes through legacy PFDs
+211
+212
PIXELFORMATDESCRIPTOR pfd;
+213
+214
if (!DescribePixelFormat(window->context.wgl.dc,
+215
pixelFormat,
+216
sizeof(PIXELFORMATDESCRIPTOR),
+217
&pfd))
+218
{
+219
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+220
"WGL: Failed to describe pixel format");
+221
+222
_glfw_free(usableConfigs);
+223
return 0;
+224
}
+225
+226
if (!(pfd.dwFlags & PFD_DRAW_TO_WINDOW) ||
+227
!(pfd.dwFlags & PFD_SUPPORT_OPENGL))
+228
{
+229
continue;
+230
}
+231
+232
if (!(pfd.dwFlags & PFD_GENERIC_ACCELERATED) &&
+233
(pfd.dwFlags & PFD_GENERIC_FORMAT))
+234
{
+235
continue;
+236
}
+237
+238
if (pfd.iPixelType != PFD_TYPE_RGBA)
+239
continue;
+240
+241
if (!!(pfd.dwFlags & PFD_DOUBLEBUFFER) != fbconfig->doublebuffer)
+242
continue;
+243
+244
u->redBits = pfd.cRedBits;
+245
u->greenBits = pfd.cGreenBits;
+246
u->blueBits = pfd.cBlueBits;
+247
u->alphaBits = pfd.cAlphaBits;
+248
+249
u->depthBits = pfd.cDepthBits;
+250
u->stencilBits = pfd.cStencilBits;
+251
+252
u->accumRedBits = pfd.cAccumRedBits;
+253
u->accumGreenBits = pfd.cAccumGreenBits;
+254
u->accumBlueBits = pfd.cAccumBlueBits;
+255
u->accumAlphaBits = pfd.cAccumAlphaBits;
+256
+257
u->auxBuffers = pfd.cAuxBuffers;
+258
u->stereo = (pfd.dwFlags & PFD_STEREO);
+259
}
+260
+261
u->handle = pixelFormat;
+262
usableCount++;
+263
}
+264
+265
if (!usableCount)
+266
{
+267
_glfwInputError(GLFW_API_UNAVAILABLE,
+268
"WGL: The driver does not appear to support OpenGL");
+269
+270
_glfw_free(usableConfigs);
+271
return 0;
+272
}
+273
+274
closest = _glfwChooseFBConfig(fbconfig, usableConfigs, usableCount);
+275
if (!closest)
+276
{
+277
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
+278
"WGL: Failed to find a suitable pixel format");
+279
+280
_glfw_free(usableConfigs);
+281
return 0;
+282
}
+283
+284
pixelFormat = (int) closest->handle;
+285
_glfw_free(usableConfigs);
+286
+287
return pixelFormat;
+288
}
+289
+290
#undef ADD_ATTRIB
+291
#undef FIND_ATTRIB_VALUE
+292
+293
static void makeContextCurrentWGL(_GLFWwindow* window)
+294
{
+295
if (window)
+296
{
+297
if (wglMakeCurrent(window->context.wgl.dc, window->context.wgl.handle))
+298
_glfwPlatformSetTls(&_glfw.contextSlot, window);
+299
else
+300
{
+301
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+302
"WGL: Failed to make context current");
+303
_glfwPlatformSetTls(&_glfw.contextSlot, NULL);
+304
}
+305
}
+306
else
+307
{
+308
if (!wglMakeCurrent(NULL, NULL))
+309
{
+310
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+311
"WGL: Failed to clear current context");
+312
}
+313
+314
_glfwPlatformSetTls(&_glfw.contextSlot, NULL);
+315
}
+316
}
+317
+318
static void swapBuffersWGL(_GLFWwindow* window)
+319
{
+320
if (!window->monitor)
+321
{
+322
// HACK: Use DwmFlush when desktop composition is enabled on Windows 7
+323
if (!IsWindows8OrGreater())
+324
{
+325
BOOL enabled = FALSE;
+326
+327
if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)
+328
{
+329
int count = abs(window->context.wgl.interval);
+330
while (count--)
+331
DwmFlush();
+332
}
+333
}
+334
}
+335
+336
SwapBuffers(window->context.wgl.dc);
+337
}
+338
+339
static void swapIntervalWGL(int interval)
+340
{
+341
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
+342
assert(window != NULL);
+343
+344
window->context.wgl.interval = interval;
+345
+346
if (!window->monitor)
+347
{
+348
// HACK: Disable WGL swap interval when desktop composition is enabled on
+349
// Windows 7 to avoid interfering with DWM vsync
+350
if (!IsWindows8OrGreater())
+351
{
+352
BOOL enabled = FALSE;
+353
+354
if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)
+355
interval = 0;
+356
}
+357
}
+358
+359
if (_glfw.wgl.EXT_swap_control)
+360
wglSwapIntervalEXT(interval);
+361
}
+362
+363
static int extensionSupportedWGL(const char* extension)
+364
{
+365
const char* extensions = NULL;
+366
+367
if (_glfw.wgl.GetExtensionsStringARB)
+368
extensions = wglGetExtensionsStringARB(wglGetCurrentDC());
+369
else if (_glfw.wgl.GetExtensionsStringEXT)
+370
extensions = wglGetExtensionsStringEXT();
+371
+372
if (!extensions)
+373
return GLFW_FALSE;
+374
+375
return _glfwStringInExtensionString(extension, extensions);
+376
}
+377
+378
static GLFWglproc getProcAddressWGL(const char* procname)
+379
{
+380
const GLFWglproc proc = (GLFWglproc) wglGetProcAddress(procname);
+381
if (proc)
+382
return proc;
+383
+384
return (GLFWglproc) _glfwPlatformGetModuleSymbol(_glfw.wgl.instance, procname);
+385
}
+386
+387
static void destroyContextWGL(_GLFWwindow* window)
+388
{
+389
if (window->context.wgl.handle)
+390
{
+391
wglDeleteContext(window->context.wgl.handle);
+392
window->context.wgl.handle = NULL;
+393
}
+394
}
+395
+396
GLFWbool _glfwInitWGL(void)
+397
{
+398
PIXELFORMATDESCRIPTOR pfd;
+399
HGLRC prc, rc;
+400
HDC pdc, dc;
+401
+402
if (_glfw.wgl.instance)
+403
return GLFW_TRUE;
+404
+405
_glfw.wgl.instance = _glfwPlatformLoadModule("opengl32.dll");
+406
if (!_glfw.wgl.instance)
+407
{
+408
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+409
"WGL: Failed to load opengl32.dll");
+410
return GLFW_FALSE;
+411
}
+412
+413
_glfw.wgl.CreateContext = (PFN_wglCreateContext)
+414
_glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglCreateContext");
+415
_glfw.wgl.DeleteContext = (PFN_wglDeleteContext)
+416
_glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglDeleteContext");
+417
_glfw.wgl.GetProcAddress = (PFN_wglGetProcAddress)
+418
_glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglGetProcAddress");
+419
_glfw.wgl.GetCurrentDC = (PFN_wglGetCurrentDC)
+420
_glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglGetCurrentDC");
+421
_glfw.wgl.GetCurrentContext = (PFN_wglGetCurrentContext)
+422
_glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglGetCurrentContext");
+423
_glfw.wgl.MakeCurrent = (PFN_wglMakeCurrent)
+424
_glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglMakeCurrent");
+425
_glfw.wgl.ShareLists = (PFN_wglShareLists)
+426
_glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglShareLists");
+427
+428
// NOTE: A dummy context has to be created for opengl32.dll to load the
+429
// OpenGL ICD, from which we can then query WGL extensions
+430
// NOTE: This code will accept the Microsoft GDI ICD; accelerated context
+431
// creation failure occurs during manual pixel format enumeration
+432
+433
dc = GetDC(_glfw.win32.helperWindowHandle);
+434
+435
ZeroMemory(&pfd, sizeof(pfd));
+436
pfd.nSize = sizeof(pfd);
+437
pfd.nVersion = 1;
+438
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
+439
pfd.iPixelType = PFD_TYPE_RGBA;
+440
pfd.cColorBits = 24;
+441
+442
if (!SetPixelFormat(dc, ChoosePixelFormat(dc, &pfd), &pfd))
+443
{
+444
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+445
"WGL: Failed to set pixel format for dummy context");
+446
return GLFW_FALSE;
+447
}
+448
+449
rc = wglCreateContext(dc);
+450
if (!rc)
+451
{
+452
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+453
"WGL: Failed to create dummy context");
+454
return GLFW_FALSE;
+455
}
+456
+457
pdc = wglGetCurrentDC();
+458
prc = wglGetCurrentContext();
+459
+460
if (!wglMakeCurrent(dc, rc))
+461
{
+462
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+463
"WGL: Failed to make dummy context current");
+464
wglMakeCurrent(pdc, prc);
+465
wglDeleteContext(rc);
+466
return GLFW_FALSE;
+467
}
+468
+469
// NOTE: Functions must be loaded first as they're needed to retrieve the
+470
// extension string that tells us whether the functions are supported
+471
_glfw.wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)
+472
wglGetProcAddress("wglGetExtensionsStringEXT");
+473
_glfw.wgl.GetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)
+474
wglGetProcAddress("wglGetExtensionsStringARB");
+475
_glfw.wgl.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
+476
wglGetProcAddress("wglCreateContextAttribsARB");
+477
_glfw.wgl.SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)
+478
wglGetProcAddress("wglSwapIntervalEXT");
+479
_glfw.wgl.GetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)
+480
wglGetProcAddress("wglGetPixelFormatAttribivARB");
+481
+482
// NOTE: WGL_ARB_extensions_string and WGL_EXT_extensions_string are not
+483
// checked below as we are already using them
+484
_glfw.wgl.ARB_multisample =
+485
extensionSupportedWGL("WGL_ARB_multisample");
+486
_glfw.wgl.ARB_framebuffer_sRGB =
+487
extensionSupportedWGL("WGL_ARB_framebuffer_sRGB");
+488
_glfw.wgl.EXT_framebuffer_sRGB =
+489
extensionSupportedWGL("WGL_EXT_framebuffer_sRGB");
+490
_glfw.wgl.ARB_create_context =
+491
extensionSupportedWGL("WGL_ARB_create_context");
+492
_glfw.wgl.ARB_create_context_profile =
+493
extensionSupportedWGL("WGL_ARB_create_context_profile");
+494
_glfw.wgl.EXT_create_context_es2_profile =
+495
extensionSupportedWGL("WGL_EXT_create_context_es2_profile");
+496
_glfw.wgl.ARB_create_context_robustness =
+497
extensionSupportedWGL("WGL_ARB_create_context_robustness");
+498
_glfw.wgl.ARB_create_context_no_error =
+499
extensionSupportedWGL("WGL_ARB_create_context_no_error");

Showing the first 500 of 787 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/win32_init.cadded
@@ -0,0 +1,712 @@
+1
//========================================================================
+2
// GLFW 3.5 Win32 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_WIN32)
+31
+32
#include <stdlib.h>
+33
+34
static const GUID _glfw_GUID_DEVINTERFACE_HID =
+35
{0x4d1e55b2,0xf16f,0x11cf,{0x88,0xcb,0x00,0x11,0x11,0x00,0x00,0x30}};
+36
+37
#define GUID_DEVINTERFACE_HID _glfw_GUID_DEVINTERFACE_HID
+38
+39
#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
+40
+41
#if defined(_GLFW_BUILD_DLL)
+42
#pragma message("These symbols must be exported by the executable and have no effect in a DLL")
+43
#endif
+44
+45
// Executables (but not DLLs) exporting this symbol with this value will be
+46
// automatically directed to the high-performance GPU on Nvidia Optimus systems
+47
// with up-to-date drivers
+48
//
+49
__declspec(dllexport) DWORD NvOptimusEnablement = 1;
+50
+51
// Executables (but not DLLs) exporting this symbol with this value will be
+52
// automatically directed to the high-performance GPU on AMD PowerXpress systems
+53
// with up-to-date drivers
+54
//
+55
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
+56
+57
#endif // _GLFW_USE_HYBRID_HPG
+58
+59
#if defined(_GLFW_BUILD_DLL)
+60
+61
// GLFW DLL entry point
+62
//
+63
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
+64
{
+65
return TRUE;
+66
}
+67
+68
#endif // _GLFW_BUILD_DLL
+69
+70
// Load necessary libraries (DLLs)
+71
//
+72
static GLFWbool loadLibraries(void)
+73
{
+74
if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+75
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
+76
(const WCHAR*) &_glfw,
+77
(HMODULE*) &_glfw.win32.instance))
+78
{
+79
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+80
"Win32: Failed to retrieve own module handle");
+81
return GLFW_FALSE;
+82
}
+83
+84
_glfw.win32.user32.instance = _glfwPlatformLoadModule("user32.dll");
+85
if (!_glfw.win32.user32.instance)
+86
{
+87
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+88
"Win32: Failed to load user32.dll");
+89
return GLFW_FALSE;
+90
}
+91
+92
_glfw.win32.user32.EnableNonClientDpiScaling_ = (PFN_EnableNonClientDpiScaling)
+93
_glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "EnableNonClientDpiScaling");
+94
_glfw.win32.user32.SetProcessDpiAwarenessContext_ = (PFN_SetProcessDpiAwarenessContext)
+95
_glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "SetProcessDpiAwarenessContext");
+96
_glfw.win32.user32.GetDpiForWindow_ = (PFN_GetDpiForWindow)
+97
_glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "GetDpiForWindow");
+98
_glfw.win32.user32.AdjustWindowRectExForDpi_ = (PFN_AdjustWindowRectExForDpi)
+99
_glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "AdjustWindowRectExForDpi");
+100
_glfw.win32.user32.GetSystemMetricsForDpi_ = (PFN_GetSystemMetricsForDpi)
+101
_glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "GetSystemMetricsForDpi");
+102
+103
_glfw.win32.dinput8.instance = _glfwPlatformLoadModule("dinput8.dll");
+104
if (_glfw.win32.dinput8.instance)
+105
{
+106
_glfw.win32.dinput8.Create = (PFN_DirectInput8Create)
+107
_glfwPlatformGetModuleSymbol(_glfw.win32.dinput8.instance, "DirectInput8Create");
+108
}
+109
+110
{
+111
int i;
+112
const char* names[] =
+113
{
+114
"xinput1_4.dll",
+115
"xinput1_3.dll",
+116
"xinput9_1_0.dll",
+117
"xinput1_2.dll",
+118
"xinput1_1.dll",
+119
NULL
+120
};
+121
+122
for (i = 0; names[i]; i++)
+123
{
+124
_glfw.win32.xinput.instance = _glfwPlatformLoadModule(names[i]);
+125
if (_glfw.win32.xinput.instance)
+126
{
+127
_glfw.win32.xinput.GetCapabilities = (PFN_XInputGetCapabilities)
+128
_glfwPlatformGetModuleSymbol(_glfw.win32.xinput.instance, "XInputGetCapabilities");
+129
_glfw.win32.xinput.GetState = (PFN_XInputGetState)
+130
_glfwPlatformGetModuleSymbol(_glfw.win32.xinput.instance, "XInputGetState");
+131
+132
break;
+133
}
+134
}
+135
}
+136
+137
_glfw.win32.dwmapi.instance = _glfwPlatformLoadModule("dwmapi.dll");
+138
if (_glfw.win32.dwmapi.instance)
+139
{
+140
_glfw.win32.dwmapi.IsCompositionEnabled = (PFN_DwmIsCompositionEnabled)
+141
_glfwPlatformGetModuleSymbol(_glfw.win32.dwmapi.instance, "DwmIsCompositionEnabled");
+142
_glfw.win32.dwmapi.Flush = (PFN_DwmFlush)
+143
_glfwPlatformGetModuleSymbol(_glfw.win32.dwmapi.instance, "DwmFlush");
+144
_glfw.win32.dwmapi.EnableBlurBehindWindow = (PFN_DwmEnableBlurBehindWindow)
+145
_glfwPlatformGetModuleSymbol(_glfw.win32.dwmapi.instance, "DwmEnableBlurBehindWindow");
+146
_glfw.win32.dwmapi.GetColorizationColor = (PFN_DwmGetColorizationColor)
+147
_glfwPlatformGetModuleSymbol(_glfw.win32.dwmapi.instance, "DwmGetColorizationColor");
+148
}
+149
+150
_glfw.win32.shcore.instance = _glfwPlatformLoadModule("shcore.dll");
+151
if (_glfw.win32.shcore.instance)
+152
{
+153
_glfw.win32.shcore.SetProcessDpiAwareness_ = (PFN_SetProcessDpiAwareness)
+154
_glfwPlatformGetModuleSymbol(_glfw.win32.shcore.instance, "SetProcessDpiAwareness");
+155
_glfw.win32.shcore.GetDpiForMonitor_ = (PFN_GetDpiForMonitor)
+156
_glfwPlatformGetModuleSymbol(_glfw.win32.shcore.instance, "GetDpiForMonitor");
+157
}
+158
+159
_glfw.win32.ntdll.instance = _glfwPlatformLoadModule("ntdll.dll");
+160
if (_glfw.win32.ntdll.instance)
+161
{
+162
_glfw.win32.ntdll.RtlVerifyVersionInfo_ = (PFN_RtlVerifyVersionInfo)
+163
_glfwPlatformGetModuleSymbol(_glfw.win32.ntdll.instance, "RtlVerifyVersionInfo");
+164
}
+165
+166
return GLFW_TRUE;
+167
}
+168
+169
// Create key code translation tables
+170
//
+171
static void createKeyTables(void)
+172
{
+173
int scancode;
+174
+175
memset(_glfw.win32.keycodes, -1, sizeof(_glfw.win32.keycodes));
+176
memset(_glfw.win32.scancodes, -1, sizeof(_glfw.win32.scancodes));
+177
+178
_glfw.win32.keycodes[0x00B] = GLFW_KEY_0;
+179
_glfw.win32.keycodes[0x002] = GLFW_KEY_1;
+180
_glfw.win32.keycodes[0x003] = GLFW_KEY_2;
+181
_glfw.win32.keycodes[0x004] = GLFW_KEY_3;
+182
_glfw.win32.keycodes[0x005] = GLFW_KEY_4;
+183
_glfw.win32.keycodes[0x006] = GLFW_KEY_5;
+184
_glfw.win32.keycodes[0x007] = GLFW_KEY_6;
+185
_glfw.win32.keycodes[0x008] = GLFW_KEY_7;
+186
_glfw.win32.keycodes[0x009] = GLFW_KEY_8;
+187
_glfw.win32.keycodes[0x00A] = GLFW_KEY_9;
+188
_glfw.win32.keycodes[0x01E] = GLFW_KEY_A;
+189
_glfw.win32.keycodes[0x030] = GLFW_KEY_B;
+190
_glfw.win32.keycodes[0x02E] = GLFW_KEY_C;
+191
_glfw.win32.keycodes[0x020] = GLFW_KEY_D;
+192
_glfw.win32.keycodes[0x012] = GLFW_KEY_E;
+193
_glfw.win32.keycodes[0x021] = GLFW_KEY_F;
+194
_glfw.win32.keycodes[0x022] = GLFW_KEY_G;
+195
_glfw.win32.keycodes[0x023] = GLFW_KEY_H;
+196
_glfw.win32.keycodes[0x017] = GLFW_KEY_I;
+197
_glfw.win32.keycodes[0x024] = GLFW_KEY_J;
+198
_glfw.win32.keycodes[0x025] = GLFW_KEY_K;
+199
_glfw.win32.keycodes[0x026] = GLFW_KEY_L;
+200
_glfw.win32.keycodes[0x032] = GLFW_KEY_M;
+201
_glfw.win32.keycodes[0x031] = GLFW_KEY_N;
+202
_glfw.win32.keycodes[0x018] = GLFW_KEY_O;
+203
_glfw.win32.keycodes[0x019] = GLFW_KEY_P;
+204
_glfw.win32.keycodes[0x010] = GLFW_KEY_Q;
+205
_glfw.win32.keycodes[0x013] = GLFW_KEY_R;
+206
_glfw.win32.keycodes[0x01F] = GLFW_KEY_S;
+207
_glfw.win32.keycodes[0x014] = GLFW_KEY_T;
+208
_glfw.win32.keycodes[0x016] = GLFW_KEY_U;
+209
_glfw.win32.keycodes[0x02F] = GLFW_KEY_V;
+210
_glfw.win32.keycodes[0x011] = GLFW_KEY_W;
+211
_glfw.win32.keycodes[0x02D] = GLFW_KEY_X;
+212
_glfw.win32.keycodes[0x015] = GLFW_KEY_Y;
+213
_glfw.win32.keycodes[0x02C] = GLFW_KEY_Z;
+214
+215
_glfw.win32.keycodes[0x028] = GLFW_KEY_APOSTROPHE;
+216
_glfw.win32.keycodes[0x02B] = GLFW_KEY_BACKSLASH;
+217
_glfw.win32.keycodes[0x033] = GLFW_KEY_COMMA;
+218
_glfw.win32.keycodes[0x00D] = GLFW_KEY_EQUAL;
+219
_glfw.win32.keycodes[0x029] = GLFW_KEY_GRAVE_ACCENT;
+220
_glfw.win32.keycodes[0x01A] = GLFW_KEY_LEFT_BRACKET;
+221
_glfw.win32.keycodes[0x00C] = GLFW_KEY_MINUS;
+222
_glfw.win32.keycodes[0x034] = GLFW_KEY_PERIOD;
+223
_glfw.win32.keycodes[0x01B] = GLFW_KEY_RIGHT_BRACKET;
+224
_glfw.win32.keycodes[0x027] = GLFW_KEY_SEMICOLON;
+225
_glfw.win32.keycodes[0x035] = GLFW_KEY_SLASH;
+226
_glfw.win32.keycodes[0x056] = GLFW_KEY_WORLD_2;
+227
+228
_glfw.win32.keycodes[0x00E] = GLFW_KEY_BACKSPACE;
+229
_glfw.win32.keycodes[0x153] = GLFW_KEY_DELETE;
+230
_glfw.win32.keycodes[0x14F] = GLFW_KEY_END;
+231
_glfw.win32.keycodes[0x01C] = GLFW_KEY_ENTER;
+232
_glfw.win32.keycodes[0x001] = GLFW_KEY_ESCAPE;
+233
_glfw.win32.keycodes[0x147] = GLFW_KEY_HOME;
+234
_glfw.win32.keycodes[0x152] = GLFW_KEY_INSERT;
+235
_glfw.win32.keycodes[0x15D] = GLFW_KEY_MENU;
+236
_glfw.win32.keycodes[0x151] = GLFW_KEY_PAGE_DOWN;
+237
_glfw.win32.keycodes[0x149] = GLFW_KEY_PAGE_UP;
+238
_glfw.win32.keycodes[0x045] = GLFW_KEY_PAUSE;
+239
_glfw.win32.keycodes[0x039] = GLFW_KEY_SPACE;
+240
_glfw.win32.keycodes[0x00F] = GLFW_KEY_TAB;
+241
_glfw.win32.keycodes[0x03A] = GLFW_KEY_CAPS_LOCK;
+242
_glfw.win32.keycodes[0x145] = GLFW_KEY_NUM_LOCK;
+243
_glfw.win32.keycodes[0x046] = GLFW_KEY_SCROLL_LOCK;
+244
_glfw.win32.keycodes[0x03B] = GLFW_KEY_F1;
+245
_glfw.win32.keycodes[0x03C] = GLFW_KEY_F2;
+246
_glfw.win32.keycodes[0x03D] = GLFW_KEY_F3;
+247
_glfw.win32.keycodes[0x03E] = GLFW_KEY_F4;
+248
_glfw.win32.keycodes[0x03F] = GLFW_KEY_F5;
+249
_glfw.win32.keycodes[0x040] = GLFW_KEY_F6;
+250
_glfw.win32.keycodes[0x041] = GLFW_KEY_F7;
+251
_glfw.win32.keycodes[0x042] = GLFW_KEY_F8;
+252
_glfw.win32.keycodes[0x043] = GLFW_KEY_F9;
+253
_glfw.win32.keycodes[0x044] = GLFW_KEY_F10;
+254
_glfw.win32.keycodes[0x057] = GLFW_KEY_F11;
+255
_glfw.win32.keycodes[0x058] = GLFW_KEY_F12;
+256
_glfw.win32.keycodes[0x064] = GLFW_KEY_F13;
+257
_glfw.win32.keycodes[0x065] = GLFW_KEY_F14;
+258
_glfw.win32.keycodes[0x066] = GLFW_KEY_F15;
+259
_glfw.win32.keycodes[0x067] = GLFW_KEY_F16;
+260
_glfw.win32.keycodes[0x068] = GLFW_KEY_F17;
+261
_glfw.win32.keycodes[0x069] = GLFW_KEY_F18;
+262
_glfw.win32.keycodes[0x06A] = GLFW_KEY_F19;
+263
_glfw.win32.keycodes[0x06B] = GLFW_KEY_F20;
+264
_glfw.win32.keycodes[0x06C] = GLFW_KEY_F21;
+265
_glfw.win32.keycodes[0x06D] = GLFW_KEY_F22;
+266
_glfw.win32.keycodes[0x06E] = GLFW_KEY_F23;
+267
_glfw.win32.keycodes[0x076] = GLFW_KEY_F24;
+268
_glfw.win32.keycodes[0x038] = GLFW_KEY_LEFT_ALT;
+269
_glfw.win32.keycodes[0x01D] = GLFW_KEY_LEFT_CONTROL;
+270
_glfw.win32.keycodes[0x02A] = GLFW_KEY_LEFT_SHIFT;
+271
_glfw.win32.keycodes[0x15B] = GLFW_KEY_LEFT_SUPER;
+272
_glfw.win32.keycodes[0x137] = GLFW_KEY_PRINT_SCREEN;
+273
_glfw.win32.keycodes[0x138] = GLFW_KEY_RIGHT_ALT;
+274
_glfw.win32.keycodes[0x11D] = GLFW_KEY_RIGHT_CONTROL;
+275
_glfw.win32.keycodes[0x036] = GLFW_KEY_RIGHT_SHIFT;
+276
_glfw.win32.keycodes[0x15C] = GLFW_KEY_RIGHT_SUPER;
+277
_glfw.win32.keycodes[0x150] = GLFW_KEY_DOWN;
+278
_glfw.win32.keycodes[0x14B] = GLFW_KEY_LEFT;
+279
_glfw.win32.keycodes[0x14D] = GLFW_KEY_RIGHT;
+280
_glfw.win32.keycodes[0x148] = GLFW_KEY_UP;
+281
+282
_glfw.win32.keycodes[0x052] = GLFW_KEY_KP_0;
+283
_glfw.win32.keycodes[0x04F] = GLFW_KEY_KP_1;
+284
_glfw.win32.keycodes[0x050] = GLFW_KEY_KP_2;
+285
_glfw.win32.keycodes[0x051] = GLFW_KEY_KP_3;
+286
_glfw.win32.keycodes[0x04B] = GLFW_KEY_KP_4;
+287
_glfw.win32.keycodes[0x04C] = GLFW_KEY_KP_5;
+288
_glfw.win32.keycodes[0x04D] = GLFW_KEY_KP_6;
+289
_glfw.win32.keycodes[0x047] = GLFW_KEY_KP_7;
+290
_glfw.win32.keycodes[0x048] = GLFW_KEY_KP_8;
+291
_glfw.win32.keycodes[0x049] = GLFW_KEY_KP_9;
+292
_glfw.win32.keycodes[0x04E] = GLFW_KEY_KP_ADD;
+293
_glfw.win32.keycodes[0x053] = GLFW_KEY_KP_DECIMAL;
+294
_glfw.win32.keycodes[0x135] = GLFW_KEY_KP_DIVIDE;
+295
_glfw.win32.keycodes[0x11C] = GLFW_KEY_KP_ENTER;
+296
_glfw.win32.keycodes[0x059] = GLFW_KEY_KP_EQUAL;
+297
_glfw.win32.keycodes[0x037] = GLFW_KEY_KP_MULTIPLY;
+298
_glfw.win32.keycodes[0x04A] = GLFW_KEY_KP_SUBTRACT;
+299
+300
for (scancode = 0; scancode < 512; scancode++)
+301
{
+302
if (_glfw.win32.keycodes[scancode] > 0)
+303
_glfw.win32.scancodes[_glfw.win32.keycodes[scancode]] = scancode;
+304
}
+305
}
+306
+307
// Window procedure for the hidden helper window
+308
//
+309
static LRESULT CALLBACK helperWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+310
{
+311
switch (uMsg)
+312
{
+313
case WM_DISPLAYCHANGE:
+314
_glfwPollMonitorsWin32();
+315
break;
+316
+317
case WM_DEVICECHANGE:
+318
{
+319
if (!_glfw.joysticksInitialized)
+320
break;
+321
+322
if (wParam == DBT_DEVICEARRIVAL)
+323
{
+324
DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam;
+325
if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
+326
_glfwDetectJoystickConnectionWin32();
+327
}
+328
else if (wParam == DBT_DEVICEREMOVECOMPLETE)
+329
{
+330
DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam;
+331
if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
+332
_glfwDetectJoystickDisconnectionWin32();
+333
}
+334
+335
break;
+336
}
+337
}
+338
+339
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
+340
}
+341
+342
// Creates a dummy window for behind-the-scenes work
+343
//
+344
static GLFWbool createHelperWindow(void)
+345
{
+346
MSG msg;
+347
WNDCLASSEXW wc = { sizeof(wc) };
+348
+349
wc.style = CS_OWNDC;
+350
wc.lpfnWndProc = (WNDPROC) helperWindowProc;
+351
wc.hInstance = _glfw.win32.instance;
+352
wc.lpszClassName = L"GLFW3 Helper";
+353
+354
_glfw.win32.helperWindowClass = RegisterClassExW(&wc);
+355
if (!_glfw.win32.helperWindowClass)
+356
{
+357
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+358
"Win32: Failed to register helper window class");
+359
return GLFW_FALSE;
+360
}
+361
+362
_glfw.win32.helperWindowHandle =
+363
CreateWindowExW(WS_EX_OVERLAPPEDWINDOW,
+364
MAKEINTATOM(_glfw.win32.helperWindowClass),
+365
L"GLFW message window",
+366
WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+367
0, 0, 1, 1,
+368
NULL, NULL,
+369
_glfw.win32.instance,
+370
NULL);
+371
+372
if (!_glfw.win32.helperWindowHandle)
+373
{
+374
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+375
"Win32: Failed to create helper window");
+376
return GLFW_FALSE;
+377
}
+378
+379
// HACK: The command to the first ShowWindow call is ignored if the parent
+380
// process passed along a STARTUPINFO, so clear that with a no-op call
+381
ShowWindow(_glfw.win32.helperWindowHandle, SW_HIDE);
+382
+383
// Register for HID device notifications
+384
{
+385
DEV_BROADCAST_DEVICEINTERFACE_W dbi;
+386
ZeroMemory(&dbi, sizeof(dbi));
+387
dbi.dbcc_size = sizeof(dbi);
+388
dbi.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
+389
dbi.dbcc_classguid = GUID_DEVINTERFACE_HID;
+390
+391
_glfw.win32.deviceNotificationHandle =
+392
RegisterDeviceNotificationW(_glfw.win32.helperWindowHandle,
+393
(DEV_BROADCAST_HDR*) &dbi,
+394
DEVICE_NOTIFY_WINDOW_HANDLE);
+395
}
+396
+397
while (PeekMessageW(&msg, _glfw.win32.helperWindowHandle, 0, 0, PM_REMOVE))
+398
{
+399
TranslateMessage(&msg);
+400
DispatchMessageW(&msg);
+401
}
+402
+403
return GLFW_TRUE;
+404
}
+405
+406
//////////////////////////////////////////////////////////////////////////
+407
////// GLFW internal API //////
+408
//////////////////////////////////////////////////////////////////////////
+409
+410
// Returns a wide string version of the specified UTF-8 string
+411
//
+412
WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source)
+413
{
+414
WCHAR* target;
+415
int count;
+416
+417
count = MultiByteToWideChar(CP_UTF8, 0, source, -1, NULL, 0);
+418
if (!count)
+419
{
+420
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+421
"Win32: Failed to convert string from UTF-8");
+422
return NULL;
+423
}
+424
+425
target = _glfw_calloc(count, sizeof(WCHAR));
+426
+427
if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, count))
+428
{
+429
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+430
"Win32: Failed to convert string from UTF-8");
+431
_glfw_free(target);
+432
return NULL;
+433
}
+434
+435
return target;
+436
}
+437
+438
// Returns a UTF-8 string version of the specified wide string
+439
//
+440
char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source)
+441
{
+442
char* target;
+443
int size;
+444
+445
size = WideCharToMultiByte(CP_UTF8, 0, source, -1, NULL, 0, NULL, NULL);
+446
if (!size)
+447
{
+448
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+449
"Win32: Failed to convert string to UTF-8");
+450
return NULL;
+451
}
+452
+453
target = _glfw_calloc(size, 1);
+454
+455
if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, size, NULL, NULL))
+456
{
+457
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+458
"Win32: Failed to convert string to UTF-8");
+459
_glfw_free(target);
+460
return NULL;
+461
}
+462
+463
return target;
+464
}
+465
+466
// Reports the specified error, appending information about the last Win32 error
+467
//
+468
void _glfwInputErrorWin32(int error, const char* description)
+469
{
+470
WCHAR buffer[_GLFW_MESSAGE_SIZE] = L"";
+471
char message[_GLFW_MESSAGE_SIZE] = "";
+472
+473
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
+474
FORMAT_MESSAGE_IGNORE_INSERTS |
+475
FORMAT_MESSAGE_MAX_WIDTH_MASK,
+476
NULL,
+477
GetLastError() & 0xffff,
+478
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+479
buffer,
+480
sizeof(buffer) / sizeof(WCHAR),
+481
NULL);
+482
WideCharToMultiByte(CP_UTF8, 0, buffer, -1, message, sizeof(message), NULL, NULL);
+483
+484
_glfwInputError(error, "%s: %s", description, message);
+485
}
+486
+487
// Updates key names according to the current keyboard layout
+488
//
+489
void _glfwUpdateKeyNamesWin32(void)
+490
{
+491
int key;
+492
BYTE state[256] = {0};
+493
+494
memset(_glfw.win32.keynames, 0, sizeof(_glfw.win32.keynames));
+495
+496
for (key = GLFW_KEY_SPACE; key <= GLFW_KEY_LAST; key++)
+497
{
+498
UINT vk;
+499
int scancode, length;

Showing the first 500 of 713 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/win32_joystick.cadded
@@ -0,0 +1,767 @@
+1
//========================================================================
+2
// GLFW 3.5 Win32 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_WIN32)
+31
+32
#include <stdio.h>
+33
#include <math.h>
+34
+35
#define _GLFW_TYPE_AXIS 0
+36
#define _GLFW_TYPE_SLIDER 1
+37
#define _GLFW_TYPE_BUTTON 2
+38
#define _GLFW_TYPE_POV 3
+39
+40
// Data produced with DirectInput device object enumeration
+41
//
+42
typedef struct _GLFWobjenumWin32
+43
{
+44
IDirectInputDevice8W* device;
+45
_GLFWjoyobjectWin32* objects;
+46
int objectCount;
+47
int axisCount;
+48
int sliderCount;
+49
int buttonCount;
+50
int povCount;
+51
} _GLFWobjenumWin32;
+52
+53
// Define local copies of the necessary GUIDs
+54
//
+55
static const GUID _glfw_IID_IDirectInput8W =
+56
{0xbf798031,0x483a,0x4da2,{0xaa,0x99,0x5d,0x64,0xed,0x36,0x97,0x00}};
+57
static const GUID _glfw_GUID_XAxis =
+58
{0xa36d02e0,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
+59
static const GUID _glfw_GUID_YAxis =
+60
{0xa36d02e1,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
+61
static const GUID _glfw_GUID_ZAxis =
+62
{0xa36d02e2,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
+63
static const GUID _glfw_GUID_RxAxis =
+64
{0xa36d02f4,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
+65
static const GUID _glfw_GUID_RyAxis =
+66
{0xa36d02f5,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
+67
static const GUID _glfw_GUID_RzAxis =
+68
{0xa36d02e3,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
+69
static const GUID _glfw_GUID_Slider =
+70
{0xa36d02e4,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
+71
static const GUID _glfw_GUID_POV =
+72
{0xa36d02f2,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
+73
+74
#define IID_IDirectInput8W _glfw_IID_IDirectInput8W
+75
#define GUID_XAxis _glfw_GUID_XAxis
+76
#define GUID_YAxis _glfw_GUID_YAxis
+77
#define GUID_ZAxis _glfw_GUID_ZAxis
+78
#define GUID_RxAxis _glfw_GUID_RxAxis
+79
#define GUID_RyAxis _glfw_GUID_RyAxis
+80
#define GUID_RzAxis _glfw_GUID_RzAxis
+81
#define GUID_Slider _glfw_GUID_Slider
+82
#define GUID_POV _glfw_GUID_POV
+83
+84
// Object data array for our clone of c_dfDIJoystick
+85
// Generated with https://github.com/elmindreda/c_dfDIJoystick2
+86
//
+87
static DIOBJECTDATAFORMAT _glfwObjectDataFormats[] =
+88
{
+89
{ &GUID_XAxis,DIJOFS_X,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION },
+90
{ &GUID_YAxis,DIJOFS_Y,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION },
+91
{ &GUID_ZAxis,DIJOFS_Z,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION },
+92
{ &GUID_RxAxis,DIJOFS_RX,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION },
+93
{ &GUID_RyAxis,DIJOFS_RY,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION },
+94
{ &GUID_RzAxis,DIJOFS_RZ,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION },
+95
{ &GUID_Slider,DIJOFS_SLIDER(0),DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION },
+96
{ &GUID_Slider,DIJOFS_SLIDER(1),DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION },
+97
{ &GUID_POV,DIJOFS_POV(0),DIDFT_POV|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+98
{ &GUID_POV,DIJOFS_POV(1),DIDFT_POV|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+99
{ &GUID_POV,DIJOFS_POV(2),DIDFT_POV|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+100
{ &GUID_POV,DIJOFS_POV(3),DIDFT_POV|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+101
{ NULL,DIJOFS_BUTTON(0),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+102
{ NULL,DIJOFS_BUTTON(1),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+103
{ NULL,DIJOFS_BUTTON(2),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+104
{ NULL,DIJOFS_BUTTON(3),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+105
{ NULL,DIJOFS_BUTTON(4),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+106
{ NULL,DIJOFS_BUTTON(5),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+107
{ NULL,DIJOFS_BUTTON(6),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+108
{ NULL,DIJOFS_BUTTON(7),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+109
{ NULL,DIJOFS_BUTTON(8),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+110
{ NULL,DIJOFS_BUTTON(9),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+111
{ NULL,DIJOFS_BUTTON(10),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+112
{ NULL,DIJOFS_BUTTON(11),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+113
{ NULL,DIJOFS_BUTTON(12),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+114
{ NULL,DIJOFS_BUTTON(13),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+115
{ NULL,DIJOFS_BUTTON(14),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+116
{ NULL,DIJOFS_BUTTON(15),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+117
{ NULL,DIJOFS_BUTTON(16),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+118
{ NULL,DIJOFS_BUTTON(17),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+119
{ NULL,DIJOFS_BUTTON(18),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+120
{ NULL,DIJOFS_BUTTON(19),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+121
{ NULL,DIJOFS_BUTTON(20),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+122
{ NULL,DIJOFS_BUTTON(21),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+123
{ NULL,DIJOFS_BUTTON(22),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+124
{ NULL,DIJOFS_BUTTON(23),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+125
{ NULL,DIJOFS_BUTTON(24),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+126
{ NULL,DIJOFS_BUTTON(25),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+127
{ NULL,DIJOFS_BUTTON(26),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+128
{ NULL,DIJOFS_BUTTON(27),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+129
{ NULL,DIJOFS_BUTTON(28),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+130
{ NULL,DIJOFS_BUTTON(29),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+131
{ NULL,DIJOFS_BUTTON(30),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+132
{ NULL,DIJOFS_BUTTON(31),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 },
+133
};
+134
+135
// Our clone of c_dfDIJoystick
+136
//
+137
static const DIDATAFORMAT _glfwDataFormat =
+138
{
+139
sizeof(DIDATAFORMAT),
+140
sizeof(DIOBJECTDATAFORMAT),
+141
DIDFT_ABSAXIS,
+142
sizeof(DIJOYSTATE),
+143
sizeof(_glfwObjectDataFormats) / sizeof(DIOBJECTDATAFORMAT),
+144
_glfwObjectDataFormats
+145
};
+146
+147
// Returns a description fitting the specified XInput capabilities
+148
//
+149
static const char* getDeviceDescription(const XINPUT_CAPABILITIES* xic)
+150
{
+151
switch (xic->SubType)
+152
{
+153
case XINPUT_DEVSUBTYPE_WHEEL:
+154
return "XInput Wheel";
+155
case XINPUT_DEVSUBTYPE_ARCADE_STICK:
+156
return "XInput Arcade Stick";
+157
case XINPUT_DEVSUBTYPE_FLIGHT_STICK:
+158
return "XInput Flight Stick";
+159
case XINPUT_DEVSUBTYPE_DANCE_PAD:
+160
return "XInput Dance Pad";
+161
case XINPUT_DEVSUBTYPE_GUITAR:
+162
return "XInput Guitar";
+163
case XINPUT_DEVSUBTYPE_DRUM_KIT:
+164
return "XInput Drum Kit";
+165
case XINPUT_DEVSUBTYPE_GAMEPAD:
+166
{
+167
if (xic->Flags & XINPUT_CAPS_WIRELESS)
+168
return "Wireless Xbox Controller";
+169
else
+170
return "Xbox Controller";
+171
}
+172
}
+173
+174
return "Unknown XInput Device";
+175
}
+176
+177
// Lexically compare device objects
+178
//
+179
static int compareJoystickObjects(const void* first, const void* second)
+180
{
+181
const _GLFWjoyobjectWin32* fo = first;
+182
const _GLFWjoyobjectWin32* so = second;
+183
+184
if (fo->type != so->type)
+185
return fo->type - so->type;
+186
+187
return fo->offset - so->offset;
+188
}
+189
+190
// Checks whether the specified device supports XInput
+191
// Technique from FDInputJoystickManager::IsXInputDeviceFast in ZDoom
+192
//
+193
static GLFWbool supportsXInput(const GUID* guid)
+194
{
+195
UINT i, count = 0;
+196
RAWINPUTDEVICELIST* ridl;
+197
GLFWbool result = GLFW_FALSE;
+198
+199
if (GetRawInputDeviceList(NULL, &count, sizeof(RAWINPUTDEVICELIST)) != 0)
+200
return GLFW_FALSE;
+201
+202
ridl = _glfw_calloc(count, sizeof(RAWINPUTDEVICELIST));
+203
+204
if (GetRawInputDeviceList(ridl, &count, sizeof(RAWINPUTDEVICELIST)) == (UINT) -1)
+205
{
+206
_glfw_free(ridl);
+207
return GLFW_FALSE;
+208
}
+209
+210
for (i = 0; i < count; i++)
+211
{
+212
RID_DEVICE_INFO rdi;
+213
char name[256];
+214
UINT size;
+215
+216
if (ridl[i].dwType != RIM_TYPEHID)
+217
continue;
+218
+219
ZeroMemory(&rdi, sizeof(rdi));
+220
rdi.cbSize = sizeof(rdi);
+221
size = sizeof(rdi);
+222
+223
if ((INT) GetRawInputDeviceInfoA(ridl[i].hDevice,
+224
RIDI_DEVICEINFO,
+225
&rdi, &size) == -1)
+226
{
+227
continue;
+228
}
+229
+230
if (MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) != (LONG) guid->Data1)
+231
continue;
+232
+233
memset(name, 0, sizeof(name));
+234
size = sizeof(name);
+235
+236
if ((INT) GetRawInputDeviceInfoA(ridl[i].hDevice,
+237
RIDI_DEVICENAME,
+238
name, &size) == -1)
+239
{
+240
break;
+241
}
+242
+243
name[sizeof(name) - 1] = '\0';
+244
if (strstr(name, "IG_"))
+245
{
+246
result = GLFW_TRUE;
+247
break;
+248
}
+249
}
+250
+251
_glfw_free(ridl);
+252
return result;
+253
}
+254
+255
// Frees all resources associated with the specified joystick
+256
//
+257
static void closeJoystick(_GLFWjoystick* js)
+258
{
+259
_glfwInputJoystick(js, GLFW_DISCONNECTED);
+260
+261
if (js->win32.device)
+262
{
+263
IDirectInputDevice8_Unacquire(js->win32.device);
+264
IDirectInputDevice8_Release(js->win32.device);
+265
}
+266
+267
_glfw_free(js->win32.objects);
+268
_glfwFreeJoystick(js);
+269
}
+270
+271
// DirectInput device object enumeration callback
+272
// Insights gleaned from SDL
+273
//
+274
static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi,
+275
void* user)
+276
{
+277
_GLFWobjenumWin32* data = user;
+278
_GLFWjoyobjectWin32* object = data->objects + data->objectCount;
+279
+280
if (DIDFT_GETTYPE(doi->dwType) & DIDFT_AXIS)
+281
{
+282
DIPROPRANGE dipr;
+283
+284
if (memcmp(&doi->guidType, &GUID_Slider, sizeof(GUID)) == 0)
+285
object->offset = DIJOFS_SLIDER(data->sliderCount);
+286
else if (memcmp(&doi->guidType, &GUID_XAxis, sizeof(GUID)) == 0)
+287
object->offset = DIJOFS_X;
+288
else if (memcmp(&doi->guidType, &GUID_YAxis, sizeof(GUID)) == 0)
+289
object->offset = DIJOFS_Y;
+290
else if (memcmp(&doi->guidType, &GUID_ZAxis, sizeof(GUID)) == 0)
+291
object->offset = DIJOFS_Z;
+292
else if (memcmp(&doi->guidType, &GUID_RxAxis, sizeof(GUID)) == 0)
+293
object->offset = DIJOFS_RX;
+294
else if (memcmp(&doi->guidType, &GUID_RyAxis, sizeof(GUID)) == 0)
+295
object->offset = DIJOFS_RY;
+296
else if (memcmp(&doi->guidType, &GUID_RzAxis, sizeof(GUID)) == 0)
+297
object->offset = DIJOFS_RZ;
+298
else
+299
return DIENUM_CONTINUE;
+300
+301
ZeroMemory(&dipr, sizeof(dipr));
+302
dipr.diph.dwSize = sizeof(dipr);
+303
dipr.diph.dwHeaderSize = sizeof(dipr.diph);
+304
dipr.diph.dwObj = doi->dwType;
+305
dipr.diph.dwHow = DIPH_BYID;
+306
dipr.lMin = -32768;
+307
dipr.lMax = 32767;
+308
+309
if (FAILED(IDirectInputDevice8_SetProperty(data->device,
+310
DIPROP_RANGE,
+311
&dipr.diph)))
+312
{
+313
return DIENUM_CONTINUE;
+314
}
+315
+316
if (memcmp(&doi->guidType, &GUID_Slider, sizeof(GUID)) == 0)
+317
{
+318
object->type = _GLFW_TYPE_SLIDER;
+319
data->sliderCount++;
+320
}
+321
else
+322
{
+323
object->type = _GLFW_TYPE_AXIS;
+324
data->axisCount++;
+325
}
+326
}
+327
else if (DIDFT_GETTYPE(doi->dwType) & DIDFT_BUTTON)
+328
{
+329
object->offset = DIJOFS_BUTTON(data->buttonCount);
+330
object->type = _GLFW_TYPE_BUTTON;
+331
data->buttonCount++;
+332
}
+333
else if (DIDFT_GETTYPE(doi->dwType) & DIDFT_POV)
+334
{
+335
object->offset = DIJOFS_POV(data->povCount);
+336
object->type = _GLFW_TYPE_POV;
+337
data->povCount++;
+338
}
+339
+340
data->objectCount++;
+341
return DIENUM_CONTINUE;
+342
}
+343
+344
// DirectInput device enumeration callback
+345
//
+346
static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
+347
{
+348
int jid = 0;
+349
DIDEVCAPS dc;
+350
DIPROPDWORD dipd;
+351
IDirectInputDevice8* device;
+352
_GLFWobjenumWin32 data;
+353
_GLFWjoystick* js;
+354
char guid[33];
+355
char name[256];
+356
+357
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
+358
{
+359
js = _glfw.joysticks + jid;
+360
if (js->connected)
+361
{
+362
if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0)
+363
return DIENUM_CONTINUE;
+364
}
+365
}
+366
+367
if (supportsXInput(&di->guidProduct))
+368
return DIENUM_CONTINUE;
+369
+370
if (FAILED(IDirectInput8_CreateDevice(_glfw.win32.dinput8.api,
+371
&di->guidInstance,
+372
&device,
+373
NULL)))
+374
{
+375
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create device");
+376
return DIENUM_CONTINUE;
+377
}
+378
+379
if (FAILED(IDirectInputDevice8_SetDataFormat(device, &_glfwDataFormat)))
+380
{
+381
_glfwInputError(GLFW_PLATFORM_ERROR,
+382
"Win32: Failed to set device data format");
+383
+384
IDirectInputDevice8_Release(device);
+385
return DIENUM_CONTINUE;
+386
}
+387
+388
ZeroMemory(&dc, sizeof(dc));
+389
dc.dwSize = sizeof(dc);
+390
+391
if (FAILED(IDirectInputDevice8_GetCapabilities(device, &dc)))
+392
{
+393
_glfwInputError(GLFW_PLATFORM_ERROR,
+394
"Win32: Failed to query device capabilities");
+395
+396
IDirectInputDevice8_Release(device);
+397
return DIENUM_CONTINUE;
+398
}
+399
+400
ZeroMemory(&dipd, sizeof(dipd));
+401
dipd.diph.dwSize = sizeof(dipd);
+402
dipd.diph.dwHeaderSize = sizeof(dipd.diph);
+403
dipd.diph.dwHow = DIPH_DEVICE;
+404
dipd.dwData = DIPROPAXISMODE_ABS;
+405
+406
if (FAILED(IDirectInputDevice8_SetProperty(device,
+407
DIPROP_AXISMODE,
+408
&dipd.diph)))
+409
{
+410
_glfwInputError(GLFW_PLATFORM_ERROR,
+411
"Win32: Failed to set device axis mode");
+412
+413
IDirectInputDevice8_Release(device);
+414
return DIENUM_CONTINUE;
+415
}
+416
+417
memset(&data, 0, sizeof(data));
+418
data.device = device;
+419
data.objects = _glfw_calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs,
+420
sizeof(_GLFWjoyobjectWin32));
+421
+422
if (FAILED(IDirectInputDevice8_EnumObjects(device,
+423
deviceObjectCallback,
+424
&data,
+425
DIDFT_AXIS | DIDFT_BUTTON | DIDFT_POV)))
+426
{
+427
_glfwInputError(GLFW_PLATFORM_ERROR,
+428
"Win32: Failed to enumerate device objects");
+429
+430
IDirectInputDevice8_Release(device);
+431
_glfw_free(data.objects);
+432
return DIENUM_CONTINUE;
+433
}
+434
+435
qsort(data.objects, data.objectCount,
+436
sizeof(_GLFWjoyobjectWin32),
+437
compareJoystickObjects);
+438
+439
if (!WideCharToMultiByte(CP_UTF8, 0,
+440
di->tszInstanceName, -1,
+441
name, sizeof(name),
+442
NULL, NULL))
+443
{
+444
_glfwInputError(GLFW_PLATFORM_ERROR,
+445
"Win32: Failed to convert joystick name to UTF-8");
+446
+447
IDirectInputDevice8_Release(device);
+448
_glfw_free(data.objects);
+449
return DIENUM_STOP;
+450
}
+451
+452
// Generate a joystick GUID that matches the SDL 2.0.5+ one
+453
if (memcmp(&di->guidProduct.Data4[2], "PIDVID", 6) == 0)
+454
{
+455
sprintf(guid, "03000000%02x%02x0000%02x%02x000000000000",
+456
(uint8_t) di->guidProduct.Data1,
+457
(uint8_t) (di->guidProduct.Data1 >> 8),
+458
(uint8_t) (di->guidProduct.Data1 >> 16),
+459
(uint8_t) (di->guidProduct.Data1 >> 24));
+460
}
+461
else
+462
{
+463
sprintf(guid, "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
+464
name[0], name[1], name[2], name[3],
+465
name[4], name[5], name[6], name[7],
+466
name[8], name[9], name[10]);
+467
}
+468
+469
js = _glfwAllocJoystick(name, guid,
+470
data.axisCount + data.sliderCount,
+471
data.buttonCount,
+472
data.povCount);
+473
if (!js)
+474
{
+475
IDirectInputDevice8_Release(device);
+476
_glfw_free(data.objects);
+477
return DIENUM_STOP;
+478
}
+479
+480
js->win32.device = device;
+481
js->win32.guid = di->guidInstance;
+482
js->win32.objects = data.objects;
+483
js->win32.objectCount = data.objectCount;
+484
+485
_glfwInputJoystick(js, GLFW_CONNECTED);
+486
return DIENUM_CONTINUE;
+487
}
+488
+489
+490
//////////////////////////////////////////////////////////////////////////
+491
////// GLFW internal API //////
+492
//////////////////////////////////////////////////////////////////////////
+493
+494
// Checks for new joysticks after DBT_DEVICEARRIVAL
+495
//
+496
void _glfwDetectJoystickConnectionWin32(void)
+497
{
+498
if (_glfw.win32.xinput.instance)
+499
{

Showing the first 500 of 768 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/win32_joystick.hadded
@@ -0,0 +1,51 @@
+1
//========================================================================
+2
// GLFW 3.5 Win32 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+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
#define GLFW_WIN32_JOYSTICK_STATE _GLFWjoystickWin32 win32;
+28
#define GLFW_WIN32_LIBRARY_JOYSTICK_STATE
+29
+30
// Joystick element (axis, button or slider)
+31
//
+32
typedef struct _GLFWjoyobjectWin32
+33
{
+34
int offset;
+35
int type;
+36
} _GLFWjoyobjectWin32;
+37
+38
// Win32-specific per-joystick data
+39
//
+40
typedef struct _GLFWjoystickWin32
+41
{
+42
_GLFWjoyobjectWin32* objects;
+43
int objectCount;
+44
IDirectInputDevice8W* device;
+45
DWORD index;
+46
GUID guid;
+47
} _GLFWjoystickWin32;
+48
+49
void _glfwDetectJoystickConnectionWin32(void);
+50
void _glfwDetectJoystickDisconnectionWin32(void);
+51
vendor/glfw/src/win32_module.cadded
@@ -0,0 +1,52 @@
+1
//========================================================================
+2
// GLFW 3.5 Win32 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2021 Camilla Löwy <elmindreda@glfw.org>
+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 "internal.h"
+28
+29
#if defined(GLFW_BUILD_WIN32_MODULE)
+30
+31
//////////////////////////////////////////////////////////////////////////
+32
////// GLFW platform API //////
+33
//////////////////////////////////////////////////////////////////////////
+34
+35
void* _glfwPlatformLoadModule(const char* path)
+36
{
+37
return LoadLibraryA(path);
+38
}
+39
+40
void _glfwPlatformFreeModule(void* module)
+41
{
+42
if (module)
+43
FreeLibrary((HMODULE) module);
+44
}
+45
+46
GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name)
+47
{
+48
return (GLFWproc) GetProcAddress((HMODULE) module, name);
+49
}
+50
+51
#endif // GLFW_BUILD_WIN32_MODULE
+52
vendor/glfw/src/win32_monitor.cadded
@@ -0,0 +1,574 @@
+1
//========================================================================
+2
// GLFW 3.5 Win32 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_WIN32)
+31
+32
#include <stdlib.h>
+33
#include <string.h>
+34
#include <limits.h>
+35
#include <wchar.h>
+36
#include <assert.h>
+37
+38
+39
// Callback for EnumDisplayMonitors in createMonitor
+40
//
+41
static BOOL CALLBACK monitorCallback(HMONITOR handle,
+42
HDC dc,
+43
RECT* rect,
+44
LPARAM data)
+45
{
+46
MONITORINFOEXW mi;
+47
ZeroMemory(&mi, sizeof(mi));
+48
mi.cbSize = sizeof(mi);
+49
+50
if (GetMonitorInfoW(handle, (MONITORINFO*) &mi))
+51
{
+52
_GLFWmonitor* monitor = (_GLFWmonitor*) data;
+53
if (wcscmp(mi.szDevice, monitor->win32.adapterName) == 0)
+54
monitor->win32.handle = handle;
+55
}
+56
+57
return TRUE;
+58
}
+59
+60
// Create monitor from an adapter and (optionally) a display
+61
//
+62
static _GLFWmonitor* createMonitor(DISPLAY_DEVICEW* adapter,
+63
DISPLAY_DEVICEW* display)
+64
{
+65
_GLFWmonitor* monitor;
+66
int widthMM, heightMM;
+67
char* name;
+68
HDC dc;
+69
DEVMODEW dm;
+70
RECT rect;
+71
+72
if (display)
+73
name = _glfwCreateUTF8FromWideStringWin32(display->DeviceString);
+74
else
+75
name = _glfwCreateUTF8FromWideStringWin32(adapter->DeviceString);
+76
if (!name)
+77
return NULL;
+78
+79
ZeroMemory(&dm, sizeof(dm));
+80
dm.dmSize = sizeof(dm);
+81
EnumDisplaySettingsW(adapter->DeviceName, ENUM_CURRENT_SETTINGS, &dm);
+82
+83
dc = CreateDCW(L"DISPLAY", adapter->DeviceName, NULL, NULL);
+84
+85
if (IsWindows8Point1OrGreater())
+86
{
+87
widthMM = GetDeviceCaps(dc, HORZSIZE);
+88
heightMM = GetDeviceCaps(dc, VERTSIZE);
+89
}
+90
else
+91
{
+92
widthMM = (int) (dm.dmPelsWidth * 25.4f / GetDeviceCaps(dc, LOGPIXELSX));
+93
heightMM = (int) (dm.dmPelsHeight * 25.4f / GetDeviceCaps(dc, LOGPIXELSY));
+94
}
+95
+96
DeleteDC(dc);
+97
+98
monitor = _glfwAllocMonitor(name, widthMM, heightMM);
+99
_glfw_free(name);
+100
+101
if (adapter->StateFlags & DISPLAY_DEVICE_MODESPRUNED)
+102
monitor->win32.modesPruned = GLFW_TRUE;
+103
+104
wcscpy(monitor->win32.adapterName, adapter->DeviceName);
+105
WideCharToMultiByte(CP_UTF8, 0,
+106
adapter->DeviceName, -1,
+107
monitor->win32.publicAdapterName,
+108
sizeof(monitor->win32.publicAdapterName),
+109
NULL, NULL);
+110
+111
if (display)
+112
{
+113
wcscpy(monitor->win32.displayName, display->DeviceName);
+114
WideCharToMultiByte(CP_UTF8, 0,
+115
display->DeviceName, -1,
+116
monitor->win32.publicDisplayName,
+117
sizeof(monitor->win32.publicDisplayName),
+118
NULL, NULL);
+119
}
+120
+121
rect.left = dm.dmPosition.x;
+122
rect.top = dm.dmPosition.y;
+123
rect.right = dm.dmPosition.x + dm.dmPelsWidth;
+124
rect.bottom = dm.dmPosition.y + dm.dmPelsHeight;
+125
+126
EnumDisplayMonitors(NULL, &rect, monitorCallback, (LPARAM) monitor);
+127
return monitor;
+128
}
+129
+130
+131
//////////////////////////////////////////////////////////////////////////
+132
////// GLFW internal API //////
+133
//////////////////////////////////////////////////////////////////////////
+134
+135
// Poll for changes in the set of connected monitors
+136
//
+137
void _glfwPollMonitorsWin32(void)
+138
{
+139
int i, disconnectedCount;
+140
_GLFWmonitor** disconnected = NULL;
+141
DWORD adapterIndex, displayIndex;
+142
DISPLAY_DEVICEW adapter, display;
+143
_GLFWmonitor* monitor;
+144
+145
disconnectedCount = _glfw.monitorCount;
+146
if (disconnectedCount)
+147
{
+148
disconnected = _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
+149
memcpy(disconnected,
+150
_glfw.monitors,
+151
_glfw.monitorCount * sizeof(_GLFWmonitor*));
+152
}
+153
+154
for (adapterIndex = 0; ; adapterIndex++)
+155
{
+156
int type = _GLFW_INSERT_LAST;
+157
+158
ZeroMemory(&adapter, sizeof(adapter));
+159
adapter.cb = sizeof(adapter);
+160
+161
if (!EnumDisplayDevicesW(NULL, adapterIndex, &adapter, 0))
+162
break;
+163
+164
if (!(adapter.StateFlags & DISPLAY_DEVICE_ACTIVE))
+165
continue;
+166
+167
if (adapter.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
+168
type = _GLFW_INSERT_FIRST;
+169
+170
for (displayIndex = 0; ; displayIndex++)
+171
{
+172
ZeroMemory(&display, sizeof(display));
+173
display.cb = sizeof(display);
+174
+175
if (!EnumDisplayDevicesW(adapter.DeviceName, displayIndex, &display, 0))
+176
break;
+177
+178
if (!(display.StateFlags & DISPLAY_DEVICE_ACTIVE))
+179
continue;
+180
+181
for (i = 0; i < disconnectedCount; i++)
+182
{
+183
if (disconnected[i] &&
+184
wcscmp(disconnected[i]->win32.displayName,
+185
display.DeviceName) == 0)
+186
{
+187
disconnected[i] = NULL;
+188
// handle may have changed, update
+189
EnumDisplayMonitors(NULL, NULL, monitorCallback, (LPARAM) _glfw.monitors[i]);
+190
break;
+191
}
+192
}
+193
+194
if (i < disconnectedCount)
+195
continue;
+196
+197
monitor = createMonitor(&adapter, &display);
+198
if (!monitor)
+199
{
+200
_glfw_free(disconnected);
+201
return;
+202
}
+203
+204
_glfwInputMonitor(monitor, GLFW_CONNECTED, type);
+205
+206
type = _GLFW_INSERT_LAST;
+207
}
+208
+209
// HACK: If an active adapter does not have any display devices
+210
// (as sometimes happens), add it directly as a monitor
+211
if (displayIndex == 0)
+212
{
+213
for (i = 0; i < disconnectedCount; i++)
+214
{
+215
if (disconnected[i] &&
+216
wcscmp(disconnected[i]->win32.adapterName,
+217
adapter.DeviceName) == 0)
+218
{
+219
disconnected[i] = NULL;
+220
break;
+221
}
+222
}
+223
+224
if (i < disconnectedCount)
+225
continue;
+226
+227
monitor = createMonitor(&adapter, NULL);
+228
if (!monitor)
+229
{
+230
_glfw_free(disconnected);
+231
return;
+232
}
+233
+234
_glfwInputMonitor(monitor, GLFW_CONNECTED, type);
+235
}
+236
}
+237
+238
for (i = 0; i < disconnectedCount; i++)
+239
{
+240
if (disconnected[i])
+241
_glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
+242
}
+243
+244
_glfw_free(disconnected);
+245
}
+246
+247
// Change the current video mode
+248
//
+249
void _glfwSetVideoModeWin32(_GLFWmonitor* monitor, const GLFWvidmode* desired)
+250
{
+251
GLFWvidmode current;
+252
const GLFWvidmode* best;
+253
DEVMODEW dm;
+254
LONG result;
+255
+256
best = _glfwChooseVideoMode(monitor, desired);
+257
_glfwGetVideoModeWin32(monitor, &current);
+258
if (_glfwCompareVideoModes(&current, best) == 0)
+259
return;
+260
+261
ZeroMemory(&dm, sizeof(dm));
+262
dm.dmSize = sizeof(dm);
+263
dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL |
+264
DM_DISPLAYFREQUENCY;
+265
dm.dmPelsWidth = best->width;
+266
dm.dmPelsHeight = best->height;
+267
dm.dmBitsPerPel = best->redBits + best->greenBits + best->blueBits;
+268
dm.dmDisplayFrequency = best->refreshRate;
+269
+270
if (dm.dmBitsPerPel < 15 || dm.dmBitsPerPel >= 24)
+271
dm.dmBitsPerPel = 32;
+272
+273
result = ChangeDisplaySettingsExW(monitor->win32.adapterName,
+274
&dm,
+275
NULL,
+276
CDS_FULLSCREEN,
+277
NULL);
+278
if (result == DISP_CHANGE_SUCCESSFUL)
+279
monitor->win32.modeChanged = GLFW_TRUE;
+280
else
+281
{
+282
const char* description = "Unknown error";
+283
+284
if (result == DISP_CHANGE_BADDUALVIEW)
+285
description = "The system uses DualView";
+286
else if (result == DISP_CHANGE_BADFLAGS)
+287
description = "Invalid flags";
+288
else if (result == DISP_CHANGE_BADMODE)
+289
description = "Graphics mode not supported";
+290
else if (result == DISP_CHANGE_BADPARAM)
+291
description = "Invalid parameter";
+292
else if (result == DISP_CHANGE_FAILED)
+293
description = "Graphics mode failed";
+294
else if (result == DISP_CHANGE_NOTUPDATED)
+295
description = "Failed to write to registry";
+296
else if (result == DISP_CHANGE_RESTART)
+297
description = "Computer restart required";
+298
+299
_glfwInputError(GLFW_PLATFORM_ERROR,
+300
"Win32: Failed to set video mode: %s",
+301
description);
+302
}
+303
}
+304
+305
// Restore the previously saved (original) video mode
+306
//
+307
void _glfwRestoreVideoModeWin32(_GLFWmonitor* monitor)
+308
{
+309
if (monitor->win32.modeChanged)
+310
{
+311
ChangeDisplaySettingsExW(monitor->win32.adapterName,
+312
NULL, NULL, CDS_FULLSCREEN, NULL);
+313
monitor->win32.modeChanged = GLFW_FALSE;
+314
}
+315
}
+316
+317
void _glfwGetHMONITORContentScaleWin32(HMONITOR handle, float* xscale, float* yscale)
+318
{
+319
UINT xdpi, ydpi;
+320
+321
if (xscale)
+322
*xscale = 0.f;
+323
if (yscale)
+324
*yscale = 0.f;
+325
+326
if (IsWindows8Point1OrGreater())
+327
{
+328
if (GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi) != S_OK)
+329
{
+330
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to query monitor DPI");
+331
return;
+332
}
+333
}
+334
else
+335
{
+336
const HDC dc = GetDC(NULL);
+337
xdpi = GetDeviceCaps(dc, LOGPIXELSX);
+338
ydpi = GetDeviceCaps(dc, LOGPIXELSY);
+339
ReleaseDC(NULL, dc);
+340
}
+341
+342
if (xscale)
+343
*xscale = xdpi / (float) USER_DEFAULT_SCREEN_DPI;
+344
if (yscale)
+345
*yscale = ydpi / (float) USER_DEFAULT_SCREEN_DPI;
+346
}
+347
+348
+349
//////////////////////////////////////////////////////////////////////////
+350
////// GLFW platform API //////
+351
//////////////////////////////////////////////////////////////////////////
+352
+353
void _glfwFreeMonitorWin32(_GLFWmonitor* monitor)
+354
{
+355
}
+356
+357
void _glfwGetMonitorPosWin32(_GLFWmonitor* monitor, int* xpos, int* ypos)
+358
{
+359
DEVMODEW dm;
+360
ZeroMemory(&dm, sizeof(dm));
+361
dm.dmSize = sizeof(dm);
+362
+363
EnumDisplaySettingsExW(monitor->win32.adapterName,
+364
ENUM_CURRENT_SETTINGS,
+365
&dm,
+366
EDS_ROTATEDMODE);
+367
+368
if (xpos)
+369
*xpos = dm.dmPosition.x;
+370
if (ypos)
+371
*ypos = dm.dmPosition.y;
+372
}
+373
+374
void _glfwGetMonitorContentScaleWin32(_GLFWmonitor* monitor,
+375
float* xscale, float* yscale)
+376
{
+377
_glfwGetHMONITORContentScaleWin32(monitor->win32.handle, xscale, yscale);
+378
}
+379
+380
void _glfwGetMonitorWorkareaWin32(_GLFWmonitor* monitor,
+381
int* xpos, int* ypos,
+382
int* width, int* height)
+383
{
+384
MONITORINFO mi = { sizeof(mi) };
+385
GetMonitorInfoW(monitor->win32.handle, &mi);
+386
+387
if (xpos)
+388
*xpos = mi.rcWork.left;
+389
if (ypos)
+390
*ypos = mi.rcWork.top;
+391
if (width)
+392
*width = mi.rcWork.right - mi.rcWork.left;
+393
if (height)
+394
*height = mi.rcWork.bottom - mi.rcWork.top;
+395
}
+396
+397
GLFWvidmode* _glfwGetVideoModesWin32(_GLFWmonitor* monitor, int* count)
+398
{
+399
int modeIndex = 0, size = 0;
+400
GLFWvidmode* result = NULL;
+401
+402
*count = 0;
+403
+404
for (;;)
+405
{
+406
int i;
+407
GLFWvidmode mode;
+408
DEVMODEW dm;
+409
+410
ZeroMemory(&dm, sizeof(dm));
+411
dm.dmSize = sizeof(dm);
+412
+413
if (!EnumDisplaySettingsW(monitor->win32.adapterName, modeIndex, &dm))
+414
break;
+415
+416
modeIndex++;
+417
+418
// Skip modes with less than 15 BPP
+419
if (dm.dmBitsPerPel < 15)
+420
continue;
+421
+422
mode.width = dm.dmPelsWidth;
+423
mode.height = dm.dmPelsHeight;
+424
mode.refreshRate = dm.dmDisplayFrequency;
+425
_glfwSplitBPP(dm.dmBitsPerPel,
+426
&mode.redBits,
+427
&mode.greenBits,
+428
&mode.blueBits);
+429
+430
for (i = 0; i < *count; i++)
+431
{
+432
if (_glfwCompareVideoModes(result + i, &mode) == 0)
+433
break;
+434
}
+435
+436
// Skip duplicate modes
+437
if (i < *count)
+438
continue;
+439
+440
if (monitor->win32.modesPruned)
+441
{
+442
// Skip modes not supported by the connected displays
+443
if (ChangeDisplaySettingsExW(monitor->win32.adapterName,
+444
&dm,
+445
NULL,
+446
CDS_TEST,
+447
NULL) != DISP_CHANGE_SUCCESSFUL)
+448
{
+449
continue;
+450
}
+451
}
+452
+453
if (*count == size)
+454
{
+455
size += 128;
+456
result = (GLFWvidmode*) _glfw_realloc(result, size * sizeof(GLFWvidmode));
+457
}
+458
+459
(*count)++;
+460
result[*count - 1] = mode;
+461
}
+462
+463
if (!*count)
+464
{
+465
// HACK: Report the current mode if no valid modes were found
+466
result = _glfw_calloc(1, sizeof(GLFWvidmode));
+467
_glfwGetVideoModeWin32(monitor, result);
+468
*count = 1;
+469
}
+470
+471
return result;
+472
}
+473
+474
GLFWbool _glfwGetVideoModeWin32(_GLFWmonitor* monitor, GLFWvidmode* mode)
+475
{
+476
DEVMODEW dm;
+477
ZeroMemory(&dm, sizeof(dm));
+478
dm.dmSize = sizeof(dm);
+479
+480
if (!EnumDisplaySettingsW(monitor->win32.adapterName, ENUM_CURRENT_SETTINGS, &dm))
+481
{
+482
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to query display settings");
+483
return GLFW_FALSE;
+484
}
+485
+486
mode->width = dm.dmPelsWidth;
+487
mode->height = dm.dmPelsHeight;
+488
mode->refreshRate = dm.dmDisplayFrequency;
+489
_glfwSplitBPP(dm.dmBitsPerPel,
+490
&mode->redBits,
+491
&mode->greenBits,
+492
&mode->blueBits);
+493
+494
return GLFW_TRUE;
+495
}
+496
+497
GLFWbool _glfwGetGammaRampWin32(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
+498
{
+499
HDC dc;

Showing the first 500 of 575 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/win32_platform.hadded
@@ -0,0 +1,567 @@
+1
//========================================================================
+2
// GLFW 3.5 Win32 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
// We don't need all the fancy stuff
+29
#ifndef NOMINMAX
+30
#define NOMINMAX
+31
#endif
+32
+33
#ifndef VC_EXTRALEAN
+34
#define VC_EXTRALEAN
+35
#endif
+36
+37
#ifndef WIN32_LEAN_AND_MEAN
+38
#define WIN32_LEAN_AND_MEAN
+39
#endif
+40
+41
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
+42
// example to allow applications to correctly declare a GL_KHR_debug callback)
+43
// but windows.h assumes no one will define APIENTRY before it does
+44
#undef APIENTRY
+45
+46
// GLFW on Windows is Unicode only and does not work in MBCS mode
+47
#ifndef UNICODE
+48
#define UNICODE
+49
#endif
+50
+51
// GLFW requires Windows 7 or later
+52
#if WINVER < 0x0601
+53
#undef WINVER
+54
#define WINVER 0x0601
+55
#endif
+56
#if _WIN32_WINNT < 0x0601
+57
#undef _WIN32_WINNT
+58
#define _WIN32_WINNT 0x0601
+59
#endif
+60
+61
// GLFW uses DirectInput8 interfaces
+62
#define DIRECTINPUT_VERSION 0x0800
+63
+64
// GLFW uses OEM cursor resources
+65
#define OEMRESOURCE
+66
+67
#include <wctype.h>
+68
#include <windows.h>
+69
#include <dwmapi.h>
+70
#include <dinput.h>
+71
#include <xinput.h>
+72
#include <dbt.h>
+73
+74
// HACK: Define macros that some windows.h variants don't
+75
#ifndef WM_COPYGLOBALDATA
+76
#define WM_COPYGLOBALDATA 0x0049
+77
#endif
+78
#ifndef WM_DPICHANGED
+79
#define WM_DPICHANGED 0x02E0
+80
#endif
+81
#ifndef EDS_ROTATEDMODE
+82
#define EDS_ROTATEDMODE 0x00000004
+83
#endif
+84
#ifndef _WIN32_WINNT_WINBLUE
+85
#define _WIN32_WINNT_WINBLUE 0x0603
+86
#endif
+87
#ifndef _WIN32_WINNT_WIN8
+88
#define _WIN32_WINNT_WIN8 0x0602
+89
#endif
+90
#ifndef WM_GETDPISCALEDSIZE
+91
#define WM_GETDPISCALEDSIZE 0x02e4
+92
#endif
+93
#ifndef USER_DEFAULT_SCREEN_DPI
+94
#define USER_DEFAULT_SCREEN_DPI 96
+95
#endif
+96
+97
#ifndef DPI_ENUMS_DECLARED
+98
typedef enum
+99
{
+100
PROCESS_DPI_UNAWARE = 0,
+101
PROCESS_SYSTEM_DPI_AWARE = 1,
+102
PROCESS_PER_MONITOR_DPI_AWARE = 2
+103
} PROCESS_DPI_AWARENESS;
+104
typedef enum
+105
{
+106
MDT_EFFECTIVE_DPI = 0,
+107
MDT_ANGULAR_DPI = 1,
+108
MDT_RAW_DPI = 2,
+109
MDT_DEFAULT = MDT_EFFECTIVE_DPI
+110
} MONITOR_DPI_TYPE;
+111
#endif /*DPI_ENUMS_DECLARED*/
+112
+113
#ifndef DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
+114
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((HANDLE) -4)
+115
#endif /*DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2*/
+116
+117
// Replacement for versionhelpers.h macros, as we cannot rely on the
+118
// application having a correct embedded manifest
+119
//
+120
#define IsWindows8OrGreater() \
+121
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WIN8), \
+122
LOBYTE(_WIN32_WINNT_WIN8), 0)
+123
#define IsWindows8Point1OrGreater() \
+124
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINBLUE), \
+125
LOBYTE(_WIN32_WINNT_WINBLUE), 0)
+126
+127
// Windows 10 Anniversary Update
+128
#define _glfwIsWindows10Version1607OrGreaterWin32() \
+129
_glfwIsWindows10BuildOrGreaterWin32(14393)
+130
// Windows 10 Creators Update
+131
#define _glfwIsWindows10Version1703OrGreaterWin32() \
+132
_glfwIsWindows10BuildOrGreaterWin32(15063)
+133
+134
// HACK: Define macros that some xinput.h variants don't
+135
#ifndef XINPUT_CAPS_WIRELESS
+136
#define XINPUT_CAPS_WIRELESS 0x0002
+137
#endif
+138
#ifndef XINPUT_DEVSUBTYPE_WHEEL
+139
#define XINPUT_DEVSUBTYPE_WHEEL 0x02
+140
#endif
+141
#ifndef XINPUT_DEVSUBTYPE_ARCADE_STICK
+142
#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
+143
#endif
+144
#ifndef XINPUT_DEVSUBTYPE_FLIGHT_STICK
+145
#define XINPUT_DEVSUBTYPE_FLIGHT_STICK 0x04
+146
#endif
+147
#ifndef XINPUT_DEVSUBTYPE_DANCE_PAD
+148
#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
+149
#endif
+150
#ifndef XINPUT_DEVSUBTYPE_GUITAR
+151
#define XINPUT_DEVSUBTYPE_GUITAR 0x06
+152
#endif
+153
#ifndef XINPUT_DEVSUBTYPE_DRUM_KIT
+154
#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
+155
#endif
+156
#ifndef XINPUT_DEVSUBTYPE_ARCADE_PAD
+157
#define XINPUT_DEVSUBTYPE_ARCADE_PAD 0x13
+158
#endif
+159
#ifndef XUSER_MAX_COUNT
+160
#define XUSER_MAX_COUNT 4
+161
#endif
+162
+163
// HACK: Define macros that some dinput.h variants don't
+164
#ifndef DIDFT_OPTIONAL
+165
#define DIDFT_OPTIONAL 0x80000000
+166
#endif
+167
+168
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
+169
#define WGL_SUPPORT_OPENGL_ARB 0x2010
+170
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
+171
#define WGL_PIXEL_TYPE_ARB 0x2013
+172
#define WGL_TYPE_RGBA_ARB 0x202b
+173
#define WGL_ACCELERATION_ARB 0x2003
+174
#define WGL_NO_ACCELERATION_ARB 0x2025
+175
#define WGL_RED_BITS_ARB 0x2015
+176
#define WGL_RED_SHIFT_ARB 0x2016
+177
#define WGL_GREEN_BITS_ARB 0x2017
+178
#define WGL_GREEN_SHIFT_ARB 0x2018
+179
#define WGL_BLUE_BITS_ARB 0x2019
+180
#define WGL_BLUE_SHIFT_ARB 0x201a
+181
#define WGL_ALPHA_BITS_ARB 0x201b
+182
#define WGL_ALPHA_SHIFT_ARB 0x201c
+183
#define WGL_ACCUM_BITS_ARB 0x201d
+184
#define WGL_ACCUM_RED_BITS_ARB 0x201e
+185
#define WGL_ACCUM_GREEN_BITS_ARB 0x201f
+186
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
+187
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
+188
#define WGL_DEPTH_BITS_ARB 0x2022
+189
#define WGL_STENCIL_BITS_ARB 0x2023
+190
#define WGL_AUX_BUFFERS_ARB 0x2024
+191
#define WGL_STEREO_ARB 0x2012
+192
#define WGL_DOUBLE_BUFFER_ARB 0x2011
+193
#define WGL_SAMPLES_ARB 0x2042
+194
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20a9
+195
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
+196
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+197
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
+198
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+199
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+200
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
+201
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
+202
#define WGL_CONTEXT_FLAGS_ARB 0x2094
+203
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
+204
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
+205
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+206
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+207
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
+208
#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
+209
#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
+210
#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
+211
#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3
+212
#define WGL_COLORSPACE_EXT 0x309d
+213
#define WGL_COLORSPACE_SRGB_EXT 0x3089
+214
+215
#define ERROR_INVALID_VERSION_ARB 0x2095
+216
#define ERROR_INVALID_PROFILE_ARB 0x2096
+217
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
+218
+219
// xinput.dll function pointer typedefs
+220
typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*);
+221
typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*);
+222
#define XInputGetCapabilities _glfw.win32.xinput.GetCapabilities
+223
#define XInputGetState _glfw.win32.xinput.GetState
+224
+225
// dinput8.dll function pointer typedefs
+226
typedef HRESULT (WINAPI * PFN_DirectInput8Create)(HINSTANCE,DWORD,REFIID,LPVOID*,LPUNKNOWN);
+227
#define DirectInput8Create _glfw.win32.dinput8.Create
+228
+229
// user32.dll function pointer typedefs
+230
typedef BOOL (WINAPI * PFN_EnableNonClientDpiScaling)(HWND);
+231
typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE);
+232
typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND);
+233
typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT);
+234
typedef int (WINAPI * PFN_GetSystemMetricsForDpi)(int,UINT);
+235
#define EnableNonClientDpiScaling _glfw.win32.user32.EnableNonClientDpiScaling_
+236
#define SetProcessDpiAwarenessContext _glfw.win32.user32.SetProcessDpiAwarenessContext_
+237
#define GetDpiForWindow _glfw.win32.user32.GetDpiForWindow_
+238
#define AdjustWindowRectExForDpi _glfw.win32.user32.AdjustWindowRectExForDpi_
+239
#define GetSystemMetricsForDpi _glfw.win32.user32.GetSystemMetricsForDpi_
+240
+241
// dwmapi.dll function pointer typedefs
+242
typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*);
+243
typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID);
+244
typedef HRESULT(WINAPI * PFN_DwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*);
+245
typedef HRESULT (WINAPI * PFN_DwmGetColorizationColor)(DWORD*,BOOL*);
+246
#define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled
+247
#define DwmFlush _glfw.win32.dwmapi.Flush
+248
#define DwmEnableBlurBehindWindow _glfw.win32.dwmapi.EnableBlurBehindWindow
+249
#define DwmGetColorizationColor _glfw.win32.dwmapi.GetColorizationColor
+250
+251
// shcore.dll function pointer typedefs
+252
typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);
+253
typedef HRESULT (WINAPI * PFN_GetDpiForMonitor)(HMONITOR,MONITOR_DPI_TYPE,UINT*,UINT*);
+254
#define SetProcessDpiAwareness _glfw.win32.shcore.SetProcessDpiAwareness_
+255
#define GetDpiForMonitor _glfw.win32.shcore.GetDpiForMonitor_
+256
+257
// ntdll.dll function pointer typedefs
+258
typedef LONG (WINAPI * PFN_RtlVerifyVersionInfo)(OSVERSIONINFOEXW*,ULONG,ULONGLONG);
+259
#define RtlVerifyVersionInfo _glfw.win32.ntdll.RtlVerifyVersionInfo_
+260
+261
// WGL extension pointer typedefs
+262
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int);
+263
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*);
+264
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void);
+265
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC);
+266
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*);
+267
#define wglSwapIntervalEXT _glfw.wgl.SwapIntervalEXT
+268
#define wglGetPixelFormatAttribivARB _glfw.wgl.GetPixelFormatAttribivARB
+269
#define wglGetExtensionsStringEXT _glfw.wgl.GetExtensionsStringEXT
+270
#define wglGetExtensionsStringARB _glfw.wgl.GetExtensionsStringARB
+271
#define wglCreateContextAttribsARB _glfw.wgl.CreateContextAttribsARB
+272
+273
// opengl32.dll function pointer typedefs
+274
typedef HGLRC (WINAPI * PFN_wglCreateContext)(HDC);
+275
typedef BOOL (WINAPI * PFN_wglDeleteContext)(HGLRC);
+276
typedef PROC (WINAPI * PFN_wglGetProcAddress)(LPCSTR);
+277
typedef HDC (WINAPI * PFN_wglGetCurrentDC)(void);
+278
typedef HGLRC (WINAPI * PFN_wglGetCurrentContext)(void);
+279
typedef BOOL (WINAPI * PFN_wglMakeCurrent)(HDC,HGLRC);
+280
typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC);
+281
#define wglCreateContext _glfw.wgl.CreateContext
+282
#define wglDeleteContext _glfw.wgl.DeleteContext
+283
#define wglGetProcAddress _glfw.wgl.GetProcAddress
+284
#define wglGetCurrentDC _glfw.wgl.GetCurrentDC
+285
#define wglGetCurrentContext _glfw.wgl.GetCurrentContext
+286
#define wglMakeCurrent _glfw.wgl.MakeCurrent
+287
#define wglShareLists _glfw.wgl.ShareLists
+288
+289
typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
+290
+291
typedef struct VkWin32SurfaceCreateInfoKHR
+292
{
+293
VkStructureType sType;
+294
const void* pNext;
+295
VkWin32SurfaceCreateFlagsKHR flags;
+296
HINSTANCE hinstance;
+297
HWND hwnd;
+298
} VkWin32SurfaceCreateInfoKHR;
+299
+300
typedef VkResult (APIENTRY *PFN_vkCreateWin32SurfaceKHR)(VkInstance,const VkWin32SurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
+301
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice,uint32_t);
+302
+303
#define GLFW_WIN32_WINDOW_STATE _GLFWwindowWin32 win32;
+304
#define GLFW_WIN32_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32;
+305
#define GLFW_WIN32_MONITOR_STATE _GLFWmonitorWin32 win32;
+306
#define GLFW_WIN32_CURSOR_STATE _GLFWcursorWin32 win32;
+307
+308
#define GLFW_WGL_CONTEXT_STATE _GLFWcontextWGL wgl;
+309
#define GLFW_WGL_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl;
+310
+311
+312
// WGL-specific per-context data
+313
//
+314
typedef struct _GLFWcontextWGL
+315
{
+316
HDC dc;
+317
HGLRC handle;
+318
int interval;
+319
} _GLFWcontextWGL;
+320
+321
// WGL-specific global data
+322
//
+323
typedef struct _GLFWlibraryWGL
+324
{
+325
HINSTANCE instance;
+326
PFN_wglCreateContext CreateContext;
+327
PFN_wglDeleteContext DeleteContext;
+328
PFN_wglGetProcAddress GetProcAddress;
+329
PFN_wglGetCurrentDC GetCurrentDC;
+330
PFN_wglGetCurrentContext GetCurrentContext;
+331
PFN_wglMakeCurrent MakeCurrent;
+332
PFN_wglShareLists ShareLists;
+333
+334
PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT;
+335
PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB;
+336
PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT;
+337
PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB;
+338
PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
+339
bool EXT_swap_control;
+340
bool EXT_colorspace;
+341
bool ARB_multisample;
+342
bool ARB_framebuffer_sRGB;
+343
bool EXT_framebuffer_sRGB;
+344
bool ARB_pixel_format;
+345
bool ARB_create_context;
+346
bool ARB_create_context_profile;
+347
bool EXT_create_context_es2_profile;
+348
bool ARB_create_context_robustness;
+349
bool ARB_create_context_no_error;
+350
bool ARB_context_flush_control;
+351
} _GLFWlibraryWGL;
+352
+353
// Win32-specific per-window data
+354
//
+355
typedef struct _GLFWwindowWin32
+356
{
+357
HWND handle;
+358
HICON bigIcon;
+359
HICON smallIcon;
+360
+361
GLFWbool cursorTracked;
+362
GLFWbool frameAction;
+363
GLFWbool iconified;
+364
GLFWbool maximized;
+365
// Whether to enable framebuffer transparency on DWM
+366
GLFWbool transparent;
+367
GLFWbool scaleToMonitor;
+368
GLFWbool keymenu;
+369
GLFWbool showDefault;
+370
+371
// Cached size used to filter out duplicate events
+372
int width, height;
+373
+374
// The last received cursor position, regardless of source
+375
int lastCursorPosX, lastCursorPosY;
+376
// The last received high surrogate when decoding pairs of UTF-16 messages
+377
WCHAR highSurrogate;
+378
} _GLFWwindowWin32;
+379
+380
// Win32-specific global data
+381
//
+382
typedef struct _GLFWlibraryWin32
+383
{
+384
HINSTANCE instance;
+385
HWND helperWindowHandle;
+386
ATOM helperWindowClass;
+387
ATOM mainWindowClass;
+388
HDEVNOTIFY deviceNotificationHandle;
+389
int acquiredMonitorCount;
+390
char* clipboardString;
+391
short int keycodes[512];
+392
short int scancodes[GLFW_KEY_LAST + 1];
+393
char keynames[GLFW_KEY_LAST + 1][5];
+394
// Where to place the cursor when re-enabled
+395
double restoreCursorPosX, restoreCursorPosY;
+396
// The window whose disabled cursor mode is active
+397
_GLFWwindow* disabledCursorWindow;
+398
// The window the cursor is captured in
+399
_GLFWwindow* capturedCursorWindow;
+400
RAWINPUT* rawInput;
+401
int rawInputSize;
+402
UINT mouseTrailSize;
+403
// The cursor handle to use to hide the cursor (NULL or a transparent cursor)
+404
HCURSOR blankCursor;
+405
+406
struct {
+407
HINSTANCE instance;
+408
PFN_DirectInput8Create Create;
+409
IDirectInput8W* api;
+410
} dinput8;
+411
+412
struct {
+413
HINSTANCE instance;
+414
PFN_XInputGetCapabilities GetCapabilities;
+415
PFN_XInputGetState GetState;
+416
} xinput;
+417
+418
struct {
+419
HINSTANCE instance;
+420
PFN_EnableNonClientDpiScaling EnableNonClientDpiScaling_;
+421
PFN_SetProcessDpiAwarenessContext SetProcessDpiAwarenessContext_;
+422
PFN_GetDpiForWindow GetDpiForWindow_;
+423
PFN_AdjustWindowRectExForDpi AdjustWindowRectExForDpi_;
+424
PFN_GetSystemMetricsForDpi GetSystemMetricsForDpi_;
+425
} user32;
+426
+427
struct {
+428
HINSTANCE instance;
+429
PFN_DwmIsCompositionEnabled IsCompositionEnabled;
+430
PFN_DwmFlush Flush;
+431
PFN_DwmEnableBlurBehindWindow EnableBlurBehindWindow;
+432
PFN_DwmGetColorizationColor GetColorizationColor;
+433
} dwmapi;
+434
+435
struct {
+436
HINSTANCE instance;
+437
PFN_SetProcessDpiAwareness SetProcessDpiAwareness_;
+438
PFN_GetDpiForMonitor GetDpiForMonitor_;
+439
} shcore;
+440
+441
struct {
+442
HINSTANCE instance;
+443
PFN_RtlVerifyVersionInfo RtlVerifyVersionInfo_;
+444
} ntdll;
+445
} _GLFWlibraryWin32;
+446
+447
// Win32-specific per-monitor data
+448
//
+449
typedef struct _GLFWmonitorWin32
+450
{
+451
HMONITOR handle;
+452
// This size matches the static size of DISPLAY_DEVICE.DeviceName
+453
WCHAR adapterName[32];
+454
WCHAR displayName[32];
+455
char publicAdapterName[32];
+456
char publicDisplayName[32];
+457
GLFWbool modesPruned;
+458
GLFWbool modeChanged;
+459
} _GLFWmonitorWin32;
+460
+461
// Win32-specific per-cursor data
+462
//
+463
typedef struct _GLFWcursorWin32
+464
{
+465
HCURSOR handle;
+466
} _GLFWcursorWin32;
+467
+468
+469
GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform);
+470
int _glfwInitWin32(void);
+471
void _glfwTerminateWin32(void);
+472
+473
WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source);
+474
char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source);
+475
BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp);
+476
BOOL _glfwIsWindows10BuildOrGreaterWin32(WORD build);
+477
void _glfwInputErrorWin32(int error, const char* description);
+478
void _glfwUpdateKeyNamesWin32(void);
+479
+480
void _glfwPollMonitorsWin32(void);
+481
void _glfwSetVideoModeWin32(_GLFWmonitor* monitor, const GLFWvidmode* desired);
+482
void _glfwRestoreVideoModeWin32(_GLFWmonitor* monitor);
+483
void _glfwGetHMONITORContentScaleWin32(HMONITOR handle, float* xscale, float* yscale);
+484
+485
GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
+486
void _glfwDestroyWindowWin32(_GLFWwindow* window);
+487
void _glfwSetWindowTitleWin32(_GLFWwindow* window, const char* title);
+488
void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* images);
+489
void _glfwGetWindowPosWin32(_GLFWwindow* window, int* xpos, int* ypos);
+490
void _glfwSetWindowPosWin32(_GLFWwindow* window, int xpos, int ypos);
+491
void _glfwGetWindowSizeWin32(_GLFWwindow* window, int* width, int* height);
+492
void _glfwSetWindowSizeWin32(_GLFWwindow* window, int width, int height);
+493
void _glfwSetWindowSizeLimitsWin32(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
+494
void _glfwSetWindowAspectRatioWin32(_GLFWwindow* window, int numer, int denom);
+495
void _glfwGetFramebufferSizeWin32(_GLFWwindow* window, int* width, int* height);
+496
void _glfwGetWindowFrameSizeWin32(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
+497
void _glfwGetWindowContentScaleWin32(_GLFWwindow* window, float* xscale, float* yscale);
+498
void _glfwIconifyWindowWin32(_GLFWwindow* window);
+499
void _glfwRestoreWindowWin32(_GLFWwindow* window);

Showing the first 500 of 568 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/win32_thread.cadded
@@ -0,0 +1,100 @@
+1
//========================================================================
+2
// GLFW 3.5 Win32 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(GLFW_BUILD_WIN32_THREAD)
+31
+32
#include <assert.h>
+33
+34
+35
//////////////////////////////////////////////////////////////////////////
+36
////// GLFW platform API //////
+37
//////////////////////////////////////////////////////////////////////////
+38
+39
GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls)
+40
{
+41
assert(tls->win32.allocated == GLFW_FALSE);
+42
+43
tls->win32.index = TlsAlloc();
+44
if (tls->win32.index == TLS_OUT_OF_INDEXES)
+45
{
+46
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to allocate TLS index");
+47
return GLFW_FALSE;
+48
}
+49
+50
tls->win32.allocated = GLFW_TRUE;
+51
return GLFW_TRUE;
+52
}
+53
+54
void _glfwPlatformDestroyTls(_GLFWtls* tls)
+55
{
+56
if (tls->win32.allocated)
+57
TlsFree(tls->win32.index);
+58
memset(tls, 0, sizeof(_GLFWtls));
+59
}
+60
+61
void* _glfwPlatformGetTls(_GLFWtls* tls)
+62
{
+63
assert(tls->win32.allocated == GLFW_TRUE);
+64
return TlsGetValue(tls->win32.index);
+65
}
+66
+67
void _glfwPlatformSetTls(_GLFWtls* tls, void* value)
+68
{
+69
assert(tls->win32.allocated == GLFW_TRUE);
+70
TlsSetValue(tls->win32.index, value);
+71
}
+72
+73
GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex)
+74
{
+75
assert(mutex->win32.allocated == GLFW_FALSE);
+76
InitializeCriticalSection(&mutex->win32.section);
+77
return mutex->win32.allocated = GLFW_TRUE;
+78
}
+79
+80
void _glfwPlatformDestroyMutex(_GLFWmutex* mutex)
+81
{
+82
if (mutex->win32.allocated)
+83
DeleteCriticalSection(&mutex->win32.section);
+84
memset(mutex, 0, sizeof(_GLFWmutex));
+85
}
+86
+87
void _glfwPlatformLockMutex(_GLFWmutex* mutex)
+88
{
+89
assert(mutex->win32.allocated == GLFW_TRUE);
+90
EnterCriticalSection(&mutex->win32.section);
+91
}
+92
+93
void _glfwPlatformUnlockMutex(_GLFWmutex* mutex)
+94
{
+95
assert(mutex->win32.allocated == GLFW_TRUE);
+96
LeaveCriticalSection(&mutex->win32.section);
+97
}
+98
+99
#endif // GLFW_BUILD_WIN32_THREAD
+100
vendor/glfw/src/win32_thread.hadded
@@ -0,0 +1,53 @@
+1
//========================================================================
+2
// GLFW 3.5 Win32 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
+29
// example to allow applications to correctly declare a GL_KHR_debug callback)
+30
// but windows.h assumes no one will define APIENTRY before it does
+31
#undef APIENTRY
+32
+33
#include <windows.h>
+34
+35
#define GLFW_WIN32_TLS_STATE _GLFWtlsWin32 win32;
+36
#define GLFW_WIN32_MUTEX_STATE _GLFWmutexWin32 win32;
+37
+38
// Win32-specific thread local storage data
+39
//
+40
typedef struct _GLFWtlsWin32
+41
{
+42
GLFWbool allocated;
+43
DWORD index;
+44
} _GLFWtlsWin32;
+45
+46
// Win32-specific mutex data
+47
//
+48
typedef struct _GLFWmutexWin32
+49
{
+50
GLFWbool allocated;
+51
CRITICAL_SECTION section;
+52
} _GLFWmutexWin32;
+53
vendor/glfw/src/win32_time.cadded
@@ -0,0 +1,54 @@
+1
//========================================================================
+2
// GLFW 3.5 Win32 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(GLFW_BUILD_WIN32_TIMER)
+31
+32
//////////////////////////////////////////////////////////////////////////
+33
////// GLFW platform API //////
+34
//////////////////////////////////////////////////////////////////////////
+35
+36
void _glfwPlatformInitTimer(void)
+37
{
+38
QueryPerformanceFrequency((LARGE_INTEGER*) &_glfw.timer.win32.frequency);
+39
}
+40
+41
uint64_t _glfwPlatformGetTimerValue(void)
+42
{
+43
uint64_t value;
+44
QueryPerformanceCounter((LARGE_INTEGER*) &value);
+45
return value;
+46
}
+47
+48
uint64_t _glfwPlatformGetTimerFrequency(void)
+49
{
+50
return _glfw.timer.win32.frequency;
+51
}
+52
+53
#endif // GLFW_BUILD_WIN32_TIMER
+54
vendor/glfw/src/win32_time.hadded
@@ -0,0 +1,43 @@
+1
//========================================================================
+2
// GLFW 3.5 Win32 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
+29
// example to allow applications to correctly declare a GL_KHR_debug callback)
+30
// but windows.h assumes no one will define APIENTRY before it does
+31
#undef APIENTRY
+32
+33
#include <windows.h>
+34
+35
#define GLFW_WIN32_LIBRARY_TIMER_STATE _GLFWtimerWin32 win32;
+36
+37
// Win32-specific global timer data
+38
//
+39
typedef struct _GLFWtimerWin32
+40
{
+41
uint64_t frequency;
+42
} _GLFWtimerWin32;
+43
vendor/glfw/src/win32_window.cadded
@@ -0,0 +1,2584 @@
+1
//========================================================================
+2
// GLFW 3.5 Win32 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_WIN32)
+31
+32
#include <limits.h>
+33
#include <stdlib.h>
+34
#include <string.h>
+35
#include <assert.h>
+36
#include <windowsx.h>
+37
#include <shellapi.h>
+38
+39
// Returns the window style for the specified window
+40
//
+41
static DWORD getWindowStyle(const _GLFWwindow* window)
+42
{
+43
DWORD style = WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
+44
+45
if (window->monitor)
+46
style |= WS_POPUP;
+47
else
+48
{
+49
style |= WS_SYSMENU | WS_MINIMIZEBOX;
+50
+51
if (window->decorated)
+52
{
+53
style |= WS_CAPTION;
+54
+55
if (window->resizable)
+56
style |= WS_MAXIMIZEBOX | WS_THICKFRAME;
+57
}
+58
else
+59
style |= WS_POPUP;
+60
}
+61
+62
return style;
+63
}
+64
+65
// Returns the extended window style for the specified window
+66
//
+67
static DWORD getWindowExStyle(const _GLFWwindow* window)
+68
{
+69
DWORD style = WS_EX_APPWINDOW;
+70
+71
if (window->monitor || window->floating)
+72
style |= WS_EX_TOPMOST;
+73
+74
return style;
+75
}
+76
+77
// Returns the image whose area most closely matches the desired one
+78
//
+79
static const GLFWimage* chooseImage(int count, const GLFWimage* images,
+80
int width, int height)
+81
{
+82
int i, leastDiff = INT_MAX;
+83
const GLFWimage* closest = NULL;
+84
+85
for (i = 0; i < count; i++)
+86
{
+87
const int currDiff = abs(images[i].width * images[i].height -
+88
width * height);
+89
if (currDiff < leastDiff)
+90
{
+91
closest = images + i;
+92
leastDiff = currDiff;
+93
}
+94
}
+95
+96
return closest;
+97
}
+98
+99
// Creates an RGBA icon or cursor
+100
//
+101
static HICON createIcon(const GLFWimage* image, int xhot, int yhot, GLFWbool icon)
+102
{
+103
int i;
+104
HDC dc;
+105
HICON handle;
+106
HBITMAP color, mask;
+107
BITMAPV5HEADER bi;
+108
ICONINFO ii;
+109
unsigned char* target = NULL;
+110
unsigned char* source = image->pixels;
+111
+112
ZeroMemory(&bi, sizeof(bi));
+113
bi.bV5Size = sizeof(bi);
+114
bi.bV5Width = image->width;
+115
bi.bV5Height = -image->height;
+116
bi.bV5Planes = 1;
+117
bi.bV5BitCount = 32;
+118
bi.bV5Compression = BI_BITFIELDS;
+119
bi.bV5RedMask = 0x00ff0000;
+120
bi.bV5GreenMask = 0x0000ff00;
+121
bi.bV5BlueMask = 0x000000ff;
+122
bi.bV5AlphaMask = 0xff000000;
+123
+124
dc = GetDC(NULL);
+125
color = CreateDIBSection(dc,
+126
(BITMAPINFO*) &bi,
+127
DIB_RGB_COLORS,
+128
(void**) &target,
+129
NULL,
+130
(DWORD) 0);
+131
ReleaseDC(NULL, dc);
+132
+133
if (!color)
+134
{
+135
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+136
"Win32: Failed to create RGBA bitmap");
+137
return NULL;
+138
}
+139
+140
mask = CreateBitmap(image->width, image->height, 1, 1, NULL);
+141
if (!mask)
+142
{
+143
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+144
"Win32: Failed to create mask bitmap");
+145
DeleteObject(color);
+146
return NULL;
+147
}
+148
+149
for (i = 0; i < image->width * image->height; i++)
+150
{
+151
target[0] = source[2];
+152
target[1] = source[1];
+153
target[2] = source[0];
+154
target[3] = source[3];
+155
target += 4;
+156
source += 4;
+157
}
+158
+159
ZeroMemory(&ii, sizeof(ii));
+160
ii.fIcon = icon;
+161
ii.xHotspot = xhot;
+162
ii.yHotspot = yhot;
+163
ii.hbmMask = mask;
+164
ii.hbmColor = color;
+165
+166
handle = CreateIconIndirect(&ii);
+167
+168
DeleteObject(color);
+169
DeleteObject(mask);
+170
+171
if (!handle)
+172
{
+173
if (icon)
+174
{
+175
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+176
"Win32: Failed to create icon");
+177
}
+178
else
+179
{
+180
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+181
"Win32: Failed to create cursor");
+182
}
+183
}
+184
+185
return handle;
+186
}
+187
+188
// Enforce the content area aspect ratio based on which edge is being dragged
+189
//
+190
static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area)
+191
{
+192
RECT frame = {0};
+193
const float ratio = (float) window->numer / (float) window->denom;
+194
const DWORD style = getWindowStyle(window);
+195
const DWORD exStyle = getWindowExStyle(window);
+196
+197
if (_glfwIsWindows10Version1607OrGreaterWin32())
+198
{
+199
AdjustWindowRectExForDpi(&frame, style, FALSE, exStyle,
+200
GetDpiForWindow(window->win32.handle));
+201
}
+202
else
+203
AdjustWindowRectEx(&frame, style, FALSE, exStyle);
+204
+205
if (edge == WMSZ_LEFT || edge == WMSZ_BOTTOMLEFT ||
+206
edge == WMSZ_RIGHT || edge == WMSZ_BOTTOMRIGHT)
+207
{
+208
area->bottom = area->top + (frame.bottom - frame.top) +
+209
(int) (((area->right - area->left) - (frame.right - frame.left)) / ratio);
+210
}
+211
else if (edge == WMSZ_TOPLEFT || edge == WMSZ_TOPRIGHT)
+212
{
+213
area->top = area->bottom - (frame.bottom - frame.top) -
+214
(int) (((area->right - area->left) - (frame.right - frame.left)) / ratio);
+215
}
+216
else if (edge == WMSZ_TOP || edge == WMSZ_BOTTOM)
+217
{
+218
area->right = area->left + (frame.right - frame.left) +
+219
(int) (((area->bottom - area->top) - (frame.bottom - frame.top)) * ratio);
+220
}
+221
}
+222
+223
// Updates the cursor image according to its cursor mode
+224
//
+225
static void updateCursorImage(_GLFWwindow* window)
+226
{
+227
if (window->cursorMode == GLFW_CURSOR_NORMAL ||
+228
window->cursorMode == GLFW_CURSOR_CAPTURED)
+229
{
+230
if (window->cursor)
+231
SetCursor(window->cursor->win32.handle);
+232
else
+233
SetCursor(LoadCursorW(NULL, IDC_ARROW));
+234
}
+235
else
+236
{
+237
// NOTE: Via Remote Desktop, setting the cursor to NULL does not hide it.
+238
// HACK: When running locally, it is set to NULL, but when connected via Remote
+239
// Desktop, this is a transparent cursor.
+240
SetCursor(_glfw.win32.blankCursor);
+241
}
+242
}
+243
+244
// Sets the cursor clip rect to the window content area
+245
//
+246
static void captureCursor(_GLFWwindow* window)
+247
{
+248
RECT clipRect;
+249
GetClientRect(window->win32.handle, &clipRect);
+250
ClientToScreen(window->win32.handle, (POINT*) &clipRect.left);
+251
ClientToScreen(window->win32.handle, (POINT*) &clipRect.right);
+252
ClipCursor(&clipRect);
+253
_glfw.win32.capturedCursorWindow = window;
+254
}
+255
+256
// Disabled clip cursor
+257
//
+258
static void releaseCursor(void)
+259
{
+260
ClipCursor(NULL);
+261
_glfw.win32.capturedCursorWindow = NULL;
+262
}
+263
+264
// Enables WM_INPUT messages for the mouse for the specified window
+265
//
+266
static void enableRawMouseMotion(_GLFWwindow* window)
+267
{
+268
const RAWINPUTDEVICE rid = { 0x01, 0x02, 0, window->win32.handle };
+269
+270
if (!RegisterRawInputDevices(&rid, 1, sizeof(rid)))
+271
{
+272
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+273
"Win32: Failed to register raw input device");
+274
}
+275
}
+276
+277
// Disables WM_INPUT messages for the mouse
+278
//
+279
static void disableRawMouseMotion(_GLFWwindow* window)
+280
{
+281
const RAWINPUTDEVICE rid = { 0x01, 0x02, RIDEV_REMOVE, NULL };
+282
+283
if (!RegisterRawInputDevices(&rid, 1, sizeof(rid)))
+284
{
+285
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+286
"Win32: Failed to remove raw input device");
+287
}
+288
}
+289
+290
// Apply disabled cursor mode to a focused window
+291
//
+292
static void disableCursor(_GLFWwindow* window)
+293
{
+294
_glfw.win32.disabledCursorWindow = window;
+295
_glfwGetCursorPosWin32(window,
+296
&_glfw.win32.restoreCursorPosX,
+297
&_glfw.win32.restoreCursorPosY);
+298
updateCursorImage(window);
+299
_glfwCenterCursorInContentArea(window);
+300
captureCursor(window);
+301
+302
if (window->rawMouseMotion)
+303
enableRawMouseMotion(window);
+304
}
+305
+306
// Exit disabled cursor mode for the specified window
+307
//
+308
static void enableCursor(_GLFWwindow* window)
+309
{
+310
if (window->rawMouseMotion)
+311
disableRawMouseMotion(window);
+312
+313
_glfw.win32.disabledCursorWindow = NULL;
+314
releaseCursor();
+315
_glfwSetCursorPosWin32(window,
+316
_glfw.win32.restoreCursorPosX,
+317
_glfw.win32.restoreCursorPosY);
+318
updateCursorImage(window);
+319
}
+320
+321
// Returns whether the cursor is in the content area of the specified window
+322
//
+323
static GLFWbool cursorInContentArea(_GLFWwindow* window)
+324
{
+325
RECT area;
+326
POINT pos;
+327
+328
if (!GetCursorPos(&pos))
+329
return GLFW_FALSE;
+330
+331
if (WindowFromPoint(pos) != window->win32.handle)
+332
return GLFW_FALSE;
+333
+334
GetClientRect(window->win32.handle, &area);
+335
ClientToScreen(window->win32.handle, (POINT*) &area.left);
+336
ClientToScreen(window->win32.handle, (POINT*) &area.right);
+337
+338
return PtInRect(&area, pos);
+339
}
+340
+341
// Update native window styles to match attributes
+342
//
+343
static void updateWindowStyles(const _GLFWwindow* window)
+344
{
+345
RECT rect;
+346
DWORD style = GetWindowLongW(window->win32.handle, GWL_STYLE);
+347
style &= ~(WS_OVERLAPPEDWINDOW | WS_POPUP);
+348
style |= getWindowStyle(window);
+349
+350
GetClientRect(window->win32.handle, &rect);
+351
+352
if (_glfwIsWindows10Version1607OrGreaterWin32())
+353
{
+354
AdjustWindowRectExForDpi(&rect, style, FALSE,
+355
getWindowExStyle(window),
+356
GetDpiForWindow(window->win32.handle));
+357
}
+358
else
+359
AdjustWindowRectEx(&rect, style, FALSE, getWindowExStyle(window));
+360
+361
ClientToScreen(window->win32.handle, (POINT*) &rect.left);
+362
ClientToScreen(window->win32.handle, (POINT*) &rect.right);
+363
SetWindowLongW(window->win32.handle, GWL_STYLE, style);
+364
SetWindowPos(window->win32.handle, HWND_TOP,
+365
rect.left, rect.top,
+366
rect.right - rect.left, rect.bottom - rect.top,
+367
SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER);
+368
}
+369
+370
// Update window framebuffer transparency
+371
//
+372
static void updateFramebufferTransparency(const _GLFWwindow* window)
+373
{
+374
BOOL composition, opaque;
+375
DWORD color;
+376
+377
if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition)
+378
return;
+379
+380
if (IsWindows8OrGreater() ||
+381
(SUCCEEDED(DwmGetColorizationColor(&color, &opaque)) && !opaque))
+382
{
+383
HRGN region = CreateRectRgn(0, 0, -1, -1);
+384
DWM_BLURBEHIND bb = {0};
+385
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
+386
bb.hRgnBlur = region;
+387
bb.fEnable = TRUE;
+388
+389
DwmEnableBlurBehindWindow(window->win32.handle, &bb);
+390
DeleteObject(region);
+391
}
+392
else
+393
{
+394
// HACK: Disable framebuffer transparency on Windows 7 when the
+395
// colorization color is opaque, because otherwise the window
+396
// contents is blended additively with the previous frame instead
+397
// of replacing it
+398
DWM_BLURBEHIND bb = {0};
+399
bb.dwFlags = DWM_BB_ENABLE;
+400
DwmEnableBlurBehindWindow(window->win32.handle, &bb);
+401
}
+402
}
+403
+404
// Retrieves and translates modifier keys
+405
//
+406
static int getKeyMods(void)
+407
{
+408
int mods = 0;
+409
+410
if (GetKeyState(VK_SHIFT) & 0x8000)
+411
mods |= GLFW_MOD_SHIFT;
+412
if (GetKeyState(VK_CONTROL) & 0x8000)
+413
mods |= GLFW_MOD_CONTROL;
+414
if (GetKeyState(VK_MENU) & 0x8000)
+415
mods |= GLFW_MOD_ALT;
+416
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x8000)
+417
mods |= GLFW_MOD_SUPER;
+418
if (GetKeyState(VK_CAPITAL) & 1)
+419
mods |= GLFW_MOD_CAPS_LOCK;
+420
if (GetKeyState(VK_NUMLOCK) & 1)
+421
mods |= GLFW_MOD_NUM_LOCK;
+422
+423
return mods;
+424
}
+425
+426
static void fitToMonitor(_GLFWwindow* window)
+427
{
+428
MONITORINFO mi = { sizeof(mi) };
+429
GetMonitorInfoW(window->monitor->win32.handle, &mi);
+430
SetWindowPos(window->win32.handle, HWND_TOPMOST,
+431
mi.rcMonitor.left,
+432
mi.rcMonitor.top,
+433
mi.rcMonitor.right - mi.rcMonitor.left,
+434
mi.rcMonitor.bottom - mi.rcMonitor.top,
+435
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS);
+436
}
+437
+438
// Make the specified window and its video mode active on its monitor
+439
//
+440
static void acquireMonitor(_GLFWwindow* window)
+441
{
+442
if (!_glfw.win32.acquiredMonitorCount)
+443
{
+444
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
+445
+446
// HACK: When mouse trails are enabled the cursor becomes invisible when
+447
// the OpenGL ICD switches to page flipping
+448
SystemParametersInfoW(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0);
+449
SystemParametersInfoW(SPI_SETMOUSETRAILS, 0, 0, 0);
+450
}
+451
+452
if (!window->monitor->window)
+453
_glfw.win32.acquiredMonitorCount++;
+454
+455
_glfwSetVideoModeWin32(window->monitor, &window->videoMode);
+456
_glfwInputMonitorWindow(window->monitor, window);
+457
}
+458
+459
// Remove the window and restore the original video mode
+460
//
+461
static void releaseMonitor(_GLFWwindow* window)
+462
{
+463
if (window->monitor->window != window)
+464
return;
+465
+466
_glfw.win32.acquiredMonitorCount--;
+467
if (!_glfw.win32.acquiredMonitorCount)
+468
{
+469
SetThreadExecutionState(ES_CONTINUOUS);
+470
+471
// HACK: Restore mouse trail length saved in acquireMonitor
+472
SystemParametersInfoW(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0);
+473
}
+474
+475
_glfwInputMonitorWindow(window->monitor, NULL);
+476
_glfwRestoreVideoModeWin32(window->monitor);
+477
}
+478
+479
// Manually maximize the window, for when SW_MAXIMIZE cannot be used
+480
//
+481
static void maximizeWindowManually(_GLFWwindow* window)
+482
{
+483
RECT rect;
+484
DWORD style;
+485
MONITORINFO mi = { sizeof(mi) };
+486
+487
GetMonitorInfoW(MonitorFromWindow(window->win32.handle,
+488
MONITOR_DEFAULTTONEAREST), &mi);
+489
+490
rect = mi.rcWork;
+491
+492
if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE)
+493
{
+494
rect.right = _glfw_min(rect.right, rect.left + window->maxwidth);
+495
rect.bottom = _glfw_min(rect.bottom, rect.top + window->maxheight);
+496
}
+497
+498
style = GetWindowLongW(window->win32.handle, GWL_STYLE);
+499
style |= WS_MAXIMIZE;

Showing the first 500 of 2585 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/window.cadded
@@ -0,0 +1,1198 @@
+1
//========================================================================
+2
// GLFW 3.5 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
+7
//
+8
// This software is provided 'as-is', without any express or implied
+9
// warranty. In no event will the authors be held liable for any damages
+10
// arising from the use of this software.
+11
//
+12
// Permission is granted to anyone to use this software for any purpose,
+13
// including commercial applications, and to alter it and redistribute it
+14
// freely, subject to the following restrictions:
+15
//
+16
// 1. The origin of this software must not be misrepresented; you must not
+17
// claim that you wrote the original software. If you use this software
+18
// in a product, an acknowledgment in the product documentation would
+19
// be appreciated but is not required.
+20
//
+21
// 2. Altered source versions must be plainly marked as such, and must not
+22
// be misrepresented as being the original software.
+23
//
+24
// 3. This notice may not be removed or altered from any source
+25
// distribution.
+26
//
+27
//========================================================================
+28
+29
#include "internal.h"
+30
+31
#include <assert.h>
+32
#include <string.h>
+33
#include <stdlib.h>
+34
#include <float.h>
+35
#include <math.h>
+36
+37
//////////////////////////////////////////////////////////////////////////
+38
////// GLFW event API //////
+39
//////////////////////////////////////////////////////////////////////////
+40
+41
// Notifies shared code that a window has lost or received input focus
+42
//
+43
void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused)
+44
{
+45
assert(window != NULL);
+46
assert(focused == GLFW_TRUE || focused == GLFW_FALSE);
+47
+48
if (window->callbacks.focus)
+49
window->callbacks.focus((GLFWwindow*) window, focused);
+50
+51
if (!focused)
+52
{
+53
int key, button;
+54
+55
for (key = 0; key <= GLFW_KEY_LAST; key++)
+56
{
+57
if (window->keys[key] == GLFW_PRESS)
+58
{
+59
const int scancode = _glfw.platform.getKeyScancode(key);
+60
_glfwInputKey(window, key, scancode, GLFW_RELEASE, 0);
+61
}
+62
}
+63
+64
for (button = 0; button <= GLFW_MOUSE_BUTTON_LAST; button++)
+65
{
+66
if (window->mouseButtons[button] == GLFW_PRESS)
+67
_glfwInputMouseClick(window, button, GLFW_RELEASE, 0);
+68
}
+69
}
+70
}
+71
+72
// Notifies shared code that a window has moved
+73
// The position is specified in content area relative screen coordinates
+74
//
+75
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
+76
{
+77
assert(window != NULL);
+78
+79
if (window->callbacks.pos)
+80
window->callbacks.pos((GLFWwindow*) window, x, y);
+81
}
+82
+83
// Notifies shared code that a window has been resized
+84
// The size is specified in screen coordinates
+85
//
+86
void _glfwInputWindowSize(_GLFWwindow* window, int width, int height)
+87
{
+88
assert(window != NULL);
+89
assert(width >= 0);
+90
assert(height >= 0);
+91
+92
if (window->callbacks.size)
+93
window->callbacks.size((GLFWwindow*) window, width, height);
+94
}
+95
+96
// Notifies shared code that a window has been iconified or restored
+97
//
+98
void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified)
+99
{
+100
assert(window != NULL);
+101
assert(iconified == GLFW_TRUE || iconified == GLFW_FALSE);
+102
+103
if (window->callbacks.iconify)
+104
window->callbacks.iconify((GLFWwindow*) window, iconified);
+105
}
+106
+107
// Notifies shared code that a window has been maximized or restored
+108
//
+109
void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized)
+110
{
+111
assert(window != NULL);
+112
assert(maximized == GLFW_TRUE || maximized == GLFW_FALSE);
+113
+114
if (window->callbacks.maximize)
+115
window->callbacks.maximize((GLFWwindow*) window, maximized);
+116
}
+117
+118
// Notifies shared code that a window framebuffer has been resized
+119
// The size is specified in pixels
+120
//
+121
void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height)
+122
{
+123
assert(window != NULL);
+124
assert(width >= 0);
+125
assert(height >= 0);
+126
+127
if (window->callbacks.fbsize)
+128
window->callbacks.fbsize((GLFWwindow*) window, width, height);
+129
}
+130
+131
// Notifies shared code that a window content scale has changed
+132
// The scale is specified as the ratio between the current and default DPI
+133
//
+134
void _glfwInputWindowContentScale(_GLFWwindow* window, float xscale, float yscale)
+135
{
+136
assert(window != NULL);
+137
assert(xscale > 0.f);
+138
assert(isfinite(xscale));
+139
assert(yscale > 0.f);
+140
assert(isfinite(yscale));
+141
+142
if (window->callbacks.scale)
+143
window->callbacks.scale((GLFWwindow*) window, xscale, yscale);
+144
}
+145
+146
// Notifies shared code that the window contents needs updating
+147
//
+148
void _glfwInputWindowDamage(_GLFWwindow* window)
+149
{
+150
assert(window != NULL);
+151
+152
if (window->callbacks.refresh)
+153
window->callbacks.refresh((GLFWwindow*) window);
+154
}
+155
+156
// Notifies shared code that the user wishes to close a window
+157
//
+158
void _glfwInputWindowCloseRequest(_GLFWwindow* window)
+159
{
+160
assert(window != NULL);
+161
+162
window->shouldClose = GLFW_TRUE;
+163
+164
if (window->callbacks.close)
+165
window->callbacks.close((GLFWwindow*) window);
+166
}
+167
+168
// Notifies shared code that a window has changed its desired monitor
+169
//
+170
void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor)
+171
{
+172
assert(window != NULL);
+173
window->monitor = monitor;
+174
}
+175
+176
//////////////////////////////////////////////////////////////////////////
+177
////// GLFW public API //////
+178
//////////////////////////////////////////////////////////////////////////
+179
+180
GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
+181
const char* title,
+182
GLFWmonitor* monitor,
+183
GLFWwindow* share)
+184
{
+185
_GLFWfbconfig fbconfig;
+186
_GLFWctxconfig ctxconfig;
+187
_GLFWwndconfig wndconfig;
+188
_GLFWwindow* window;
+189
+190
assert(title != NULL);
+191
assert(width >= 0);
+192
assert(height >= 0);
+193
+194
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+195
+196
if (width <= 0 || height <= 0)
+197
{
+198
_glfwInputError(GLFW_INVALID_VALUE,
+199
"Invalid window size %ix%i",
+200
width, height);
+201
+202
return NULL;
+203
}
+204
+205
fbconfig = _glfw.hints.framebuffer;
+206
ctxconfig = _glfw.hints.context;
+207
wndconfig = _glfw.hints.window;
+208
+209
wndconfig.width = width;
+210
wndconfig.height = height;
+211
ctxconfig.share = (_GLFWwindow*) share;
+212
+213
if (!_glfwIsValidContextConfig(&ctxconfig))
+214
return NULL;
+215
+216
window = _glfw_calloc(1, sizeof(_GLFWwindow));
+217
window->next = _glfw.windowListHead;
+218
_glfw.windowListHead = window;
+219
+220
window->videoMode.width = width;
+221
window->videoMode.height = height;
+222
window->videoMode.redBits = fbconfig.redBits;
+223
window->videoMode.greenBits = fbconfig.greenBits;
+224
window->videoMode.blueBits = fbconfig.blueBits;
+225
window->videoMode.refreshRate = _glfw.hints.refreshRate;
+226
+227
window->monitor = (_GLFWmonitor*) monitor;
+228
window->resizable = wndconfig.resizable;
+229
window->decorated = wndconfig.decorated;
+230
window->autoIconify = wndconfig.autoIconify;
+231
window->floating = wndconfig.floating;
+232
window->focusOnShow = wndconfig.focusOnShow;
+233
window->mousePassthrough = wndconfig.mousePassthrough;
+234
window->cursorMode = GLFW_CURSOR_NORMAL;
+235
+236
window->doublebuffer = fbconfig.doublebuffer;
+237
+238
window->minwidth = GLFW_DONT_CARE;
+239
window->minheight = GLFW_DONT_CARE;
+240
window->maxwidth = GLFW_DONT_CARE;
+241
window->maxheight = GLFW_DONT_CARE;
+242
window->numer = GLFW_DONT_CARE;
+243
window->denom = GLFW_DONT_CARE;
+244
window->title = _glfw_strdup(title);
+245
+246
if (!_glfw.platform.createWindow(window, &wndconfig, &ctxconfig, &fbconfig))
+247
{
+248
glfwDestroyWindow((GLFWwindow*) window);
+249
return NULL;
+250
}
+251
+252
return (GLFWwindow*) window;
+253
}
+254
+255
void glfwDefaultWindowHints(void)
+256
{
+257
_GLFW_REQUIRE_INIT();
+258
+259
// The default is OpenGL with minimum version 1.0
+260
memset(&_glfw.hints.context, 0, sizeof(_glfw.hints.context));
+261
_glfw.hints.context.client = GLFW_OPENGL_API;
+262
_glfw.hints.context.source = GLFW_NATIVE_CONTEXT_API;
+263
_glfw.hints.context.major = 1;
+264
_glfw.hints.context.minor = 0;
+265
+266
// The default is a focused, visible, resizable window with decorations
+267
memset(&_glfw.hints.window, 0, sizeof(_glfw.hints.window));
+268
_glfw.hints.window.resizable = true;
+269
_glfw.hints.window.visible = true;
+270
_glfw.hints.window.decorated = true;
+271
_glfw.hints.window.focused = true;
+272
_glfw.hints.window.autoIconify = true;
+273
_glfw.hints.window.centerCursor = true;
+274
_glfw.hints.window.focusOnShow = true;
+275
_glfw.hints.window.xpos = GLFW_ANY_POSITION;
+276
_glfw.hints.window.ypos = GLFW_ANY_POSITION;
+277
_glfw.hints.window.scaleFramebuffer = true;
+278
+279
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil,
+280
// double buffered
+281
memset(&_glfw.hints.framebuffer, 0, sizeof(_glfw.hints.framebuffer));
+282
_glfw.hints.framebuffer.redBits = 8;
+283
_glfw.hints.framebuffer.greenBits = 8;
+284
_glfw.hints.framebuffer.blueBits = 8;
+285
_glfw.hints.framebuffer.alphaBits = 8;
+286
_glfw.hints.framebuffer.depthBits = 24;
+287
_glfw.hints.framebuffer.stencilBits = 8;
+288
_glfw.hints.framebuffer.doublebuffer = true;
+289
+290
// The default is to select the highest available refresh rate
+291
_glfw.hints.refreshRate = GLFW_DONT_CARE;
+292
}
+293
+294
GLFWAPI void glfwWindowHint(int hint, int value)
+295
{
+296
_GLFW_REQUIRE_INIT();
+297
+298
switch (hint)
+299
{
+300
case GLFW_RED_BITS:
+301
_glfw.hints.framebuffer.redBits = value;
+302
return;
+303
case GLFW_GREEN_BITS:
+304
_glfw.hints.framebuffer.greenBits = value;
+305
return;
+306
case GLFW_BLUE_BITS:
+307
_glfw.hints.framebuffer.blueBits = value;
+308
return;
+309
case GLFW_ALPHA_BITS:
+310
_glfw.hints.framebuffer.alphaBits = value;
+311
return;
+312
case GLFW_DEPTH_BITS:
+313
_glfw.hints.framebuffer.depthBits = value;
+314
return;
+315
case GLFW_STENCIL_BITS:
+316
_glfw.hints.framebuffer.stencilBits = value;
+317
return;
+318
case GLFW_ACCUM_RED_BITS:
+319
_glfw.hints.framebuffer.accumRedBits = value;
+320
return;
+321
case GLFW_ACCUM_GREEN_BITS:
+322
_glfw.hints.framebuffer.accumGreenBits = value;
+323
return;
+324
case GLFW_ACCUM_BLUE_BITS:
+325
_glfw.hints.framebuffer.accumBlueBits = value;
+326
return;
+327
case GLFW_ACCUM_ALPHA_BITS:
+328
_glfw.hints.framebuffer.accumAlphaBits = value;
+329
return;
+330
case GLFW_AUX_BUFFERS:
+331
_glfw.hints.framebuffer.auxBuffers = value;
+332
return;
+333
case GLFW_STEREO:
+334
_glfw.hints.framebuffer.stereo = value;
+335
return;
+336
case GLFW_DOUBLEBUFFER:
+337
_glfw.hints.framebuffer.doublebuffer = value;
+338
return;
+339
case GLFW_TRANSPARENT_FRAMEBUFFER:
+340
_glfw.hints.framebuffer.transparent = value;
+341
return;
+342
case GLFW_SAMPLES:
+343
_glfw.hints.framebuffer.samples = value;
+344
return;
+345
case GLFW_SRGB_CAPABLE:
+346
_glfw.hints.framebuffer.sRGB = value;
+347
return;
+348
case GLFW_RESIZABLE:
+349
_glfw.hints.window.resizable = value;
+350
return;
+351
case GLFW_DECORATED:
+352
_glfw.hints.window.decorated = value;
+353
return;
+354
case GLFW_FOCUSED:
+355
_glfw.hints.window.focused = value;
+356
return;
+357
case GLFW_AUTO_ICONIFY:
+358
_glfw.hints.window.autoIconify = value;
+359
return;
+360
case GLFW_FLOATING:
+361
_glfw.hints.window.floating = value;
+362
return;
+363
case GLFW_MAXIMIZED:
+364
_glfw.hints.window.maximized = value;
+365
return;
+366
case GLFW_VISIBLE:
+367
_glfw.hints.window.visible = value;
+368
return;
+369
case GLFW_POSITION_X:
+370
_glfw.hints.window.xpos = value;
+371
return;
+372
case GLFW_POSITION_Y:
+373
_glfw.hints.window.ypos = value;
+374
return;
+375
case GLFW_WIN32_KEYBOARD_MENU:
+376
_glfw.hints.window.win32.keymenu = value;
+377
return;
+378
case GLFW_WIN32_SHOWDEFAULT:
+379
_glfw.hints.window.win32.showDefault = value;
+380
return;
+381
case GLFW_COCOA_GRAPHICS_SWITCHING:
+382
_glfw.hints.context.nsgl.offline = value;
+383
return;
+384
case GLFW_SCALE_TO_MONITOR:
+385
_glfw.hints.window.scaleToMonitor = value;
+386
return;
+387
case GLFW_SCALE_FRAMEBUFFER:
+388
case GLFW_COCOA_RETINA_FRAMEBUFFER:
+389
_glfw.hints.window.scaleFramebuffer = value;
+390
return;
+391
case GLFW_CENTER_CURSOR:
+392
_glfw.hints.window.centerCursor = value;
+393
return;
+394
case GLFW_FOCUS_ON_SHOW:
+395
_glfw.hints.window.focusOnShow = value;
+396
return;
+397
case GLFW_MOUSE_PASSTHROUGH:
+398
_glfw.hints.window.mousePassthrough = value;
+399
return;
+400
case GLFW_CLIENT_API:
+401
_glfw.hints.context.client = value;
+402
return;
+403
case GLFW_CONTEXT_CREATION_API:
+404
_glfw.hints.context.source = value;
+405
return;
+406
case GLFW_CONTEXT_VERSION_MAJOR:
+407
_glfw.hints.context.major = value;
+408
return;
+409
case GLFW_CONTEXT_VERSION_MINOR:
+410
_glfw.hints.context.minor = value;
+411
return;
+412
case GLFW_CONTEXT_ROBUSTNESS:
+413
_glfw.hints.context.robustness = value;
+414
return;
+415
case GLFW_OPENGL_FORWARD_COMPAT:
+416
_glfw.hints.context.forward = value;
+417
return;
+418
case GLFW_CONTEXT_DEBUG:
+419
_glfw.hints.context.debug = value;
+420
return;
+421
case GLFW_CONTEXT_NO_ERROR:
+422
_glfw.hints.context.noerror = value;
+423
return;
+424
case GLFW_OPENGL_PROFILE:
+425
_glfw.hints.context.profile = value;
+426
return;
+427
case GLFW_CONTEXT_RELEASE_BEHAVIOR:
+428
_glfw.hints.context.release = value;
+429
return;
+430
case GLFW_REFRESH_RATE:
+431
_glfw.hints.refreshRate = value;
+432
return;
+433
}
+434
+435
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint 0x%08X", hint);
+436
}
+437
+438
GLFWAPI void glfwWindowHintString(int hint, const char* value)
+439
{
+440
assert(value != NULL);
+441
+442
_GLFW_REQUIRE_INIT();
+443
+444
switch (hint)
+445
{
+446
case GLFW_COCOA_FRAME_NAME:
+447
strncpy(_glfw.hints.window.ns.frameName, value,
+448
sizeof(_glfw.hints.window.ns.frameName) - 1);
+449
return;
+450
case GLFW_X11_CLASS_NAME:
+451
strncpy(_glfw.hints.window.x11.className, value,
+452
sizeof(_glfw.hints.window.x11.className) - 1);
+453
return;
+454
case GLFW_X11_INSTANCE_NAME:
+455
strncpy(_glfw.hints.window.x11.instanceName, value,
+456
sizeof(_glfw.hints.window.x11.instanceName) - 1);
+457
return;
+458
case GLFW_WAYLAND_APP_ID:
+459
strncpy(_glfw.hints.window.wl.appId, value,
+460
sizeof(_glfw.hints.window.wl.appId) - 1);
+461
return;
+462
}
+463
+464
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint string 0x%08X", hint);
+465
}
+466
+467
GLFWAPI void glfwDestroyWindow(GLFWwindow* handle)
+468
{
+469
_GLFW_REQUIRE_INIT();
+470
+471
_GLFWwindow* window = (_GLFWwindow*) handle;
+472
+473
// Allow closing of NULL (to match the behavior of free)
+474
if (window == NULL)
+475
return;
+476
+477
// Clear all callbacks to avoid exposing a half torn-down window object
+478
memset(&window->callbacks, 0, sizeof(window->callbacks));
+479
+480
// The window's context must not be current on another thread when the
+481
// window is destroyed
+482
if (window == _glfwPlatformGetTls(&_glfw.contextSlot))
+483
glfwMakeContextCurrent(NULL);
+484
+485
_glfw.platform.destroyWindow(window);
+486
+487
// Unlink window from global linked list
+488
{
+489
_GLFWwindow** prev = &_glfw.windowListHead;
+490
+491
while (*prev != window)
+492
prev = &((*prev)->next);
+493
+494
*prev = window->next;
+495
}
+496
+497
_glfw_free(window->title);
+498
_glfw_free(window);
+499
}

Showing the first 500 of 1199 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/wl_init.cadded
@@ -0,0 +1,1019 @@
+1
//========================================================================
+2
// GLFW 3.5 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 "internal.h"
+28
+29
#if defined(_GLFW_WAYLAND)
+30
+31
#include <errno.h>
+32
#include <limits.h>
+33
#include <linux/input.h>
+34
#include <stdio.h>
+35
#include <stdlib.h>
+36
#include <string.h>
+37
#include <sys/mman.h>
+38
#include <sys/timerfd.h>
+39
#include <unistd.h>
+40
#include <time.h>
+41
#include <assert.h>
+42
+43
#include "wayland-client-protocol.h"
+44
#include "xdg-shell-client-protocol.h"
+45
#include "xdg-decoration-unstable-v1-client-protocol.h"
+46
#include "viewporter-client-protocol.h"
+47
#include "relative-pointer-unstable-v1-client-protocol.h"
+48
#include "pointer-constraints-unstable-v1-client-protocol.h"
+49
#include "fractional-scale-v1-client-protocol.h"
+50
#include "xdg-activation-v1-client-protocol.h"
+51
#include "idle-inhibit-unstable-v1-client-protocol.h"
+52
+53
// NOTE: Versions of wayland-scanner prior to 1.17.91 named every global array of
+54
// wl_interface pointers 'types', making it impossible to combine several unmodified
+55
// private-code files into a single compilation unit
+56
// HACK: We override this name with a macro for each file, allowing them to coexist
+57
+58
#define types _glfw_wayland_types
+59
#include "wayland-client-protocol-code.h"
+60
#undef types
+61
+62
#define types _glfw_xdg_shell_types
+63
#include "xdg-shell-client-protocol-code.h"
+64
#undef types
+65
+66
#define types _glfw_xdg_decoration_types
+67
#include "xdg-decoration-unstable-v1-client-protocol-code.h"
+68
#undef types
+69
+70
#define types _glfw_viewporter_types
+71
#include "viewporter-client-protocol-code.h"
+72
#undef types
+73
+74
#define types _glfw_relative_pointer_types
+75
#include "relative-pointer-unstable-v1-client-protocol-code.h"
+76
#undef types
+77
+78
#define types _glfw_pointer_constraints_types
+79
#include "pointer-constraints-unstable-v1-client-protocol-code.h"
+80
#undef types
+81
+82
#define types _glfw_fractional_scale_types
+83
#include "fractional-scale-v1-client-protocol-code.h"
+84
#undef types
+85
+86
#define types _glfw_xdg_activation_types
+87
#include "xdg-activation-v1-client-protocol-code.h"
+88
#undef types
+89
+90
#define types _glfw_idle_inhibit_types
+91
#include "idle-inhibit-unstable-v1-client-protocol-code.h"
+92
#undef types
+93
+94
static void wmBaseHandlePing(void* userData,
+95
struct xdg_wm_base* wmBase,
+96
uint32_t serial)
+97
{
+98
xdg_wm_base_pong(wmBase, serial);
+99
}
+100
+101
static const struct xdg_wm_base_listener wmBaseListener =
+102
{
+103
wmBaseHandlePing
+104
};
+105
+106
static void registryHandleGlobal(void* userData,
+107
struct wl_registry* registry,
+108
uint32_t name,
+109
const char* interface,
+110
uint32_t version)
+111
{
+112
if (strcmp(interface, "wl_compositor") == 0)
+113
{
+114
_glfw.wl.compositor =
+115
wl_registry_bind(registry, name, &wl_compositor_interface,
+116
_glfw_min(3, version));
+117
}
+118
else if (strcmp(interface, "wl_subcompositor") == 0)
+119
{
+120
_glfw.wl.subcompositor =
+121
wl_registry_bind(registry, name, &wl_subcompositor_interface, 1);
+122
}
+123
else if (strcmp(interface, "wl_shm") == 0)
+124
{
+125
_glfw.wl.shm =
+126
wl_registry_bind(registry, name, &wl_shm_interface, 1);
+127
}
+128
else if (strcmp(interface, "wl_output") == 0)
+129
{
+130
_glfwAddOutputWayland(name, version);
+131
}
+132
else if (strcmp(interface, "wl_seat") == 0)
+133
{
+134
if (!_glfw.wl.seat)
+135
{
+136
_glfw.wl.seat =
+137
wl_registry_bind(registry, name, &wl_seat_interface,
+138
_glfw_min(8, version));
+139
_glfwAddSeatListenerWayland(_glfw.wl.seat);
+140
}
+141
}
+142
else if (strcmp(interface, "wl_data_device_manager") == 0)
+143
{
+144
if (!_glfw.wl.dataDeviceManager)
+145
{
+146
_glfw.wl.dataDeviceManager =
+147
wl_registry_bind(registry, name,
+148
&wl_data_device_manager_interface, 1);
+149
}
+150
}
+151
else if (strcmp(interface, "xdg_wm_base") == 0)
+152
{
+153
_glfw.wl.wmBase =
+154
wl_registry_bind(registry, name, &xdg_wm_base_interface, 1);
+155
xdg_wm_base_add_listener(_glfw.wl.wmBase, &wmBaseListener, NULL);
+156
}
+157
else if (strcmp(interface, "zxdg_decoration_manager_v1") == 0)
+158
{
+159
_glfw.wl.decorationManager =
+160
wl_registry_bind(registry, name,
+161
&zxdg_decoration_manager_v1_interface,
+162
1);
+163
}
+164
else if (strcmp(interface, "wp_viewporter") == 0)
+165
{
+166
_glfw.wl.viewporter =
+167
wl_registry_bind(registry, name, &wp_viewporter_interface, 1);
+168
}
+169
else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0)
+170
{
+171
_glfw.wl.relativePointerManager =
+172
wl_registry_bind(registry, name,
+173
&zwp_relative_pointer_manager_v1_interface,
+174
1);
+175
}
+176
else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0)
+177
{
+178
_glfw.wl.pointerConstraints =
+179
wl_registry_bind(registry, name,
+180
&zwp_pointer_constraints_v1_interface,
+181
1);
+182
}
+183
else if (strcmp(interface, "zwp_idle_inhibit_manager_v1") == 0)
+184
{
+185
_glfw.wl.idleInhibitManager =
+186
wl_registry_bind(registry, name,
+187
&zwp_idle_inhibit_manager_v1_interface,
+188
1);
+189
}
+190
else if (strcmp(interface, "xdg_activation_v1") == 0)
+191
{
+192
_glfw.wl.activationManager =
+193
wl_registry_bind(registry, name,
+194
&xdg_activation_v1_interface,
+195
1);
+196
}
+197
else if (strcmp(interface, "wp_fractional_scale_manager_v1") == 0)
+198
{
+199
_glfw.wl.fractionalScaleManager =
+200
wl_registry_bind(registry, name,
+201
&wp_fractional_scale_manager_v1_interface,
+202
1);
+203
}
+204
}
+205
+206
static void registryHandleGlobalRemove(void* userData,
+207
struct wl_registry* registry,
+208
uint32_t name)
+209
{
+210
for (int i = 0; i < _glfw.monitorCount; ++i)
+211
{
+212
_GLFWmonitor* monitor = _glfw.monitors[i];
+213
if (monitor->wl.name == name)
+214
{
+215
_glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0);
+216
return;
+217
}
+218
}
+219
}
+220
+221
+222
static const struct wl_registry_listener registryListener =
+223
{
+224
registryHandleGlobal,
+225
registryHandleGlobalRemove
+226
};
+227
+228
void libdecorHandleError(struct libdecor* context,
+229
enum libdecor_error error,
+230
const char* message)
+231
{
+232
_glfwInputError(GLFW_PLATFORM_ERROR,
+233
"Wayland: libdecor error %u: %s",
+234
error, message);
+235
}
+236
+237
static const struct libdecor_interface libdecorInterface =
+238
{
+239
libdecorHandleError
+240
};
+241
+242
static void libdecorReadyCallback(void* userData,
+243
struct wl_callback* callback,
+244
uint32_t time)
+245
{
+246
_glfw.wl.libdecor.ready = GLFW_TRUE;
+247
wl_callback_destroy(callback);
+248
}
+249
+250
static const struct wl_callback_listener libdecorReadyListener =
+251
{
+252
libdecorReadyCallback
+253
};
+254
+255
// Create key code translation tables
+256
//
+257
static void createKeyTables(void)
+258
{
+259
memset(_glfw.wl.keycodes, -1, sizeof(_glfw.wl.keycodes));
+260
memset(_glfw.wl.scancodes, -1, sizeof(_glfw.wl.scancodes));
+261
+262
_glfw.wl.keycodes[KEY_GRAVE] = GLFW_KEY_GRAVE_ACCENT;
+263
_glfw.wl.keycodes[KEY_1] = GLFW_KEY_1;
+264
_glfw.wl.keycodes[KEY_2] = GLFW_KEY_2;
+265
_glfw.wl.keycodes[KEY_3] = GLFW_KEY_3;
+266
_glfw.wl.keycodes[KEY_4] = GLFW_KEY_4;
+267
_glfw.wl.keycodes[KEY_5] = GLFW_KEY_5;
+268
_glfw.wl.keycodes[KEY_6] = GLFW_KEY_6;
+269
_glfw.wl.keycodes[KEY_7] = GLFW_KEY_7;
+270
_glfw.wl.keycodes[KEY_8] = GLFW_KEY_8;
+271
_glfw.wl.keycodes[KEY_9] = GLFW_KEY_9;
+272
_glfw.wl.keycodes[KEY_0] = GLFW_KEY_0;
+273
_glfw.wl.keycodes[KEY_SPACE] = GLFW_KEY_SPACE;
+274
_glfw.wl.keycodes[KEY_MINUS] = GLFW_KEY_MINUS;
+275
_glfw.wl.keycodes[KEY_EQUAL] = GLFW_KEY_EQUAL;
+276
_glfw.wl.keycodes[KEY_Q] = GLFW_KEY_Q;
+277
_glfw.wl.keycodes[KEY_W] = GLFW_KEY_W;
+278
_glfw.wl.keycodes[KEY_E] = GLFW_KEY_E;
+279
_glfw.wl.keycodes[KEY_R] = GLFW_KEY_R;
+280
_glfw.wl.keycodes[KEY_T] = GLFW_KEY_T;
+281
_glfw.wl.keycodes[KEY_Y] = GLFW_KEY_Y;
+282
_glfw.wl.keycodes[KEY_U] = GLFW_KEY_U;
+283
_glfw.wl.keycodes[KEY_I] = GLFW_KEY_I;
+284
_glfw.wl.keycodes[KEY_O] = GLFW_KEY_O;
+285
_glfw.wl.keycodes[KEY_P] = GLFW_KEY_P;
+286
_glfw.wl.keycodes[KEY_LEFTBRACE] = GLFW_KEY_LEFT_BRACKET;
+287
_glfw.wl.keycodes[KEY_RIGHTBRACE] = GLFW_KEY_RIGHT_BRACKET;
+288
_glfw.wl.keycodes[KEY_A] = GLFW_KEY_A;
+289
_glfw.wl.keycodes[KEY_S] = GLFW_KEY_S;
+290
_glfw.wl.keycodes[KEY_D] = GLFW_KEY_D;
+291
_glfw.wl.keycodes[KEY_F] = GLFW_KEY_F;
+292
_glfw.wl.keycodes[KEY_G] = GLFW_KEY_G;
+293
_glfw.wl.keycodes[KEY_H] = GLFW_KEY_H;
+294
_glfw.wl.keycodes[KEY_J] = GLFW_KEY_J;
+295
_glfw.wl.keycodes[KEY_K] = GLFW_KEY_K;
+296
_glfw.wl.keycodes[KEY_L] = GLFW_KEY_L;
+297
_glfw.wl.keycodes[KEY_SEMICOLON] = GLFW_KEY_SEMICOLON;
+298
_glfw.wl.keycodes[KEY_APOSTROPHE] = GLFW_KEY_APOSTROPHE;
+299
_glfw.wl.keycodes[KEY_Z] = GLFW_KEY_Z;
+300
_glfw.wl.keycodes[KEY_X] = GLFW_KEY_X;
+301
_glfw.wl.keycodes[KEY_C] = GLFW_KEY_C;
+302
_glfw.wl.keycodes[KEY_V] = GLFW_KEY_V;
+303
_glfw.wl.keycodes[KEY_B] = GLFW_KEY_B;
+304
_glfw.wl.keycodes[KEY_N] = GLFW_KEY_N;
+305
_glfw.wl.keycodes[KEY_M] = GLFW_KEY_M;
+306
_glfw.wl.keycodes[KEY_COMMA] = GLFW_KEY_COMMA;
+307
_glfw.wl.keycodes[KEY_DOT] = GLFW_KEY_PERIOD;
+308
_glfw.wl.keycodes[KEY_SLASH] = GLFW_KEY_SLASH;
+309
_glfw.wl.keycodes[KEY_BACKSLASH] = GLFW_KEY_BACKSLASH;
+310
_glfw.wl.keycodes[KEY_ESC] = GLFW_KEY_ESCAPE;
+311
_glfw.wl.keycodes[KEY_TAB] = GLFW_KEY_TAB;
+312
_glfw.wl.keycodes[KEY_LEFTSHIFT] = GLFW_KEY_LEFT_SHIFT;
+313
_glfw.wl.keycodes[KEY_RIGHTSHIFT] = GLFW_KEY_RIGHT_SHIFT;
+314
_glfw.wl.keycodes[KEY_LEFTCTRL] = GLFW_KEY_LEFT_CONTROL;
+315
_glfw.wl.keycodes[KEY_RIGHTCTRL] = GLFW_KEY_RIGHT_CONTROL;
+316
_glfw.wl.keycodes[KEY_LEFTALT] = GLFW_KEY_LEFT_ALT;
+317
_glfw.wl.keycodes[KEY_RIGHTALT] = GLFW_KEY_RIGHT_ALT;
+318
_glfw.wl.keycodes[KEY_LEFTMETA] = GLFW_KEY_LEFT_SUPER;
+319
_glfw.wl.keycodes[KEY_RIGHTMETA] = GLFW_KEY_RIGHT_SUPER;
+320
_glfw.wl.keycodes[KEY_COMPOSE] = GLFW_KEY_MENU;
+321
_glfw.wl.keycodes[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK;
+322
_glfw.wl.keycodes[KEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK;
+323
_glfw.wl.keycodes[KEY_PRINT] = GLFW_KEY_PRINT_SCREEN;
+324
_glfw.wl.keycodes[KEY_SCROLLLOCK] = GLFW_KEY_SCROLL_LOCK;
+325
_glfw.wl.keycodes[KEY_PAUSE] = GLFW_KEY_PAUSE;
+326
_glfw.wl.keycodes[KEY_DELETE] = GLFW_KEY_DELETE;
+327
_glfw.wl.keycodes[KEY_BACKSPACE] = GLFW_KEY_BACKSPACE;
+328
_glfw.wl.keycodes[KEY_ENTER] = GLFW_KEY_ENTER;
+329
_glfw.wl.keycodes[KEY_HOME] = GLFW_KEY_HOME;
+330
_glfw.wl.keycodes[KEY_END] = GLFW_KEY_END;
+331
_glfw.wl.keycodes[KEY_PAGEUP] = GLFW_KEY_PAGE_UP;
+332
_glfw.wl.keycodes[KEY_PAGEDOWN] = GLFW_KEY_PAGE_DOWN;
+333
_glfw.wl.keycodes[KEY_INSERT] = GLFW_KEY_INSERT;
+334
_glfw.wl.keycodes[KEY_LEFT] = GLFW_KEY_LEFT;
+335
_glfw.wl.keycodes[KEY_RIGHT] = GLFW_KEY_RIGHT;
+336
_glfw.wl.keycodes[KEY_DOWN] = GLFW_KEY_DOWN;
+337
_glfw.wl.keycodes[KEY_UP] = GLFW_KEY_UP;
+338
_glfw.wl.keycodes[KEY_F1] = GLFW_KEY_F1;
+339
_glfw.wl.keycodes[KEY_F2] = GLFW_KEY_F2;
+340
_glfw.wl.keycodes[KEY_F3] = GLFW_KEY_F3;
+341
_glfw.wl.keycodes[KEY_F4] = GLFW_KEY_F4;
+342
_glfw.wl.keycodes[KEY_F5] = GLFW_KEY_F5;
+343
_glfw.wl.keycodes[KEY_F6] = GLFW_KEY_F6;
+344
_glfw.wl.keycodes[KEY_F7] = GLFW_KEY_F7;
+345
_glfw.wl.keycodes[KEY_F8] = GLFW_KEY_F8;
+346
_glfw.wl.keycodes[KEY_F9] = GLFW_KEY_F9;
+347
_glfw.wl.keycodes[KEY_F10] = GLFW_KEY_F10;
+348
_glfw.wl.keycodes[KEY_F11] = GLFW_KEY_F11;
+349
_glfw.wl.keycodes[KEY_F12] = GLFW_KEY_F12;
+350
_glfw.wl.keycodes[KEY_F13] = GLFW_KEY_F13;
+351
_glfw.wl.keycodes[KEY_F14] = GLFW_KEY_F14;
+352
_glfw.wl.keycodes[KEY_F15] = GLFW_KEY_F15;
+353
_glfw.wl.keycodes[KEY_F16] = GLFW_KEY_F16;
+354
_glfw.wl.keycodes[KEY_F17] = GLFW_KEY_F17;
+355
_glfw.wl.keycodes[KEY_F18] = GLFW_KEY_F18;
+356
_glfw.wl.keycodes[KEY_F19] = GLFW_KEY_F19;
+357
_glfw.wl.keycodes[KEY_F20] = GLFW_KEY_F20;
+358
_glfw.wl.keycodes[KEY_F21] = GLFW_KEY_F21;
+359
_glfw.wl.keycodes[KEY_F22] = GLFW_KEY_F22;
+360
_glfw.wl.keycodes[KEY_F23] = GLFW_KEY_F23;
+361
_glfw.wl.keycodes[KEY_F24] = GLFW_KEY_F24;
+362
_glfw.wl.keycodes[KEY_KPSLASH] = GLFW_KEY_KP_DIVIDE;
+363
_glfw.wl.keycodes[KEY_KPASTERISK] = GLFW_KEY_KP_MULTIPLY;
+364
_glfw.wl.keycodes[KEY_KPMINUS] = GLFW_KEY_KP_SUBTRACT;
+365
_glfw.wl.keycodes[KEY_KPPLUS] = GLFW_KEY_KP_ADD;
+366
_glfw.wl.keycodes[KEY_KP0] = GLFW_KEY_KP_0;
+367
_glfw.wl.keycodes[KEY_KP1] = GLFW_KEY_KP_1;
+368
_glfw.wl.keycodes[KEY_KP2] = GLFW_KEY_KP_2;
+369
_glfw.wl.keycodes[KEY_KP3] = GLFW_KEY_KP_3;
+370
_glfw.wl.keycodes[KEY_KP4] = GLFW_KEY_KP_4;
+371
_glfw.wl.keycodes[KEY_KP5] = GLFW_KEY_KP_5;
+372
_glfw.wl.keycodes[KEY_KP6] = GLFW_KEY_KP_6;
+373
_glfw.wl.keycodes[KEY_KP7] = GLFW_KEY_KP_7;
+374
_glfw.wl.keycodes[KEY_KP8] = GLFW_KEY_KP_8;
+375
_glfw.wl.keycodes[KEY_KP9] = GLFW_KEY_KP_9;
+376
_glfw.wl.keycodes[KEY_KPDOT] = GLFW_KEY_KP_DECIMAL;
+377
_glfw.wl.keycodes[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL;
+378
_glfw.wl.keycodes[KEY_KPENTER] = GLFW_KEY_KP_ENTER;
+379
_glfw.wl.keycodes[KEY_102ND] = GLFW_KEY_WORLD_2;
+380
+381
for (int scancode = 0; scancode < 256; scancode++)
+382
{
+383
if (_glfw.wl.keycodes[scancode] > 0)
+384
_glfw.wl.scancodes[_glfw.wl.keycodes[scancode]] = scancode;
+385
}
+386
}
+387
+388
static GLFWbool loadCursorTheme(void)
+389
{
+390
int cursorSize = 16;
+391
+392
const char* sizeString = getenv("XCURSOR_SIZE");
+393
if (sizeString)
+394
{
+395
errno = 0;
+396
const long cursorSizeLong = strtol(sizeString, NULL, 10);
+397
if (errno == 0 && cursorSizeLong > 0 && cursorSizeLong < INT_MAX)
+398
cursorSize = (int) cursorSizeLong;
+399
}
+400
+401
const char* themeName = getenv("XCURSOR_THEME");
+402
+403
_glfw.wl.cursorTheme = wl_cursor_theme_load(themeName, cursorSize, _glfw.wl.shm);
+404
if (!_glfw.wl.cursorTheme)
+405
{
+406
_glfwInputError(GLFW_PLATFORM_ERROR,
+407
"Wayland: Failed to load default cursor theme");
+408
return GLFW_FALSE;
+409
}
+410
+411
// If this happens to be NULL, we just fallback to the scale=1 version.
+412
_glfw.wl.cursorThemeHiDPI =
+413
wl_cursor_theme_load(themeName, cursorSize * 2, _glfw.wl.shm);
+414
+415
_glfw.wl.cursorSurface = wl_compositor_create_surface(_glfw.wl.compositor);
+416
_glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
+417
return GLFW_TRUE;
+418
}
+419
+420
+421
//////////////////////////////////////////////////////////////////////////
+422
////// GLFW platform API //////
+423
//////////////////////////////////////////////////////////////////////////
+424
+425
GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform)
+426
{
+427
const _GLFWplatform wayland =
+428
{
+429
.platformID = GLFW_PLATFORM_WAYLAND,
+430
.init = _glfwInitWayland,
+431
.terminate = _glfwTerminateWayland,
+432
.getCursorPos = _glfwGetCursorPosWayland,
+433
.setCursorPos = _glfwSetCursorPosWayland,
+434
.setCursorMode = _glfwSetCursorModeWayland,
+435
.setRawMouseMotion = _glfwSetRawMouseMotionWayland,
+436
.rawMouseMotionSupported = _glfwRawMouseMotionSupportedWayland,
+437
.createCursor = _glfwCreateCursorWayland,
+438
.createStandardCursor = _glfwCreateStandardCursorWayland,
+439
.destroyCursor = _glfwDestroyCursorWayland,
+440
.setCursor = _glfwSetCursorWayland,
+441
.getScancodeName = _glfwGetScancodeNameWayland,
+442
.getKeyScancode = _glfwGetKeyScancodeWayland,
+443
.setClipboardString = _glfwSetClipboardStringWayland,
+444
.getClipboardString = _glfwGetClipboardStringWayland,
+445
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
+446
.initJoysticks = _glfwInitJoysticksLinux,
+447
.terminateJoysticks = _glfwTerminateJoysticksLinux,
+448
.pollJoystick = _glfwPollJoystickLinux,
+449
.getMappingName = _glfwGetMappingNameLinux,
+450
.updateGamepadGUID = _glfwUpdateGamepadGUIDLinux,
+451
#else
+452
.initJoysticks = _glfwInitJoysticksNull,
+453
.terminateJoysticks = _glfwTerminateJoysticksNull,
+454
.pollJoystick = _glfwPollJoystickNull,
+455
.getMappingName = _glfwGetMappingNameNull,
+456
.updateGamepadGUID = _glfwUpdateGamepadGUIDNull,
+457
#endif
+458
.freeMonitor = _glfwFreeMonitorWayland,
+459
.getMonitorPos = _glfwGetMonitorPosWayland,
+460
.getMonitorContentScale = _glfwGetMonitorContentScaleWayland,
+461
.getMonitorWorkarea = _glfwGetMonitorWorkareaWayland,
+462
.getVideoModes = _glfwGetVideoModesWayland,
+463
.getVideoMode = _glfwGetVideoModeWayland,
+464
.getGammaRamp = _glfwGetGammaRampWayland,
+465
.setGammaRamp = _glfwSetGammaRampWayland,
+466
.createWindow = _glfwCreateWindowWayland,
+467
.destroyWindow = _glfwDestroyWindowWayland,
+468
.setWindowTitle = _glfwSetWindowTitleWayland,
+469
.setWindowIcon = _glfwSetWindowIconWayland,
+470
.getWindowPos = _glfwGetWindowPosWayland,
+471
.setWindowPos = _glfwSetWindowPosWayland,
+472
.getWindowSize = _glfwGetWindowSizeWayland,
+473
.setWindowSize = _glfwSetWindowSizeWayland,
+474
.setWindowSizeLimits = _glfwSetWindowSizeLimitsWayland,
+475
.setWindowAspectRatio = _glfwSetWindowAspectRatioWayland,
+476
.getFramebufferSize = _glfwGetFramebufferSizeWayland,
+477
.getWindowFrameSize = _glfwGetWindowFrameSizeWayland,
+478
.getWindowContentScale = _glfwGetWindowContentScaleWayland,
+479
.iconifyWindow = _glfwIconifyWindowWayland,
+480
.restoreWindow = _glfwRestoreWindowWayland,
+481
.maximizeWindow = _glfwMaximizeWindowWayland,
+482
.showWindow = _glfwShowWindowWayland,
+483
.hideWindow = _glfwHideWindowWayland,
+484
.requestWindowAttention = _glfwRequestWindowAttentionWayland,
+485
.focusWindow = _glfwFocusWindowWayland,
+486
.setWindowMonitor = _glfwSetWindowMonitorWayland,
+487
.windowFocused = _glfwWindowFocusedWayland,
+488
.windowIconified = _glfwWindowIconifiedWayland,
+489
.windowVisible = _glfwWindowVisibleWayland,
+490
.windowMaximized = _glfwWindowMaximizedWayland,
+491
.windowHovered = _glfwWindowHoveredWayland,
+492
.framebufferTransparent = _glfwFramebufferTransparentWayland,
+493
.getWindowOpacity = _glfwGetWindowOpacityWayland,
+494
.setWindowResizable = _glfwSetWindowResizableWayland,
+495
.setWindowDecorated = _glfwSetWindowDecoratedWayland,
+496
.setWindowFloating = _glfwSetWindowFloatingWayland,
+497
.setWindowOpacity = _glfwSetWindowOpacityWayland,
+498
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughWayland,
+499
.pollEvents = _glfwPollEventsWayland,

Showing the first 500 of 1020 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/wl_monitor.cadded
@@ -0,0 +1,277 @@
+1
//========================================================================
+2
// GLFW 3.5 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 "internal.h"
+28
+29
#if defined(_GLFW_WAYLAND)
+30
+31
#include <stdio.h>
+32
#include <stdlib.h>
+33
#include <string.h>
+34
#include <errno.h>
+35
#include <math.h>
+36
#include <assert.h>
+37
+38
#include "wayland-client-protocol.h"
+39
+40
+41
static void outputHandleGeometry(void* userData,
+42
struct wl_output* output,
+43
int32_t x,
+44
int32_t y,
+45
int32_t physicalWidth,
+46
int32_t physicalHeight,
+47
int32_t subpixel,
+48
const char* make,
+49
const char* model,
+50
int32_t transform)
+51
{
+52
struct _GLFWmonitor* monitor = userData;
+53
+54
monitor->wl.x = x;
+55
monitor->wl.y = y;
+56
monitor->widthMM = physicalWidth;
+57
monitor->heightMM = physicalHeight;
+58
+59
if (strlen(monitor->name) == 0)
+60
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
+61
}
+62
+63
static void outputHandleMode(void* userData,
+64
struct wl_output* output,
+65
uint32_t flags,
+66
int32_t width,
+67
int32_t height,
+68
int32_t refresh)
+69
{
+70
struct _GLFWmonitor* monitor = userData;
+71
GLFWvidmode mode;
+72
+73
mode.width = width;
+74
mode.height = height;
+75
mode.redBits = 8;
+76
mode.greenBits = 8;
+77
mode.blueBits = 8;
+78
mode.refreshRate = (int) round(refresh / 1000.0);
+79
+80
monitor->modeCount++;
+81
monitor->modes =
+82
_glfw_realloc(monitor->modes, monitor->modeCount * sizeof(GLFWvidmode));
+83
monitor->modes[monitor->modeCount - 1] = mode;
+84
+85
if (flags & WL_OUTPUT_MODE_CURRENT)
+86
monitor->wl.currentMode = monitor->modeCount - 1;
+87
}
+88
+89
static void outputHandleDone(void* userData, struct wl_output* output)
+90
{
+91
struct _GLFWmonitor* monitor = userData;
+92
+93
if (monitor->widthMM <= 0 || monitor->heightMM <= 0)
+94
{
+95
// If Wayland does not provide a physical size, assume the default 96 DPI
+96
const GLFWvidmode* mode = &monitor->modes[monitor->wl.currentMode];
+97
monitor->widthMM = (int) (mode->width * 25.4f / 96.f);
+98
monitor->heightMM = (int) (mode->height * 25.4f / 96.f);
+99
}
+100
+101
for (int i = 0; i < _glfw.monitorCount; i++)
+102
{
+103
if (_glfw.monitors[i] == monitor)
+104
return;
+105
}
+106
+107
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
+108
}
+109
+110
static void outputHandleScale(void* userData,
+111
struct wl_output* output,
+112
int32_t factor)
+113
{
+114
struct _GLFWmonitor* monitor = userData;
+115
+116
monitor->wl.scale = factor;
+117
+118
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
+119
{
+120
for (size_t i = 0; i < window->wl.outputScaleCount; i++)
+121
{
+122
if (window->wl.outputScales[i].output == monitor->wl.output)
+123
{
+124
window->wl.outputScales[i].factor = monitor->wl.scale;
+125
_glfwUpdateBufferScaleFromOutputsWayland(window);
+126
break;
+127
}
+128
}
+129
}
+130
}
+131
+132
void outputHandleName(void* userData, struct wl_output* wl_output, const char* name)
+133
{
+134
struct _GLFWmonitor* monitor = userData;
+135
+136
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
+137
}
+138
+139
void outputHandleDescription(void* userData,
+140
struct wl_output* wl_output,
+141
const char* description)
+142
{
+143
}
+144
+145
static const struct wl_output_listener outputListener =
+146
{
+147
outputHandleGeometry,
+148
outputHandleMode,
+149
outputHandleDone,
+150
outputHandleScale,
+151
outputHandleName,
+152
outputHandleDescription,
+153
};
+154
+155
+156
//////////////////////////////////////////////////////////////////////////
+157
////// GLFW internal API //////
+158
//////////////////////////////////////////////////////////////////////////
+159
+160
void _glfwAddOutputWayland(uint32_t name, uint32_t version)
+161
{
+162
if (version < 2)
+163
{
+164
_glfwInputError(GLFW_PLATFORM_ERROR,
+165
"Wayland: Unsupported output interface version");
+166
return;
+167
}
+168
+169
version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION);
+170
+171
struct wl_output* output = wl_registry_bind(_glfw.wl.registry,
+172
name,
+173
&wl_output_interface,
+174
version);
+175
if (!output)
+176
return;
+177
+178
// The actual name of this output will be set in the geometry handler
+179
_GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0);
+180
monitor->wl.scale = 1;
+181
monitor->wl.output = output;
+182
monitor->wl.name = name;
+183
+184
wl_proxy_set_tag((struct wl_proxy*) output, &_glfw.wl.tag);
+185
wl_output_add_listener(output, &outputListener, monitor);
+186
}
+187
+188
+189
//////////////////////////////////////////////////////////////////////////
+190
////// GLFW platform API //////
+191
//////////////////////////////////////////////////////////////////////////
+192
+193
void _glfwFreeMonitorWayland(_GLFWmonitor* monitor)
+194
{
+195
if (monitor->wl.output)
+196
wl_output_destroy(monitor->wl.output);
+197
}
+198
+199
void _glfwGetMonitorPosWayland(_GLFWmonitor* monitor, int* xpos, int* ypos)
+200
{
+201
if (xpos)
+202
*xpos = monitor->wl.x;
+203
if (ypos)
+204
*ypos = monitor->wl.y;
+205
}
+206
+207
void _glfwGetMonitorContentScaleWayland(_GLFWmonitor* monitor,
+208
float* xscale, float* yscale)
+209
{
+210
if (xscale)
+211
*xscale = (float) monitor->wl.scale;
+212
if (yscale)
+213
*yscale = (float) monitor->wl.scale;
+214
}
+215
+216
void _glfwGetMonitorWorkareaWayland(_GLFWmonitor* monitor,
+217
int* xpos, int* ypos,
+218
int* width, int* height)
+219
{
+220
if (xpos)
+221
*xpos = monitor->wl.x;
+222
if (ypos)
+223
*ypos = monitor->wl.y;
+224
if (width)
+225
*width = monitor->modes[monitor->wl.currentMode].width;
+226
if (height)
+227
*height = monitor->modes[monitor->wl.currentMode].height;
+228
}
+229
+230
GLFWvidmode* _glfwGetVideoModesWayland(_GLFWmonitor* monitor, int* found)
+231
{
+232
*found = monitor->modeCount;
+233
return monitor->modes;
+234
}
+235
+236
GLFWbool _glfwGetVideoModeWayland(_GLFWmonitor* monitor, GLFWvidmode* mode)
+237
{
+238
*mode = monitor->modes[monitor->wl.currentMode];
+239
return GLFW_TRUE;
+240
}
+241
+242
GLFWbool _glfwGetGammaRampWayland(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
+243
{
+244
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
+245
"Wayland: Gamma ramp access is not available");
+246
return GLFW_FALSE;
+247
}
+248
+249
void _glfwSetGammaRampWayland(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
+250
{
+251
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
+252
"Wayland: Gamma ramp access is not available");
+253
}
+254
+255
+256
//////////////////////////////////////////////////////////////////////////
+257
////// GLFW native API //////
+258
//////////////////////////////////////////////////////////////////////////
+259
+260
GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* handle)
+261
{
+262
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+263
+264
if (_glfw.platform.platformID != GLFW_PLATFORM_WAYLAND)
+265
{
+266
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Wayland: Platform not initialized");
+267
return NULL;
+268
}
+269
+270
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
+271
assert(monitor != NULL);
+272
+273
return monitor->wl.output;
+274
}
+275
+276
#endif // _GLFW_WAYLAND
+277
vendor/glfw/src/wl_platform.hadded
@@ -0,0 +1,736 @@
+1
//========================================================================
+2
// GLFW 3.5 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
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
+32
+33
typedef 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
+42
typedef VkResult (APIENTRY *PFN_vkCreateWaylandSurfaceKHR)(VkInstance,const VkWaylandSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
+43
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice,uint32_t,struct wl_display*);
+44
+45
typedef int (* PFN_wl_display_flush)(struct wl_display* display);
+46
typedef void (* PFN_wl_display_cancel_read)(struct wl_display* display);
+47
typedef int (* PFN_wl_display_dispatch_pending)(struct wl_display* display);
+48
typedef int (* PFN_wl_display_read_events)(struct wl_display* display);
+49
typedef struct wl_display* (* PFN_wl_display_connect)(const char*);
+50
typedef void (* PFN_wl_display_disconnect)(struct wl_display*);
+51
typedef int (* PFN_wl_display_roundtrip)(struct wl_display*);
+52
typedef int (* PFN_wl_display_get_fd)(struct wl_display*);
+53
typedef int (* PFN_wl_display_prepare_read)(struct wl_display*);
+54
typedef struct wl_event_queue* (* PFN_wl_display_create_queue)(struct wl_display*);
+55
typedef void (* PFN_wl_event_queue_destroy)(struct wl_event_queue*);
+56
typedef int (* PFN_wl_display_prepare_read_queue)(struct wl_display*,struct wl_event_queue*);
+57
typedef int (* PFN_wl_display_dispatch_queue_pending)(struct wl_display*,struct wl_event_queue*);
+58
typedef void (* PFN_wl_proxy_marshal)(struct wl_proxy*,uint32_t,...);
+59
typedef int (* PFN_wl_proxy_add_listener)(struct wl_proxy*,void(**)(void),void*);
+60
typedef void (* PFN_wl_proxy_destroy)(struct wl_proxy*);
+61
typedef struct wl_proxy* (* PFN_wl_proxy_marshal_constructor)(struct wl_proxy*,uint32_t,const struct wl_interface*,...);
+62
typedef struct wl_proxy* (* PFN_wl_proxy_marshal_constructor_versioned)(struct wl_proxy*,uint32_t,const struct wl_interface*,uint32_t,...);
+63
typedef void* (* PFN_wl_proxy_get_user_data)(struct wl_proxy*);
+64
typedef void (* PFN_wl_proxy_set_user_data)(struct wl_proxy*,void*);
+65
typedef void (* PFN_wl_proxy_set_tag)(struct wl_proxy*,const char*const*);
+66
typedef const char* const* (* PFN_wl_proxy_get_tag)(struct wl_proxy*);
+67
typedef uint32_t (* PFN_wl_proxy_get_version)(struct wl_proxy*);
+68
typedef struct wl_proxy* (* PFN_wl_proxy_marshal_flags)(struct wl_proxy*,uint32_t,const struct wl_interface*,uint32_t,uint32_t,...);
+69
typedef void* (* PFN_wl_proxy_create_wrapper)(void*);
+70
typedef void (* PFN_wl_proxy_wrapper_destroy)(void*);
+71
typedef void (* PFN_wl_proxy_set_queue)(struct wl_proxy*,struct wl_event_queue*);
+72
#define wl_display_flush _glfw.wl.client.display_flush
+73
#define wl_display_cancel_read _glfw.wl.client.display_cancel_read
+74
#define wl_display_dispatch_pending _glfw.wl.client.display_dispatch_pending
+75
#define wl_display_read_events _glfw.wl.client.display_read_events
+76
#define wl_display_disconnect _glfw.wl.client.display_disconnect
+77
#define wl_display_roundtrip _glfw.wl.client.display_roundtrip
+78
#define wl_display_get_fd _glfw.wl.client.display_get_fd
+79
#define wl_display_prepare_read _glfw.wl.client.display_prepare_read
+80
#define wl_display_create_queue _glfw.wl.client.display_create_queue
+81
#define wl_display_prepare_read_queue _glfw.wl.client.display_prepare_read_queue
+82
#define wl_display_dispatch_queue_pending _glfw.wl.client.display_dispatch_queue_pending
+83
#define wl_event_queue_destroy _glfw.wl.client.event_queue_destroy
+84
#define wl_proxy_marshal _glfw.wl.client.proxy_marshal
+85
#define wl_proxy_add_listener _glfw.wl.client.proxy_add_listener
+86
#define wl_proxy_destroy _glfw.wl.client.proxy_destroy
+87
#define wl_proxy_marshal_constructor _glfw.wl.client.proxy_marshal_constructor
+88
#define wl_proxy_marshal_constructor_versioned _glfw.wl.client.proxy_marshal_constructor_versioned
+89
#define wl_proxy_get_user_data _glfw.wl.client.proxy_get_user_data
+90
#define wl_proxy_set_user_data _glfw.wl.client.proxy_set_user_data
+91
#define wl_proxy_get_tag _glfw.wl.client.proxy_get_tag
+92
#define wl_proxy_set_tag _glfw.wl.client.proxy_set_tag
+93
#define wl_proxy_get_version _glfw.wl.client.proxy_get_version
+94
#define wl_proxy_marshal_flags _glfw.wl.client.proxy_marshal_flags
+95
#define wl_proxy_create_wrapper _glfw.wl.client.proxy_create_wrapper
+96
#define wl_proxy_wrapper_destroy _glfw.wl.client.proxy_wrapper_destroy
+97
#define wl_proxy_set_queue _glfw.wl.client.proxy_set_queue
+98
+99
struct wl_shm;
+100
struct wl_output;
+101
+102
#define wl_display_interface _glfw_wl_display_interface
+103
#define wl_subcompositor_interface _glfw_wl_subcompositor_interface
+104
#define wl_compositor_interface _glfw_wl_compositor_interface
+105
#define wl_shm_interface _glfw_wl_shm_interface
+106
#define wl_data_device_manager_interface _glfw_wl_data_device_manager_interface
+107
#define wl_shell_interface _glfw_wl_shell_interface
+108
#define wl_buffer_interface _glfw_wl_buffer_interface
+109
#define wl_callback_interface _glfw_wl_callback_interface
+110
#define wl_data_device_interface _glfw_wl_data_device_interface
+111
#define wl_data_offer_interface _glfw_wl_data_offer_interface
+112
#define wl_data_source_interface _glfw_wl_data_source_interface
+113
#define wl_keyboard_interface _glfw_wl_keyboard_interface
+114
#define wl_output_interface _glfw_wl_output_interface
+115
#define wl_pointer_interface _glfw_wl_pointer_interface
+116
#define wl_region_interface _glfw_wl_region_interface
+117
#define wl_registry_interface _glfw_wl_registry_interface
+118
#define wl_seat_interface _glfw_wl_seat_interface
+119
#define wl_shell_surface_interface _glfw_wl_shell_surface_interface
+120
#define wl_shm_pool_interface _glfw_wl_shm_pool_interface
+121
#define wl_subsurface_interface _glfw_wl_subsurface_interface
+122
#define wl_surface_interface _glfw_wl_surface_interface
+123
#define wl_touch_interface _glfw_wl_touch_interface
+124
#define zwp_idle_inhibitor_v1_interface _glfw_zwp_idle_inhibitor_v1_interface
+125
#define zwp_idle_inhibit_manager_v1_interface _glfw_zwp_idle_inhibit_manager_v1_interface
+126
#define zwp_confined_pointer_v1_interface _glfw_zwp_confined_pointer_v1_interface
+127
#define zwp_locked_pointer_v1_interface _glfw_zwp_locked_pointer_v1_interface
+128
#define zwp_pointer_constraints_v1_interface _glfw_zwp_pointer_constraints_v1_interface
+129
#define zwp_relative_pointer_v1_interface _glfw_zwp_relative_pointer_v1_interface
+130
#define zwp_relative_pointer_manager_v1_interface _glfw_zwp_relative_pointer_manager_v1_interface
+131
#define wp_viewport_interface _glfw_wp_viewport_interface
+132
#define wp_viewporter_interface _glfw_wp_viewporter_interface
+133
#define xdg_toplevel_interface _glfw_xdg_toplevel_interface
+134
#define zxdg_toplevel_decoration_v1_interface _glfw_zxdg_toplevel_decoration_v1_interface
+135
#define zxdg_decoration_manager_v1_interface _glfw_zxdg_decoration_manager_v1_interface
+136
#define xdg_popup_interface _glfw_xdg_popup_interface
+137
#define xdg_positioner_interface _glfw_xdg_positioner_interface
+138
#define xdg_surface_interface _glfw_xdg_surface_interface
+139
#define xdg_toplevel_interface _glfw_xdg_toplevel_interface
+140
#define xdg_wm_base_interface _glfw_xdg_wm_base_interface
+141
#define xdg_activation_v1_interface _glfw_xdg_activation_v1_interface
+142
#define xdg_activation_token_v1_interface _glfw_xdg_activation_token_v1_interface
+143
#define wl_surface_interface _glfw_wl_surface_interface
+144
#define wp_fractional_scale_v1_interface _glfw_wp_fractional_scale_v1_interface
+145
+146
#define GLFW_WAYLAND_WINDOW_STATE _GLFWwindowWayland wl;
+147
#define GLFW_WAYLAND_LIBRARY_WINDOW_STATE _GLFWlibraryWayland wl;
+148
#define GLFW_WAYLAND_MONITOR_STATE _GLFWmonitorWayland wl;
+149
#define GLFW_WAYLAND_CURSOR_STATE _GLFWcursorWayland wl;
+150
+151
struct wl_cursor_image
+152
{
+153
uint32_t width;
+154
uint32_t height;
+155
uint32_t hotspot_x;
+156
uint32_t hotspot_y;
+157
uint32_t delay;
+158
};
+159
+160
struct wl_cursor
+161
{
+162
unsigned int image_count;
+163
struct wl_cursor_image** images;
+164
char* name;
+165
};
+166
+167
typedef struct wl_cursor_theme* (* PFN_wl_cursor_theme_load)(const char*, int, struct wl_shm*);
+168
typedef void (* PFN_wl_cursor_theme_destroy)(struct wl_cursor_theme*);
+169
typedef struct wl_cursor* (* PFN_wl_cursor_theme_get_cursor)(struct wl_cursor_theme*, const char*);
+170
typedef struct wl_buffer* (* PFN_wl_cursor_image_get_buffer)(struct wl_cursor_image*);
+171
#define wl_cursor_theme_load _glfw.wl.cursor.theme_load
+172
#define wl_cursor_theme_destroy _glfw.wl.cursor.theme_destroy
+173
#define wl_cursor_theme_get_cursor _glfw.wl.cursor.theme_get_cursor
+174
#define wl_cursor_image_get_buffer _glfw.wl.cursor.image_get_buffer
+175
+176
typedef struct wl_egl_window* (* PFN_wl_egl_window_create)(struct wl_surface*, int, int);
+177
typedef void (* PFN_wl_egl_window_destroy)(struct wl_egl_window*);
+178
typedef void (* PFN_wl_egl_window_resize)(struct wl_egl_window*, int, int, int, int);
+179
#define wl_egl_window_create _glfw.wl.egl.window_create
+180
#define wl_egl_window_destroy _glfw.wl.egl.window_destroy
+181
#define wl_egl_window_resize _glfw.wl.egl.window_resize
+182
+183
typedef struct xkb_context* (* PFN_xkb_context_new)(enum xkb_context_flags);
+184
typedef void (* PFN_xkb_context_unref)(struct xkb_context*);
+185
typedef struct xkb_keymap* (* PFN_xkb_keymap_new_from_string)(struct xkb_context*, const char*, enum xkb_keymap_format, enum xkb_keymap_compile_flags);
+186
typedef void (* PFN_xkb_keymap_unref)(struct xkb_keymap*);
+187
typedef xkb_mod_index_t (* PFN_xkb_keymap_mod_get_index)(struct xkb_keymap*, const char*);
+188
typedef int (* PFN_xkb_keymap_key_repeats)(struct xkb_keymap*, xkb_keycode_t);
+189
typedef 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**);
+190
typedef struct xkb_state* (* PFN_xkb_state_new)(struct xkb_keymap*);
+191
typedef void (* PFN_xkb_state_unref)(struct xkb_state*);
+192
typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, const xkb_keysym_t**);
+193
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);
+194
typedef xkb_layout_index_t (* PFN_xkb_state_key_get_layout)(struct xkb_state*,xkb_keycode_t);
+195
typedef int (* PFN_xkb_state_mod_index_is_active)(struct xkb_state*,xkb_mod_index_t,enum xkb_state_component);
+196
typedef uint32_t (* PFN_xkb_keysym_to_utf32)(xkb_keysym_t);
+197
typedef int (* PFN_xkb_keysym_to_utf8)(xkb_keysym_t, char*, size_t);
+198
#define xkb_context_new _glfw.wl.xkb.context_new
+199
#define xkb_context_unref _glfw.wl.xkb.context_unref
+200
#define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string
+201
#define xkb_keymap_unref _glfw.wl.xkb.keymap_unref
+202
#define xkb_keymap_mod_get_index _glfw.wl.xkb.keymap_mod_get_index
+203
#define xkb_keymap_key_repeats _glfw.wl.xkb.keymap_key_repeats
+204
#define xkb_keymap_key_get_syms_by_level _glfw.wl.xkb.keymap_key_get_syms_by_level
+205
#define xkb_state_new _glfw.wl.xkb.state_new
+206
#define xkb_state_unref _glfw.wl.xkb.state_unref
+207
#define xkb_state_key_get_syms _glfw.wl.xkb.state_key_get_syms
+208
#define xkb_state_update_mask _glfw.wl.xkb.state_update_mask
+209
#define xkb_state_key_get_layout _glfw.wl.xkb.state_key_get_layout
+210
#define xkb_state_mod_index_is_active _glfw.wl.xkb.state_mod_index_is_active
+211
#define xkb_keysym_to_utf32 _glfw.wl.xkb.keysym_to_utf32
+212
#define xkb_keysym_to_utf8 _glfw.wl.xkb.keysym_to_utf8
+213
+214
typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags);
+215
typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*);
+216
typedef struct xkb_compose_state* (* PFN_xkb_compose_state_new)(struct xkb_compose_table*, enum xkb_compose_state_flags);
+217
typedef void (* PFN_xkb_compose_state_unref)(struct xkb_compose_state*);
+218
typedef enum xkb_compose_feed_result (* PFN_xkb_compose_state_feed)(struct xkb_compose_state*, xkb_keysym_t);
+219
typedef enum xkb_compose_status (* PFN_xkb_compose_state_get_status)(struct xkb_compose_state*);
+220
typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_state*);
+221
#define xkb_compose_table_new_from_locale _glfw.wl.xkb.compose_table_new_from_locale
+222
#define xkb_compose_table_unref _glfw.wl.xkb.compose_table_unref
+223
#define xkb_compose_state_new _glfw.wl.xkb.compose_state_new
+224
#define xkb_compose_state_unref _glfw.wl.xkb.compose_state_unref
+225
#define xkb_compose_state_feed _glfw.wl.xkb.compose_state_feed
+226
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
+227
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
+228
+229
struct libdecor;
+230
struct libdecor_frame;
+231
struct libdecor_state;
+232
struct libdecor_configuration;
+233
+234
enum libdecor_error
+235
{
+236
LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE,
+237
LIBDECOR_ERROR_INVALID_FRAME_CONFIGURATION,
+238
};
+239
+240
enum libdecor_window_state
+241
{
+242
LIBDECOR_WINDOW_STATE_NONE = 0,
+243
LIBDECOR_WINDOW_STATE_ACTIVE = 1,
+244
LIBDECOR_WINDOW_STATE_MAXIMIZED = 2,
+245
LIBDECOR_WINDOW_STATE_FULLSCREEN = 4,
+246
LIBDECOR_WINDOW_STATE_TILED_LEFT = 8,
+247
LIBDECOR_WINDOW_STATE_TILED_RIGHT = 16,
+248
LIBDECOR_WINDOW_STATE_TILED_TOP = 32,
+249
LIBDECOR_WINDOW_STATE_TILED_BOTTOM = 64
+250
};
+251
+252
enum libdecor_capabilities
+253
{
+254
LIBDECOR_ACTION_MOVE = 1,
+255
LIBDECOR_ACTION_RESIZE = 2,
+256
LIBDECOR_ACTION_MINIMIZE = 4,
+257
LIBDECOR_ACTION_FULLSCREEN = 8,
+258
LIBDECOR_ACTION_CLOSE = 16
+259
};
+260
+261
struct libdecor_interface
+262
{
+263
void (* error)(struct libdecor*,enum libdecor_error,const char*);
+264
void (* reserved0)(void);
+265
void (* reserved1)(void);
+266
void (* reserved2)(void);
+267
void (* reserved3)(void);
+268
void (* reserved4)(void);
+269
void (* reserved5)(void);
+270
void (* reserved6)(void);
+271
void (* reserved7)(void);
+272
void (* reserved8)(void);
+273
void (* reserved9)(void);
+274
};
+275
+276
struct libdecor_frame_interface
+277
{
+278
void (* configure)(struct libdecor_frame*,struct libdecor_configuration*,void*);
+279
void (* close)(struct libdecor_frame*,void*);
+280
void (* commit)(struct libdecor_frame*,void*);
+281
void (* dismiss_popup)(struct libdecor_frame*,const char*,void*);
+282
void (* reserved0)(void);
+283
void (* reserved1)(void);
+284
void (* reserved2)(void);
+285
void (* reserved3)(void);
+286
void (* reserved4)(void);
+287
void (* reserved5)(void);
+288
void (* reserved6)(void);
+289
void (* reserved7)(void);
+290
void (* reserved8)(void);
+291
void (* reserved9)(void);
+292
};
+293
+294
typedef struct libdecor* (* PFN_libdecor_new)(struct wl_display*,const struct libdecor_interface*);
+295
typedef void (* PFN_libdecor_unref)(struct libdecor*);
+296
typedef int (* PFN_libdecor_get_fd)(struct libdecor*);
+297
typedef int (* PFN_libdecor_dispatch)(struct libdecor*,int);
+298
typedef struct libdecor_frame* (* PFN_libdecor_decorate)(struct libdecor*,struct wl_surface*,const struct libdecor_frame_interface*,void*);
+299
typedef void (* PFN_libdecor_frame_unref)(struct libdecor_frame*);
+300
typedef void (* PFN_libdecor_frame_set_app_id)(struct libdecor_frame*,const char*);
+301
typedef void (* PFN_libdecor_frame_set_title)(struct libdecor_frame*,const char*);
+302
typedef void (* PFN_libdecor_frame_set_minimized)(struct libdecor_frame*);
+303
typedef void (* PFN_libdecor_frame_set_fullscreen)(struct libdecor_frame*,struct wl_output*);
+304
typedef void (* PFN_libdecor_frame_unset_fullscreen)(struct libdecor_frame*);
+305
typedef void (* PFN_libdecor_frame_map)(struct libdecor_frame*);
+306
typedef void (* PFN_libdecor_frame_commit)(struct libdecor_frame*,struct libdecor_state*,struct libdecor_configuration*);
+307
typedef void (* PFN_libdecor_frame_set_min_content_size)(struct libdecor_frame*,int,int);
+308
typedef void (* PFN_libdecor_frame_set_max_content_size)(struct libdecor_frame*,int,int);
+309
typedef void (* PFN_libdecor_frame_set_maximized)(struct libdecor_frame*);
+310
typedef void (* PFN_libdecor_frame_unset_maximized)(struct libdecor_frame*);
+311
typedef void (* PFN_libdecor_frame_set_capabilities)(struct libdecor_frame*,enum libdecor_capabilities);
+312
typedef void (* PFN_libdecor_frame_unset_capabilities)(struct libdecor_frame*,enum libdecor_capabilities);
+313
typedef void (* PFN_libdecor_frame_set_visibility)(struct libdecor_frame*,bool visible);
+314
typedef bool (* PFN_libdecor_frame_is_visible)(struct libdecor_frame*);
+315
typedef struct xdg_toplevel* (* PFN_libdecor_frame_get_xdg_toplevel)(struct libdecor_frame*);
+316
typedef bool (* PFN_libdecor_configuration_get_content_size)(struct libdecor_configuration*,struct libdecor_frame*,int*,int*);
+317
typedef bool (* PFN_libdecor_configuration_get_window_state)(struct libdecor_configuration*,enum libdecor_window_state*);
+318
typedef struct libdecor_state* (* PFN_libdecor_state_new)(int,int);
+319
typedef void (* PFN_libdecor_state_free)(struct libdecor_state*);
+320
#define libdecor_new _glfw.wl.libdecor.libdecor_new_
+321
#define libdecor_unref _glfw.wl.libdecor.libdecor_unref_
+322
#define libdecor_get_fd _glfw.wl.libdecor.libdecor_get_fd_
+323
#define libdecor_dispatch _glfw.wl.libdecor.libdecor_dispatch_
+324
#define libdecor_decorate _glfw.wl.libdecor.libdecor_decorate_
+325
#define libdecor_frame_unref _glfw.wl.libdecor.libdecor_frame_unref_
+326
#define libdecor_frame_set_app_id _glfw.wl.libdecor.libdecor_frame_set_app_id_
+327
#define libdecor_frame_set_title _glfw.wl.libdecor.libdecor_frame_set_title_
+328
#define libdecor_frame_set_minimized _glfw.wl.libdecor.libdecor_frame_set_minimized_
+329
#define libdecor_frame_set_fullscreen _glfw.wl.libdecor.libdecor_frame_set_fullscreen_
+330
#define libdecor_frame_unset_fullscreen _glfw.wl.libdecor.libdecor_frame_unset_fullscreen_
+331
#define libdecor_frame_map _glfw.wl.libdecor.libdecor_frame_map_
+332
#define libdecor_frame_commit _glfw.wl.libdecor.libdecor_frame_commit_
+333
#define libdecor_frame_set_min_content_size _glfw.wl.libdecor.libdecor_frame_set_min_content_size_
+334
#define libdecor_frame_set_max_content_size _glfw.wl.libdecor.libdecor_frame_set_max_content_size_
+335
#define libdecor_frame_set_maximized _glfw.wl.libdecor.libdecor_frame_set_maximized_
+336
#define libdecor_frame_unset_maximized _glfw.wl.libdecor.libdecor_frame_unset_maximized_
+337
#define libdecor_frame_set_capabilities _glfw.wl.libdecor.libdecor_frame_set_capabilities_
+338
#define libdecor_frame_unset_capabilities _glfw.wl.libdecor.libdecor_frame_unset_capabilities_
+339
#define libdecor_frame_set_visibility _glfw.wl.libdecor.libdecor_frame_set_visibility_
+340
#define libdecor_frame_is_visible _glfw.wl.libdecor.libdecor_frame_is_visible_
+341
#define libdecor_frame_get_xdg_toplevel _glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_
+342
#define libdecor_configuration_get_content_size _glfw.wl.libdecor.libdecor_configuration_get_content_size_
+343
#define libdecor_configuration_get_window_state _glfw.wl.libdecor.libdecor_configuration_get_window_state_
+344
#define libdecor_state_new _glfw.wl.libdecor.libdecor_state_new_
+345
#define libdecor_state_free _glfw.wl.libdecor.libdecor_state_free_
+346
+347
typedef struct _GLFWfallbackEdgeWayland
+348
{
+349
struct wl_surface* surface;
+350
struct wl_subsurface* subsurface;
+351
struct wp_viewport* viewport;
+352
} _GLFWfallbackEdgeWayland;
+353
+354
typedef struct _GLFWofferWayland
+355
{
+356
struct wl_data_offer* offer;
+357
GLFWbool text_plain_utf8;
+358
GLFWbool text_uri_list;
+359
} _GLFWofferWayland;
+360
+361
typedef struct _GLFWscaleWayland
+362
{
+363
struct wl_output* output;
+364
int32_t factor;
+365
} _GLFWscaleWayland;
+366
+367
// Wayland-specific per-window data
+368
//
+369
typedef struct _GLFWwindowWayland
+370
{
+371
int width, height;
+372
int fbWidth, fbHeight;
+373
GLFWbool visible;
+374
GLFWbool maximized;
+375
GLFWbool activated;
+376
GLFWbool fullscreen;
+377
GLFWbool transparent;
+378
GLFWbool scaleFramebuffer;
+379
struct wl_surface* surface;
+380
+381
struct {
+382
struct wl_event_queue* queue;
+383
struct wl_egl_window* window;
+384
struct wl_callback* callback;
+385
struct wl_surface* wrapper;
+386
int interval;
+387
} egl;
+388
+389
struct {
+390
int width, height;
+391
GLFWbool maximized;
+392
GLFWbool iconified;
+393
GLFWbool activated;
+394
GLFWbool fullscreen;
+395
} pending;
+396
+397
struct {
+398
struct xdg_surface* surface;
+399
struct xdg_toplevel* toplevel;
+400
struct zxdg_toplevel_decoration_v1* decoration;
+401
uint32_t decorationMode;
+402
} xdg;
+403
+404
struct {
+405
struct libdecor_frame* frame;
+406
} libdecor;
+407
+408
double cursorPosX, cursorPosY;
+409
+410
char* appId;
+411
+412
// We need to track the monitors the window spans on to calculate the
+413
// optimal scaling factor.
+414
int32_t bufferScale;
+415
_GLFWscaleWayland* outputScales;
+416
size_t outputScaleCount;
+417
size_t outputScaleSize;
+418
+419
struct wp_viewport* scalingViewport;
+420
uint32_t scalingNumerator;
+421
struct wp_fractional_scale_v1* fractionalScale;
+422
+423
struct zwp_relative_pointer_v1* relativePointer;
+424
struct zwp_locked_pointer_v1* lockedPointer;
+425
struct zwp_confined_pointer_v1* confinedPointer;
+426
+427
struct zwp_idle_inhibitor_v1* idleInhibitor;
+428
struct xdg_activation_token_v1* activationToken;
+429
+430
struct {
+431
GLFWbool decorations;
+432
struct wl_buffer* buffer;
+433
_GLFWfallbackEdgeWayland top, left, right, bottom;
+434
double pointerX, pointerY;
+435
uint32_t buttonPressSerial;
+436
const char* cursorName;
+437
} fallback;
+438
} _GLFWwindowWayland;
+439
+440
// Wayland-specific global data
+441
//
+442
typedef struct _GLFWlibraryWayland
+443
{
+444
struct wl_display* display;
+445
struct wl_registry* registry;
+446
struct wl_compositor* compositor;
+447
struct wl_subcompositor* subcompositor;
+448
struct wl_shm* shm;
+449
struct wl_seat* seat;
+450
struct wl_pointer* pointer;
+451
struct wl_keyboard* keyboard;
+452
struct wl_data_device_manager* dataDeviceManager;
+453
struct wl_data_device* dataDevice;
+454
struct xdg_wm_base* wmBase;
+455
struct zxdg_decoration_manager_v1* decorationManager;
+456
struct wp_viewporter* viewporter;
+457
struct zwp_relative_pointer_manager_v1* relativePointerManager;
+458
struct zwp_pointer_constraints_v1* pointerConstraints;
+459
struct zwp_idle_inhibit_manager_v1* idleInhibitManager;
+460
struct xdg_activation_v1* activationManager;
+461
struct wp_fractional_scale_manager_v1* fractionalScaleManager;
+462
+463
_GLFWofferWayland* offers;
+464
unsigned int offerCount;
+465
+466
struct wl_data_offer* selectionOffer;
+467
struct wl_data_source* selectionSource;
+468
+469
struct wl_data_offer* dragOffer;
+470
_GLFWwindow* dragFocus;
+471
uint32_t dragSerial;
+472
+473
const char* tag;
+474
+475
struct wl_surface* pointerSurface;
+476
struct wl_cursor_theme* cursorTheme;
+477
struct wl_cursor_theme* cursorThemeHiDPI;
+478
struct wl_surface* cursorSurface;
+479
int cursorTimerfd;
+480
uint32_t serial;
+481
uint32_t pointerEnterSerial;
+482
+483
int keyRepeatTimerfd;
+484
int32_t keyRepeatRate;
+485
int32_t keyRepeatDelay;
+486
int keyRepeatScancode;
+487
+488
char* clipboardString;
+489
short int keycodes[256];
+490
short int scancodes[GLFW_KEY_LAST + 1];
+491
char keynames[GLFW_KEY_LAST + 1][5];
+492
+493
struct {
+494
struct wl_surface* pointerSurface;
+495
unsigned int events;
+496
double pointerX;
+497
double pointerY;
+498
double scrollX;
+499
double scrollY;

Showing the first 500 of 737 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/wl_window.cadded
@@ -0,0 +1,3620 @@
+1
//========================================================================
+2
// GLFW 3.5 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
#if !defined(_GNU_SOURCE)
+28
#define _GNU_SOURCE
+29
#endif
+30
+31
#include "internal.h"
+32
+33
#if defined(_GLFW_WAYLAND)
+34
+35
#include <stdio.h>
+36
#include <stdlib.h>
+37
#include <errno.h>
+38
#include <assert.h>
+39
#include <unistd.h>
+40
#include <string.h>
+41
#include <fcntl.h>
+42
#include <sys/mman.h>
+43
#include <sys/timerfd.h>
+44
#include <poll.h>
+45
#include <linux/input-event-codes.h>
+46
+47
#include "wayland-client-protocol.h"
+48
#include "xdg-shell-client-protocol.h"
+49
#include "xdg-decoration-unstable-v1-client-protocol.h"
+50
#include "viewporter-client-protocol.h"
+51
#include "relative-pointer-unstable-v1-client-protocol.h"
+52
#include "pointer-constraints-unstable-v1-client-protocol.h"
+53
#include "xdg-activation-v1-client-protocol.h"
+54
#include "idle-inhibit-unstable-v1-client-protocol.h"
+55
#include "fractional-scale-v1-client-protocol.h"
+56
+57
#define GLFW_BORDER_SIZE 4
+58
#define GLFW_CAPTION_HEIGHT 24
+59
+60
#define GLFW_PENDING_SURFACE 1
+61
#define GLFW_PENDING_BUTTON 2
+62
#define GLFW_PENDING_MOTION 4
+63
#define GLFW_PENDING_SCROLL 8
+64
#define GLFW_PENDING_DISCRETE 16
+65
+66
static int createTmpfileCloexec(char* tmpname)
+67
{
+68
int fd;
+69
+70
fd = mkostemp(tmpname, O_CLOEXEC);
+71
if (fd >= 0)
+72
unlink(tmpname);
+73
+74
return fd;
+75
}
+76
+77
/*
+78
* Create a new, unique, anonymous file of the given size, and
+79
* return the file descriptor for it. The file descriptor is set
+80
* CLOEXEC. The file is immediately suitable for mmap()'ing
+81
* the given size at offset zero.
+82
*
+83
* The file should not have a permanent backing store like a disk,
+84
* but may have if XDG_RUNTIME_DIR is not properly implemented in OS.
+85
*
+86
* The file name is deleted from the file system.
+87
*
+88
* The file is suitable for buffer sharing between processes by
+89
* transmitting the file descriptor over Unix sockets using the
+90
* SCM_RIGHTS methods.
+91
*
+92
* posix_fallocate() is used to guarantee that disk space is available
+93
* for the file at the given size. If disk space is insufficient, errno
+94
* is set to ENOSPC. If posix_fallocate() is not supported, program may
+95
* receive SIGBUS on accessing mmap()'ed file contents instead.
+96
*/
+97
static int createAnonymousFile(off_t size)
+98
{
+99
static const char template[] = "/glfw-shared-XXXXXX";
+100
const char* path;
+101
char* name;
+102
int fd;
+103
int ret;
+104
+105
#ifdef HAVE_MEMFD_CREATE
+106
fd = memfd_create("glfw-shared", MFD_CLOEXEC | MFD_ALLOW_SEALING);
+107
if (fd >= 0)
+108
{
+109
// We can add this seal before calling posix_fallocate(), as the file
+110
// is currently zero-sized anyway.
+111
//
+112
// There is also no need to check for the return value, we couldn’t do
+113
// anything with it anyway.
+114
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
+115
}
+116
else
+117
#elif defined(SHM_ANON)
+118
fd = shm_open(SHM_ANON, O_RDWR | O_CLOEXEC, 0600);
+119
if (fd < 0)
+120
#endif
+121
{
+122
path = getenv("XDG_RUNTIME_DIR");
+123
if (!path)
+124
{
+125
errno = ENOENT;
+126
return -1;
+127
}
+128
+129
name = _glfw_calloc(strlen(path) + sizeof(template), 1);
+130
strcpy(name, path);
+131
strcat(name, template);
+132
+133
fd = createTmpfileCloexec(name);
+134
_glfw_free(name);
+135
if (fd < 0)
+136
return -1;
+137
}
+138
+139
#if defined(SHM_ANON)
+140
// posix_fallocate does not work on SHM descriptors
+141
ret = ftruncate(fd, size);
+142
#else
+143
ret = posix_fallocate(fd, 0, size);
+144
#endif
+145
if (ret != 0)
+146
{
+147
close(fd);
+148
errno = ret;
+149
return -1;
+150
}
+151
return fd;
+152
}
+153
+154
static struct wl_buffer* createShmBuffer(const GLFWimage* image)
+155
{
+156
const int stride = image->width * 4;
+157
const int length = image->width * image->height * 4;
+158
+159
const int fd = createAnonymousFile(length);
+160
if (fd < 0)
+161
{
+162
_glfwInputError(GLFW_PLATFORM_ERROR,
+163
"Wayland: Failed to create buffer file of size %d: %s",
+164
length, strerror(errno));
+165
return NULL;
+166
}
+167
+168
void* data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+169
if (data == MAP_FAILED)
+170
{
+171
_glfwInputError(GLFW_PLATFORM_ERROR,
+172
"Wayland: Failed to map file: %s", strerror(errno));
+173
close(fd);
+174
return NULL;
+175
}
+176
+177
struct wl_shm_pool* pool = wl_shm_create_pool(_glfw.wl.shm, fd, length);
+178
+179
close(fd);
+180
+181
unsigned char* source = (unsigned char*) image->pixels;
+182
unsigned char* target = data;
+183
for (int i = 0; i < image->width * image->height; i++, source += 4)
+184
{
+185
unsigned int alpha = source[3];
+186
+187
*target++ = (unsigned char) ((source[2] * alpha) / 255);
+188
*target++ = (unsigned char) ((source[1] * alpha) / 255);
+189
*target++ = (unsigned char) ((source[0] * alpha) / 255);
+190
*target++ = (unsigned char) alpha;
+191
}
+192
+193
struct wl_buffer* buffer =
+194
wl_shm_pool_create_buffer(pool, 0,
+195
image->width,
+196
image->height,
+197
stride, WL_SHM_FORMAT_ARGB8888);
+198
munmap(data, length);
+199
wl_shm_pool_destroy(pool);
+200
+201
return buffer;
+202
}
+203
+204
static void callbackHandleDone(void* userData, struct wl_callback* callback, uint32_t data)
+205
{
+206
wl_callback_destroy(callback);
+207
}
+208
+209
static const struct wl_callback_listener noopCallbackListener =
+210
{
+211
callbackHandleDone
+212
};
+213
+214
static void createFallbackEdge(_GLFWwindow* window,
+215
_GLFWfallbackEdgeWayland* edge,
+216
struct wl_surface* parent,
+217
struct wl_buffer* buffer,
+218
int x, int y,
+219
int width, int height)
+220
{
+221
edge->surface = wl_compositor_create_surface(_glfw.wl.compositor);
+222
wl_surface_set_user_data(edge->surface, window);
+223
wl_proxy_set_tag((struct wl_proxy*) edge->surface, &_glfw.wl.tag);
+224
edge->subsurface = wl_subcompositor_get_subsurface(_glfw.wl.subcompositor,
+225
edge->surface, parent);
+226
wl_subsurface_set_position(edge->subsurface, x, y);
+227
edge->viewport = wp_viewporter_get_viewport(_glfw.wl.viewporter,
+228
edge->surface);
+229
wp_viewport_set_destination(edge->viewport, width, height);
+230
wl_surface_attach(edge->surface, buffer, 0, 0);
+231
+232
struct wl_region* region = wl_compositor_create_region(_glfw.wl.compositor);
+233
wl_region_add(region, 0, 0, width, height);
+234
wl_surface_set_opaque_region(edge->surface, region);
+235
wl_surface_commit(edge->surface);
+236
wl_region_destroy(region);
+237
}
+238
+239
static void createFallbackDecorations(_GLFWwindow* window)
+240
{
+241
unsigned char data[] = { 224, 224, 224, 255 };
+242
const GLFWimage image = { 1, 1, data };
+243
+244
if (!_glfw.wl.viewporter)
+245
return;
+246
+247
if (!window->wl.fallback.buffer)
+248
window->wl.fallback.buffer = createShmBuffer(&image);
+249
if (!window->wl.fallback.buffer)
+250
return;
+251
+252
createFallbackEdge(window, &window->wl.fallback.top, window->wl.surface,
+253
window->wl.fallback.buffer,
+254
0, -GLFW_CAPTION_HEIGHT,
+255
window->wl.width, GLFW_CAPTION_HEIGHT);
+256
createFallbackEdge(window, &window->wl.fallback.left, window->wl.surface,
+257
window->wl.fallback.buffer,
+258
-GLFW_BORDER_SIZE, -GLFW_CAPTION_HEIGHT,
+259
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
+260
createFallbackEdge(window, &window->wl.fallback.right, window->wl.surface,
+261
window->wl.fallback.buffer,
+262
window->wl.width, -GLFW_CAPTION_HEIGHT,
+263
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
+264
createFallbackEdge(window, &window->wl.fallback.bottom, window->wl.surface,
+265
window->wl.fallback.buffer,
+266
-GLFW_BORDER_SIZE, window->wl.height,
+267
window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE);
+268
+269
window->wl.fallback.decorations = GLFW_TRUE;
+270
}
+271
+272
static void destroyFallbackEdge(_GLFWfallbackEdgeWayland* edge)
+273
{
+274
if (edge->surface == _glfw.wl.pointerSurface)
+275
_glfw.wl.pointerSurface = NULL;
+276
+277
if (edge->subsurface)
+278
wl_subsurface_destroy(edge->subsurface);
+279
if (edge->surface)
+280
wl_surface_destroy(edge->surface);
+281
if (edge->viewport)
+282
wp_viewport_destroy(edge->viewport);
+283
+284
edge->surface = NULL;
+285
edge->subsurface = NULL;
+286
edge->viewport = NULL;
+287
}
+288
+289
static void destroyFallbackDecorations(_GLFWwindow* window)
+290
{
+291
window->wl.fallback.decorations = GLFW_FALSE;
+292
+293
destroyFallbackEdge(&window->wl.fallback.top);
+294
destroyFallbackEdge(&window->wl.fallback.left);
+295
destroyFallbackEdge(&window->wl.fallback.right);
+296
destroyFallbackEdge(&window->wl.fallback.bottom);
+297
}
+298
+299
static void updateFallbackDecorationCursor(_GLFWwindow* window, double xpos, double ypos)
+300
{
+301
window->wl.fallback.pointerX = xpos;
+302
window->wl.fallback.pointerY = ypos;
+303
+304
const char* cursorName = "left_ptr";
+305
+306
if (window->resizable)
+307
{
+308
if (_glfw.wl.pointerSurface == window->wl.fallback.top.surface)
+309
{
+310
if (ypos < GLFW_BORDER_SIZE)
+311
cursorName = "n-resize";
+312
}
+313
else if (_glfw.wl.pointerSurface == window->wl.fallback.left.surface)
+314
{
+315
if (ypos < GLFW_BORDER_SIZE)
+316
cursorName = "nw-resize";
+317
else
+318
cursorName = "w-resize";
+319
}
+320
else if (_glfw.wl.pointerSurface == window->wl.fallback.right.surface)
+321
{
+322
if (ypos < GLFW_BORDER_SIZE)
+323
cursorName = "ne-resize";
+324
else
+325
cursorName = "e-resize";
+326
}
+327
else if (_glfw.wl.pointerSurface == window->wl.fallback.bottom.surface)
+328
{
+329
if (xpos < GLFW_BORDER_SIZE)
+330
cursorName = "sw-resize";
+331
else if (xpos > window->wl.width + GLFW_BORDER_SIZE)
+332
cursorName = "se-resize";
+333
else
+334
cursorName = "s-resize";
+335
}
+336
}
+337
+338
if (window->wl.fallback.cursorName != cursorName)
+339
{
+340
struct wl_surface* surface = _glfw.wl.cursorSurface;
+341
struct wl_cursor_theme* theme = _glfw.wl.cursorTheme;
+342
int scale = 1;
+343
+344
if (window->wl.bufferScale > 1 && _glfw.wl.cursorThemeHiDPI)
+345
{
+346
// We only support up to scale=2 for now, since libwayland-cursor
+347
// requires us to load a different theme for each size.
+348
scale = 2;
+349
theme = _glfw.wl.cursorThemeHiDPI;
+350
}
+351
+352
struct wl_cursor* cursor = wl_cursor_theme_get_cursor(theme, cursorName);
+353
if (!cursor)
+354
return;
+355
+356
// TODO: handle animated cursors too.
+357
struct wl_cursor_image* image = cursor->images[0];
+358
if (!image)
+359
return;
+360
+361
struct wl_buffer* buffer = wl_cursor_image_get_buffer(image);
+362
if (!buffer)
+363
return;
+364
+365
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
+366
surface,
+367
image->hotspot_x / scale,
+368
image->hotspot_y / scale);
+369
wl_surface_set_buffer_scale(surface, scale);
+370
wl_surface_attach(surface, buffer, 0, 0);
+371
wl_surface_damage(surface, 0, 0, image->width, image->height);
+372
wl_surface_commit(surface);
+373
+374
window->wl.fallback.cursorName = cursorName;
+375
}
+376
}
+377
+378
static void handleFallbackDecorationButton(_GLFWwindow* window, int button, int action)
+379
{
+380
if (action != GLFW_PRESS)
+381
return;
+382
+383
const double xpos = window->wl.fallback.pointerX;
+384
const double ypos = window->wl.fallback.pointerY;
+385
const uint32_t serial = window->wl.fallback.buttonPressSerial;
+386
+387
if (button == GLFW_MOUSE_BUTTON_LEFT)
+388
{
+389
uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE;
+390
+391
if (_glfw.wl.pointerSurface == window->wl.fallback.top.surface)
+392
{
+393
if (ypos < GLFW_BORDER_SIZE)
+394
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP;
+395
else
+396
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
+397
}
+398
else if (_glfw.wl.pointerSurface == window->wl.fallback.left.surface)
+399
{
+400
if (ypos < GLFW_BORDER_SIZE)
+401
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT;
+402
else
+403
edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT;
+404
}
+405
else if (_glfw.wl.pointerSurface == window->wl.fallback.right.surface)
+406
{
+407
if (ypos < GLFW_BORDER_SIZE)
+408
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT;
+409
else
+410
edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT;
+411
}
+412
else if (_glfw.wl.pointerSurface == window->wl.fallback.bottom.surface)
+413
{
+414
if (xpos < GLFW_BORDER_SIZE)
+415
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
+416
else if (xpos > window->wl.width + GLFW_BORDER_SIZE)
+417
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
+418
else
+419
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM;
+420
}
+421
+422
if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE)
+423
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat, serial, edges);
+424
}
+425
else if (button == GLFW_MOUSE_BUTTON_RIGHT)
+426
{
+427
if (!window->wl.xdg.toplevel)
+428
return;
+429
+430
if (_glfw.wl.pointerSurface != window->wl.fallback.top.surface)
+431
return;
+432
+433
if (ypos < GLFW_BORDER_SIZE)
+434
return;
+435
+436
xdg_toplevel_show_window_menu(window->wl.xdg.toplevel, _glfw.wl.seat, serial,
+437
xpos, ypos - GLFW_CAPTION_HEIGHT - GLFW_BORDER_SIZE);
+438
}
+439
}
+440
+441
static void xdgDecorationHandleConfigure(void* userData,
+442
struct zxdg_toplevel_decoration_v1* decoration,
+443
uint32_t mode)
+444
{
+445
_GLFWwindow* window = userData;
+446
+447
window->wl.xdg.decorationMode = mode;
+448
+449
if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE)
+450
{
+451
if (window->decorated && !window->monitor)
+452
createFallbackDecorations(window);
+453
}
+454
else
+455
destroyFallbackDecorations(window);
+456
}
+457
+458
static const struct zxdg_toplevel_decoration_v1_listener xdgDecorationListener =
+459
{
+460
xdgDecorationHandleConfigure,
+461
};
+462
+463
// Makes the surface considered as XRGB instead of ARGB.
+464
static void setContentAreaOpaque(_GLFWwindow* window)
+465
{
+466
struct wl_region* region;
+467
+468
region = wl_compositor_create_region(_glfw.wl.compositor);
+469
if (!region)
+470
return;
+471
+472
wl_region_add(region, 0, 0, window->wl.width, window->wl.height);
+473
wl_surface_set_opaque_region(window->wl.surface, region);
+474
wl_region_destroy(region);
+475
}
+476
+477
static void resizeFramebuffer(_GLFWwindow* window)
+478
{
+479
if (window->wl.fractionalScale)
+480
{
+481
// Round halfway away from zero per fractional-scale-v1 protocol spec
+482
window->wl.fbWidth = (window->wl.width * window->wl.scalingNumerator + 60) / 120;
+483
window->wl.fbHeight = (window->wl.height * window->wl.scalingNumerator + 60) / 120;
+484
}
+485
else
+486
{
+487
window->wl.fbWidth = window->wl.width * window->wl.bufferScale;
+488
window->wl.fbHeight = window->wl.height * window->wl.bufferScale;
+489
}
+490
+491
if (window->wl.egl.window)
+492
{
+493
wl_egl_window_resize(window->wl.egl.window,
+494
window->wl.fbWidth,
+495
window->wl.fbHeight,
+496
0, 0);
+497
}
+498
+499
if (!window->wl.transparent)

Showing the first 500 of 3621 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/x11_init.cadded
@@ -0,0 +1,1621 @@
+1
//========================================================================
+2
// GLFW 3.5 X11 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_X11)
+31
+32
#include <stdlib.h>
+33
#include <string.h>
+34
#include <limits.h>
+35
#include <stdio.h>
+36
#include <locale.h>
+37
#include <unistd.h>
+38
#include <fcntl.h>
+39
#include <errno.h>
+40
#include <assert.h>
+41
+42
+43
// Translate the X11 KeySyms for a key to a GLFW key code
+44
// NOTE: This is only used as a fallback, in case the XKB method fails
+45
// It is layout-dependent and will fail partially on most non-US layouts
+46
//
+47
static int translateKeySyms(const KeySym* keysyms, int width)
+48
{
+49
if (width > 1)
+50
{
+51
switch (keysyms[1])
+52
{
+53
case XK_KP_0: return GLFW_KEY_KP_0;
+54
case XK_KP_1: return GLFW_KEY_KP_1;
+55
case XK_KP_2: return GLFW_KEY_KP_2;
+56
case XK_KP_3: return GLFW_KEY_KP_3;
+57
case XK_KP_4: return GLFW_KEY_KP_4;
+58
case XK_KP_5: return GLFW_KEY_KP_5;
+59
case XK_KP_6: return GLFW_KEY_KP_6;
+60
case XK_KP_7: return GLFW_KEY_KP_7;
+61
case XK_KP_8: return GLFW_KEY_KP_8;
+62
case XK_KP_9: return GLFW_KEY_KP_9;
+63
case XK_KP_Separator:
+64
case XK_KP_Decimal: return GLFW_KEY_KP_DECIMAL;
+65
case XK_KP_Equal: return GLFW_KEY_KP_EQUAL;
+66
case XK_KP_Enter: return GLFW_KEY_KP_ENTER;
+67
default: break;
+68
}
+69
}
+70
+71
switch (keysyms[0])
+72
{
+73
case XK_Escape: return GLFW_KEY_ESCAPE;
+74
case XK_Tab: return GLFW_KEY_TAB;
+75
case XK_Shift_L: return GLFW_KEY_LEFT_SHIFT;
+76
case XK_Shift_R: return GLFW_KEY_RIGHT_SHIFT;
+77
case XK_Control_L: return GLFW_KEY_LEFT_CONTROL;
+78
case XK_Control_R: return GLFW_KEY_RIGHT_CONTROL;
+79
case XK_Meta_L:
+80
case XK_Alt_L: return GLFW_KEY_LEFT_ALT;
+81
case XK_Mode_switch: // Mapped to Alt_R on many keyboards
+82
case XK_ISO_Level3_Shift: // AltGr on at least some machines
+83
case XK_Meta_R:
+84
case XK_Alt_R: return GLFW_KEY_RIGHT_ALT;
+85
case XK_Super_L: return GLFW_KEY_LEFT_SUPER;
+86
case XK_Super_R: return GLFW_KEY_RIGHT_SUPER;
+87
case XK_Menu: return GLFW_KEY_MENU;
+88
case XK_Num_Lock: return GLFW_KEY_NUM_LOCK;
+89
case XK_Caps_Lock: return GLFW_KEY_CAPS_LOCK;
+90
case XK_Print: return GLFW_KEY_PRINT_SCREEN;
+91
case XK_Scroll_Lock: return GLFW_KEY_SCROLL_LOCK;
+92
case XK_Pause: return GLFW_KEY_PAUSE;
+93
case XK_Delete: return GLFW_KEY_DELETE;
+94
case XK_BackSpace: return GLFW_KEY_BACKSPACE;
+95
case XK_Return: return GLFW_KEY_ENTER;
+96
case XK_Home: return GLFW_KEY_HOME;
+97
case XK_End: return GLFW_KEY_END;
+98
case XK_Page_Up: return GLFW_KEY_PAGE_UP;
+99
case XK_Page_Down: return GLFW_KEY_PAGE_DOWN;
+100
case XK_Insert: return GLFW_KEY_INSERT;
+101
case XK_Left: return GLFW_KEY_LEFT;
+102
case XK_Right: return GLFW_KEY_RIGHT;
+103
case XK_Down: return GLFW_KEY_DOWN;
+104
case XK_Up: return GLFW_KEY_UP;
+105
case XK_F1: return GLFW_KEY_F1;
+106
case XK_F2: return GLFW_KEY_F2;
+107
case XK_F3: return GLFW_KEY_F3;
+108
case XK_F4: return GLFW_KEY_F4;
+109
case XK_F5: return GLFW_KEY_F5;
+110
case XK_F6: return GLFW_KEY_F6;
+111
case XK_F7: return GLFW_KEY_F7;
+112
case XK_F8: return GLFW_KEY_F8;
+113
case XK_F9: return GLFW_KEY_F9;
+114
case XK_F10: return GLFW_KEY_F10;
+115
case XK_F11: return GLFW_KEY_F11;
+116
case XK_F12: return GLFW_KEY_F12;
+117
case XK_F13: return GLFW_KEY_F13;
+118
case XK_F14: return GLFW_KEY_F14;
+119
case XK_F15: return GLFW_KEY_F15;
+120
case XK_F16: return GLFW_KEY_F16;
+121
case XK_F17: return GLFW_KEY_F17;
+122
case XK_F18: return GLFW_KEY_F18;
+123
case XK_F19: return GLFW_KEY_F19;
+124
case XK_F20: return GLFW_KEY_F20;
+125
case XK_F21: return GLFW_KEY_F21;
+126
case XK_F22: return GLFW_KEY_F22;
+127
case XK_F23: return GLFW_KEY_F23;
+128
case XK_F24: return GLFW_KEY_F24;
+129
case XK_F25: return GLFW_KEY_F25;
+130
+131
// Numeric keypad
+132
case XK_KP_Divide: return GLFW_KEY_KP_DIVIDE;
+133
case XK_KP_Multiply: return GLFW_KEY_KP_MULTIPLY;
+134
case XK_KP_Subtract: return GLFW_KEY_KP_SUBTRACT;
+135
case XK_KP_Add: return GLFW_KEY_KP_ADD;
+136
+137
// These should have been detected in secondary keysym test above!
+138
case XK_KP_Insert: return GLFW_KEY_KP_0;
+139
case XK_KP_End: return GLFW_KEY_KP_1;
+140
case XK_KP_Down: return GLFW_KEY_KP_2;
+141
case XK_KP_Page_Down: return GLFW_KEY_KP_3;
+142
case XK_KP_Left: return GLFW_KEY_KP_4;
+143
case XK_KP_Right: return GLFW_KEY_KP_6;
+144
case XK_KP_Home: return GLFW_KEY_KP_7;
+145
case XK_KP_Up: return GLFW_KEY_KP_8;
+146
case XK_KP_Page_Up: return GLFW_KEY_KP_9;
+147
case XK_KP_Delete: return GLFW_KEY_KP_DECIMAL;
+148
case XK_KP_Equal: return GLFW_KEY_KP_EQUAL;
+149
case XK_KP_Enter: return GLFW_KEY_KP_ENTER;
+150
+151
// Last resort: Check for printable keys (should not happen if the XKB
+152
// extension is available). This will give a layout dependent mapping
+153
// (which is wrong, and we may miss some keys, especially on non-US
+154
// keyboards), but it's better than nothing...
+155
case XK_a: return GLFW_KEY_A;
+156
case XK_b: return GLFW_KEY_B;
+157
case XK_c: return GLFW_KEY_C;
+158
case XK_d: return GLFW_KEY_D;
+159
case XK_e: return GLFW_KEY_E;
+160
case XK_f: return GLFW_KEY_F;
+161
case XK_g: return GLFW_KEY_G;
+162
case XK_h: return GLFW_KEY_H;
+163
case XK_i: return GLFW_KEY_I;
+164
case XK_j: return GLFW_KEY_J;
+165
case XK_k: return GLFW_KEY_K;
+166
case XK_l: return GLFW_KEY_L;
+167
case XK_m: return GLFW_KEY_M;
+168
case XK_n: return GLFW_KEY_N;
+169
case XK_o: return GLFW_KEY_O;
+170
case XK_p: return GLFW_KEY_P;
+171
case XK_q: return GLFW_KEY_Q;
+172
case XK_r: return GLFW_KEY_R;
+173
case XK_s: return GLFW_KEY_S;
+174
case XK_t: return GLFW_KEY_T;
+175
case XK_u: return GLFW_KEY_U;
+176
case XK_v: return GLFW_KEY_V;
+177
case XK_w: return GLFW_KEY_W;
+178
case XK_x: return GLFW_KEY_X;
+179
case XK_y: return GLFW_KEY_Y;
+180
case XK_z: return GLFW_KEY_Z;
+181
case XK_1: return GLFW_KEY_1;
+182
case XK_2: return GLFW_KEY_2;
+183
case XK_3: return GLFW_KEY_3;
+184
case XK_4: return GLFW_KEY_4;
+185
case XK_5: return GLFW_KEY_5;
+186
case XK_6: return GLFW_KEY_6;
+187
case XK_7: return GLFW_KEY_7;
+188
case XK_8: return GLFW_KEY_8;
+189
case XK_9: return GLFW_KEY_9;
+190
case XK_0: return GLFW_KEY_0;
+191
case XK_space: return GLFW_KEY_SPACE;
+192
case XK_minus: return GLFW_KEY_MINUS;
+193
case XK_equal: return GLFW_KEY_EQUAL;
+194
case XK_bracketleft: return GLFW_KEY_LEFT_BRACKET;
+195
case XK_bracketright: return GLFW_KEY_RIGHT_BRACKET;
+196
case XK_backslash: return GLFW_KEY_BACKSLASH;
+197
case XK_semicolon: return GLFW_KEY_SEMICOLON;
+198
case XK_apostrophe: return GLFW_KEY_APOSTROPHE;
+199
case XK_grave: return GLFW_KEY_GRAVE_ACCENT;
+200
case XK_comma: return GLFW_KEY_COMMA;
+201
case XK_period: return GLFW_KEY_PERIOD;
+202
case XK_slash: return GLFW_KEY_SLASH;
+203
case XK_less: return GLFW_KEY_WORLD_1; // At least in some layouts...
+204
default: break;
+205
}
+206
+207
// No matching translation was found
+208
return GLFW_KEY_UNKNOWN;
+209
}
+210
+211
// Create key code translation tables
+212
//
+213
static void createKeyTables(void)
+214
{
+215
int scancodeMin, scancodeMax;
+216
+217
memset(_glfw.x11.keycodes, -1, sizeof(_glfw.x11.keycodes));
+218
memset(_glfw.x11.scancodes, -1, sizeof(_glfw.x11.scancodes));
+219
+220
if (_glfw.x11.xkb.available)
+221
{
+222
// Use XKB to determine physical key locations independently of the
+223
// current keyboard layout
+224
+225
XkbDescPtr desc = XkbGetMap(_glfw.x11.display, 0, XkbUseCoreKbd);
+226
XkbGetNames(_glfw.x11.display, XkbKeyNamesMask | XkbKeyAliasesMask, desc);
+227
+228
scancodeMin = desc->min_key_code;
+229
scancodeMax = desc->max_key_code;
+230
+231
const struct
+232
{
+233
int key;
+234
char* name;
+235
} keymap[] =
+236
{
+237
{ GLFW_KEY_GRAVE_ACCENT, "TLDE" },
+238
{ GLFW_KEY_1, "AE01" },
+239
{ GLFW_KEY_2, "AE02" },
+240
{ GLFW_KEY_3, "AE03" },
+241
{ GLFW_KEY_4, "AE04" },
+242
{ GLFW_KEY_5, "AE05" },
+243
{ GLFW_KEY_6, "AE06" },
+244
{ GLFW_KEY_7, "AE07" },
+245
{ GLFW_KEY_8, "AE08" },
+246
{ GLFW_KEY_9, "AE09" },
+247
{ GLFW_KEY_0, "AE10" },
+248
{ GLFW_KEY_MINUS, "AE11" },
+249
{ GLFW_KEY_EQUAL, "AE12" },
+250
{ GLFW_KEY_Q, "AD01" },
+251
{ GLFW_KEY_W, "AD02" },
+252
{ GLFW_KEY_E, "AD03" },
+253
{ GLFW_KEY_R, "AD04" },
+254
{ GLFW_KEY_T, "AD05" },
+255
{ GLFW_KEY_Y, "AD06" },
+256
{ GLFW_KEY_U, "AD07" },
+257
{ GLFW_KEY_I, "AD08" },
+258
{ GLFW_KEY_O, "AD09" },
+259
{ GLFW_KEY_P, "AD10" },
+260
{ GLFW_KEY_LEFT_BRACKET, "AD11" },
+261
{ GLFW_KEY_RIGHT_BRACKET, "AD12" },
+262
{ GLFW_KEY_A, "AC01" },
+263
{ GLFW_KEY_S, "AC02" },
+264
{ GLFW_KEY_D, "AC03" },
+265
{ GLFW_KEY_F, "AC04" },
+266
{ GLFW_KEY_G, "AC05" },
+267
{ GLFW_KEY_H, "AC06" },
+268
{ GLFW_KEY_J, "AC07" },
+269
{ GLFW_KEY_K, "AC08" },
+270
{ GLFW_KEY_L, "AC09" },
+271
{ GLFW_KEY_SEMICOLON, "AC10" },
+272
{ GLFW_KEY_APOSTROPHE, "AC11" },
+273
{ GLFW_KEY_Z, "AB01" },
+274
{ GLFW_KEY_X, "AB02" },
+275
{ GLFW_KEY_C, "AB03" },
+276
{ GLFW_KEY_V, "AB04" },
+277
{ GLFW_KEY_B, "AB05" },
+278
{ GLFW_KEY_N, "AB06" },
+279
{ GLFW_KEY_M, "AB07" },
+280
{ GLFW_KEY_COMMA, "AB08" },
+281
{ GLFW_KEY_PERIOD, "AB09" },
+282
{ GLFW_KEY_SLASH, "AB10" },
+283
{ GLFW_KEY_BACKSLASH, "BKSL" },
+284
{ GLFW_KEY_WORLD_1, "LSGT" },
+285
{ GLFW_KEY_SPACE, "SPCE" },
+286
{ GLFW_KEY_ESCAPE, "ESC" },
+287
{ GLFW_KEY_ENTER, "RTRN" },
+288
{ GLFW_KEY_TAB, "TAB" },
+289
{ GLFW_KEY_BACKSPACE, "BKSP" },
+290
{ GLFW_KEY_INSERT, "INS" },
+291
{ GLFW_KEY_DELETE, "DELE" },
+292
{ GLFW_KEY_RIGHT, "RGHT" },
+293
{ GLFW_KEY_LEFT, "LEFT" },
+294
{ GLFW_KEY_DOWN, "DOWN" },
+295
{ GLFW_KEY_UP, "UP" },
+296
{ GLFW_KEY_PAGE_UP, "PGUP" },
+297
{ GLFW_KEY_PAGE_DOWN, "PGDN" },
+298
{ GLFW_KEY_HOME, "HOME" },
+299
{ GLFW_KEY_END, "END" },
+300
{ GLFW_KEY_CAPS_LOCK, "CAPS" },
+301
{ GLFW_KEY_SCROLL_LOCK, "SCLK" },
+302
{ GLFW_KEY_NUM_LOCK, "NMLK" },
+303
{ GLFW_KEY_PRINT_SCREEN, "PRSC" },
+304
{ GLFW_KEY_PAUSE, "PAUS" },
+305
{ GLFW_KEY_F1, "FK01" },
+306
{ GLFW_KEY_F2, "FK02" },
+307
{ GLFW_KEY_F3, "FK03" },
+308
{ GLFW_KEY_F4, "FK04" },
+309
{ GLFW_KEY_F5, "FK05" },
+310
{ GLFW_KEY_F6, "FK06" },
+311
{ GLFW_KEY_F7, "FK07" },
+312
{ GLFW_KEY_F8, "FK08" },
+313
{ GLFW_KEY_F9, "FK09" },
+314
{ GLFW_KEY_F10, "FK10" },
+315
{ GLFW_KEY_F11, "FK11" },
+316
{ GLFW_KEY_F12, "FK12" },
+317
{ GLFW_KEY_F13, "FK13" },
+318
{ GLFW_KEY_F14, "FK14" },
+319
{ GLFW_KEY_F15, "FK15" },
+320
{ GLFW_KEY_F16, "FK16" },
+321
{ GLFW_KEY_F17, "FK17" },
+322
{ GLFW_KEY_F18, "FK18" },
+323
{ GLFW_KEY_F19, "FK19" },
+324
{ GLFW_KEY_F20, "FK20" },
+325
{ GLFW_KEY_F21, "FK21" },
+326
{ GLFW_KEY_F22, "FK22" },
+327
{ GLFW_KEY_F23, "FK23" },
+328
{ GLFW_KEY_F24, "FK24" },
+329
{ GLFW_KEY_F25, "FK25" },
+330
{ GLFW_KEY_KP_0, "KP0" },
+331
{ GLFW_KEY_KP_1, "KP1" },
+332
{ GLFW_KEY_KP_2, "KP2" },
+333
{ GLFW_KEY_KP_3, "KP3" },
+334
{ GLFW_KEY_KP_4, "KP4" },
+335
{ GLFW_KEY_KP_5, "KP5" },
+336
{ GLFW_KEY_KP_6, "KP6" },
+337
{ GLFW_KEY_KP_7, "KP7" },
+338
{ GLFW_KEY_KP_8, "KP8" },
+339
{ GLFW_KEY_KP_9, "KP9" },
+340
{ GLFW_KEY_KP_DECIMAL, "KPDL" },
+341
{ GLFW_KEY_KP_DIVIDE, "KPDV" },
+342
{ GLFW_KEY_KP_MULTIPLY, "KPMU" },
+343
{ GLFW_KEY_KP_SUBTRACT, "KPSU" },
+344
{ GLFW_KEY_KP_ADD, "KPAD" },
+345
{ GLFW_KEY_KP_ENTER, "KPEN" },
+346
{ GLFW_KEY_KP_EQUAL, "KPEQ" },
+347
{ GLFW_KEY_LEFT_SHIFT, "LFSH" },
+348
{ GLFW_KEY_LEFT_CONTROL, "LCTL" },
+349
{ GLFW_KEY_LEFT_ALT, "LALT" },
+350
{ GLFW_KEY_LEFT_SUPER, "LWIN" },
+351
{ GLFW_KEY_RIGHT_SHIFT, "RTSH" },
+352
{ GLFW_KEY_RIGHT_CONTROL, "RCTL" },
+353
{ GLFW_KEY_RIGHT_ALT, "RALT" },
+354
{ GLFW_KEY_RIGHT_ALT, "LVL3" },
+355
{ GLFW_KEY_RIGHT_ALT, "MDSW" },
+356
{ GLFW_KEY_RIGHT_SUPER, "RWIN" },
+357
{ GLFW_KEY_MENU, "MENU" }
+358
};
+359
+360
// Find the X11 key code -> GLFW key code mapping
+361
for (int scancode = scancodeMin; scancode <= scancodeMax; scancode++)
+362
{
+363
int key = GLFW_KEY_UNKNOWN;
+364
+365
// Map the key name to a GLFW key code. Note: We use the US
+366
// keyboard layout. Because function keys aren't mapped correctly
+367
// when using traditional KeySym translations, they are mapped
+368
// here instead.
+369
for (int i = 0; i < sizeof(keymap) / sizeof(keymap[0]); i++)
+370
{
+371
if (strncmp(desc->names->keys[scancode].name,
+372
keymap[i].name,
+373
XkbKeyNameLength) == 0)
+374
{
+375
key = keymap[i].key;
+376
break;
+377
}
+378
}
+379
+380
// Fall back to key aliases in case the key name did not match
+381
for (int i = 0; i < desc->names->num_key_aliases; i++)
+382
{
+383
if (key != GLFW_KEY_UNKNOWN)
+384
break;
+385
+386
if (strncmp(desc->names->key_aliases[i].real,
+387
desc->names->keys[scancode].name,
+388
XkbKeyNameLength) != 0)
+389
{
+390
continue;
+391
}
+392
+393
for (int j = 0; j < sizeof(keymap) / sizeof(keymap[0]); j++)
+394
{
+395
if (strncmp(desc->names->key_aliases[i].alias,
+396
keymap[j].name,
+397
XkbKeyNameLength) == 0)
+398
{
+399
key = keymap[j].key;
+400
break;
+401
}
+402
}
+403
}
+404
+405
_glfw.x11.keycodes[scancode] = key;
+406
}
+407
+408
XkbFreeNames(desc, XkbKeyNamesMask, True);
+409
XkbFreeKeyboard(desc, 0, True);
+410
}
+411
else
+412
XDisplayKeycodes(_glfw.x11.display, &scancodeMin, &scancodeMax);
+413
+414
int width;
+415
KeySym* keysyms = XGetKeyboardMapping(_glfw.x11.display,
+416
scancodeMin,
+417
scancodeMax - scancodeMin + 1,
+418
&width);
+419
+420
for (int scancode = scancodeMin; scancode <= scancodeMax; scancode++)
+421
{
+422
// Translate the un-translated key codes using traditional X11 KeySym
+423
// lookups
+424
if (_glfw.x11.keycodes[scancode] < 0)
+425
{
+426
const size_t base = (scancode - scancodeMin) * width;
+427
_glfw.x11.keycodes[scancode] = translateKeySyms(&keysyms[base], width);
+428
}
+429
+430
// Store the reverse translation for faster key name lookup
+431
if (_glfw.x11.keycodes[scancode] > 0)
+432
_glfw.x11.scancodes[_glfw.x11.keycodes[scancode]] = scancode;
+433
}
+434
+435
XFree(keysyms);
+436
}
+437
+438
// Check whether the IM has a usable style
+439
//
+440
static GLFWbool hasUsableInputMethodStyle(void)
+441
{
+442
GLFWbool found = GLFW_FALSE;
+443
XIMStyles* styles = NULL;
+444
+445
if (XGetIMValues(_glfw.x11.im, XNQueryInputStyle, &styles, NULL) != NULL)
+446
return GLFW_FALSE;
+447
+448
for (unsigned int i = 0; i < styles->count_styles; i++)
+449
{
+450
if (styles->supported_styles[i] == (XIMPreeditNothing | XIMStatusNothing))
+451
{
+452
found = GLFW_TRUE;
+453
break;
+454
}
+455
}
+456
+457
XFree(styles);
+458
return found;
+459
}
+460
+461
static void inputMethodDestroyCallback(XIM im, XPointer clientData, XPointer callData)
+462
{
+463
_glfw.x11.im = NULL;
+464
}
+465
+466
static void inputMethodInstantiateCallback(Display* display,
+467
XPointer clientData,
+468
XPointer callData)
+469
{
+470
if (_glfw.x11.im)
+471
return;
+472
+473
_glfw.x11.im = XOpenIM(_glfw.x11.display, 0, NULL, NULL);
+474
if (_glfw.x11.im)
+475
{
+476
if (!hasUsableInputMethodStyle())
+477
{
+478
XCloseIM(_glfw.x11.im);
+479
_glfw.x11.im = NULL;
+480
}
+481
}
+482
+483
if (_glfw.x11.im)
+484
{
+485
XIMCallback callback;
+486
callback.callback = (XIMProc) inputMethodDestroyCallback;
+487
callback.client_data = NULL;
+488
XSetIMValues(_glfw.x11.im, XNDestroyCallback, &callback, NULL);
+489
+490
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
+491
_glfwCreateInputContextX11(window);
+492
}
+493
}
+494
+495
// Return the atom ID only if it is listed in the specified array
+496
//
+497
static Atom getAtomIfSupported(Atom* supportedAtoms,
+498
unsigned long atomCount,
+499
const char* atomName)

Showing the first 500 of 1622 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/x11_monitor.cadded
@@ -0,0 +1,652 @@
+1
//========================================================================
+2
// GLFW 3.5 X11 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_X11)
+31
+32
#include <limits.h>
+33
#include <stdlib.h>
+34
#include <string.h>
+35
#include <math.h>
+36
#include <assert.h>
+37
+38
+39
// Check whether the display mode should be included in enumeration
+40
//
+41
static GLFWbool modeIsGood(const XRRModeInfo* mi)
+42
{
+43
return (mi->modeFlags & RR_Interlace) == 0;
+44
}
+45
+46
// Calculates the refresh rate, in Hz, from the specified RandR mode info
+47
//
+48
static int calculateRefreshRate(const XRRModeInfo* mi)
+49
{
+50
if (mi->hTotal && mi->vTotal)
+51
return (int) round((double) mi->dotClock / ((double) mi->hTotal * (double) mi->vTotal));
+52
else
+53
return 0;
+54
}
+55
+56
// Returns the mode info for a RandR mode XID
+57
//
+58
static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMode id)
+59
{
+60
for (int i = 0; i < sr->nmode; i++)
+61
{
+62
if (sr->modes[i].id == id)
+63
return sr->modes + i;
+64
}
+65
+66
return NULL;
+67
}
+68
+69
// Convert RandR mode info to GLFW video mode
+70
//
+71
static GLFWvidmode vidmodeFromModeInfo(const XRRModeInfo* mi,
+72
const XRRCrtcInfo* ci)
+73
{
+74
GLFWvidmode mode;
+75
+76
if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270)
+77
{
+78
mode.width = mi->height;
+79
mode.height = mi->width;
+80
}
+81
else
+82
{
+83
mode.width = mi->width;
+84
mode.height = mi->height;
+85
}
+86
+87
mode.refreshRate = calculateRefreshRate(mi);
+88
+89
_glfwSplitBPP(DefaultDepth(_glfw.x11.display, _glfw.x11.screen),
+90
&mode.redBits, &mode.greenBits, &mode.blueBits);
+91
+92
return mode;
+93
}
+94
+95
+96
//////////////////////////////////////////////////////////////////////////
+97
////// GLFW internal API //////
+98
//////////////////////////////////////////////////////////////////////////
+99
+100
// Poll for changes in the set of connected monitors
+101
//
+102
void _glfwPollMonitorsX11(void)
+103
{
+104
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
+105
{
+106
int disconnectedCount, screenCount = 0;
+107
_GLFWmonitor** disconnected = NULL;
+108
XineramaScreenInfo* screens = NULL;
+109
XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display,
+110
_glfw.x11.root);
+111
RROutput primary = XRRGetOutputPrimary(_glfw.x11.display,
+112
_glfw.x11.root);
+113
+114
if (_glfw.x11.xinerama.available)
+115
screens = XineramaQueryScreens(_glfw.x11.display, &screenCount);
+116
+117
disconnectedCount = _glfw.monitorCount;
+118
if (disconnectedCount)
+119
{
+120
disconnected = _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
+121
memcpy(disconnected,
+122
_glfw.monitors,
+123
_glfw.monitorCount * sizeof(_GLFWmonitor*));
+124
}
+125
+126
for (int i = 0; i < sr->noutput; i++)
+127
{
+128
int j, type, widthMM, heightMM;
+129
+130
XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, sr->outputs[i]);
+131
if (oi->connection != RR_Connected || oi->crtc == None)
+132
{
+133
XRRFreeOutputInfo(oi);
+134
continue;
+135
}
+136
+137
for (j = 0; j < disconnectedCount; j++)
+138
{
+139
if (disconnected[j] &&
+140
disconnected[j]->x11.output == sr->outputs[i])
+141
{
+142
disconnected[j] = NULL;
+143
break;
+144
}
+145
}
+146
+147
if (j < disconnectedCount)
+148
{
+149
XRRFreeOutputInfo(oi);
+150
continue;
+151
}
+152
+153
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc);
+154
if (!ci)
+155
{
+156
XRRFreeOutputInfo(oi);
+157
continue;
+158
}
+159
+160
if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270)
+161
{
+162
widthMM = oi->mm_height;
+163
heightMM = oi->mm_width;
+164
}
+165
else
+166
{
+167
widthMM = oi->mm_width;
+168
heightMM = oi->mm_height;
+169
}
+170
+171
if (widthMM <= 0 || heightMM <= 0)
+172
{
+173
// HACK: If RandR does not provide a physical size, assume the
+174
// X11 default 96 DPI and calculate from the CRTC viewport
+175
// NOTE: These members are affected by rotation, unlike the mode
+176
// info and output info members
+177
widthMM = (int) (ci->width * 25.4f / 96.f);
+178
heightMM = (int) (ci->height * 25.4f / 96.f);
+179
}
+180
+181
_GLFWmonitor* monitor = _glfwAllocMonitor(oi->name, widthMM, heightMM);
+182
monitor->x11.output = sr->outputs[i];
+183
monitor->x11.crtc = oi->crtc;
+184
+185
for (j = 0; j < screenCount; j++)
+186
{
+187
if (screens[j].x_org == ci->x &&
+188
screens[j].y_org == ci->y &&
+189
screens[j].width == ci->width &&
+190
screens[j].height == ci->height)
+191
{
+192
monitor->x11.index = j;
+193
break;
+194
}
+195
}
+196
+197
if (monitor->x11.output == primary)
+198
type = _GLFW_INSERT_FIRST;
+199
else
+200
type = _GLFW_INSERT_LAST;
+201
+202
_glfwInputMonitor(monitor, GLFW_CONNECTED, type);
+203
+204
XRRFreeOutputInfo(oi);
+205
XRRFreeCrtcInfo(ci);
+206
}
+207
+208
XRRFreeScreenResources(sr);
+209
+210
if (screens)
+211
XFree(screens);
+212
+213
for (int i = 0; i < disconnectedCount; i++)
+214
{
+215
if (disconnected[i])
+216
_glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
+217
}
+218
+219
_glfw_free(disconnected);
+220
}
+221
else
+222
{
+223
const int widthMM = DisplayWidthMM(_glfw.x11.display, _glfw.x11.screen);
+224
const int heightMM = DisplayHeightMM(_glfw.x11.display, _glfw.x11.screen);
+225
+226
_glfwInputMonitor(_glfwAllocMonitor("Display", widthMM, heightMM),
+227
GLFW_CONNECTED,
+228
_GLFW_INSERT_FIRST);
+229
}
+230
}
+231
+232
// Set the current video mode for the specified monitor
+233
//
+234
void _glfwSetVideoModeX11(_GLFWmonitor* monitor, const GLFWvidmode* desired)
+235
{
+236
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
+237
{
+238
GLFWvidmode current;
+239
RRMode native = None;
+240
+241
const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired);
+242
_glfwGetVideoModeX11(monitor, &current);
+243
if (_glfwCompareVideoModes(&current, best) == 0)
+244
return;
+245
+246
XRRScreenResources* sr =
+247
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
+248
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
+249
XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
+250
+251
for (int i = 0; i < oi->nmode; i++)
+252
{
+253
const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]);
+254
if (!modeIsGood(mi))
+255
continue;
+256
+257
const GLFWvidmode mode = vidmodeFromModeInfo(mi, ci);
+258
if (_glfwCompareVideoModes(best, &mode) == 0)
+259
{
+260
native = mi->id;
+261
break;
+262
}
+263
}
+264
+265
if (native)
+266
{
+267
if (monitor->x11.oldMode == None)
+268
monitor->x11.oldMode = ci->mode;
+269
+270
XRRSetCrtcConfig(_glfw.x11.display,
+271
sr, monitor->x11.crtc,
+272
CurrentTime,
+273
ci->x, ci->y,
+274
native,
+275
ci->rotation,
+276
ci->outputs,
+277
ci->noutput);
+278
}
+279
+280
XRRFreeOutputInfo(oi);
+281
XRRFreeCrtcInfo(ci);
+282
XRRFreeScreenResources(sr);
+283
}
+284
}
+285
+286
// Restore the saved (original) video mode for the specified monitor
+287
//
+288
void _glfwRestoreVideoModeX11(_GLFWmonitor* monitor)
+289
{
+290
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
+291
{
+292
if (monitor->x11.oldMode == None)
+293
return;
+294
+295
XRRScreenResources* sr =
+296
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
+297
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
+298
+299
XRRSetCrtcConfig(_glfw.x11.display,
+300
sr, monitor->x11.crtc,
+301
CurrentTime,
+302
ci->x, ci->y,
+303
monitor->x11.oldMode,
+304
ci->rotation,
+305
ci->outputs,
+306
ci->noutput);
+307
+308
XRRFreeCrtcInfo(ci);
+309
XRRFreeScreenResources(sr);
+310
+311
monitor->x11.oldMode = None;
+312
}
+313
}
+314
+315
+316
//////////////////////////////////////////////////////////////////////////
+317
////// GLFW platform API //////
+318
//////////////////////////////////////////////////////////////////////////
+319
+320
void _glfwFreeMonitorX11(_GLFWmonitor* monitor)
+321
{
+322
}
+323
+324
void _glfwGetMonitorPosX11(_GLFWmonitor* monitor, int* xpos, int* ypos)
+325
{
+326
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
+327
{
+328
XRRScreenResources* sr =
+329
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
+330
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
+331
+332
if (ci)
+333
{
+334
if (xpos)
+335
*xpos = ci->x;
+336
if (ypos)
+337
*ypos = ci->y;
+338
+339
XRRFreeCrtcInfo(ci);
+340
}
+341
+342
XRRFreeScreenResources(sr);
+343
}
+344
}
+345
+346
void _glfwGetMonitorContentScaleX11(_GLFWmonitor* monitor,
+347
float* xscale, float* yscale)
+348
{
+349
if (xscale)
+350
*xscale = _glfw.x11.contentScaleX;
+351
if (yscale)
+352
*yscale = _glfw.x11.contentScaleY;
+353
}
+354
+355
void _glfwGetMonitorWorkareaX11(_GLFWmonitor* monitor,
+356
int* xpos, int* ypos,
+357
int* width, int* height)
+358
{
+359
int areaX = 0, areaY = 0, areaWidth = 0, areaHeight = 0;
+360
+361
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
+362
{
+363
XRRScreenResources* sr =
+364
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
+365
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
+366
+367
areaX = ci->x;
+368
areaY = ci->y;
+369
+370
const XRRModeInfo* mi = getModeInfo(sr, ci->mode);
+371
+372
if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270)
+373
{
+374
areaWidth = mi->height;
+375
areaHeight = mi->width;
+376
}
+377
else
+378
{
+379
areaWidth = mi->width;
+380
areaHeight = mi->height;
+381
}
+382
+383
XRRFreeCrtcInfo(ci);
+384
XRRFreeScreenResources(sr);
+385
}
+386
else
+387
{
+388
areaWidth = DisplayWidth(_glfw.x11.display, _glfw.x11.screen);
+389
areaHeight = DisplayHeight(_glfw.x11.display, _glfw.x11.screen);
+390
}
+391
+392
if (_glfw.x11.NET_WORKAREA && _glfw.x11.NET_CURRENT_DESKTOP)
+393
{
+394
Atom* extents = NULL;
+395
Atom* desktop = NULL;
+396
const unsigned long extentCount =
+397
_glfwGetWindowPropertyX11(_glfw.x11.root,
+398
_glfw.x11.NET_WORKAREA,
+399
XA_CARDINAL,
+400
(unsigned char**) &extents);
+401
+402
if (_glfwGetWindowPropertyX11(_glfw.x11.root,
+403
_glfw.x11.NET_CURRENT_DESKTOP,
+404
XA_CARDINAL,
+405
(unsigned char**) &desktop) > 0)
+406
{
+407
if (extentCount >= 4 && *desktop < extentCount / 4)
+408
{
+409
const int globalX = extents[*desktop * 4 + 0];
+410
const int globalY = extents[*desktop * 4 + 1];
+411
const int globalWidth = extents[*desktop * 4 + 2];
+412
const int globalHeight = extents[*desktop * 4 + 3];
+413
+414
if (areaX < globalX)
+415
{
+416
areaWidth -= globalX - areaX;
+417
areaX = globalX;
+418
}
+419
+420
if (areaY < globalY)
+421
{
+422
areaHeight -= globalY - areaY;
+423
areaY = globalY;
+424
}
+425
+426
if (areaX + areaWidth > globalX + globalWidth)
+427
areaWidth = globalX - areaX + globalWidth;
+428
if (areaY + areaHeight > globalY + globalHeight)
+429
areaHeight = globalY - areaY + globalHeight;
+430
}
+431
}
+432
+433
if (extents)
+434
XFree(extents);
+435
if (desktop)
+436
XFree(desktop);
+437
}
+438
+439
if (xpos)
+440
*xpos = areaX;
+441
if (ypos)
+442
*ypos = areaY;
+443
if (width)
+444
*width = areaWidth;
+445
if (height)
+446
*height = areaHeight;
+447
}
+448
+449
GLFWvidmode* _glfwGetVideoModesX11(_GLFWmonitor* monitor, int* count)
+450
{
+451
GLFWvidmode* result;
+452
+453
*count = 0;
+454
+455
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
+456
{
+457
XRRScreenResources* sr =
+458
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
+459
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
+460
XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
+461
+462
result = _glfw_calloc(oi->nmode, sizeof(GLFWvidmode));
+463
+464
for (int i = 0; i < oi->nmode; i++)
+465
{
+466
const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]);
+467
if (!modeIsGood(mi))
+468
continue;
+469
+470
const GLFWvidmode mode = vidmodeFromModeInfo(mi, ci);
+471
int j;
+472
+473
for (j = 0; j < *count; j++)
+474
{
+475
if (_glfwCompareVideoModes(result + j, &mode) == 0)
+476
break;
+477
}
+478
+479
// Skip duplicate modes
+480
if (j < *count)
+481
continue;
+482
+483
(*count)++;
+484
result[*count - 1] = mode;
+485
}
+486
+487
XRRFreeOutputInfo(oi);
+488
XRRFreeCrtcInfo(ci);
+489
XRRFreeScreenResources(sr);
+490
}
+491
else
+492
{
+493
*count = 1;
+494
result = _glfw_calloc(1, sizeof(GLFWvidmode));
+495
_glfwGetVideoModeX11(monitor, result);
+496
}
+497
+498
return result;
+499
}

Showing the first 500 of 653 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/x11_platform.hadded
@@ -0,0 +1,1005 @@
+1
//========================================================================
+2
// GLFW 3.5 X11 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include <unistd.h>
+29
#include <signal.h>
+30
#include <stdint.h>
+31
+32
#include <X11/Xlib.h>
+33
#include <X11/keysym.h>
+34
#include <X11/Xatom.h>
+35
#include <X11/Xresource.h>
+36
#include <X11/Xcursor/Xcursor.h>
+37
+38
// The XRandR extension provides mode setting and gamma control
+39
#include <X11/extensions/Xrandr.h>
+40
+41
// The Xkb extension provides improved keyboard support
+42
#include <X11/XKBlib.h>
+43
+44
// The Xinerama extension provides legacy monitor indices
+45
#include <X11/extensions/Xinerama.h>
+46
+47
// The XInput extension provides raw mouse motion input
+48
#include <X11/extensions/XInput2.h>
+49
+50
// The Shape extension provides custom window shapes
+51
#include <X11/extensions/shape.h>
+52
+53
#define GLX_VENDOR 1
+54
#define GLX_RGBA_BIT 0x00000001
+55
#define GLX_WINDOW_BIT 0x00000001
+56
#define GLX_DRAWABLE_TYPE 0x8010
+57
#define GLX_RENDER_TYPE 0x8011
+58
#define GLX_RGBA_TYPE 0x8014
+59
#define GLX_DOUBLEBUFFER 5
+60
#define GLX_STEREO 6
+61
#define GLX_AUX_BUFFERS 7
+62
#define GLX_RED_SIZE 8
+63
#define GLX_GREEN_SIZE 9
+64
#define GLX_BLUE_SIZE 10
+65
#define GLX_ALPHA_SIZE 11
+66
#define GLX_DEPTH_SIZE 12
+67
#define GLX_STENCIL_SIZE 13
+68
#define GLX_ACCUM_RED_SIZE 14
+69
#define GLX_ACCUM_GREEN_SIZE 15
+70
#define GLX_ACCUM_BLUE_SIZE 16
+71
#define GLX_ACCUM_ALPHA_SIZE 17
+72
#define GLX_SAMPLES 0x186a1
+73
#define GLX_VISUAL_ID 0x800b
+74
+75
#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20b2
+76
#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
+77
#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+78
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+79
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
+80
#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+81
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
+82
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
+83
#define GLX_CONTEXT_FLAGS_ARB 0x2094
+84
#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
+85
#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
+86
#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+87
#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+88
#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261
+89
#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
+90
#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
+91
#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
+92
#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3
+93
+94
typedef XID GLXWindow;
+95
typedef XID GLXDrawable;
+96
typedef struct __GLXFBConfig* GLXFBConfig;
+97
typedef struct __GLXcontext* GLXContext;
+98
typedef void (*__GLXextproc)(void);
+99
+100
typedef XClassHint* (* PFN_XAllocClassHint)(void);
+101
typedef XSizeHints* (* PFN_XAllocSizeHints)(void);
+102
typedef XWMHints* (* PFN_XAllocWMHints)(void);
+103
typedef int (* PFN_XChangeProperty)(Display*,Window,Atom,Atom,int,int,const unsigned char*,int);
+104
typedef int (* PFN_XChangeWindowAttributes)(Display*,Window,unsigned long,XSetWindowAttributes*);
+105
typedef Bool (* PFN_XCheckIfEvent)(Display*,XEvent*,Bool(*)(Display*,XEvent*,XPointer),XPointer);
+106
typedef Bool (* PFN_XCheckTypedWindowEvent)(Display*,Window,int,XEvent*);
+107
typedef int (* PFN_XCloseDisplay)(Display*);
+108
typedef Status (* PFN_XCloseIM)(XIM);
+109
typedef int (* PFN_XConvertSelection)(Display*,Atom,Atom,Atom,Window,Time);
+110
typedef Colormap (* PFN_XCreateColormap)(Display*,Window,Visual*,int);
+111
typedef Cursor (* PFN_XCreateFontCursor)(Display*,unsigned int);
+112
typedef XIC (* PFN_XCreateIC)(XIM,...);
+113
typedef Region (* PFN_XCreateRegion)(void);
+114
typedef Window (* PFN_XCreateWindow)(Display*,Window,int,int,unsigned int,unsigned int,unsigned int,int,unsigned int,Visual*,unsigned long,XSetWindowAttributes*);
+115
typedef int (* PFN_XDefineCursor)(Display*,Window,Cursor);
+116
typedef int (* PFN_XDeleteContext)(Display*,XID,XContext);
+117
typedef int (* PFN_XDeleteProperty)(Display*,Window,Atom);
+118
typedef void (* PFN_XDestroyIC)(XIC);
+119
typedef int (* PFN_XDestroyRegion)(Region);
+120
typedef int (* PFN_XDestroyWindow)(Display*,Window);
+121
typedef int (* PFN_XDisplayKeycodes)(Display*,int*,int*);
+122
typedef int (* PFN_XEventsQueued)(Display*,int);
+123
typedef Bool (* PFN_XFilterEvent)(XEvent*,Window);
+124
typedef int (* PFN_XFindContext)(Display*,XID,XContext,XPointer*);
+125
typedef int (* PFN_XFlush)(Display*);
+126
typedef int (* PFN_XFree)(void*);
+127
typedef int (* PFN_XFreeColormap)(Display*,Colormap);
+128
typedef int (* PFN_XFreeCursor)(Display*,Cursor);
+129
typedef void (* PFN_XFreeEventData)(Display*,XGenericEventCookie*);
+130
typedef int (* PFN_XGetErrorText)(Display*,int,char*,int);
+131
typedef Bool (* PFN_XGetEventData)(Display*,XGenericEventCookie*);
+132
typedef char* (* PFN_XGetICValues)(XIC,...);
+133
typedef char* (* PFN_XGetIMValues)(XIM,...);
+134
typedef int (* PFN_XGetInputFocus)(Display*,Window*,int*);
+135
typedef KeySym* (* PFN_XGetKeyboardMapping)(Display*,KeyCode,int,int*);
+136
typedef int (* PFN_XGetScreenSaver)(Display*,int*,int*,int*,int*);
+137
typedef Window (* PFN_XGetSelectionOwner)(Display*,Atom);
+138
typedef XVisualInfo* (* PFN_XGetVisualInfo)(Display*,long,XVisualInfo*,int*);
+139
typedef Status (* PFN_XGetWMNormalHints)(Display*,Window,XSizeHints*,long*);
+140
typedef Status (* PFN_XGetWindowAttributes)(Display*,Window,XWindowAttributes*);
+141
typedef int (* PFN_XGetWindowProperty)(Display*,Window,Atom,long,long,Bool,Atom,Atom*,int*,unsigned long*,unsigned long*,unsigned char**);
+142
typedef int (* PFN_XGrabPointer)(Display*,Window,Bool,unsigned int,int,int,Window,Cursor,Time);
+143
typedef Status (* PFN_XIconifyWindow)(Display*,Window,int);
+144
typedef Status (* PFN_XInitThreads)(void);
+145
typedef Atom (* PFN_XInternAtom)(Display*,const char*,Bool);
+146
typedef int (* PFN_XLookupString)(XKeyEvent*,char*,int,KeySym*,XComposeStatus*);
+147
typedef int (* PFN_XMapRaised)(Display*,Window);
+148
typedef int (* PFN_XMapWindow)(Display*,Window);
+149
typedef int (* PFN_XMoveResizeWindow)(Display*,Window,int,int,unsigned int,unsigned int);
+150
typedef int (* PFN_XMoveWindow)(Display*,Window,int,int);
+151
typedef int (* PFN_XNextEvent)(Display*,XEvent*);
+152
typedef Display* (* PFN_XOpenDisplay)(const char*);
+153
typedef XIM (* PFN_XOpenIM)(Display*,XrmDatabase*,char*,char*);
+154
typedef int (* PFN_XPeekEvent)(Display*,XEvent*);
+155
typedef int (* PFN_XPending)(Display*);
+156
typedef Bool (* PFN_XQueryExtension)(Display*,const char*,int*,int*,int*);
+157
typedef Bool (* PFN_XQueryPointer)(Display*,Window,Window*,Window*,int*,int*,int*,int*,unsigned int*);
+158
typedef int (* PFN_XRaiseWindow)(Display*,Window);
+159
typedef Bool (* PFN_XRegisterIMInstantiateCallback)(Display*,void*,char*,char*,XIDProc,XPointer);
+160
typedef int (* PFN_XResizeWindow)(Display*,Window,unsigned int,unsigned int);
+161
typedef char* (* PFN_XResourceManagerString)(Display*);
+162
typedef int (* PFN_XSaveContext)(Display*,XID,XContext,const char*);
+163
typedef int (* PFN_XSelectInput)(Display*,Window,long);
+164
typedef Status (* PFN_XSendEvent)(Display*,Window,Bool,long,XEvent*);
+165
typedef int (* PFN_XSetClassHint)(Display*,Window,XClassHint*);
+166
typedef XErrorHandler (* PFN_XSetErrorHandler)(XErrorHandler);
+167
typedef void (* PFN_XSetICFocus)(XIC);
+168
typedef char* (* PFN_XSetIMValues)(XIM,...);
+169
typedef int (* PFN_XSetInputFocus)(Display*,Window,int,Time);
+170
typedef char* (* PFN_XSetLocaleModifiers)(const char*);
+171
typedef int (* PFN_XSetScreenSaver)(Display*,int,int,int,int);
+172
typedef int (* PFN_XSetSelectionOwner)(Display*,Atom,Window,Time);
+173
typedef int (* PFN_XSetWMHints)(Display*,Window,XWMHints*);
+174
typedef void (* PFN_XSetWMNormalHints)(Display*,Window,XSizeHints*);
+175
typedef Status (* PFN_XSetWMProtocols)(Display*,Window,Atom*,int);
+176
typedef Bool (* PFN_XSupportsLocale)(void);
+177
typedef int (* PFN_XSync)(Display*,Bool);
+178
typedef Bool (* PFN_XTranslateCoordinates)(Display*,Window,Window,int,int,int*,int*,Window*);
+179
typedef int (* PFN_XUndefineCursor)(Display*,Window);
+180
typedef int (* PFN_XUngrabPointer)(Display*,Time);
+181
typedef int (* PFN_XUnmapWindow)(Display*,Window);
+182
typedef void (* PFN_XUnsetICFocus)(XIC);
+183
typedef VisualID (* PFN_XVisualIDFromVisual)(Visual*);
+184
typedef int (* PFN_XWarpPointer)(Display*,Window,Window,int,int,unsigned int,unsigned int,int,int);
+185
typedef void (* PFN_XkbFreeKeyboard)(XkbDescPtr,unsigned int,Bool);
+186
typedef void (* PFN_XkbFreeNames)(XkbDescPtr,unsigned int,Bool);
+187
typedef XkbDescPtr (* PFN_XkbGetMap)(Display*,unsigned int,unsigned int);
+188
typedef Status (* PFN_XkbGetNames)(Display*,unsigned int,XkbDescPtr);
+189
typedef Status (* PFN_XkbGetState)(Display*,unsigned int,XkbStatePtr);
+190
typedef KeySym (* PFN_XkbKeycodeToKeysym)(Display*,KeyCode,int,int);
+191
typedef Bool (* PFN_XkbQueryExtension)(Display*,int*,int*,int*,int*,int*);
+192
typedef Bool (* PFN_XkbSelectEventDetails)(Display*,unsigned int,unsigned int,unsigned long,unsigned long);
+193
typedef Bool (* PFN_XkbSetDetectableAutoRepeat)(Display*,Bool,Bool*);
+194
typedef void (* PFN_XrmDestroyDatabase)(XrmDatabase);
+195
typedef Bool (* PFN_XrmGetResource)(XrmDatabase,const char*,const char*,char**,XrmValue*);
+196
typedef XrmDatabase (* PFN_XrmGetStringDatabase)(const char*);
+197
typedef void (* PFN_XrmInitialize)(void);
+198
typedef XrmQuark (* PFN_XrmUniqueQuark)(void);
+199
typedef Bool (* PFN_XUnregisterIMInstantiateCallback)(Display*,void*,char*,char*,XIDProc,XPointer);
+200
typedef int (* PFN_Xutf8LookupString)(XIC,XKeyPressedEvent*,char*,int,KeySym*,Status*);
+201
typedef void (* PFN_Xutf8SetWMProperties)(Display*,Window,const char*,const char*,char**,int,XSizeHints*,XWMHints*,XClassHint*);
+202
#define XAllocClassHint _glfw.x11.xlib.AllocClassHint
+203
#define XAllocSizeHints _glfw.x11.xlib.AllocSizeHints
+204
#define XAllocWMHints _glfw.x11.xlib.AllocWMHints
+205
#define XChangeProperty _glfw.x11.xlib.ChangeProperty
+206
#define XChangeWindowAttributes _glfw.x11.xlib.ChangeWindowAttributes
+207
#define XCheckIfEvent _glfw.x11.xlib.CheckIfEvent
+208
#define XCheckTypedWindowEvent _glfw.x11.xlib.CheckTypedWindowEvent
+209
#define XCloseDisplay _glfw.x11.xlib.CloseDisplay
+210
#define XCloseIM _glfw.x11.xlib.CloseIM
+211
#define XConvertSelection _glfw.x11.xlib.ConvertSelection
+212
#define XCreateColormap _glfw.x11.xlib.CreateColormap
+213
#define XCreateFontCursor _glfw.x11.xlib.CreateFontCursor
+214
#define XCreateIC _glfw.x11.xlib.CreateIC
+215
#define XCreateRegion _glfw.x11.xlib.CreateRegion
+216
#define XCreateWindow _glfw.x11.xlib.CreateWindow
+217
#define XDefineCursor _glfw.x11.xlib.DefineCursor
+218
#define XDeleteContext _glfw.x11.xlib.DeleteContext
+219
#define XDeleteProperty _glfw.x11.xlib.DeleteProperty
+220
#define XDestroyIC _glfw.x11.xlib.DestroyIC
+221
#define XDestroyRegion _glfw.x11.xlib.DestroyRegion
+222
#define XDestroyWindow _glfw.x11.xlib.DestroyWindow
+223
#define XDisplayKeycodes _glfw.x11.xlib.DisplayKeycodes
+224
#define XEventsQueued _glfw.x11.xlib.EventsQueued
+225
#define XFilterEvent _glfw.x11.xlib.FilterEvent
+226
#define XFindContext _glfw.x11.xlib.FindContext
+227
#define XFlush _glfw.x11.xlib.Flush
+228
#define XFree _glfw.x11.xlib.Free
+229
#define XFreeColormap _glfw.x11.xlib.FreeColormap
+230
#define XFreeCursor _glfw.x11.xlib.FreeCursor
+231
#define XFreeEventData _glfw.x11.xlib.FreeEventData
+232
#define XGetErrorText _glfw.x11.xlib.GetErrorText
+233
#define XGetEventData _glfw.x11.xlib.GetEventData
+234
#define XGetICValues _glfw.x11.xlib.GetICValues
+235
#define XGetIMValues _glfw.x11.xlib.GetIMValues
+236
#define XGetInputFocus _glfw.x11.xlib.GetInputFocus
+237
#define XGetKeyboardMapping _glfw.x11.xlib.GetKeyboardMapping
+238
#define XGetScreenSaver _glfw.x11.xlib.GetScreenSaver
+239
#define XGetSelectionOwner _glfw.x11.xlib.GetSelectionOwner
+240
#define XGetVisualInfo _glfw.x11.xlib.GetVisualInfo
+241
#define XGetWMNormalHints _glfw.x11.xlib.GetWMNormalHints
+242
#define XGetWindowAttributes _glfw.x11.xlib.GetWindowAttributes
+243
#define XGetWindowProperty _glfw.x11.xlib.GetWindowProperty
+244
#define XGrabPointer _glfw.x11.xlib.GrabPointer
+245
#define XIconifyWindow _glfw.x11.xlib.IconifyWindow
+246
#define XInternAtom _glfw.x11.xlib.InternAtom
+247
#define XLookupString _glfw.x11.xlib.LookupString
+248
#define XMapRaised _glfw.x11.xlib.MapRaised
+249
#define XMapWindow _glfw.x11.xlib.MapWindow
+250
#define XMoveResizeWindow _glfw.x11.xlib.MoveResizeWindow
+251
#define XMoveWindow _glfw.x11.xlib.MoveWindow
+252
#define XNextEvent _glfw.x11.xlib.NextEvent
+253
#define XOpenIM _glfw.x11.xlib.OpenIM
+254
#define XPeekEvent _glfw.x11.xlib.PeekEvent
+255
#define XPending _glfw.x11.xlib.Pending
+256
#define XQueryExtension _glfw.x11.xlib.QueryExtension
+257
#define XQueryPointer _glfw.x11.xlib.QueryPointer
+258
#define XRaiseWindow _glfw.x11.xlib.RaiseWindow
+259
#define XRegisterIMInstantiateCallback _glfw.x11.xlib.RegisterIMInstantiateCallback
+260
#define XResizeWindow _glfw.x11.xlib.ResizeWindow
+261
#define XResourceManagerString _glfw.x11.xlib.ResourceManagerString
+262
#define XSaveContext _glfw.x11.xlib.SaveContext
+263
#define XSelectInput _glfw.x11.xlib.SelectInput
+264
#define XSendEvent _glfw.x11.xlib.SendEvent
+265
#define XSetClassHint _glfw.x11.xlib.SetClassHint
+266
#define XSetErrorHandler _glfw.x11.xlib.SetErrorHandler
+267
#define XSetICFocus _glfw.x11.xlib.SetICFocus
+268
#define XSetIMValues _glfw.x11.xlib.SetIMValues
+269
#define XSetInputFocus _glfw.x11.xlib.SetInputFocus
+270
#define XSetLocaleModifiers _glfw.x11.xlib.SetLocaleModifiers
+271
#define XSetScreenSaver _glfw.x11.xlib.SetScreenSaver
+272
#define XSetSelectionOwner _glfw.x11.xlib.SetSelectionOwner
+273
#define XSetWMHints _glfw.x11.xlib.SetWMHints
+274
#define XSetWMNormalHints _glfw.x11.xlib.SetWMNormalHints
+275
#define XSetWMProtocols _glfw.x11.xlib.SetWMProtocols
+276
#define XSupportsLocale _glfw.x11.xlib.SupportsLocale
+277
#define XSync _glfw.x11.xlib.Sync
+278
#define XTranslateCoordinates _glfw.x11.xlib.TranslateCoordinates
+279
#define XUndefineCursor _glfw.x11.xlib.UndefineCursor
+280
#define XUngrabPointer _glfw.x11.xlib.UngrabPointer
+281
#define XUnmapWindow _glfw.x11.xlib.UnmapWindow
+282
#define XUnsetICFocus _glfw.x11.xlib.UnsetICFocus
+283
#define XVisualIDFromVisual _glfw.x11.xlib.VisualIDFromVisual
+284
#define XWarpPointer _glfw.x11.xlib.WarpPointer
+285
#define XkbFreeKeyboard _glfw.x11.xkb.FreeKeyboard
+286
#define XkbFreeNames _glfw.x11.xkb.FreeNames
+287
#define XkbGetMap _glfw.x11.xkb.GetMap
+288
#define XkbGetNames _glfw.x11.xkb.GetNames
+289
#define XkbGetState _glfw.x11.xkb.GetState
+290
#define XkbKeycodeToKeysym _glfw.x11.xkb.KeycodeToKeysym
+291
#define XkbQueryExtension _glfw.x11.xkb.QueryExtension
+292
#define XkbSelectEventDetails _glfw.x11.xkb.SelectEventDetails
+293
#define XkbSetDetectableAutoRepeat _glfw.x11.xkb.SetDetectableAutoRepeat
+294
#define XrmDestroyDatabase _glfw.x11.xrm.DestroyDatabase
+295
#define XrmGetResource _glfw.x11.xrm.GetResource
+296
#define XrmGetStringDatabase _glfw.x11.xrm.GetStringDatabase
+297
#define XrmUniqueQuark _glfw.x11.xrm.UniqueQuark
+298
#define XUnregisterIMInstantiateCallback _glfw.x11.xlib.UnregisterIMInstantiateCallback
+299
#define Xutf8LookupString _glfw.x11.xlib.utf8LookupString
+300
#define Xutf8SetWMProperties _glfw.x11.xlib.utf8SetWMProperties
+301
+302
typedef XRRCrtcGamma* (* PFN_XRRAllocGamma)(int);
+303
typedef void (* PFN_XRRFreeCrtcInfo)(XRRCrtcInfo*);
+304
typedef void (* PFN_XRRFreeGamma)(XRRCrtcGamma*);
+305
typedef void (* PFN_XRRFreeOutputInfo)(XRROutputInfo*);
+306
typedef void (* PFN_XRRFreeScreenResources)(XRRScreenResources*);
+307
typedef XRRCrtcGamma* (* PFN_XRRGetCrtcGamma)(Display*,RRCrtc);
+308
typedef int (* PFN_XRRGetCrtcGammaSize)(Display*,RRCrtc);
+309
typedef XRRCrtcInfo* (* PFN_XRRGetCrtcInfo) (Display*,XRRScreenResources*,RRCrtc);
+310
typedef XRROutputInfo* (* PFN_XRRGetOutputInfo)(Display*,XRRScreenResources*,RROutput);
+311
typedef RROutput (* PFN_XRRGetOutputPrimary)(Display*,Window);
+312
typedef XRRScreenResources* (* PFN_XRRGetScreenResourcesCurrent)(Display*,Window);
+313
typedef Bool (* PFN_XRRQueryExtension)(Display*,int*,int*);
+314
typedef Status (* PFN_XRRQueryVersion)(Display*,int*,int*);
+315
typedef void (* PFN_XRRSelectInput)(Display*,Window,int);
+316
typedef Status (* PFN_XRRSetCrtcConfig)(Display*,XRRScreenResources*,RRCrtc,Time,int,int,RRMode,Rotation,RROutput*,int);
+317
typedef void (* PFN_XRRSetCrtcGamma)(Display*,RRCrtc,XRRCrtcGamma*);
+318
typedef int (* PFN_XRRUpdateConfiguration)(XEvent*);
+319
#define XRRAllocGamma _glfw.x11.randr.AllocGamma
+320
#define XRRFreeCrtcInfo _glfw.x11.randr.FreeCrtcInfo
+321
#define XRRFreeGamma _glfw.x11.randr.FreeGamma
+322
#define XRRFreeOutputInfo _glfw.x11.randr.FreeOutputInfo
+323
#define XRRFreeScreenResources _glfw.x11.randr.FreeScreenResources
+324
#define XRRGetCrtcGamma _glfw.x11.randr.GetCrtcGamma
+325
#define XRRGetCrtcGammaSize _glfw.x11.randr.GetCrtcGammaSize
+326
#define XRRGetCrtcInfo _glfw.x11.randr.GetCrtcInfo
+327
#define XRRGetOutputInfo _glfw.x11.randr.GetOutputInfo
+328
#define XRRGetOutputPrimary _glfw.x11.randr.GetOutputPrimary
+329
#define XRRGetScreenResourcesCurrent _glfw.x11.randr.GetScreenResourcesCurrent
+330
#define XRRQueryExtension _glfw.x11.randr.QueryExtension
+331
#define XRRQueryVersion _glfw.x11.randr.QueryVersion
+332
#define XRRSelectInput _glfw.x11.randr.SelectInput
+333
#define XRRSetCrtcConfig _glfw.x11.randr.SetCrtcConfig
+334
#define XRRSetCrtcGamma _glfw.x11.randr.SetCrtcGamma
+335
#define XRRUpdateConfiguration _glfw.x11.randr.UpdateConfiguration
+336
+337
typedef XcursorImage* (* PFN_XcursorImageCreate)(int,int);
+338
typedef void (* PFN_XcursorImageDestroy)(XcursorImage*);
+339
typedef Cursor (* PFN_XcursorImageLoadCursor)(Display*,const XcursorImage*);
+340
typedef char* (* PFN_XcursorGetTheme)(Display*);
+341
typedef int (* PFN_XcursorGetDefaultSize)(Display*);
+342
typedef XcursorImage* (* PFN_XcursorLibraryLoadImage)(const char*,const char*,int);
+343
#define XcursorImageCreate _glfw.x11.xcursor.ImageCreate
+344
#define XcursorImageDestroy _glfw.x11.xcursor.ImageDestroy
+345
#define XcursorImageLoadCursor _glfw.x11.xcursor.ImageLoadCursor
+346
#define XcursorGetTheme _glfw.x11.xcursor.GetTheme
+347
#define XcursorGetDefaultSize _glfw.x11.xcursor.GetDefaultSize
+348
#define XcursorLibraryLoadImage _glfw.x11.xcursor.LibraryLoadImage
+349
+350
typedef Bool (* PFN_XineramaIsActive)(Display*);
+351
typedef Bool (* PFN_XineramaQueryExtension)(Display*,int*,int*);
+352
typedef XineramaScreenInfo* (* PFN_XineramaQueryScreens)(Display*,int*);
+353
#define XineramaIsActive _glfw.x11.xinerama.IsActive
+354
#define XineramaQueryExtension _glfw.x11.xinerama.QueryExtension
+355
#define XineramaQueryScreens _glfw.x11.xinerama.QueryScreens
+356
+357
typedef XID xcb_window_t;
+358
typedef XID xcb_visualid_t;
+359
typedef struct xcb_connection_t xcb_connection_t;
+360
typedef xcb_connection_t* (* PFN_XGetXCBConnection)(Display*);
+361
#define XGetXCBConnection _glfw.x11.x11xcb.GetXCBConnection
+362
+363
typedef Bool (* PFN_XF86VidModeQueryExtension)(Display*,int*,int*);
+364
typedef Bool (* PFN_XF86VidModeGetGammaRamp)(Display*,int,int,unsigned short*,unsigned short*,unsigned short*);
+365
typedef Bool (* PFN_XF86VidModeSetGammaRamp)(Display*,int,int,unsigned short*,unsigned short*,unsigned short*);
+366
typedef Bool (* PFN_XF86VidModeGetGammaRampSize)(Display*,int,int*);
+367
#define XF86VidModeQueryExtension _glfw.x11.vidmode.QueryExtension
+368
#define XF86VidModeGetGammaRamp _glfw.x11.vidmode.GetGammaRamp
+369
#define XF86VidModeSetGammaRamp _glfw.x11.vidmode.SetGammaRamp
+370
#define XF86VidModeGetGammaRampSize _glfw.x11.vidmode.GetGammaRampSize
+371
+372
typedef Status (* PFN_XIQueryVersion)(Display*,int*,int*);
+373
typedef int (* PFN_XISelectEvents)(Display*,Window,XIEventMask*,int);
+374
#define XIQueryVersion _glfw.x11.xi.QueryVersion
+375
#define XISelectEvents _glfw.x11.xi.SelectEvents
+376
+377
typedef Bool (* PFN_XRenderQueryExtension)(Display*,int*,int*);
+378
typedef Status (* PFN_XRenderQueryVersion)(Display*dpy,int*,int*);
+379
typedef XRenderPictFormat* (* PFN_XRenderFindVisualFormat)(Display*,Visual const*);
+380
#define XRenderQueryExtension _glfw.x11.xrender.QueryExtension
+381
#define XRenderQueryVersion _glfw.x11.xrender.QueryVersion
+382
#define XRenderFindVisualFormat _glfw.x11.xrender.FindVisualFormat
+383
+384
typedef Bool (* PFN_XShapeQueryExtension)(Display*,int*,int*);
+385
typedef Status (* PFN_XShapeQueryVersion)(Display*dpy,int*,int*);
+386
typedef void (* PFN_XShapeCombineRegion)(Display*,Window,int,int,int,Region,int);
+387
typedef void (* PFN_XShapeCombineMask)(Display*,Window,int,int,int,Pixmap,int);
+388
+389
#define XShapeQueryExtension _glfw.x11.xshape.QueryExtension
+390
#define XShapeQueryVersion _glfw.x11.xshape.QueryVersion
+391
#define XShapeCombineRegion _glfw.x11.xshape.ShapeCombineRegion
+392
#define XShapeCombineMask _glfw.x11.xshape.ShapeCombineMask
+393
+394
typedef int (*PFNGLXGETFBCONFIGATTRIBPROC)(Display*,GLXFBConfig,int,int*);
+395
typedef const char* (*PFNGLXGETCLIENTSTRINGPROC)(Display*,int);
+396
typedef Bool (*PFNGLXQUERYEXTENSIONPROC)(Display*,int*,int*);
+397
typedef Bool (*PFNGLXQUERYVERSIONPROC)(Display*,int*,int*);
+398
typedef void (*PFNGLXDESTROYCONTEXTPROC)(Display*,GLXContext);
+399
typedef Bool (*PFNGLXMAKECURRENTPROC)(Display*,GLXDrawable,GLXContext);
+400
typedef void (*PFNGLXSWAPBUFFERSPROC)(Display*,GLXDrawable);
+401
typedef const char* (*PFNGLXQUERYEXTENSIONSSTRINGPROC)(Display*,int);
+402
typedef GLXFBConfig* (*PFNGLXGETFBCONFIGSPROC)(Display*,int,int*);
+403
typedef GLXContext (*PFNGLXCREATENEWCONTEXTPROC)(Display*,GLXFBConfig,int,GLXContext,Bool);
+404
typedef __GLXextproc (* PFNGLXGETPROCADDRESSPROC)(const GLubyte *procName);
+405
typedef void (*PFNGLXSWAPINTERVALEXTPROC)(Display*,GLXDrawable,int);
+406
typedef XVisualInfo* (*PFNGLXGETVISUALFROMFBCONFIGPROC)(Display*,GLXFBConfig);
+407
typedef GLXWindow (*PFNGLXCREATEWINDOWPROC)(Display*,GLXFBConfig,Window,const int*);
+408
typedef void (*PFNGLXDESTROYWINDOWPROC)(Display*,GLXWindow);
+409
+410
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
+411
typedef int (*PFNGLXSWAPINTERVALSGIPROC)(int);
+412
typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display*,GLXFBConfig,GLXContext,Bool,const int*);
+413
+414
// libGL.so function pointer typedefs
+415
#define glXGetFBConfigs _glfw.glx.GetFBConfigs
+416
#define glXGetFBConfigAttrib _glfw.glx.GetFBConfigAttrib
+417
#define glXGetClientString _glfw.glx.GetClientString
+418
#define glXQueryExtension _glfw.glx.QueryExtension
+419
#define glXQueryVersion _glfw.glx.QueryVersion
+420
#define glXDestroyContext _glfw.glx.DestroyContext
+421
#define glXMakeCurrent _glfw.glx.MakeCurrent
+422
#define glXSwapBuffers _glfw.glx.SwapBuffers
+423
#define glXQueryExtensionsString _glfw.glx.QueryExtensionsString
+424
#define glXCreateNewContext _glfw.glx.CreateNewContext
+425
#define glXGetVisualFromFBConfig _glfw.glx.GetVisualFromFBConfig
+426
#define glXCreateWindow _glfw.glx.CreateWindow
+427
#define glXDestroyWindow _glfw.glx.DestroyWindow
+428
+429
typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
+430
typedef VkFlags VkXcbSurfaceCreateFlagsKHR;
+431
+432
typedef struct VkXlibSurfaceCreateInfoKHR
+433
{
+434
VkStructureType sType;
+435
const void* pNext;
+436
VkXlibSurfaceCreateFlagsKHR flags;
+437
Display* dpy;
+438
Window window;
+439
} VkXlibSurfaceCreateInfoKHR;
+440
+441
typedef struct VkXcbSurfaceCreateInfoKHR
+442
{
+443
VkStructureType sType;
+444
const void* pNext;
+445
VkXcbSurfaceCreateFlagsKHR flags;
+446
xcb_connection_t* connection;
+447
xcb_window_t window;
+448
} VkXcbSurfaceCreateInfoKHR;
+449
+450
typedef VkResult (APIENTRY *PFN_vkCreateXlibSurfaceKHR)(VkInstance,const VkXlibSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
+451
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice,uint32_t,Display*,VisualID);
+452
typedef VkResult (APIENTRY *PFN_vkCreateXcbSurfaceKHR)(VkInstance,const VkXcbSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
+453
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice,uint32_t,xcb_connection_t*,xcb_visualid_t);
+454
+455
#define GLFW_X11_WINDOW_STATE _GLFWwindowX11 x11;
+456
#define GLFW_X11_LIBRARY_WINDOW_STATE _GLFWlibraryX11 x11;
+457
#define GLFW_X11_MONITOR_STATE _GLFWmonitorX11 x11;
+458
#define GLFW_X11_CURSOR_STATE _GLFWcursorX11 x11;
+459
+460
#define GLFW_GLX_CONTEXT_STATE _GLFWcontextGLX glx;
+461
#define GLFW_GLX_LIBRARY_CONTEXT_STATE _GLFWlibraryGLX glx;
+462
+463
#define GLFW_INVALID_CODEPOINT 0xffffffffu
+464
+465
// GLX-specific per-context data
+466
//
+467
typedef struct _GLFWcontextGLX
+468
{
+469
GLXContext handle;
+470
GLXWindow window;
+471
GLXFBConfig fbconfig;
+472
} _GLFWcontextGLX;
+473
+474
// GLX-specific global data
+475
//
+476
typedef struct _GLFWlibraryGLX
+477
{
+478
int major, minor;
+479
int eventBase;
+480
int errorBase;
+481
+482
void* handle;
+483
+484
// GLX 1.3 functions
+485
PFNGLXGETFBCONFIGSPROC GetFBConfigs;
+486
PFNGLXGETFBCONFIGATTRIBPROC GetFBConfigAttrib;
+487
PFNGLXGETCLIENTSTRINGPROC GetClientString;
+488
PFNGLXQUERYEXTENSIONPROC QueryExtension;
+489
PFNGLXQUERYVERSIONPROC QueryVersion;
+490
PFNGLXDESTROYCONTEXTPROC DestroyContext;
+491
PFNGLXMAKECURRENTPROC MakeCurrent;
+492
PFNGLXSWAPBUFFERSPROC SwapBuffers;
+493
PFNGLXQUERYEXTENSIONSSTRINGPROC QueryExtensionsString;
+494
PFNGLXCREATENEWCONTEXTPROC CreateNewContext;
+495
PFNGLXGETVISUALFROMFBCONFIGPROC GetVisualFromFBConfig;
+496
PFNGLXCREATEWINDOWPROC CreateWindow;
+497
PFNGLXDESTROYWINDOWPROC DestroyWindow;
+498
+499
// GLX 1.4 and extension functions

Showing the first 500 of 1006 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/x11_window.cadded
@@ -0,0 +1,3387 @@
+1
//========================================================================
+2
// GLFW 3.5 X11 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_X11)
+31
+32
#include <X11/cursorfont.h>
+33
#include <X11/Xmd.h>
+34
+35
#include <poll.h>
+36
+37
#include <string.h>
+38
#include <stdio.h>
+39
#include <stdlib.h>
+40
#include <limits.h>
+41
#include <errno.h>
+42
#include <assert.h>
+43
+44
// Action for EWMH client messages
+45
#define _NET_WM_STATE_REMOVE 0
+46
#define _NET_WM_STATE_ADD 1
+47
#define _NET_WM_STATE_TOGGLE 2
+48
+49
// Additional mouse button names for XButtonEvent
+50
#define Button6 6
+51
#define Button7 7
+52
+53
// Motif WM hints flags
+54
#define MWM_HINTS_DECORATIONS 2
+55
#define MWM_DECOR_ALL 1
+56
+57
#define _GLFW_XDND_VERSION 5
+58
+59
// Wait for event data to arrive on the X11 display socket
+60
// This avoids blocking other threads via the per-display Xlib lock that also
+61
// covers GLX functions
+62
//
+63
static GLFWbool waitForX11Event(double* timeout)
+64
{
+65
struct pollfd fd = { ConnectionNumber(_glfw.x11.display), POLLIN };
+66
+67
while (!XPending(_glfw.x11.display))
+68
{
+69
if (!_glfwPollPOSIX(&fd, 1, timeout))
+70
return GLFW_FALSE;
+71
}
+72
+73
return GLFW_TRUE;
+74
}
+75
+76
// Wait for event data to arrive on any event file descriptor
+77
// This avoids blocking other threads via the per-display Xlib lock that also
+78
// covers GLX functions
+79
//
+80
static GLFWbool waitForAnyEvent(double* timeout)
+81
{
+82
enum { XLIB_FD, PIPE_FD, INOTIFY_FD };
+83
struct pollfd fds[] =
+84
{
+85
[XLIB_FD] = { ConnectionNumber(_glfw.x11.display), POLLIN },
+86
[PIPE_FD] = { _glfw.x11.emptyEventPipe[0], POLLIN },
+87
[INOTIFY_FD] = { -1, POLLIN }
+88
};
+89
+90
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
+91
if (_glfw.joysticksInitialized)
+92
fds[INOTIFY_FD].fd = _glfw.linjs.inotify;
+93
#endif
+94
+95
while (!XPending(_glfw.x11.display))
+96
{
+97
if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), timeout))
+98
return GLFW_FALSE;
+99
+100
for (int i = 1; i < sizeof(fds) / sizeof(fds[0]); i++)
+101
{
+102
if (fds[i].revents & POLLIN)
+103
return GLFW_TRUE;
+104
}
+105
}
+106
+107
return GLFW_TRUE;
+108
}
+109
+110
// Writes a byte to the empty event pipe
+111
//
+112
static void writeEmptyEvent(void)
+113
{
+114
for (;;)
+115
{
+116
const char byte = 0;
+117
const ssize_t result = write(_glfw.x11.emptyEventPipe[1], &byte, 1);
+118
if (result == 1 || (result == -1 && errno != EINTR))
+119
break;
+120
}
+121
}
+122
+123
// Drains available data from the empty event pipe
+124
//
+125
static void drainEmptyEvents(void)
+126
{
+127
for (;;)
+128
{
+129
char dummy[64];
+130
const ssize_t result = read(_glfw.x11.emptyEventPipe[0], dummy, sizeof(dummy));
+131
if (result == -1 && errno != EINTR)
+132
break;
+133
}
+134
}
+135
+136
// Waits until a VisibilityNotify event arrives for the specified window or the
+137
// timeout period elapses (ICCCM section 4.2.2)
+138
//
+139
static GLFWbool waitForVisibilityNotify(_GLFWwindow* window)
+140
{
+141
XEvent dummy;
+142
double timeout = 0.1;
+143
+144
while (!XCheckTypedWindowEvent(_glfw.x11.display,
+145
window->x11.handle,
+146
VisibilityNotify,
+147
&dummy))
+148
{
+149
if (!waitForX11Event(&timeout))
+150
return GLFW_FALSE;
+151
}
+152
+153
return GLFW_TRUE;
+154
}
+155
+156
// Returns whether the window is iconified
+157
//
+158
static int getWindowState(_GLFWwindow* window)
+159
{
+160
int result = WithdrawnState;
+161
struct {
+162
CARD32 state;
+163
Window icon;
+164
} *state = NULL;
+165
+166
if (_glfwGetWindowPropertyX11(window->x11.handle,
+167
_glfw.x11.WM_STATE,
+168
_glfw.x11.WM_STATE,
+169
(unsigned char**) &state) >= 2)
+170
{
+171
result = state->state;
+172
}
+173
+174
if (state)
+175
XFree(state);
+176
+177
return result;
+178
}
+179
+180
// Returns whether the event is a selection event
+181
//
+182
static Bool isSelectionEvent(Display* display, XEvent* event, XPointer pointer)
+183
{
+184
if (event->xany.window != _glfw.x11.helperWindowHandle)
+185
return False;
+186
+187
return event->type == SelectionRequest ||
+188
event->type == SelectionNotify ||
+189
event->type == SelectionClear;
+190
}
+191
+192
// Returns whether it is a _NET_FRAME_EXTENTS event for the specified window
+193
//
+194
static Bool isFrameExtentsEvent(Display* display, XEvent* event, XPointer pointer)
+195
{
+196
_GLFWwindow* window = (_GLFWwindow*) pointer;
+197
return event->type == PropertyNotify &&
+198
event->xproperty.state == PropertyNewValue &&
+199
event->xproperty.window == window->x11.handle &&
+200
event->xproperty.atom == _glfw.x11.NET_FRAME_EXTENTS;
+201
}
+202
+203
// Returns whether it is a property event for the specified selection transfer
+204
//
+205
static Bool isSelPropNewValueNotify(Display* display, XEvent* event, XPointer pointer)
+206
{
+207
XEvent* notification = (XEvent*) pointer;
+208
return event->type == PropertyNotify &&
+209
event->xproperty.state == PropertyNewValue &&
+210
event->xproperty.window == notification->xselection.requestor &&
+211
event->xproperty.atom == notification->xselection.property;
+212
}
+213
+214
// Translates an X event modifier state mask
+215
//
+216
static int translateState(int state)
+217
{
+218
int mods = 0;
+219
+220
if (state & ShiftMask)
+221
mods |= GLFW_MOD_SHIFT;
+222
if (state & ControlMask)
+223
mods |= GLFW_MOD_CONTROL;
+224
if (state & Mod1Mask)
+225
mods |= GLFW_MOD_ALT;
+226
if (state & Mod4Mask)
+227
mods |= GLFW_MOD_SUPER;
+228
if (state & LockMask)
+229
mods |= GLFW_MOD_CAPS_LOCK;
+230
if (state & Mod2Mask)
+231
mods |= GLFW_MOD_NUM_LOCK;
+232
+233
return mods;
+234
}
+235
+236
// Translates an X11 key code to a GLFW key token
+237
//
+238
static int translateKey(int scancode)
+239
{
+240
// Use the pre-filled LUT (see createKeyTables() in x11_init.c)
+241
if (scancode < 0 || scancode > 255)
+242
return GLFW_KEY_UNKNOWN;
+243
+244
return _glfw.x11.keycodes[scancode];
+245
}
+246
+247
// Sends an EWMH or ICCCM event to the window manager
+248
//
+249
static void sendEventToWM(_GLFWwindow* window, Atom type,
+250
long a, long b, long c, long d, long e)
+251
{
+252
XEvent event = { ClientMessage };
+253
event.xclient.window = window->x11.handle;
+254
event.xclient.format = 32; // Data is 32-bit longs
+255
event.xclient.message_type = type;
+256
event.xclient.data.l[0] = a;
+257
event.xclient.data.l[1] = b;
+258
event.xclient.data.l[2] = c;
+259
event.xclient.data.l[3] = d;
+260
event.xclient.data.l[4] = e;
+261
+262
XSendEvent(_glfw.x11.display, _glfw.x11.root,
+263
False,
+264
SubstructureNotifyMask | SubstructureRedirectMask,
+265
&event);
+266
}
+267
+268
// Updates the normal hints according to the window settings
+269
//
+270
static void updateNormalHints(_GLFWwindow* window, int width, int height)
+271
{
+272
XSizeHints* hints = XAllocSizeHints();
+273
+274
long supplied;
+275
XGetWMNormalHints(_glfw.x11.display, window->x11.handle, hints, &supplied);
+276
+277
hints->flags &= ~(PMinSize | PMaxSize | PAspect);
+278
+279
if (!window->monitor)
+280
{
+281
if (window->resizable)
+282
{
+283
if (window->minwidth != GLFW_DONT_CARE &&
+284
window->minheight != GLFW_DONT_CARE)
+285
{
+286
hints->flags |= PMinSize;
+287
hints->min_width = window->minwidth;
+288
hints->min_height = window->minheight;
+289
}
+290
+291
if (window->maxwidth != GLFW_DONT_CARE &&
+292
window->maxheight != GLFW_DONT_CARE)
+293
{
+294
hints->flags |= PMaxSize;
+295
hints->max_width = window->maxwidth;
+296
hints->max_height = window->maxheight;
+297
}
+298
+299
if (window->numer != GLFW_DONT_CARE &&
+300
window->denom != GLFW_DONT_CARE)
+301
{
+302
hints->flags |= PAspect;
+303
hints->min_aspect.x = hints->max_aspect.x = window->numer;
+304
hints->min_aspect.y = hints->max_aspect.y = window->denom;
+305
}
+306
}
+307
else
+308
{
+309
hints->flags |= (PMinSize | PMaxSize);
+310
hints->min_width = hints->max_width = width;
+311
hints->min_height = hints->max_height = height;
+312
}
+313
}
+314
+315
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
+316
XFree(hints);
+317
}
+318
+319
// Updates the full screen status of the window
+320
//
+321
static void updateWindowMode(_GLFWwindow* window)
+322
{
+323
if (window->monitor)
+324
{
+325
if (_glfw.x11.xinerama.available &&
+326
_glfw.x11.NET_WM_FULLSCREEN_MONITORS)
+327
{
+328
sendEventToWM(window,
+329
_glfw.x11.NET_WM_FULLSCREEN_MONITORS,
+330
window->monitor->x11.index,
+331
window->monitor->x11.index,
+332
window->monitor->x11.index,
+333
window->monitor->x11.index,
+334
0);
+335
}
+336
+337
if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN)
+338
{
+339
sendEventToWM(window,
+340
_glfw.x11.NET_WM_STATE,
+341
_NET_WM_STATE_ADD,
+342
_glfw.x11.NET_WM_STATE_FULLSCREEN,
+343
0, 1, 0);
+344
}
+345
else
+346
{
+347
// This is the butcher's way of removing window decorations
+348
// Setting the override-redirect attribute on a window makes the
+349
// window manager ignore the window completely (ICCCM, section 4)
+350
// The good thing is that this makes undecorated full screen windows
+351
// easy to do; the bad thing is that we have to do everything
+352
// manually and some things (like iconify/restore) won't work at
+353
// all, as those are tasks usually performed by the window manager
+354
+355
XSetWindowAttributes attributes;
+356
attributes.override_redirect = True;
+357
XChangeWindowAttributes(_glfw.x11.display,
+358
window->x11.handle,
+359
CWOverrideRedirect,
+360
&attributes);
+361
+362
window->x11.overrideRedirect = GLFW_TRUE;
+363
}
+364
+365
// Enable compositor bypass
+366
if (!window->x11.transparent)
+367
{
+368
const unsigned long value = 1;
+369
+370
XChangeProperty(_glfw.x11.display, window->x11.handle,
+371
_glfw.x11.NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32,
+372
PropModeReplace, (unsigned char*) &value, 1);
+373
}
+374
}
+375
else
+376
{
+377
if (_glfw.x11.xinerama.available &&
+378
_glfw.x11.NET_WM_FULLSCREEN_MONITORS)
+379
{
+380
XDeleteProperty(_glfw.x11.display, window->x11.handle,
+381
_glfw.x11.NET_WM_FULLSCREEN_MONITORS);
+382
}
+383
+384
if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN)
+385
{
+386
sendEventToWM(window,
+387
_glfw.x11.NET_WM_STATE,
+388
_NET_WM_STATE_REMOVE,
+389
_glfw.x11.NET_WM_STATE_FULLSCREEN,
+390
0, 1, 0);
+391
}
+392
else
+393
{
+394
XSetWindowAttributes attributes;
+395
attributes.override_redirect = False;
+396
XChangeWindowAttributes(_glfw.x11.display,
+397
window->x11.handle,
+398
CWOverrideRedirect,
+399
&attributes);
+400
+401
window->x11.overrideRedirect = GLFW_FALSE;
+402
}
+403
+404
// Disable compositor bypass
+405
if (!window->x11.transparent)
+406
{
+407
XDeleteProperty(_glfw.x11.display, window->x11.handle,
+408
_glfw.x11.NET_WM_BYPASS_COMPOSITOR);
+409
}
+410
}
+411
}
+412
+413
// Decode a Unicode code point from a UTF-8 stream
+414
// Based on cutef8 by Jeff Bezanson (Public Domain)
+415
//
+416
static uint32_t decodeUTF8(const char** s)
+417
{
+418
uint32_t codepoint = 0, count = 0;
+419
static const uint32_t offsets[] =
+420
{
+421
0x00000000u, 0x00003080u, 0x000e2080u,
+422
0x03c82080u, 0xfa082080u, 0x82082080u
+423
};
+424
+425
do
+426
{
+427
codepoint = (codepoint << 6) + (unsigned char) **s;
+428
(*s)++;
+429
count++;
+430
} while ((**s & 0xc0) == 0x80);
+431
+432
assert(count <= 6);
+433
return codepoint - offsets[count - 1];
+434
}
+435
+436
// Convert the specified Latin-1 string to UTF-8
+437
//
+438
static char* convertLatin1toUTF8(const char* source)
+439
{
+440
size_t size = 1;
+441
const char* sp;
+442
+443
for (sp = source; *sp; sp++)
+444
size += (*sp & 0x80) ? 2 : 1;
+445
+446
char* target = _glfw_calloc(size, 1);
+447
char* tp = target;
+448
+449
for (sp = source; *sp; sp++)
+450
tp += _glfwEncodeUTF8(tp, *sp);
+451
+452
return target;
+453
}
+454
+455
// Updates the cursor image according to its cursor mode
+456
//
+457
static void updateCursorImage(_GLFWwindow* window)
+458
{
+459
if (window->cursorMode == GLFW_CURSOR_NORMAL ||
+460
window->cursorMode == GLFW_CURSOR_CAPTURED)
+461
{
+462
if (window->cursor)
+463
{
+464
XDefineCursor(_glfw.x11.display, window->x11.handle,
+465
window->cursor->x11.handle);
+466
}
+467
else
+468
XUndefineCursor(_glfw.x11.display, window->x11.handle);
+469
}
+470
else
+471
{
+472
XDefineCursor(_glfw.x11.display, window->x11.handle,
+473
_glfw.x11.hiddenCursorHandle);
+474
}
+475
}
+476
+477
// Grabs the cursor and confines it to the window
+478
//
+479
static void captureCursor(_GLFWwindow* window)
+480
{
+481
XGrabPointer(_glfw.x11.display, window->x11.handle, True,
+482
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
+483
GrabModeAsync, GrabModeAsync,
+484
window->x11.handle,
+485
None,
+486
CurrentTime);
+487
}
+488
+489
// Ungrabs the cursor
+490
//
+491
static void releaseCursor(void)
+492
{
+493
XUngrabPointer(_glfw.x11.display, CurrentTime);
+494
}
+495
+496
// Enable XI2 raw mouse motion events
+497
//
+498
static void enableRawMouseMotion(_GLFWwindow* window)
+499
{

Showing the first 500 of 3388 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.

vendor/glfw/src/xkb_unicode.cadded
@@ -0,0 +1,943 @@
+1
//========================================================================
+2
// GLFW 3.5 X11 - www.glfw.org
+3
//------------------------------------------------------------------------
+4
// Copyright (c) 2002-2006 Marcus Geelnard
+5
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+6
//
+7
// This software is provided 'as-is', without any express or implied
+8
// warranty. In no event will the authors be held liable for any damages
+9
// arising from the use of this software.
+10
//
+11
// Permission is granted to anyone to use this software for any purpose,
+12
// including commercial applications, and to alter it and redistribute it
+13
// freely, subject to the following restrictions:
+14
//
+15
// 1. The origin of this software must not be misrepresented; you must not
+16
// claim that you wrote the original software. If you use this software
+17
// in a product, an acknowledgment in the product documentation would
+18
// be appreciated but is not required.
+19
//
+20
// 2. Altered source versions must be plainly marked as such, and must not
+21
// be misrepresented as being the original software.
+22
//
+23
// 3. This notice may not be removed or altered from any source
+24
// distribution.
+25
//
+26
//========================================================================
+27
+28
#include "internal.h"
+29
+30
#if defined(_GLFW_X11)
+31
+32
/*
+33
* Marcus: This code was originally written by Markus G. Kuhn.
+34
* I have made some slight changes (trimmed it down a bit from >60 KB to
+35
* 20 KB), but the functionality is the same.
+36
*/
+37
+38
/*
+39
* This module converts keysym values into the corresponding ISO 10646
+40
* (UCS, Unicode) values.
+41
*
+42
* The array keysymtab[] contains pairs of X11 keysym values for graphical
+43
* characters and the corresponding Unicode value. The function
+44
* _glfwKeySym2Unicode() maps a keysym onto a Unicode value using a binary
+45
* search, therefore keysymtab[] must remain SORTED by keysym value.
+46
*
+47
* We allow to represent any UCS character in the range U-00000000 to
+48
* U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff.
+49
* This admittedly does not cover the entire 31-bit space of UCS, but
+50
* it does cover all of the characters up to U-10FFFF, which can be
+51
* represented by UTF-16, and more, and it is very unlikely that higher
+52
* UCS codes will ever be assigned by ISO. So to get Unicode character
+53
* U+ABCD you can directly use keysym 0x0100abcd.
+54
*
+55
* Original author: Markus G. Kuhn <mkuhn@acm.org>, University of
+56
* Cambridge, April 2001
+57
*
+58
* Special thanks to Richard Verhoeven <river@win.tue.nl> for preparing
+59
* an initial draft of the mapping table.
+60
*
+61
*/
+62
+63
+64
//************************************************************************
+65
//**** KeySym to Unicode mapping table ****
+66
//************************************************************************
+67
+68
static const struct codepair {
+69
unsigned short keysym;
+70
unsigned short ucs;
+71
} keysymtab[] = {
+72
{ 0x01a1, 0x0104 },
+73
{ 0x01a2, 0x02d8 },
+74
{ 0x01a3, 0x0141 },
+75
{ 0x01a5, 0x013d },
+76
{ 0x01a6, 0x015a },
+77
{ 0x01a9, 0x0160 },
+78
{ 0x01aa, 0x015e },
+79
{ 0x01ab, 0x0164 },
+80
{ 0x01ac, 0x0179 },
+81
{ 0x01ae, 0x017d },
+82
{ 0x01af, 0x017b },
+83
{ 0x01b1, 0x0105 },
+84
{ 0x01b2, 0x02db },
+85
{ 0x01b3, 0x0142 },
+86
{ 0x01b5, 0x013e },
+87
{ 0x01b6, 0x015b },
+88
{ 0x01b7, 0x02c7 },
+89
{ 0x01b9, 0x0161 },
+90
{ 0x01ba, 0x015f },
+91
{ 0x01bb, 0x0165 },
+92
{ 0x01bc, 0x017a },
+93
{ 0x01bd, 0x02dd },
+94
{ 0x01be, 0x017e },
+95
{ 0x01bf, 0x017c },
+96
{ 0x01c0, 0x0154 },
+97
{ 0x01c3, 0x0102 },
+98
{ 0x01c5, 0x0139 },
+99
{ 0x01c6, 0x0106 },
+100
{ 0x01c8, 0x010c },
+101
{ 0x01ca, 0x0118 },
+102
{ 0x01cc, 0x011a },
+103
{ 0x01cf, 0x010e },
+104
{ 0x01d0, 0x0110 },
+105
{ 0x01d1, 0x0143 },
+106
{ 0x01d2, 0x0147 },
+107
{ 0x01d5, 0x0150 },
+108
{ 0x01d8, 0x0158 },
+109
{ 0x01d9, 0x016e },
+110
{ 0x01db, 0x0170 },
+111
{ 0x01de, 0x0162 },
+112
{ 0x01e0, 0x0155 },
+113
{ 0x01e3, 0x0103 },
+114
{ 0x01e5, 0x013a },
+115
{ 0x01e6, 0x0107 },
+116
{ 0x01e8, 0x010d },
+117
{ 0x01ea, 0x0119 },
+118
{ 0x01ec, 0x011b },
+119
{ 0x01ef, 0x010f },
+120
{ 0x01f0, 0x0111 },
+121
{ 0x01f1, 0x0144 },
+122
{ 0x01f2, 0x0148 },
+123
{ 0x01f5, 0x0151 },
+124
{ 0x01f8, 0x0159 },
+125
{ 0x01f9, 0x016f },
+126
{ 0x01fb, 0x0171 },
+127
{ 0x01fe, 0x0163 },
+128
{ 0x01ff, 0x02d9 },
+129
{ 0x02a1, 0x0126 },
+130
{ 0x02a6, 0x0124 },
+131
{ 0x02a9, 0x0130 },
+132
{ 0x02ab, 0x011e },
+133
{ 0x02ac, 0x0134 },
+134
{ 0x02b1, 0x0127 },
+135
{ 0x02b6, 0x0125 },
+136
{ 0x02b9, 0x0131 },
+137
{ 0x02bb, 0x011f },
+138
{ 0x02bc, 0x0135 },
+139
{ 0x02c5, 0x010a },
+140
{ 0x02c6, 0x0108 },
+141
{ 0x02d5, 0x0120 },
+142
{ 0x02d8, 0x011c },
+143
{ 0x02dd, 0x016c },
+144
{ 0x02de, 0x015c },
+145
{ 0x02e5, 0x010b },
+146
{ 0x02e6, 0x0109 },
+147
{ 0x02f5, 0x0121 },
+148
{ 0x02f8, 0x011d },
+149
{ 0x02fd, 0x016d },
+150
{ 0x02fe, 0x015d },
+151
{ 0x03a2, 0x0138 },
+152
{ 0x03a3, 0x0156 },
+153
{ 0x03a5, 0x0128 },
+154
{ 0x03a6, 0x013b },
+155
{ 0x03aa, 0x0112 },
+156
{ 0x03ab, 0x0122 },
+157
{ 0x03ac, 0x0166 },
+158
{ 0x03b3, 0x0157 },
+159
{ 0x03b5, 0x0129 },
+160
{ 0x03b6, 0x013c },
+161
{ 0x03ba, 0x0113 },
+162
{ 0x03bb, 0x0123 },
+163
{ 0x03bc, 0x0167 },
+164
{ 0x03bd, 0x014a },
+165
{ 0x03bf, 0x014b },
+166
{ 0x03c0, 0x0100 },
+167
{ 0x03c7, 0x012e },
+168
{ 0x03cc, 0x0116 },
+169
{ 0x03cf, 0x012a },
+170
{ 0x03d1, 0x0145 },
+171
{ 0x03d2, 0x014c },
+172
{ 0x03d3, 0x0136 },
+173
{ 0x03d9, 0x0172 },
+174
{ 0x03dd, 0x0168 },
+175
{ 0x03de, 0x016a },
+176
{ 0x03e0, 0x0101 },
+177
{ 0x03e7, 0x012f },
+178
{ 0x03ec, 0x0117 },
+179
{ 0x03ef, 0x012b },
+180
{ 0x03f1, 0x0146 },
+181
{ 0x03f2, 0x014d },
+182
{ 0x03f3, 0x0137 },
+183
{ 0x03f9, 0x0173 },
+184
{ 0x03fd, 0x0169 },
+185
{ 0x03fe, 0x016b },
+186
{ 0x047e, 0x203e },
+187
{ 0x04a1, 0x3002 },
+188
{ 0x04a2, 0x300c },
+189
{ 0x04a3, 0x300d },
+190
{ 0x04a4, 0x3001 },
+191
{ 0x04a5, 0x30fb },
+192
{ 0x04a6, 0x30f2 },
+193
{ 0x04a7, 0x30a1 },
+194
{ 0x04a8, 0x30a3 },
+195
{ 0x04a9, 0x30a5 },
+196
{ 0x04aa, 0x30a7 },
+197
{ 0x04ab, 0x30a9 },
+198
{ 0x04ac, 0x30e3 },
+199
{ 0x04ad, 0x30e5 },
+200
{ 0x04ae, 0x30e7 },
+201
{ 0x04af, 0x30c3 },
+202
{ 0x04b0, 0x30fc },
+203
{ 0x04b1, 0x30a2 },
+204
{ 0x04b2, 0x30a4 },
+205
{ 0x04b3, 0x30a6 },
+206
{ 0x04b4, 0x30a8 },
+207
{ 0x04b5, 0x30aa },
+208
{ 0x04b6, 0x30ab },
+209
{ 0x04b7, 0x30ad },
+210
{ 0x04b8, 0x30af },
+211
{ 0x04b9, 0x30b1 },
+212
{ 0x04ba, 0x30b3 },
+213
{ 0x04bb, 0x30b5 },
+214
{ 0x04bc, 0x30b7 },
+215
{ 0x04bd, 0x30b9 },
+216
{ 0x04be, 0x30bb },
+217
{ 0x04bf, 0x30bd },
+218
{ 0x04c0, 0x30bf },
+219
{ 0x04c1, 0x30c1 },
+220
{ 0x04c2, 0x30c4 },
+221
{ 0x04c3, 0x30c6 },
+222
{ 0x04c4, 0x30c8 },
+223
{ 0x04c5, 0x30ca },
+224
{ 0x04c6, 0x30cb },
+225
{ 0x04c7, 0x30cc },
+226
{ 0x04c8, 0x30cd },
+227
{ 0x04c9, 0x30ce },
+228
{ 0x04ca, 0x30cf },
+229
{ 0x04cb, 0x30d2 },
+230
{ 0x04cc, 0x30d5 },
+231
{ 0x04cd, 0x30d8 },
+232
{ 0x04ce, 0x30db },
+233
{ 0x04cf, 0x30de },
+234
{ 0x04d0, 0x30df },
+235
{ 0x04d1, 0x30e0 },
+236
{ 0x04d2, 0x30e1 },
+237
{ 0x04d3, 0x30e2 },
+238
{ 0x04d4, 0x30e4 },
+239
{ 0x04d5, 0x30e6 },
+240
{ 0x04d6, 0x30e8 },
+241
{ 0x04d7, 0x30e9 },
+242
{ 0x04d8, 0x30ea },
+243
{ 0x04d9, 0x30eb },
+244
{ 0x04da, 0x30ec },
+245
{ 0x04db, 0x30ed },
+246
{ 0x04dc, 0x30ef },
+247
{ 0x04dd, 0x30f3 },
+248
{ 0x04de, 0x309b },
+249
{ 0x04df, 0x309c },
+250
{ 0x05ac, 0x060c },
+251
{ 0x05bb, 0x061b },
+252
{ 0x05bf, 0x061f },
+253
{ 0x05c1, 0x0621 },
+254
{ 0x05c2, 0x0622 },
+255
{ 0x05c3, 0x0623 },
+256
{ 0x05c4, 0x0624 },
+257
{ 0x05c5, 0x0625 },
+258
{ 0x05c6, 0x0626 },
+259
{ 0x05c7, 0x0627 },
+260
{ 0x05c8, 0x0628 },
+261
{ 0x05c9, 0x0629 },
+262
{ 0x05ca, 0x062a },
+263
{ 0x05cb, 0x062b },
+264
{ 0x05cc, 0x062c },
+265
{ 0x05cd, 0x062d },
+266
{ 0x05ce, 0x062e },
+267
{ 0x05cf, 0x062f },
+268
{ 0x05d0, 0x0630 },
+269
{ 0x05d1, 0x0631 },
+270
{ 0x05d2, 0x0632 },
+271
{ 0x05d3, 0x0633 },
+272
{ 0x05d4, 0x0634 },
+273
{ 0x05d5, 0x0635 },
+274
{ 0x05d6, 0x0636 },
+275
{ 0x05d7, 0x0637 },
+276
{ 0x05d8, 0x0638 },
+277
{ 0x05d9, 0x0639 },
+278
{ 0x05da, 0x063a },
+279
{ 0x05e0, 0x0640 },
+280
{ 0x05e1, 0x0641 },
+281
{ 0x05e2, 0x0642 },
+282
{ 0x05e3, 0x0643 },
+283
{ 0x05e4, 0x0644 },
+284
{ 0x05e5, 0x0645 },
+285
{ 0x05e6, 0x0646 },
+286
{ 0x05e7, 0x0647 },
+287
{ 0x05e8, 0x0648 },
+288
{ 0x05e9, 0x0649 },
+289
{ 0x05ea, 0x064a },
+290
{ 0x05eb, 0x064b },
+291
{ 0x05ec, 0x064c },
+292
{ 0x05ed, 0x064d },
+293
{ 0x05ee, 0x064e },
+294
{ 0x05ef, 0x064f },
+295
{ 0x05f0, 0x0650 },
+296
{ 0x05f1, 0x0651 },
+297
{ 0x05f2, 0x0652 },
+298
{ 0x06a1, 0x0452 },
+299
{ 0x06a2, 0x0453 },
+300
{ 0x06a3, 0x0451 },
+301
{ 0x06a4, 0x0454 },
+302
{ 0x06a5, 0x0455 },
+303
{ 0x06a6, 0x0456 },
+304
{ 0x06a7, 0x0457 },
+305
{ 0x06a8, 0x0458 },
+306
{ 0x06a9, 0x0459 },
+307
{ 0x06aa, 0x045a },
+308
{ 0x06ab, 0x045b },
+309
{ 0x06ac, 0x045c },
+310
{ 0x06ae, 0x045e },
+311
{ 0x06af, 0x045f },
+312
{ 0x06b0, 0x2116 },
+313
{ 0x06b1, 0x0402 },
+314
{ 0x06b2, 0x0403 },
+315
{ 0x06b3, 0x0401 },
+316
{ 0x06b4, 0x0404 },
+317
{ 0x06b5, 0x0405 },
+318
{ 0x06b6, 0x0406 },
+319
{ 0x06b7, 0x0407 },
+320
{ 0x06b8, 0x0408 },
+321
{ 0x06b9, 0x0409 },
+322
{ 0x06ba, 0x040a },
+323
{ 0x06bb, 0x040b },
+324
{ 0x06bc, 0x040c },
+325
{ 0x06be, 0x040e },
+326
{ 0x06bf, 0x040f },
+327
{ 0x06c0, 0x044e },
+328
{ 0x06c1, 0x0430 },
+329
{ 0x06c2, 0x0431 },
+330
{ 0x06c3, 0x0446 },
+331
{ 0x06c4, 0x0434 },
+332
{ 0x06c5, 0x0435 },
+333
{ 0x06c6, 0x0444 },
+334
{ 0x06c7, 0x0433 },
+335
{ 0x06c8, 0x0445 },
+336
{ 0x06c9, 0x0438 },
+337
{ 0x06ca, 0x0439 },
+338
{ 0x06cb, 0x043a },
+339
{ 0x06cc, 0x043b },
+340
{ 0x06cd, 0x043c },
+341
{ 0x06ce, 0x043d },
+342
{ 0x06cf, 0x043e },
+343
{ 0x06d0, 0x043f },
+344
{ 0x06d1, 0x044f },
+345
{ 0x06d2, 0x0440 },
+346
{ 0x06d3, 0x0441 },
+347
{ 0x06d4, 0x0442 },
+348
{ 0x06d5, 0x0443 },
+349
{ 0x06d6, 0x0436 },
+350
{ 0x06d7, 0x0432 },
+351
{ 0x06d8, 0x044c },
+352
{ 0x06d9, 0x044b },
+353
{ 0x06da, 0x0437 },
+354
{ 0x06db, 0x0448 },
+355
{ 0x06dc, 0x044d },
+356
{ 0x06dd, 0x0449 },
+357
{ 0x06de, 0x0447 },
+358
{ 0x06df, 0x044a },
+359
{ 0x06e0, 0x042e },
+360
{ 0x06e1, 0x0410 },
+361
{ 0x06e2, 0x0411 },
+362
{ 0x06e3, 0x0426 },
+363
{ 0x06e4, 0x0414 },
+364
{ 0x06e5, 0x0415 },
+365
{ 0x06e6, 0x0424 },
+366
{ 0x06e7, 0x0413 },
+367
{ 0x06e8, 0x0425 },
+368
{ 0x06e9, 0x0418 },
+369
{ 0x06ea, 0x0419 },
+370
{ 0x06eb, 0x041a },
+371
{ 0x06ec, 0x041b },
+372
{ 0x06ed, 0x041c },
+373
{ 0x06ee, 0x041d },
+374
{ 0x06ef, 0x041e },
+375
{ 0x06f0, 0x041f },
+376
{ 0x06f1, 0x042f },
+377
{ 0x06f2, 0x0420 },
+378
{ 0x06f3, 0x0421 },
+379
{ 0x06f4, 0x0422 },
+380
{ 0x06f5, 0x0423 },
+381
{ 0x06f6, 0x0416 },
+382
{ 0x06f7, 0x0412 },
+383
{ 0x06f8, 0x042c },
+384
{ 0x06f9, 0x042b },
+385
{ 0x06fa, 0x0417 },
+386
{ 0x06fb, 0x0428 },
+387
{ 0x06fc, 0x042d },
+388
{ 0x06fd, 0x0429 },
+389
{ 0x06fe, 0x0427 },
+390
{ 0x06ff, 0x042a },
+391
{ 0x07a1, 0x0386 },
+392
{ 0x07a2, 0x0388 },
+393
{ 0x07a3, 0x0389 },
+394
{ 0x07a4, 0x038a },
+395
{ 0x07a5, 0x03aa },
+396
{ 0x07a7, 0x038c },
+397
{ 0x07a8, 0x038e },
+398
{ 0x07a9, 0x03ab },
+399
{ 0x07ab, 0x038f },
+400
{ 0x07ae, 0x0385 },
+401
{ 0x07af, 0x2015 },
+402
{ 0x07b1, 0x03ac },
+403
{ 0x07b2, 0x03ad },
+404
{ 0x07b3, 0x03ae },
+405
{ 0x07b4, 0x03af },
+406
{ 0x07b5, 0x03ca },
+407
{ 0x07b6, 0x0390 },
+408
{ 0x07b7, 0x03cc },
+409
{ 0x07b8, 0x03cd },
+410
{ 0x07b9, 0x03cb },
+411
{ 0x07ba, 0x03b0 },
+412
{ 0x07bb, 0x03ce },
+413
{ 0x07c1, 0x0391 },
+414
{ 0x07c2, 0x0392 },
+415
{ 0x07c3, 0x0393 },
+416
{ 0x07c4, 0x0394 },
+417
{ 0x07c5, 0x0395 },
+418
{ 0x07c6, 0x0396 },
+419
{ 0x07c7, 0x0397 },
+420
{ 0x07c8, 0x0398 },
+421
{ 0x07c9, 0x0399 },
+422
{ 0x07ca, 0x039a },
+423
{ 0x07cb, 0x039b },
+424
{ 0x07cc, 0x039c },
+425
{ 0x07cd, 0x039d },
+426
{ 0x07ce, 0x039e },
+427
{ 0x07cf, 0x039f },
+428
{ 0x07d0, 0x03a0 },
+429
{ 0x07d1, 0x03a1 },
+430
{ 0x07d2, 0x03a3 },
+431
{ 0x07d4, 0x03a4 },
+432
{ 0x07d5, 0x03a5 },
+433
{ 0x07d6, 0x03a6 },
+434
{ 0x07d7, 0x03a7 },
+435
{ 0x07d8, 0x03a8 },
+436
{ 0x07d9, 0x03a9 },
+437
{ 0x07e1, 0x03b1 },
+438
{ 0x07e2, 0x03b2 },
+439
{ 0x07e3, 0x03b3 },
+440
{ 0x07e4, 0x03b4 },
+441
{ 0x07e5, 0x03b5 },
+442
{ 0x07e6, 0x03b6 },
+443
{ 0x07e7, 0x03b7 },
+444
{ 0x07e8, 0x03b8 },
+445
{ 0x07e9, 0x03b9 },
+446
{ 0x07ea, 0x03ba },
+447
{ 0x07eb, 0x03bb },
+448
{ 0x07ec, 0x03bc },
+449
{ 0x07ed, 0x03bd },
+450
{ 0x07ee, 0x03be },
+451
{ 0x07ef, 0x03bf },
+452
{ 0x07f0, 0x03c0 },
+453
{ 0x07f1, 0x03c1 },
+454
{ 0x07f2, 0x03c3 },
+455
{ 0x07f3, 0x03c2 },
+456
{ 0x07f4, 0x03c4 },
+457
{ 0x07f5, 0x03c5 },
+458
{ 0x07f6, 0x03c6 },
+459
{ 0x07f7, 0x03c7 },
+460
{ 0x07f8, 0x03c8 },
+461
{ 0x07f9, 0x03c9 },
+462
{ 0x08a1, 0x23b7 },
+463
{ 0x08a2, 0x250c },
+464
{ 0x08a3, 0x2500 },
+465
{ 0x08a4, 0x2320 },
+466
{ 0x08a5, 0x2321 },
+467
{ 0x08a6, 0x2502 },
+468
{ 0x08a7, 0x23a1 },
+469
{ 0x08a8, 0x23a3 },
+470
{ 0x08a9, 0x23a4 },
+471
{ 0x08aa, 0x23a6 },
+472
{ 0x08ab, 0x239b },
+473
{ 0x08ac, 0x239d },
+474
{ 0x08ad, 0x239e },
+475
{ 0x08ae, 0x23a0 },
+476
{ 0x08af, 0x23a8 },
+477
{ 0x08b0, 0x23ac },
+478
{ 0x08bc, 0x2264 },
+479
{ 0x08bd, 0x2260 },
+480
{ 0x08be, 0x2265 },
+481
{ 0x08bf, 0x222b },
+482
{ 0x08c0, 0x2234 },
+483
{ 0x08c1, 0x221d },
+484
{ 0x08c2, 0x221e },
+485
{ 0x08c5, 0x2207 },
+486
{ 0x08c8, 0x223c },
+487
{ 0x08c9, 0x2243 },
+488
{ 0x08cd, 0x21d4 },
+489
{ 0x08ce, 0x21d2 },
+490
{ 0x08cf, 0x2261 },
+491
{ 0x08d6, 0x221a },
+492
{ 0x08da, 0x2282 },
+493
{ 0x08db, 0x2283 },
+494
{ 0x08dc, 0x2229 },
+495
{ 0x08dd, 0x222a },
+496
{ 0x08de, 0x2227 },
+497
{ 0x08df, 0x2228 },
+498
{ 0x08ef, 0x2202 },
+499
{ 0x08f6, 0x0192 },

Showing the first 500 of 944 diff lines for this file. This diff is INCOMPLETE; read the file or clone the repository for the rest.