ScrapExplorer - internal.h
Home / ext / glfw / src Lines: 1 | Size: 36375 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1//======================================================================== 2// GLFW 3.5 - www.glfw.org 3//------------------------------------------------------------------------ 4// Copyright (c) 2002-2006 Marcus Geelnard 5// Copyright (c) 2006-2019 Camilla Löwy <[email protected]> 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 63typedef int GLFWbool; 64typedef void (*GLFWproc)(void); 65 66typedef struct _GLFWerror _GLFWerror; 67typedef struct _GLFWinitconfig _GLFWinitconfig; 68typedef struct _GLFWwndconfig _GLFWwndconfig; 69typedef struct _GLFWctxconfig _GLFWctxconfig; 70typedef struct _GLFWfbconfig _GLFWfbconfig; 71typedef struct _GLFWcontext _GLFWcontext; 72typedef struct _GLFWwindow _GLFWwindow; 73typedef struct _GLFWplatform _GLFWplatform; 74typedef struct _GLFWlibrary _GLFWlibrary; 75typedef struct _GLFWmonitor _GLFWmonitor; 76typedef struct _GLFWcursor _GLFWcursor; 77typedef struct _GLFWmapelement _GLFWmapelement; 78typedef struct _GLFWmapping _GLFWmapping; 79typedef struct _GLFWjoystick _GLFWjoystick; 80typedef struct _GLFWtls _GLFWtls; 81typedef 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 102typedef int GLint; 103typedef unsigned int GLuint; 104typedef unsigned int GLenum; 105typedef unsigned int GLbitfield; 106typedef unsigned char GLubyte; 107 108typedef void (APIENTRY * PFNGLCLEARPROC)(GLbitfield); 109typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGPROC)(GLenum); 110typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*); 111typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint); 112 113#define EGL_SUCCESS 0x3000 114#define EGL_NOT_INITIALIZED 0x3001 115#define EGL_BAD_ACCESS 0x3002 116#define EGL_BAD_ALLOC 0x3003 117#define EGL_BAD_ATTRIBUTE 0x3004 118#define EGL_BAD_CONFIG 0x3005 119#define EGL_BAD_CONTEXT 0x3006 120#define EGL_BAD_CURRENT_SURFACE 0x3007 121#define EGL_BAD_DISPLAY 0x3008 122#define EGL_BAD_MATCH 0x3009 123#define EGL_BAD_NATIVE_PIXMAP 0x300a 124#define EGL_BAD_NATIVE_WINDOW 0x300b 125#define EGL_BAD_PARAMETER 0x300c 126#define EGL_BAD_SURFACE 0x300d 127#define EGL_CONTEXT_LOST 0x300e 128#define EGL_COLOR_BUFFER_TYPE 0x303f 129#define EGL_RGB_BUFFER 0x308e 130#define EGL_SURFACE_TYPE 0x3033 131#define EGL_WINDOW_BIT 0x0004 132#define EGL_RENDERABLE_TYPE 0x3040 133#define EGL_OPENGL_ES_BIT 0x0001 134#define EGL_OPENGL_ES2_BIT 0x0004 135#define EGL_OPENGL_BIT 0x0008 136#define EGL_ALPHA_SIZE 0x3021 137#define EGL_BLUE_SIZE 0x3022 138#define EGL_GREEN_SIZE 0x3023 139#define EGL_RED_SIZE 0x3024 140#define EGL_DEPTH_SIZE 0x3025 141#define EGL_STENCIL_SIZE 0x3026 142#define EGL_SAMPLES 0x3031 143#define EGL_OPENGL_ES_API 0x30a0 144#define EGL_OPENGL_API 0x30a2 145#define EGL_NONE 0x3038 146#define EGL_RENDER_BUFFER 0x3086 147#define EGL_SINGLE_BUFFER 0x3085 148#define EGL_EXTENSIONS 0x3055 149#define EGL_CONTEXT_CLIENT_VERSION 0x3098 150#define EGL_NATIVE_VISUAL_ID 0x302e 151#define EGL_NO_SURFACE ((EGLSurface) 0) 152#define EGL_NO_DISPLAY ((EGLDisplay) 0) 153#define EGL_NO_CONTEXT ((EGLContext) 0) 154#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType) 0) 155#define EGL_PBUFFER_BIT 0x0001 156#define EGL_WIDTH 0x3057 157#define EGL_HEIGHT 0x3056 158 159#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 160#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 161#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 162#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 163#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31bd 164#define EGL_NO_RESET_NOTIFICATION_KHR 0x31be 165#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31bf 166#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 167#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 168#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30fb 169#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30fd 170#define EGL_CONTEXT_FLAGS_KHR 0x30fc 171#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3 172#define EGL_GL_COLORSPACE_KHR 0x309d 173#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 174#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097 175#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0 176#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098 177#define EGL_PLATFORM_X11_EXT 0x31d5 178#define EGL_PLATFORM_WAYLAND_EXT 0x31d8 179#define EGL_PRESENT_OPAQUE_EXT 0x31df 180#define EGL_PLATFORM_ANGLE_ANGLE 0x3202 181#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203 182#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320d 183#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320e 184#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207 185#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208 186#define EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE 0x3450 187#define EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE 0x3489 188#define EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE 0x348f 189#define EGL_PLATFORM_SURFACELESS_MESA 0x31dd 190 191typedef int EGLint; 192typedef unsigned int EGLBoolean; 193typedef unsigned int EGLenum; 194typedef void* EGLConfig; 195typedef void* EGLContext; 196typedef void* EGLDisplay; 197typedef void* EGLSurface; 198 199typedef void* EGLNativeDisplayType; 200typedef void* EGLNativeWindowType; 201 202// EGL function pointer typedefs 203typedef EGLBoolean (APIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*); 204typedef EGLBoolean (APIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*); 205typedef EGLDisplay (APIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType); 206typedef EGLint (APIENTRY * PFN_eglGetError)(void); 207typedef EGLBoolean (APIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*); 208typedef EGLBoolean (APIENTRY * PFN_eglTerminate)(EGLDisplay); 209typedef EGLBoolean (APIENTRY * PFN_eglBindAPI)(EGLenum); 210typedef EGLContext (APIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*); 211typedef EGLBoolean (APIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface); 212typedef EGLBoolean (APIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext); 213typedef EGLSurface (APIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*); 214typedef EGLSurface (APIENTRY * PFN_eglCreatePbufferSurface)(EGLDisplay,EGLContext,const EGLint*); 215typedef EGLBoolean (APIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext); 216typedef EGLBoolean (APIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface); 217typedef EGLBoolean (APIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint); 218typedef const char* (APIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint); 219typedef GLFWglproc (APIENTRY * PFN_eglGetProcAddress)(const char*); 220#define eglGetConfigAttrib _glfw.egl.GetConfigAttrib 221#define eglGetConfigs _glfw.egl.GetConfigs 222#define eglGetDisplay _glfw.egl.GetDisplay 223#define eglGetError _glfw.egl.GetError 224#define eglInitialize _glfw.egl.Initialize 225#define eglTerminate _glfw.egl.Terminate 226#define eglBindAPI _glfw.egl.BindAPI 227#define eglCreateContext _glfw.egl.CreateContext 228#define eglDestroySurface _glfw.egl.DestroySurface 229#define eglDestroyContext _glfw.egl.DestroyContext 230#define eglCreateWindowSurface _glfw.egl.CreateWindowSurface 231#define eglCreatePbufferSurface _glfw.egl.CreatePbufferSurface 232#define eglMakeCurrent _glfw.egl.MakeCurrent 233#define eglSwapBuffers _glfw.egl.SwapBuffers 234#define eglSwapInterval _glfw.egl.SwapInterval 235#define eglQueryString _glfw.egl.QueryString 236#define eglGetProcAddress _glfw.egl.GetProcAddress 237 238typedef EGLDisplay (APIENTRY * PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum,void*,const EGLint*); 239typedef EGLSurface (APIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay,EGLConfig,void*,const EGLint*); 240#define eglGetPlatformDisplayEXT _glfw.egl.GetPlatformDisplayEXT 241#define eglCreatePlatformWindowSurfaceEXT _glfw.egl.CreatePlatformWindowSurfaceEXT 242 243#define OSMESA_RGBA 0x1908 244#define OSMESA_FORMAT 0x22 245#define OSMESA_DEPTH_BITS 0x30 246#define OSMESA_STENCIL_BITS 0x31 247#define OSMESA_ACCUM_BITS 0x32 248#define OSMESA_PROFILE 0x33 249#define OSMESA_CORE_PROFILE 0x34 250#define OSMESA_COMPAT_PROFILE 0x35 251#define OSMESA_CONTEXT_MAJOR_VERSION 0x36 252#define OSMESA_CONTEXT_MINOR_VERSION 0x37 253 254typedef void* OSMesaContext; 255typedef void (*OSMESAproc)(void); 256 257typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum,GLint,GLint,GLint,OSMesaContext); 258typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int*,OSMesaContext); 259typedef void (GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext); 260typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int); 261typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**); 262typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**); 263typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*); 264#define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt 265#define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs 266#define OSMesaDestroyContext _glfw.osmesa.DestroyContext 267#define OSMesaMakeCurrent _glfw.osmesa.MakeCurrent 268#define OSMesaGetColorBuffer _glfw.osmesa.GetColorBuffer 269#define OSMesaGetDepthBuffer _glfw.osmesa.GetDepthBuffer 270#define OSMesaGetProcAddress _glfw.osmesa.GetProcAddress 271 272#define VK_NULL_HANDLE 0 273 274typedef void* VkInstance; 275typedef void* VkPhysicalDevice; 276typedef uint64_t VkSurfaceKHR; 277typedef uint32_t VkFlags; 278typedef uint32_t VkBool32; 279 280typedef enum VkStructureType 281{ 282 VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, 283 VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, 284 VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, 285 VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, 286 VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000, 287 VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000, 288 VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT = 1000256000, 289 VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF 290} VkStructureType; 291 292typedef enum VkResult 293{ 294 VK_SUCCESS = 0, 295 VK_NOT_READY = 1, 296 VK_TIMEOUT = 2, 297 VK_EVENT_SET = 3, 298 VK_EVENT_RESET = 4, 299 VK_INCOMPLETE = 5, 300 VK_ERROR_OUT_OF_HOST_MEMORY = -1, 301 VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, 302 VK_ERROR_INITIALIZATION_FAILED = -3, 303 VK_ERROR_DEVICE_LOST = -4, 304 VK_ERROR_MEMORY_MAP_FAILED = -5, 305 VK_ERROR_LAYER_NOT_PRESENT = -6, 306 VK_ERROR_EXTENSION_NOT_PRESENT = -7, 307 VK_ERROR_FEATURE_NOT_PRESENT = -8, 308 VK_ERROR_INCOMPATIBLE_DRIVER = -9, 309 VK_ERROR_TOO_MANY_OBJECTS = -10, 310 VK_ERROR_FORMAT_NOT_SUPPORTED = -11, 311 VK_ERROR_SURFACE_LOST_KHR = -1000000000, 312 VK_SUBOPTIMAL_KHR = 1000001003, 313 VK_ERROR_OUT_OF_DATE_KHR = -1000001004, 314 VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, 315 VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, 316 VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, 317 VK_RESULT_MAX_ENUM = 0x7FFFFFFF 318} VkResult; 319 320typedef struct VkAllocationCallbacks VkAllocationCallbacks; 321 322typedef struct VkExtensionProperties 323{ 324 char extensionName[256]; 325 uint32_t specVersion; 326} VkExtensionProperties; 327 328typedef void (APIENTRY * PFN_vkVoidFunction)(void); 329 330typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*); 331typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*); 332#define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr 333 334#include "platform.h" 335 336#define GLFW_NATIVE_INCLUDE_NONE 337#include "../include/GLFW/glfw3native.h" 338 339// Checks for whether the library has been initialized 340#define _GLFW_REQUIRE_INIT() \ 341 if (!_glfw.initialized) \ 342 { \ 343 _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \ 344 return; \ 345 } 346#define _GLFW_REQUIRE_INIT_OR_RETURN(x) \ 347 if (!_glfw.initialized) \ 348 { \ 349 _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \ 350 return x; \ 351 } 352 353// Swaps the provided pointers 354#define _GLFW_SWAP(type, x, y) \ 355 { \ 356 type t; \ 357 t = x; \ 358 x = y; \ 359 y = t; \ 360 } 361 362// Per-thread error structure 363// 364struct _GLFWerror 365{ 366 _GLFWerror* next; 367 int code; 368 char description[_GLFW_MESSAGE_SIZE]; 369}; 370 371// Initialization configuration 372// 373// Parameters relating to the initialization of the library 374// 375struct _GLFWinitconfig 376{ 377 GLFWbool hatButtons; 378 int angleType; 379 int platformID; 380 PFN_vkGetInstanceProcAddr vulkanLoader; 381 struct { 382 GLFWbool menubar; 383 GLFWbool chdir; 384 } ns; 385 struct { 386 GLFWbool xcbVulkanSurface; 387 } x11; 388 struct { 389 int libdecorMode; 390 } wl; 391}; 392 393// Window configuration 394// 395// Parameters relating to the creation of the window but not directly related 396// to the framebuffer. This is used to pass window creation parameters from 397// shared code to the platform API. 398// 399struct _GLFWwndconfig 400{ 401 int xpos; 402 int ypos; 403 int width; 404 int height; 405 GLFWbool resizable; 406 GLFWbool visible; 407 GLFWbool decorated; 408 GLFWbool focused; 409 GLFWbool autoIconify; 410 GLFWbool floating; 411 GLFWbool maximized; 412 GLFWbool centerCursor; 413 GLFWbool focusOnShow; 414 GLFWbool mousePassthrough; 415 GLFWbool scaleToMonitor; 416 GLFWbool scaleFramebuffer; 417 struct { 418 char frameName[256]; 419 } ns; 420 struct { 421 char className[256]; 422 char instanceName[256]; 423 } x11; 424 struct { 425 GLFWbool keymenu; 426 GLFWbool showDefault; 427 } win32; 428 struct { 429 char appId[256]; 430 } wl; 431}; 432 433// Context configuration 434// 435// Parameters relating to the creation of the context but not directly related 436// to the framebuffer. This is used to pass context creation parameters from 437// shared code to the platform API. 438// 439struct _GLFWctxconfig 440{ 441 int client; 442 int source; 443 int major; 444 int minor; 445 GLFWbool forward; 446 GLFWbool debug; 447 GLFWbool noerror; 448 int profile; 449 int robustness; 450 int release; 451 _GLFWwindow* share; 452 struct { 453 GLFWbool offline; 454 } nsgl; 455}; 456 457// Framebuffer configuration 458// 459// This describes buffers and their sizes. It also contains 460// a platform-specific ID used to map back to the backend API object. 461// 462// It is used to pass framebuffer parameters from shared code to the platform 463// API and also to enumerate and select available framebuffer configs. 464// 465struct _GLFWfbconfig 466{ 467 int redBits; 468 int greenBits; 469 int blueBits; 470 int alphaBits; 471 int depthBits; 472 int stencilBits; 473 int accumRedBits; 474 int accumGreenBits; 475 int accumBlueBits; 476 int accumAlphaBits; 477 int auxBuffers; 478 GLFWbool stereo; 479 int samples; 480 GLFWbool sRGB; 481 GLFWbool doublebuffer; 482 GLFWbool transparent; 483 uintptr_t handle; 484}; 485 486// Context structure 487// 488struct _GLFWcontext 489{ 490 int client; 491 int source; 492 int major, minor, revision; 493 GLFWbool forward, debug, noerror; 494 int profile; 495 int robustness; 496 int release; 497 498 PFNGLGETSTRINGIPROC GetStringi; 499 PFNGLGETINTEGERVPROC GetIntegerv; 500 PFNGLGETSTRINGPROC GetString; 501 502 void (*makeCurrent)(_GLFWwindow*); 503 void (*swapBuffers)(_GLFWwindow*); 504 void (*swapInterval)(int); 505 int (*extensionSupported)(const char*); 506 GLFWglproc (*getProcAddress)(const char*); 507 void (*destroy)(_GLFWwindow*); 508 509 struct { 510 EGLConfig config; 511 EGLContext handle; 512 EGLSurface surface; 513 void* client; 514 } egl; 515 516 struct { 517 OSMesaContext handle; 518 int width; 519 int height; 520 void* buffer; 521 } osmesa; 522 523 // This is defined in platform.h 524 GLFW_PLATFORM_CONTEXT_STATE 525}; 526 527// Window and context structure 528// 529struct _GLFWwindow 530{ 531 struct _GLFWwindow* next; 532 533 // Window settings and state 534 GLFWbool resizable; 535 GLFWbool decorated; 536 GLFWbool autoIconify; 537 GLFWbool floating; 538 GLFWbool focusOnShow; 539 GLFWbool mousePassthrough; 540 GLFWbool shouldClose; 541 void* userPointer; 542 GLFWbool doublebuffer; 543 GLFWvidmode videoMode; 544 _GLFWmonitor* monitor; 545 _GLFWcursor* cursor; 546 char* title; 547 548 int minwidth, minheight; 549 int maxwidth, maxheight; 550 int numer, denom; 551 552 GLFWbool stickyKeys; 553 GLFWbool stickyMouseButtons; 554 GLFWbool lockKeyMods; 555 GLFWbool disableMouseButtonLimit; 556 int cursorMode; 557 char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1]; 558 char keys[GLFW_KEY_LAST + 1]; 559 // Virtual cursor position when cursor is disabled 560 double virtualCursorPosX, virtualCursorPosY; 561 GLFWbool rawMouseMotion; 562 563 _GLFWcontext context; 564 565 struct { 566 GLFWwindowposfun pos; 567 GLFWwindowsizefun size; 568 GLFWwindowclosefun close; 569 GLFWwindowrefreshfun refresh; 570 GLFWwindowfocusfun focus; 571 GLFWwindowiconifyfun iconify; 572 GLFWwindowmaximizefun maximize; 573 GLFWframebuffersizefun fbsize; 574 GLFWwindowcontentscalefun scale; 575 GLFWmousebuttonfun mouseButton; 576 GLFWcursorposfun cursorPos; 577 GLFWcursorenterfun cursorEnter; 578 GLFWscrollfun scroll; 579 GLFWkeyfun key; 580 GLFWcharfun character; 581 GLFWcharmodsfun charmods; 582 GLFWdropfun drop; 583 } callbacks; 584 585 // This is defined in platform.h 586 GLFW_PLATFORM_WINDOW_STATE 587}; 588 589// Monitor structure 590// 591struct _GLFWmonitor 592{ 593 char name[128]; 594 void* userPointer; 595 596 // Physical dimensions in millimeters. 597 int widthMM, heightMM; 598 599 // The window whose video mode is current on this monitor 600 _GLFWwindow* window; 601 602 GLFWvidmode* modes; 603 int modeCount; 604 GLFWvidmode currentMode; 605 606 GLFWgammaramp originalRamp; 607 GLFWgammaramp currentRamp; 608 609 // This is defined in platform.h 610 GLFW_PLATFORM_MONITOR_STATE 611}; 612 613// Cursor structure 614// 615struct _GLFWcursor 616{ 617 _GLFWcursor* next; 618 // This is defined in platform.h 619 GLFW_PLATFORM_CURSOR_STATE 620}; 621 622// Gamepad mapping element structure 623// 624struct _GLFWmapelement 625{ 626 uint8_t type; 627 uint8_t index; 628 int8_t axisScale; 629 int8_t axisOffset; 630}; 631 632// Gamepad mapping structure 633// 634struct _GLFWmapping 635{ 636 char name[128]; 637 char guid[33]; 638 _GLFWmapelement buttons[15]; 639 _GLFWmapelement axes[6]; 640}; 641 642// Joystick structure 643// 644struct _GLFWjoystick 645{ 646 GLFWbool allocated; 647 GLFWbool connected; 648 float* axes; 649 int axisCount; 650 unsigned char* buttons; 651 int buttonCount; 652 unsigned char* hats; 653 int hatCount; 654 char name[128]; 655 void* userPointer; 656 char guid[33]; 657 _GLFWmapping* mapping; 658 659 // This is defined in platform.h 660 GLFW_PLATFORM_JOYSTICK_STATE 661}; 662 663// Thread local storage structure 664// 665struct _GLFWtls 666{ 667 // This is defined in platform.h 668 GLFW_PLATFORM_TLS_STATE 669}; 670 671// Mutex structure 672// 673struct _GLFWmutex 674{ 675 // This is defined in platform.h 676 GLFW_PLATFORM_MUTEX_STATE 677}; 678 679// Platform API structure 680// 681struct _GLFWplatform 682{ 683 int platformID; 684 // init 685 GLFWbool (*init)(void); 686 void (*terminate)(void); 687 // input 688 void (*getCursorPos)(_GLFWwindow*,double*,double*); 689 void (*setCursorPos)(_GLFWwindow*,double,double); 690 void (*setCursorMode)(_GLFWwindow*,int); 691 void (*setRawMouseMotion)(_GLFWwindow*,GLFWbool); 692 GLFWbool (*rawMouseMotionSupported)(void); 693 GLFWbool (*createCursor)(_GLFWcursor*,const GLFWimage*,int,int); 694 GLFWbool (*createStandardCursor)(_GLFWcursor*,int); 695 void (*destroyCursor)(_GLFWcursor*); 696 void (*setCursor)(_GLFWwindow*,_GLFWcursor*); 697 const char* (*getScancodeName)(int); 698 int (*getKeyScancode)(int); 699 void (*setClipboardString)(const char*); 700 const char* (*getClipboardString)(void); 701 GLFWbool (*initJoysticks)(void); 702 void (*terminateJoysticks)(void); 703 GLFWbool (*pollJoystick)(_GLFWjoystick*,int); 704 const char* (*getMappingName)(void); 705 void (*updateGamepadGUID)(char*); 706 // monitor 707 void (*freeMonitor)(_GLFWmonitor*); 708 void (*getMonitorPos)(_GLFWmonitor*,int*,int*); 709 void (*getMonitorContentScale)(_GLFWmonitor*,float*,float*); 710 void (*getMonitorWorkarea)(_GLFWmonitor*,int*,int*,int*,int*); 711 GLFWvidmode* (*getVideoModes)(_GLFWmonitor*,int*); 712 GLFWbool (*getVideoMode)(_GLFWmonitor*,GLFWvidmode*); 713 GLFWbool (*getGammaRamp)(_GLFWmonitor*,GLFWgammaramp*); 714 void (*setGammaRamp)(_GLFWmonitor*,const GLFWgammaramp*); 715 // window 716 GLFWbool (*createWindow)(_GLFWwindow*,const _GLFWwndconfig*,const _GLFWctxconfig*,const _GLFWfbconfig*); 717 void (*destroyWindow)(_GLFWwindow*); 718 void (*setWindowTitle)(_GLFWwindow*,const char*); 719 void (*setWindowIcon)(_GLFWwindow*,int,const GLFWimage*); 720 void (*getWindowPos)(_GLFWwindow*,int*,int*); 721 void (*setWindowPos)(_GLFWwindow*,int,int); 722 void (*getWindowSize)(_GLFWwindow*,int*,int*); 723 void (*setWindowSize)(_GLFWwindow*,int,int); 724 void (*setWindowSizeLimits)(_GLFWwindow*,int,int,int,int); 725 void (*setWindowAspectRatio)(_GLFWwindow*,int,int); 726 void (*getFramebufferSize)(_GLFWwindow*,int*,int*); 727 void (*getWindowFrameSize)(_GLFWwindow*,int*,int*,int*,int*); 728 void (*getWindowContentScale)(_GLFWwindow*,float*,float*); 729 void (*iconifyWindow)(_GLFWwindow*); 730 void (*restoreWindow)(_GLFWwindow*); 731 void (*maximizeWindow)(_GLFWwindow*); 732 void (*showWindow)(_GLFWwindow*); 733 void (*hideWindow)(_GLFWwindow*); 734 void (*requestWindowAttention)(_GLFWwindow*); 735 void (*focusWindow)(_GLFWwindow*); 736 void (*setWindowMonitor)(_GLFWwindow*,_GLFWmonitor*,int,int,int,int,int); 737 GLFWbool (*windowFocused)(_GLFWwindow*); 738 GLFWbool (*windowIconified)(_GLFWwindow*); 739 GLFWbool (*windowVisible)(_GLFWwindow*); 740 GLFWbool (*windowMaximized)(_GLFWwindow*); 741 GLFWbool (*windowHovered)(_GLFWwindow*); 742 GLFWbool (*framebufferTransparent)(_GLFWwindow*); 743 float (*getWindowOpacity)(_GLFWwindow*); 744 void (*setWindowResizable)(_GLFWwindow*,GLFWbool); 745 void (*setWindowDecorated)(_GLFWwindow*,GLFWbool); 746 void (*setWindowFloating)(_GLFWwindow*,GLFWbool); 747 void (*setWindowOpacity)(_GLFWwindow*,float); 748 void (*setWindowMousePassthrough)(_GLFWwindow*,GLFWbool); 749 void (*pollEvents)(void); 750 void (*waitEvents)(void); 751 void (*waitEventsTimeout)(double); 752 void (*postEmptyEvent)(void); 753 // EGL 754 EGLenum (*getEGLPlatform)(EGLint**); 755 EGLNativeDisplayType (*getEGLNativeDisplay)(void); 756 EGLNativeWindowType (*getEGLNativeWindow)(_GLFWwindow*); 757 // vulkan 758 void (*getRequiredInstanceExtensions)(char**); 759 GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t); 760 VkResult (*createWindowSurface)(VkInstance,_GLFWwindow*,const VkAllocationCallbacks*,VkSurfaceKHR*); 761}; 762 763// Library global data 764// 765struct _GLFWlibrary 766{ 767 GLFWbool initialized; 768 GLFWallocator allocator; 769 770 _GLFWplatform platform; 771 772 struct { 773 _GLFWinitconfig init; 774 _GLFWfbconfig framebuffer; 775 _GLFWwndconfig window; 776 _GLFWctxconfig context; 777 int refreshRate; 778 } hints; 779 780 _GLFWerror* errorListHead; 781 _GLFWcursor* cursorListHead; 782 _GLFWwindow* windowListHead; 783 784 _GLFWmonitor** monitors; 785 int monitorCount; 786 787 GLFWbool joysticksInitialized; 788 _GLFWjoystick joysticks[GLFW_JOYSTICK_LAST + 1]; 789 _GLFWmapping* mappings; 790 int mappingCount; 791 792 _GLFWtls errorSlot; 793 _GLFWtls contextSlot; 794 _GLFWmutex errorLock; 795 796 struct { 797 uint64_t offset; 798 // This is defined in platform.h 799 GLFW_PLATFORM_LIBRARY_TIMER_STATE 800 } timer; 801 802 struct { 803 EGLenum platform; 804 EGLDisplay display; 805 EGLint major, minor; 806 GLFWbool prefix; 807 808 GLFWbool KHR_create_context; 809 GLFWbool KHR_create_context_no_error; 810 GLFWbool KHR_gl_colorspace; 811 GLFWbool KHR_get_all_proc_addresses; 812 GLFWbool KHR_context_flush_control; 813 GLFWbool EXT_client_extensions; 814 GLFWbool EXT_platform_base; 815 GLFWbool EXT_platform_x11; 816 GLFWbool EXT_platform_wayland; 817 GLFWbool EXT_present_opaque; 818 GLFWbool ANGLE_platform_angle; 819 GLFWbool ANGLE_platform_angle_opengl; 820 GLFWbool ANGLE_platform_angle_d3d; 821 GLFWbool ANGLE_platform_angle_vulkan; 822 GLFWbool ANGLE_platform_angle_metal; 823 GLFWbool MESA_platform_surfaceless; 824 825 void* handle; 826 827 PFN_eglGetConfigAttrib GetConfigAttrib; 828 PFN_eglGetConfigs GetConfigs; 829 PFN_eglGetDisplay GetDisplay; 830 PFN_eglGetError GetError; 831 PFN_eglInitialize Initialize; 832 PFN_eglTerminate Terminate; 833 PFN_eglBindAPI BindAPI; 834 PFN_eglCreateContext CreateContext; 835 PFN_eglDestroySurface DestroySurface; 836 PFN_eglDestroyContext DestroyContext; 837 PFN_eglCreateWindowSurface CreateWindowSurface; 838 PFN_eglCreatePbufferSurface CreatePbufferSurface; 839 PFN_eglMakeCurrent MakeCurrent; 840 PFN_eglSwapBuffers SwapBuffers; 841 PFN_eglSwapInterval SwapInterval; 842 PFN_eglQueryString QueryString; 843 PFN_eglGetProcAddress GetProcAddress; 844 845 PFNEGLGETPLATFORMDISPLAYEXTPROC GetPlatformDisplayEXT; 846 PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC CreatePlatformWindowSurfaceEXT; 847 } egl; 848 849 struct { 850 void* handle; 851 852 PFN_OSMesaCreateContextExt CreateContextExt; 853 PFN_OSMesaCreateContextAttribs CreateContextAttribs; 854 PFN_OSMesaDestroyContext DestroyContext; 855 PFN_OSMesaMakeCurrent MakeCurrent; 856 PFN_OSMesaGetColorBuffer GetColorBuffer; 857 PFN_OSMesaGetDepthBuffer GetDepthBuffer; 858 PFN_OSMesaGetProcAddress GetProcAddress; 859 860 } osmesa; 861 862 struct { 863 GLFWbool available; 864 void* handle; 865 char* extensions[2]; 866 PFN_vkGetInstanceProcAddr GetInstanceProcAddr; 867 GLFWbool KHR_surface; 868 GLFWbool KHR_win32_surface; 869 GLFWbool MVK_macos_surface; 870 GLFWbool EXT_metal_surface; 871 GLFWbool KHR_xlib_surface; 872 GLFWbool KHR_xcb_surface; 873 GLFWbool KHR_wayland_surface; 874 GLFWbool EXT_headless_surface; 875 } vk; 876 877 struct { 878 GLFWmonitorfun monitor; 879 GLFWjoystickfun joystick; 880 } callbacks; 881 882 // These are defined in platform.h 883 GLFW_PLATFORM_LIBRARY_WINDOW_STATE 884 GLFW_PLATFORM_LIBRARY_CONTEXT_STATE 885 GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE 886}; 887 888// Global state shared between compilation units of GLFW 889// 890extern _GLFWlibrary _glfw; 891 892 893////////////////////////////////////////////////////////////////////////// 894////// GLFW platform API ////// 895////////////////////////////////////////////////////////////////////////// 896 897void _glfwPlatformInitTimer(void); 898uint64_t _glfwPlatformGetTimerValue(void); 899uint64_t _glfwPlatformGetTimerFrequency(void); 900 901GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls); 902void _glfwPlatformDestroyTls(_GLFWtls* tls); 903void* _glfwPlatformGetTls(_GLFWtls* tls); 904void _glfwPlatformSetTls(_GLFWtls* tls, void* value); 905 906GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex); 907void _glfwPlatformDestroyMutex(_GLFWmutex* mutex); 908void _glfwPlatformLockMutex(_GLFWmutex* mutex); 909void _glfwPlatformUnlockMutex(_GLFWmutex* mutex); 910 911void* _glfwPlatformLoadModule(const char* path); 912void _glfwPlatformFreeModule(void* module); 913GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name); 914 915 916////////////////////////////////////////////////////////////////////////// 917////// GLFW event API ////// 918////////////////////////////////////////////////////////////////////////// 919 920void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused); 921void _glfwInputWindowPos(_GLFWwindow* window, int xpos, int ypos); 922void _glfwInputWindowSize(_GLFWwindow* window, int width, int height); 923void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height); 924void _glfwInputWindowContentScale(_GLFWwindow* window, 925 float xscale, float yscale); 926void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified); 927void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized); 928void _glfwInputWindowDamage(_GLFWwindow* window); 929void _glfwInputWindowCloseRequest(_GLFWwindow* window); 930void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor); 931 932void _glfwInputKey(_GLFWwindow* window, 933 int key, int scancode, int action, int mods); 934void _glfwInputChar(_GLFWwindow* window, 935 uint32_t codepoint, int mods, GLFWbool plain); 936void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset); 937void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods); 938void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos); 939void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered); 940void _glfwInputDrop(_GLFWwindow* window, int count, const char** names); 941void _glfwInputJoystick(_GLFWjoystick* js, int event); 942void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value); 943void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value); 944void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value); 945 946void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement); 947void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window); 948 949#if defined(__GNUC__) 950void _glfwInputError(int code, const char* format, ...) 951 __attribute__((format(printf, 2, 3))); 952#else 953void _glfwInputError(int code, const char* format, ...); 954#endif 955 956 957////////////////////////////////////////////////////////////////////////// 958////// GLFW internal API ////// 959////////////////////////////////////////////////////////////////////////// 960 961GLFWbool _glfwSelectPlatform(int platformID, _GLFWplatform* platform); 962 963GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions); 964const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, 965 const _GLFWfbconfig* alternatives, 966 unsigned int count); 967GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window, 968 const _GLFWctxconfig* ctxconfig); 969GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig); 970 971const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor, 972 const GLFWvidmode* desired); 973int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second); 974_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM); 975void _glfwFreeMonitor(_GLFWmonitor* monitor); 976void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size); 977void _glfwFreeGammaArrays(GLFWgammaramp* ramp); 978void _glfwSplitBPP(int bpp, int* red, int* green, int* blue); 979 980void _glfwInitGamepadMappings(void); 981_GLFWjoystick* _glfwAllocJoystick(const char* name, 982 const char* guid, 983 int axisCount, 984 int buttonCount, 985 int hatCount); 986void _glfwFreeJoystick(_GLFWjoystick* js); 987void _glfwCenterCursorInContentArea(_GLFWwindow* window); 988 989GLFWbool _glfwInitEGL(void); 990void _glfwTerminateEGL(void); 991GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, 992 const _GLFWctxconfig* ctxconfig, 993 const _GLFWfbconfig* fbconfig); 994#if defined(_GLFW_X11) 995GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig, 996 const _GLFWctxconfig* ctxconfig, 997 const _GLFWfbconfig* fbconfig, 998 Visual** visual, int* depth); 999#endif /*_GLFW_X11*/ 1000 1001GLFWbool _glfwInitOSMesa(void); 1002void _glfwTerminateOSMesa(void); 1003GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window, 1004 const _GLFWctxconfig* ctxconfig, 1005 const _GLFWfbconfig* fbconfig); 1006 1007GLFWbool _glfwInitVulkan(int mode); 1008void _glfwTerminateVulkan(void); 1009const char* _glfwGetVulkanResultString(VkResult result); 1010 1011size_t _glfwEncodeUTF8(char* s, uint32_t codepoint); 1012char** _glfwParseUriList(char* text, int* count); 1013 1014char* _glfw_strdup(const char* source); 1015int _glfw_min(int a, int b); 1016int _glfw_max(int a, int b); 1017 1018void* _glfw_calloc(size_t count, size_t size); 1019void* _glfw_realloc(void* pointer, size_t size); 1020void _glfw_free(void* pointer); 1021 1022[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.