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,631 @@
1
+ //========================================================================
2
+ // GLFW 3.4 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
+ #pragma once
28
+
29
+ // We don't need all the fancy stuff
30
+ #ifndef NOMINMAX
31
+ #define NOMINMAX
32
+ #endif
33
+
34
+ #ifndef VC_EXTRALEAN
35
+ #define VC_EXTRALEAN
36
+ #endif
37
+
38
+ #ifndef WIN32_LEAN_AND_MEAN
39
+ #define WIN32_LEAN_AND_MEAN
40
+ #endif
41
+
42
+ // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
43
+ // example to allow applications to correctly declare a GL_KHR_debug callback)
44
+ // but windows.h assumes no one will define APIENTRY before it does
45
+ #undef APIENTRY
46
+
47
+ // GLFW on Windows is Unicode only and does not work in MBCS mode
48
+ #ifndef UNICODE
49
+ #define UNICODE
50
+ #endif
51
+
52
+ // GLFW requires Windows XP or later
53
+ #if WINVER < 0x0501
54
+ #undef WINVER
55
+ #define WINVER 0x0501
56
+ #endif
57
+ #if _WIN32_WINNT < 0x0501
58
+ #undef _WIN32_WINNT
59
+ #define _WIN32_WINNT 0x0501
60
+ #endif
61
+
62
+ // GLFW uses DirectInput8 interfaces
63
+ #define DIRECTINPUT_VERSION 0x0800
64
+
65
+ // GLFW uses OEM cursor resources
66
+ #define OEMRESOURCE
67
+
68
+ #include <wctype.h>
69
+ #include <windows.h>
70
+ #include <dinput.h>
71
+ #include <xinput.h>
72
+ #include <dbt.h>
73
+
74
+ #ifndef APIENTRY
75
+ #define APIENTRY __stdcall
76
+ #endif
77
+
78
+ // HACK: Define macros that some windows.h variants don't
79
+ #ifndef WM_MOUSEHWHEEL
80
+ #define WM_MOUSEHWHEEL 0x020E
81
+ #endif
82
+ #ifndef WM_DWMCOMPOSITIONCHANGED
83
+ #define WM_DWMCOMPOSITIONCHANGED 0x031E
84
+ #endif
85
+ #ifndef WM_DWMCOLORIZATIONCOLORCHANGED
86
+ #define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320
87
+ #endif
88
+ #ifndef WM_COPYGLOBALDATA
89
+ #define WM_COPYGLOBALDATA 0x0049
90
+ #endif
91
+ #ifndef WM_UNICHAR
92
+ #define WM_UNICHAR 0x0109
93
+ #endif
94
+ #ifndef UNICODE_NOCHAR
95
+ #define UNICODE_NOCHAR 0xFFFF
96
+ #endif
97
+ #ifndef WM_DPICHANGED
98
+ #define WM_DPICHANGED 0x02E0
99
+ #endif
100
+ #ifndef GET_XBUTTON_WPARAM
101
+ #define GET_XBUTTON_WPARAM(w) (HIWORD(w))
102
+ #endif
103
+ #ifndef EDS_ROTATEDMODE
104
+ #define EDS_ROTATEDMODE 0x00000004
105
+ #endif
106
+ #ifndef DISPLAY_DEVICE_ACTIVE
107
+ #define DISPLAY_DEVICE_ACTIVE 0x00000001
108
+ #endif
109
+ #ifndef _WIN32_WINNT_WINBLUE
110
+ #define _WIN32_WINNT_WINBLUE 0x0603
111
+ #endif
112
+ #ifndef _WIN32_WINNT_WIN8
113
+ #define _WIN32_WINNT_WIN8 0x0602
114
+ #endif
115
+ #ifndef WM_GETDPISCALEDSIZE
116
+ #define WM_GETDPISCALEDSIZE 0x02e4
117
+ #endif
118
+ #ifndef USER_DEFAULT_SCREEN_DPI
119
+ #define USER_DEFAULT_SCREEN_DPI 96
120
+ #endif
121
+ #ifndef OCR_HAND
122
+ #define OCR_HAND 32649
123
+ #endif
124
+
125
+ #if WINVER < 0x0601
126
+ typedef struct
127
+ {
128
+ DWORD cbSize;
129
+ DWORD ExtStatus;
130
+ } CHANGEFILTERSTRUCT;
131
+ #ifndef MSGFLT_ALLOW
132
+ #define MSGFLT_ALLOW 1
133
+ #endif
134
+ #endif /*Windows 7*/
135
+
136
+ #if WINVER < 0x0600
137
+ #define DWM_BB_ENABLE 0x00000001
138
+ #define DWM_BB_BLURREGION 0x00000002
139
+ typedef struct
140
+ {
141
+ DWORD dwFlags;
142
+ BOOL fEnable;
143
+ HRGN hRgnBlur;
144
+ BOOL fTransitionOnMaximized;
145
+ } DWM_BLURBEHIND;
146
+ #else
147
+ #include <dwmapi.h>
148
+ #endif /*Windows Vista*/
149
+
150
+ #ifndef DPI_ENUMS_DECLARED
151
+ typedef enum
152
+ {
153
+ PROCESS_DPI_UNAWARE = 0,
154
+ PROCESS_SYSTEM_DPI_AWARE = 1,
155
+ PROCESS_PER_MONITOR_DPI_AWARE = 2
156
+ } PROCESS_DPI_AWARENESS;
157
+ typedef enum
158
+ {
159
+ MDT_EFFECTIVE_DPI = 0,
160
+ MDT_ANGULAR_DPI = 1,
161
+ MDT_RAW_DPI = 2,
162
+ MDT_DEFAULT = MDT_EFFECTIVE_DPI
163
+ } MONITOR_DPI_TYPE;
164
+ #endif /*DPI_ENUMS_DECLARED*/
165
+
166
+ #ifndef DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
167
+ #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((HANDLE) -4)
168
+ #endif /*DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2*/
169
+
170
+ // Replacement for versionhelpers.h macros, as we cannot rely on the
171
+ // application having a correct embedded manifest
172
+ //
173
+ #define IsWindowsVistaOrGreater() \
174
+ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_VISTA), \
175
+ LOBYTE(_WIN32_WINNT_VISTA), 0)
176
+ #define IsWindows7OrGreater() \
177
+ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WIN7), \
178
+ LOBYTE(_WIN32_WINNT_WIN7), 0)
179
+ #define IsWindows8OrGreater() \
180
+ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WIN8), \
181
+ LOBYTE(_WIN32_WINNT_WIN8), 0)
182
+ #define IsWindows8Point1OrGreater() \
183
+ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINBLUE), \
184
+ LOBYTE(_WIN32_WINNT_WINBLUE), 0)
185
+
186
+ // Windows 10 Anniversary Update
187
+ #define _glfwIsWindows10Version1607OrGreaterWin32() \
188
+ _glfwIsWindows10BuildOrGreaterWin32(14393)
189
+ // Windows 10 Creators Update
190
+ #define _glfwIsWindows10Version1703OrGreaterWin32() \
191
+ _glfwIsWindows10BuildOrGreaterWin32(15063)
192
+
193
+ // HACK: Define macros that some xinput.h variants don't
194
+ #ifndef XINPUT_CAPS_WIRELESS
195
+ #define XINPUT_CAPS_WIRELESS 0x0002
196
+ #endif
197
+ #ifndef XINPUT_DEVSUBTYPE_WHEEL
198
+ #define XINPUT_DEVSUBTYPE_WHEEL 0x02
199
+ #endif
200
+ #ifndef XINPUT_DEVSUBTYPE_ARCADE_STICK
201
+ #define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
202
+ #endif
203
+ #ifndef XINPUT_DEVSUBTYPE_FLIGHT_STICK
204
+ #define XINPUT_DEVSUBTYPE_FLIGHT_STICK 0x04
205
+ #endif
206
+ #ifndef XINPUT_DEVSUBTYPE_DANCE_PAD
207
+ #define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
208
+ #endif
209
+ #ifndef XINPUT_DEVSUBTYPE_GUITAR
210
+ #define XINPUT_DEVSUBTYPE_GUITAR 0x06
211
+ #endif
212
+ #ifndef XINPUT_DEVSUBTYPE_DRUM_KIT
213
+ #define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
214
+ #endif
215
+ #ifndef XINPUT_DEVSUBTYPE_ARCADE_PAD
216
+ #define XINPUT_DEVSUBTYPE_ARCADE_PAD 0x13
217
+ #endif
218
+ #ifndef XUSER_MAX_COUNT
219
+ #define XUSER_MAX_COUNT 4
220
+ #endif
221
+
222
+ // HACK: Define macros that some dinput.h variants don't
223
+ #ifndef DIDFT_OPTIONAL
224
+ #define DIDFT_OPTIONAL 0x80000000
225
+ #endif
226
+
227
+ #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
228
+ #define WGL_SUPPORT_OPENGL_ARB 0x2010
229
+ #define WGL_DRAW_TO_WINDOW_ARB 0x2001
230
+ #define WGL_PIXEL_TYPE_ARB 0x2013
231
+ #define WGL_TYPE_RGBA_ARB 0x202b
232
+ #define WGL_ACCELERATION_ARB 0x2003
233
+ #define WGL_NO_ACCELERATION_ARB 0x2025
234
+ #define WGL_RED_BITS_ARB 0x2015
235
+ #define WGL_RED_SHIFT_ARB 0x2016
236
+ #define WGL_GREEN_BITS_ARB 0x2017
237
+ #define WGL_GREEN_SHIFT_ARB 0x2018
238
+ #define WGL_BLUE_BITS_ARB 0x2019
239
+ #define WGL_BLUE_SHIFT_ARB 0x201a
240
+ #define WGL_ALPHA_BITS_ARB 0x201b
241
+ #define WGL_ALPHA_SHIFT_ARB 0x201c
242
+ #define WGL_ACCUM_BITS_ARB 0x201d
243
+ #define WGL_ACCUM_RED_BITS_ARB 0x201e
244
+ #define WGL_ACCUM_GREEN_BITS_ARB 0x201f
245
+ #define WGL_ACCUM_BLUE_BITS_ARB 0x2020
246
+ #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
247
+ #define WGL_DEPTH_BITS_ARB 0x2022
248
+ #define WGL_STENCIL_BITS_ARB 0x2023
249
+ #define WGL_AUX_BUFFERS_ARB 0x2024
250
+ #define WGL_STEREO_ARB 0x2012
251
+ #define WGL_DOUBLE_BUFFER_ARB 0x2011
252
+ #define WGL_SAMPLES_ARB 0x2042
253
+ #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20a9
254
+ #define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
255
+ #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
256
+ #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
257
+ #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
258
+ #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
259
+ #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
260
+ #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
261
+ #define WGL_CONTEXT_FLAGS_ARB 0x2094
262
+ #define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
263
+ #define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
264
+ #define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
265
+ #define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
266
+ #define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
267
+ #define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
268
+ #define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
269
+ #define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
270
+ #define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3
271
+ #define WGL_COLORSPACE_EXT 0x309d
272
+ #define WGL_COLORSPACE_SRGB_EXT 0x3089
273
+
274
+ #define ERROR_INVALID_VERSION_ARB 0x2095
275
+ #define ERROR_INVALID_PROFILE_ARB 0x2096
276
+ #define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
277
+
278
+ // xinput.dll function pointer typedefs
279
+ typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*);
280
+ typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*);
281
+ #define XInputGetCapabilities _glfw.win32.xinput.GetCapabilities
282
+ #define XInputGetState _glfw.win32.xinput.GetState
283
+
284
+ // dinput8.dll function pointer typedefs
285
+ typedef HRESULT (WINAPI * PFN_DirectInput8Create)(HINSTANCE,DWORD,REFIID,LPVOID*,LPUNKNOWN);
286
+ #define DirectInput8Create _glfw.win32.dinput8.Create
287
+
288
+ // user32.dll function pointer typedefs
289
+ typedef BOOL (WINAPI * PFN_SetProcessDPIAware)(void);
290
+ typedef BOOL (WINAPI * PFN_ChangeWindowMessageFilterEx)(HWND,UINT,DWORD,CHANGEFILTERSTRUCT*);
291
+ typedef BOOL (WINAPI * PFN_EnableNonClientDpiScaling)(HWND);
292
+ typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE);
293
+ typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND);
294
+ typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT);
295
+ typedef int (WINAPI * PFN_GetSystemMetricsForDpi)(int,UINT);
296
+ #define SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware_
297
+ #define ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx_
298
+ #define EnableNonClientDpiScaling _glfw.win32.user32.EnableNonClientDpiScaling_
299
+ #define SetProcessDpiAwarenessContext _glfw.win32.user32.SetProcessDpiAwarenessContext_
300
+ #define GetDpiForWindow _glfw.win32.user32.GetDpiForWindow_
301
+ #define AdjustWindowRectExForDpi _glfw.win32.user32.AdjustWindowRectExForDpi_
302
+ #define GetSystemMetricsForDpi _glfw.win32.user32.GetSystemMetricsForDpi_
303
+
304
+ // dwmapi.dll function pointer typedefs
305
+ typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*);
306
+ typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID);
307
+ typedef HRESULT(WINAPI * PFN_DwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*);
308
+ typedef HRESULT (WINAPI * PFN_DwmGetColorizationColor)(DWORD*,BOOL*);
309
+ #define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled
310
+ #define DwmFlush _glfw.win32.dwmapi.Flush
311
+ #define DwmEnableBlurBehindWindow _glfw.win32.dwmapi.EnableBlurBehindWindow
312
+ #define DwmGetColorizationColor _glfw.win32.dwmapi.GetColorizationColor
313
+
314
+ // shcore.dll function pointer typedefs
315
+ typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);
316
+ typedef HRESULT (WINAPI * PFN_GetDpiForMonitor)(HMONITOR,MONITOR_DPI_TYPE,UINT*,UINT*);
317
+ #define SetProcessDpiAwareness _glfw.win32.shcore.SetProcessDpiAwareness_
318
+ #define GetDpiForMonitor _glfw.win32.shcore.GetDpiForMonitor_
319
+
320
+ // ntdll.dll function pointer typedefs
321
+ typedef LONG (WINAPI * PFN_RtlVerifyVersionInfo)(OSVERSIONINFOEXW*,ULONG,ULONGLONG);
322
+ #define RtlVerifyVersionInfo _glfw.win32.ntdll.RtlVerifyVersionInfo_
323
+
324
+ // WGL extension pointer typedefs
325
+ typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int);
326
+ typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*);
327
+ typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void);
328
+ typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC);
329
+ typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*);
330
+ #define wglSwapIntervalEXT _glfw.wgl.SwapIntervalEXT
331
+ #define wglGetPixelFormatAttribivARB _glfw.wgl.GetPixelFormatAttribivARB
332
+ #define wglGetExtensionsStringEXT _glfw.wgl.GetExtensionsStringEXT
333
+ #define wglGetExtensionsStringARB _glfw.wgl.GetExtensionsStringARB
334
+ #define wglCreateContextAttribsARB _glfw.wgl.CreateContextAttribsARB
335
+
336
+ // opengl32.dll function pointer typedefs
337
+ typedef HGLRC (WINAPI * PFN_wglCreateContext)(HDC);
338
+ typedef BOOL (WINAPI * PFN_wglDeleteContext)(HGLRC);
339
+ typedef PROC (WINAPI * PFN_wglGetProcAddress)(LPCSTR);
340
+ typedef HDC (WINAPI * PFN_wglGetCurrentDC)(void);
341
+ typedef HGLRC (WINAPI * PFN_wglGetCurrentContext)(void);
342
+ typedef BOOL (WINAPI * PFN_wglMakeCurrent)(HDC,HGLRC);
343
+ typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC);
344
+ #define wglCreateContext _glfw.wgl.CreateContext
345
+ #define wglDeleteContext _glfw.wgl.DeleteContext
346
+ #define wglGetProcAddress _glfw.wgl.GetProcAddress
347
+ #define wglGetCurrentDC _glfw.wgl.GetCurrentDC
348
+ #define wglGetCurrentContext _glfw.wgl.GetCurrentContext
349
+ #define wglMakeCurrent _glfw.wgl.MakeCurrent
350
+ #define wglShareLists _glfw.wgl.ShareLists
351
+
352
+ typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
353
+
354
+ typedef struct VkWin32SurfaceCreateInfoKHR
355
+ {
356
+ VkStructureType sType;
357
+ const void* pNext;
358
+ VkWin32SurfaceCreateFlagsKHR flags;
359
+ HINSTANCE hinstance;
360
+ HWND hwnd;
361
+ } VkWin32SurfaceCreateInfoKHR;
362
+
363
+ typedef VkResult (APIENTRY *PFN_vkCreateWin32SurfaceKHR)(VkInstance,const VkWin32SurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
364
+ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice,uint32_t);
365
+
366
+ #define GLFW_WIN32_WINDOW_STATE _GLFWwindowWin32 win32;
367
+ #define GLFW_WIN32_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32;
368
+ #define GLFW_WIN32_MONITOR_STATE _GLFWmonitorWin32 win32;
369
+ #define GLFW_WIN32_CURSOR_STATE _GLFWcursorWin32 win32;
370
+
371
+ #define GLFW_WGL_CONTEXT_STATE _GLFWcontextWGL wgl;
372
+ #define GLFW_WGL_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl;
373
+
374
+
375
+ // WGL-specific per-context data
376
+ //
377
+ typedef struct _GLFWcontextWGL
378
+ {
379
+ HDC dc;
380
+ HGLRC handle;
381
+ int interval;
382
+ } _GLFWcontextWGL;
383
+
384
+ // WGL-specific global data
385
+ //
386
+ typedef struct _GLFWlibraryWGL
387
+ {
388
+ HINSTANCE instance;
389
+ PFN_wglCreateContext CreateContext;
390
+ PFN_wglDeleteContext DeleteContext;
391
+ PFN_wglGetProcAddress GetProcAddress;
392
+ PFN_wglGetCurrentDC GetCurrentDC;
393
+ PFN_wglGetCurrentContext GetCurrentContext;
394
+ PFN_wglMakeCurrent MakeCurrent;
395
+ PFN_wglShareLists ShareLists;
396
+
397
+ PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT;
398
+ PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB;
399
+ PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT;
400
+ PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB;
401
+ PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
402
+ GLFWbool EXT_swap_control;
403
+ GLFWbool EXT_colorspace;
404
+ GLFWbool ARB_multisample;
405
+ GLFWbool ARB_framebuffer_sRGB;
406
+ GLFWbool EXT_framebuffer_sRGB;
407
+ GLFWbool ARB_pixel_format;
408
+ GLFWbool ARB_create_context;
409
+ GLFWbool ARB_create_context_profile;
410
+ GLFWbool EXT_create_context_es2_profile;
411
+ GLFWbool ARB_create_context_robustness;
412
+ GLFWbool ARB_create_context_no_error;
413
+ GLFWbool ARB_context_flush_control;
414
+ } _GLFWlibraryWGL;
415
+
416
+ // Win32-specific per-window data
417
+ //
418
+ typedef struct _GLFWwindowWin32
419
+ {
420
+ HWND handle;
421
+ HICON bigIcon;
422
+ HICON smallIcon;
423
+
424
+ GLFWbool cursorTracked;
425
+ GLFWbool frameAction;
426
+ GLFWbool iconified;
427
+ GLFWbool maximized;
428
+ // Whether to enable framebuffer transparency on DWM
429
+ GLFWbool transparent;
430
+ GLFWbool scaleToMonitor;
431
+ GLFWbool keymenu;
432
+ GLFWbool showDefault;
433
+
434
+ // Cached size used to filter out duplicate events
435
+ int width, height;
436
+
437
+ // The last received cursor position, regardless of source
438
+ int lastCursorPosX, lastCursorPosY;
439
+ // The last received high surrogate when decoding pairs of UTF-16 messages
440
+ WCHAR highSurrogate;
441
+ } _GLFWwindowWin32;
442
+
443
+ // Win32-specific global data
444
+ //
445
+ typedef struct _GLFWlibraryWin32
446
+ {
447
+ HINSTANCE instance;
448
+ HWND helperWindowHandle;
449
+ ATOM helperWindowClass;
450
+ ATOM mainWindowClass;
451
+ HDEVNOTIFY deviceNotificationHandle;
452
+ int acquiredMonitorCount;
453
+ char* clipboardString;
454
+ short int keycodes[512];
455
+ short int scancodes[GLFW_KEY_LAST + 1];
456
+ char keynames[GLFW_KEY_LAST + 1][5];
457
+ // Where to place the cursor when re-enabled
458
+ double restoreCursorPosX, restoreCursorPosY;
459
+ // The window whose disabled cursor mode is active
460
+ _GLFWwindow* disabledCursorWindow;
461
+ // The window the cursor is captured in
462
+ _GLFWwindow* capturedCursorWindow;
463
+ RAWINPUT* rawInput;
464
+ int rawInputSize;
465
+ UINT mouseTrailSize;
466
+ // The cursor handle to use to hide the cursor (NULL or a transparent cursor)
467
+ HCURSOR blankCursor;
468
+
469
+ struct {
470
+ HINSTANCE instance;
471
+ PFN_DirectInput8Create Create;
472
+ IDirectInput8W* api;
473
+ } dinput8;
474
+
475
+ struct {
476
+ HINSTANCE instance;
477
+ PFN_XInputGetCapabilities GetCapabilities;
478
+ PFN_XInputGetState GetState;
479
+ } xinput;
480
+
481
+ struct {
482
+ HINSTANCE instance;
483
+ PFN_SetProcessDPIAware SetProcessDPIAware_;
484
+ PFN_ChangeWindowMessageFilterEx ChangeWindowMessageFilterEx_;
485
+ PFN_EnableNonClientDpiScaling EnableNonClientDpiScaling_;
486
+ PFN_SetProcessDpiAwarenessContext SetProcessDpiAwarenessContext_;
487
+ PFN_GetDpiForWindow GetDpiForWindow_;
488
+ PFN_AdjustWindowRectExForDpi AdjustWindowRectExForDpi_;
489
+ PFN_GetSystemMetricsForDpi GetSystemMetricsForDpi_;
490
+ } user32;
491
+
492
+ struct {
493
+ HINSTANCE instance;
494
+ PFN_DwmIsCompositionEnabled IsCompositionEnabled;
495
+ PFN_DwmFlush Flush;
496
+ PFN_DwmEnableBlurBehindWindow EnableBlurBehindWindow;
497
+ PFN_DwmGetColorizationColor GetColorizationColor;
498
+ } dwmapi;
499
+
500
+ struct {
501
+ HINSTANCE instance;
502
+ PFN_SetProcessDpiAwareness SetProcessDpiAwareness_;
503
+ PFN_GetDpiForMonitor GetDpiForMonitor_;
504
+ } shcore;
505
+
506
+ struct {
507
+ HINSTANCE instance;
508
+ PFN_RtlVerifyVersionInfo RtlVerifyVersionInfo_;
509
+ } ntdll;
510
+ } _GLFWlibraryWin32;
511
+
512
+ // Win32-specific per-monitor data
513
+ //
514
+ typedef struct _GLFWmonitorWin32
515
+ {
516
+ HMONITOR handle;
517
+ // This size matches the static size of DISPLAY_DEVICE.DeviceName
518
+ WCHAR adapterName[32];
519
+ WCHAR displayName[32];
520
+ char publicAdapterName[32];
521
+ char publicDisplayName[32];
522
+ GLFWbool modesPruned;
523
+ GLFWbool modeChanged;
524
+ } _GLFWmonitorWin32;
525
+
526
+ // Win32-specific per-cursor data
527
+ //
528
+ typedef struct _GLFWcursorWin32
529
+ {
530
+ HCURSOR handle;
531
+ } _GLFWcursorWin32;
532
+
533
+
534
+ GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform);
535
+ int _glfwInitWin32(void);
536
+ void _glfwTerminateWin32(void);
537
+
538
+ WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source);
539
+ char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source);
540
+ BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp);
541
+ BOOL _glfwIsWindows10BuildOrGreaterWin32(WORD build);
542
+ void _glfwInputErrorWin32(int error, const char* description);
543
+ void _glfwUpdateKeyNamesWin32(void);
544
+
545
+ void _glfwPollMonitorsWin32(void);
546
+ void _glfwSetVideoModeWin32(_GLFWmonitor* monitor, const GLFWvidmode* desired);
547
+ void _glfwRestoreVideoModeWin32(_GLFWmonitor* monitor);
548
+ void _glfwGetHMONITORContentScaleWin32(HMONITOR handle, float* xscale, float* yscale);
549
+
550
+ GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
551
+ void _glfwDestroyWindowWin32(_GLFWwindow* window);
552
+ void _glfwSetWindowTitleWin32(_GLFWwindow* window, const char* title);
553
+ void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* images);
554
+ void _glfwGetWindowPosWin32(_GLFWwindow* window, int* xpos, int* ypos);
555
+ void _glfwSetWindowPosWin32(_GLFWwindow* window, int xpos, int ypos);
556
+ void _glfwGetWindowSizeWin32(_GLFWwindow* window, int* width, int* height);
557
+ void _glfwSetWindowSizeWin32(_GLFWwindow* window, int width, int height);
558
+ void _glfwSetWindowSizeLimitsWin32(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
559
+ void _glfwSetWindowAspectRatioWin32(_GLFWwindow* window, int numer, int denom);
560
+ void _glfwGetFramebufferSizeWin32(_GLFWwindow* window, int* width, int* height);
561
+ void _glfwGetWindowFrameSizeWin32(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
562
+ void _glfwGetWindowContentScaleWin32(_GLFWwindow* window, float* xscale, float* yscale);
563
+ void _glfwIconifyWindowWin32(_GLFWwindow* window);
564
+ void _glfwRestoreWindowWin32(_GLFWwindow* window);
565
+ void _glfwMaximizeWindowWin32(_GLFWwindow* window);
566
+ void _glfwShowWindowWin32(_GLFWwindow* window);
567
+ void _glfwHideWindowWin32(_GLFWwindow* window);
568
+ void _glfwRequestWindowAttentionWin32(_GLFWwindow* window);
569
+ void _glfwFocusWindowWin32(_GLFWwindow* window);
570
+ void _glfwSetWindowMonitorWin32(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
571
+ GLFWbool _glfwWindowFocusedWin32(_GLFWwindow* window);
572
+ GLFWbool _glfwWindowIconifiedWin32(_GLFWwindow* window);
573
+ GLFWbool _glfwWindowVisibleWin32(_GLFWwindow* window);
574
+ GLFWbool _glfwWindowMaximizedWin32(_GLFWwindow* window);
575
+ GLFWbool _glfwWindowHoveredWin32(_GLFWwindow* window);
576
+ GLFWbool _glfwFramebufferTransparentWin32(_GLFWwindow* window);
577
+ void _glfwSetWindowResizableWin32(_GLFWwindow* window, GLFWbool enabled);
578
+ void _glfwSetWindowDecoratedWin32(_GLFWwindow* window, GLFWbool enabled);
579
+ void _glfwSetWindowFloatingWin32(_GLFWwindow* window, GLFWbool enabled);
580
+ void _glfwSetWindowMousePassthroughWin32(_GLFWwindow* window, GLFWbool enabled);
581
+ float _glfwGetWindowOpacityWin32(_GLFWwindow* window);
582
+ void _glfwSetWindowOpacityWin32(_GLFWwindow* window, float opacity);
583
+
584
+ void _glfwSetRawMouseMotionWin32(_GLFWwindow *window, GLFWbool enabled);
585
+ GLFWbool _glfwRawMouseMotionSupportedWin32(void);
586
+
587
+ void _glfwPollEventsWin32(void);
588
+ void _glfwWaitEventsWin32(void);
589
+ void _glfwWaitEventsTimeoutWin32(double timeout);
590
+ void _glfwPostEmptyEventWin32(void);
591
+
592
+ void _glfwGetCursorPosWin32(_GLFWwindow* window, double* xpos, double* ypos);
593
+ void _glfwSetCursorPosWin32(_GLFWwindow* window, double xpos, double ypos);
594
+ void _glfwSetCursorModeWin32(_GLFWwindow* window, int mode);
595
+ const char* _glfwGetScancodeNameWin32(int scancode);
596
+ int _glfwGetKeyScancodeWin32(int key);
597
+ GLFWbool _glfwCreateCursorWin32(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
598
+ GLFWbool _glfwCreateStandardCursorWin32(_GLFWcursor* cursor, int shape);
599
+ void _glfwDestroyCursorWin32(_GLFWcursor* cursor);
600
+ void _glfwSetCursorWin32(_GLFWwindow* window, _GLFWcursor* cursor);
601
+ void _glfwSetClipboardStringWin32(const char* string);
602
+ const char* _glfwGetClipboardStringWin32(void);
603
+
604
+ EGLenum _glfwGetEGLPlatformWin32(EGLint** attribs);
605
+ EGLNativeDisplayType _glfwGetEGLNativeDisplayWin32(void);
606
+ EGLNativeWindowType _glfwGetEGLNativeWindowWin32(_GLFWwindow* window);
607
+
608
+ void _glfwGetRequiredInstanceExtensionsWin32(char** extensions);
609
+ GLFWbool _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
610
+ VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
611
+
612
+ void _glfwFreeMonitorWin32(_GLFWmonitor* monitor);
613
+ void _glfwGetMonitorPosWin32(_GLFWmonitor* monitor, int* xpos, int* ypos);
614
+ void _glfwGetMonitorContentScaleWin32(_GLFWmonitor* monitor, float* xscale, float* yscale);
615
+ void _glfwGetMonitorWorkareaWin32(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
616
+ GLFWvidmode* _glfwGetVideoModesWin32(_GLFWmonitor* monitor, int* count);
617
+ GLFWbool _glfwGetVideoModeWin32(_GLFWmonitor* monitor, GLFWvidmode* mode);
618
+ GLFWbool _glfwGetGammaRampWin32(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
619
+ void _glfwSetGammaRampWin32(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
620
+
621
+ GLFWbool _glfwInitJoysticksWin32(void);
622
+ void _glfwTerminateJoysticksWin32(void);
623
+ GLFWbool _glfwPollJoystickWin32(_GLFWjoystick* js, int mode);
624
+ const char* _glfwGetMappingNameWin32(void);
625
+ void _glfwUpdateGamepadGUIDWin32(char* guid);
626
+
627
+ GLFWbool _glfwInitWGL(void);
628
+ void _glfwTerminateWGL(void);
629
+ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
630
+ const _GLFWctxconfig* ctxconfig,
631
+ const _GLFWfbconfig* fbconfig);