glfw3.c 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/GLFW/CMakeLists.txt +368 -0
  2. package/GLFW/cocoa_init.m +694 -0
  3. package/GLFW/cocoa_joystick.h +49 -0
  4. package/GLFW/cocoa_joystick.m +485 -0
  5. package/GLFW/cocoa_monitor.m +643 -0
  6. package/GLFW/cocoa_platform.h +302 -0
  7. package/GLFW/cocoa_time.c +57 -0
  8. package/GLFW/cocoa_time.h +35 -0
  9. package/GLFW/cocoa_window.m +2072 -0
  10. package/GLFW/context.c +765 -0
  11. package/GLFW/egl_context.c +911 -0
  12. package/GLFW/glfw.rc.in +30 -0
  13. package/GLFW/glfw3.c +109 -0
  14. package/GLFW/glfw3.h +6564 -0
  15. package/GLFW/glfw3native.h +663 -0
  16. package/GLFW/glx_context.c +719 -0
  17. package/GLFW/init.c +528 -0
  18. package/GLFW/input.c +1505 -0
  19. package/GLFW/internal.h +1022 -0
  20. package/GLFW/linux_joystick.c +436 -0
  21. package/GLFW/linux_joystick.h +64 -0
  22. package/GLFW/mappings.h +1001 -0
  23. package/GLFW/mappings.h.in +82 -0
  24. package/GLFW/monitor.c +548 -0
  25. package/GLFW/nsgl_context.m +384 -0
  26. package/GLFW/null_init.c +264 -0
  27. package/GLFW/null_joystick.c +56 -0
  28. package/GLFW/null_joystick.h +32 -0
  29. package/GLFW/null_monitor.c +160 -0
  30. package/GLFW/null_platform.h +271 -0
  31. package/GLFW/null_window.c +719 -0
  32. package/GLFW/osmesa_context.c +383 -0
  33. package/GLFW/platform.c +214 -0
  34. package/GLFW/platform.h +212 -0
  35. package/GLFW/posix_module.c +53 -0
  36. package/GLFW/posix_poll.c +83 -0
  37. package/GLFW/posix_poll.h +30 -0
  38. package/GLFW/posix_thread.c +107 -0
  39. package/GLFW/posix_thread.h +49 -0
  40. package/GLFW/posix_time.c +65 -0
  41. package/GLFW/posix_time.h +41 -0
  42. package/GLFW/vulkan.c +328 -0
  43. package/GLFW/wgl_context.c +798 -0
  44. package/GLFW/win32_init.c +731 -0
  45. package/GLFW/win32_joystick.c +767 -0
  46. package/GLFW/win32_joystick.h +51 -0
  47. package/GLFW/win32_module.c +51 -0
  48. package/GLFW/win32_monitor.c +569 -0
  49. package/GLFW/win32_platform.h +631 -0
  50. package/GLFW/win32_thread.c +100 -0
  51. package/GLFW/win32_thread.h +53 -0
  52. package/GLFW/win32_time.c +54 -0
  53. package/GLFW/win32_time.h +43 -0
  54. package/GLFW/win32_window.c +2592 -0
  55. package/GLFW/window.c +1172 -0
  56. package/GLFW/wl_init.c +1003 -0
  57. package/GLFW/wl_monitor.c +274 -0
  58. package/GLFW/wl_platform.h +691 -0
  59. package/GLFW/wl_window.c +3308 -0
  60. package/GLFW/x11_init.c +1656 -0
  61. package/GLFW/x11_monitor.c +641 -0
  62. package/GLFW/x11_platform.h +1004 -0
  63. package/GLFW/x11_window.c +3357 -0
  64. package/GLFW/xkb_unicode.c +943 -0
  65. package/GLFW/xkb_unicode.h +30 -0
  66. package/LICENSE +22 -0
  67. package/README.md +236 -0
  68. package/package.json +32 -0
@@ -0,0 +1,384 @@
1
+ //========================================================================
2
+ // GLFW 3.4 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
+
34
+ static void makeContextCurrentNSGL(_GLFWwindow* window)
35
+ {
36
+ @autoreleasepool {
37
+
38
+ if (window)
39
+ [window->context.nsgl.object makeCurrentContext];
40
+ else
41
+ [NSOpenGLContext clearCurrentContext];
42
+
43
+ _glfwPlatformSetTls(&_glfw.contextSlot, window);
44
+
45
+ } // autoreleasepool
46
+ }
47
+
48
+ static void swapBuffersNSGL(_GLFWwindow* window)
49
+ {
50
+ @autoreleasepool {
51
+
52
+ // HACK: Simulate vsync with usleep as NSGL swap interval does not apply to
53
+ // windows with a non-visible occlusion state
54
+ if (window->ns.occluded)
55
+ {
56
+ int interval = 0;
57
+ [window->context.nsgl.object getValues:&interval
58
+ forParameter:NSOpenGLContextParameterSwapInterval];
59
+
60
+ if (interval > 0)
61
+ {
62
+ const double framerate = 60.0;
63
+ const uint64_t frequency = _glfwPlatformGetTimerFrequency();
64
+ const uint64_t value = _glfwPlatformGetTimerValue();
65
+
66
+ const double elapsed = value / (double) frequency;
67
+ const double period = 1.0 / framerate;
68
+ const double delay = period - fmod(elapsed, period);
69
+
70
+ usleep(floorl(delay * 1e6));
71
+ }
72
+ }
73
+
74
+ [window->context.nsgl.object flushBuffer];
75
+
76
+ } // autoreleasepool
77
+ }
78
+
79
+ static void swapIntervalNSGL(int interval)
80
+ {
81
+ @autoreleasepool {
82
+
83
+ _GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
84
+ assert(window != NULL);
85
+
86
+ [window->context.nsgl.object setValues:&interval
87
+ forParameter:NSOpenGLContextParameterSwapInterval];
88
+
89
+ } // autoreleasepool
90
+ }
91
+
92
+ static int extensionSupportedNSGL(const char* extension)
93
+ {
94
+ // There are no NSGL extensions
95
+ return GLFW_FALSE;
96
+ }
97
+
98
+ static GLFWglproc getProcAddressNSGL(const char* procname)
99
+ {
100
+ CFStringRef symbolName = CFStringCreateWithCString(kCFAllocatorDefault,
101
+ procname,
102
+ kCFStringEncodingASCII);
103
+
104
+ GLFWglproc symbol = CFBundleGetFunctionPointerForName(_glfw.nsgl.framework,
105
+ symbolName);
106
+
107
+ CFRelease(symbolName);
108
+
109
+ return symbol;
110
+ }
111
+
112
+ static void destroyContextNSGL(_GLFWwindow* window)
113
+ {
114
+ @autoreleasepool {
115
+
116
+ [window->context.nsgl.pixelFormat release];
117
+ window->context.nsgl.pixelFormat = nil;
118
+
119
+ [window->context.nsgl.object release];
120
+ window->context.nsgl.object = nil;
121
+
122
+ } // autoreleasepool
123
+ }
124
+
125
+
126
+ //////////////////////////////////////////////////////////////////////////
127
+ ////// GLFW internal API //////
128
+ //////////////////////////////////////////////////////////////////////////
129
+
130
+ // Initialize OpenGL support
131
+ //
132
+ GLFWbool _glfwInitNSGL(void)
133
+ {
134
+ if (_glfw.nsgl.framework)
135
+ return GLFW_TRUE;
136
+
137
+ _glfw.nsgl.framework =
138
+ CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
139
+ if (_glfw.nsgl.framework == NULL)
140
+ {
141
+ _glfwInputError(GLFW_API_UNAVAILABLE,
142
+ "NSGL: Failed to locate OpenGL framework");
143
+ return GLFW_FALSE;
144
+ }
145
+
146
+ return GLFW_TRUE;
147
+ }
148
+
149
+ // Terminate OpenGL support
150
+ //
151
+ void _glfwTerminateNSGL(void)
152
+ {
153
+ }
154
+
155
+ // Create the OpenGL context
156
+ //
157
+ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
158
+ const _GLFWctxconfig* ctxconfig,
159
+ const _GLFWfbconfig* fbconfig)
160
+ {
161
+ if (ctxconfig->client == GLFW_OPENGL_ES_API)
162
+ {
163
+ _glfwInputError(GLFW_API_UNAVAILABLE,
164
+ "NSGL: OpenGL ES is not available via NSGL");
165
+ return GLFW_FALSE;
166
+ }
167
+
168
+ if (ctxconfig->major > 2)
169
+ {
170
+ if (ctxconfig->major == 3 && ctxconfig->minor < 2)
171
+ {
172
+ _glfwInputError(GLFW_VERSION_UNAVAILABLE,
173
+ "NSGL: The targeted version of macOS does not support OpenGL 3.0 or 3.1 but may support 3.2 and above");
174
+ return GLFW_FALSE;
175
+ }
176
+ }
177
+
178
+ if (ctxconfig->major >= 3 && ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
179
+ {
180
+ _glfwInputError(GLFW_VERSION_UNAVAILABLE,
181
+ "NSGL: The compatibility profile is not available on macOS");
182
+ return GLFW_FALSE;
183
+ }
184
+
185
+ // Context robustness modes (GL_KHR_robustness) are not yet supported by
186
+ // macOS but are not a hard constraint, so ignore and continue
187
+
188
+ // Context release behaviors (GL_KHR_context_flush_control) are not yet
189
+ // supported by macOS but are not a hard constraint, so ignore and continue
190
+
191
+ // Debug contexts (GL_KHR_debug) are not yet supported by macOS but are not
192
+ // a hard constraint, so ignore and continue
193
+
194
+ // No-error contexts (GL_KHR_no_error) are not yet supported by macOS but
195
+ // are not a hard constraint, so ignore and continue
196
+
197
+ #define ADD_ATTRIB(a) \
198
+ { \
199
+ assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \
200
+ attribs[index++] = a; \
201
+ }
202
+ #define SET_ATTRIB(a, v) { ADD_ATTRIB(a); ADD_ATTRIB(v); }
203
+
204
+ NSOpenGLPixelFormatAttribute attribs[40];
205
+ int index = 0;
206
+
207
+ ADD_ATTRIB(NSOpenGLPFAAccelerated);
208
+ ADD_ATTRIB(NSOpenGLPFAClosestPolicy);
209
+
210
+ if (ctxconfig->nsgl.offline)
211
+ {
212
+ ADD_ATTRIB(NSOpenGLPFAAllowOfflineRenderers);
213
+ // NOTE: This replaces the NSSupportsAutomaticGraphicsSwitching key in
214
+ // Info.plist for unbundled applications
215
+ // HACK: This assumes that NSOpenGLPixelFormat will remain
216
+ // a straightforward wrapper of its CGL counterpart
217
+ ADD_ATTRIB(kCGLPFASupportsAutomaticGraphicsSwitching);
218
+ }
219
+
220
+ #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
221
+ if (ctxconfig->major >= 4)
222
+ {
223
+ SET_ATTRIB(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core);
224
+ }
225
+ else
226
+ #endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
227
+ if (ctxconfig->major >= 3)
228
+ {
229
+ SET_ATTRIB(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
230
+ }
231
+
232
+ if (ctxconfig->major <= 2)
233
+ {
234
+ if (fbconfig->auxBuffers != GLFW_DONT_CARE)
235
+ SET_ATTRIB(NSOpenGLPFAAuxBuffers, fbconfig->auxBuffers);
236
+
237
+ if (fbconfig->accumRedBits != GLFW_DONT_CARE &&
238
+ fbconfig->accumGreenBits != GLFW_DONT_CARE &&
239
+ fbconfig->accumBlueBits != GLFW_DONT_CARE &&
240
+ fbconfig->accumAlphaBits != GLFW_DONT_CARE)
241
+ {
242
+ const int accumBits = fbconfig->accumRedBits +
243
+ fbconfig->accumGreenBits +
244
+ fbconfig->accumBlueBits +
245
+ fbconfig->accumAlphaBits;
246
+
247
+ SET_ATTRIB(NSOpenGLPFAAccumSize, accumBits);
248
+ }
249
+ }
250
+
251
+ if (fbconfig->redBits != GLFW_DONT_CARE &&
252
+ fbconfig->greenBits != GLFW_DONT_CARE &&
253
+ fbconfig->blueBits != GLFW_DONT_CARE)
254
+ {
255
+ int colorBits = fbconfig->redBits +
256
+ fbconfig->greenBits +
257
+ fbconfig->blueBits;
258
+
259
+ // macOS needs non-zero color size, so set reasonable values
260
+ if (colorBits == 0)
261
+ colorBits = 24;
262
+ else if (colorBits < 15)
263
+ colorBits = 15;
264
+
265
+ SET_ATTRIB(NSOpenGLPFAColorSize, colorBits);
266
+ }
267
+
268
+ if (fbconfig->alphaBits != GLFW_DONT_CARE)
269
+ SET_ATTRIB(NSOpenGLPFAAlphaSize, fbconfig->alphaBits);
270
+
271
+ if (fbconfig->depthBits != GLFW_DONT_CARE)
272
+ SET_ATTRIB(NSOpenGLPFADepthSize, fbconfig->depthBits);
273
+
274
+ if (fbconfig->stencilBits != GLFW_DONT_CARE)
275
+ SET_ATTRIB(NSOpenGLPFAStencilSize, fbconfig->stencilBits);
276
+
277
+ if (fbconfig->stereo)
278
+ {
279
+ #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
280
+ _glfwInputError(GLFW_FORMAT_UNAVAILABLE,
281
+ "NSGL: Stereo rendering is deprecated");
282
+ return GLFW_FALSE;
283
+ #else
284
+ ADD_ATTRIB(NSOpenGLPFAStereo);
285
+ #endif
286
+ }
287
+
288
+ if (fbconfig->doublebuffer)
289
+ ADD_ATTRIB(NSOpenGLPFADoubleBuffer);
290
+
291
+ if (fbconfig->samples != GLFW_DONT_CARE)
292
+ {
293
+ if (fbconfig->samples == 0)
294
+ {
295
+ SET_ATTRIB(NSOpenGLPFASampleBuffers, 0);
296
+ }
297
+ else
298
+ {
299
+ SET_ATTRIB(NSOpenGLPFASampleBuffers, 1);
300
+ SET_ATTRIB(NSOpenGLPFASamples, fbconfig->samples);
301
+ }
302
+ }
303
+
304
+ // NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB
305
+ // framebuffer, so there's no need (and no way) to request it
306
+
307
+ ADD_ATTRIB(0);
308
+
309
+ #undef ADD_ATTRIB
310
+ #undef SET_ATTRIB
311
+
312
+ window->context.nsgl.pixelFormat =
313
+ [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
314
+ if (window->context.nsgl.pixelFormat == nil)
315
+ {
316
+ _glfwInputError(GLFW_FORMAT_UNAVAILABLE,
317
+ "NSGL: Failed to find a suitable pixel format");
318
+ return GLFW_FALSE;
319
+ }
320
+
321
+ NSOpenGLContext* share = nil;
322
+
323
+ if (ctxconfig->share)
324
+ share = ctxconfig->share->context.nsgl.object;
325
+
326
+ window->context.nsgl.object =
327
+ [[NSOpenGLContext alloc] initWithFormat:window->context.nsgl.pixelFormat
328
+ shareContext:share];
329
+ if (window->context.nsgl.object == nil)
330
+ {
331
+ _glfwInputError(GLFW_VERSION_UNAVAILABLE,
332
+ "NSGL: Failed to create OpenGL context");
333
+ return GLFW_FALSE;
334
+ }
335
+
336
+ if (fbconfig->transparent)
337
+ {
338
+ GLint opaque = 0;
339
+ [window->context.nsgl.object setValues:&opaque
340
+ forParameter:NSOpenGLContextParameterSurfaceOpacity];
341
+ }
342
+
343
+ [window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.scaleFramebuffer];
344
+
345
+ [window->context.nsgl.object setView:window->ns.view];
346
+
347
+ window->context.makeCurrent = makeContextCurrentNSGL;
348
+ window->context.swapBuffers = swapBuffersNSGL;
349
+ window->context.swapInterval = swapIntervalNSGL;
350
+ window->context.extensionSupported = extensionSupportedNSGL;
351
+ window->context.getProcAddress = getProcAddressNSGL;
352
+ window->context.destroy = destroyContextNSGL;
353
+
354
+ return GLFW_TRUE;
355
+ }
356
+
357
+
358
+ //////////////////////////////////////////////////////////////////////////
359
+ ////// GLFW native API //////
360
+ //////////////////////////////////////////////////////////////////////////
361
+
362
+ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
363
+ {
364
+ _GLFWwindow* window = (_GLFWwindow*) handle;
365
+ _GLFW_REQUIRE_INIT_OR_RETURN(nil);
366
+
367
+ if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
368
+ {
369
+ _glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
370
+ "NSGL: Platform not initialized");
371
+ return nil;
372
+ }
373
+
374
+ if (window->context.source != GLFW_NATIVE_CONTEXT_API)
375
+ {
376
+ _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
377
+ return nil;
378
+ }
379
+
380
+ return window->context.nsgl.object;
381
+ }
382
+
383
+ #endif // _GLFW_COCOA
384
+
@@ -0,0 +1,264 @@
1
+ //========================================================================
2
+ // GLFW 3.4 - 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
+ }
264
+