DSCF

.co.uk

PC32

A ColorForth compiler and editor for x86-64
git clone https://dscf.co.uk/clone/PC32.git
Log | Files | Refs | README

internal.h (28080B)


      1 //========================================================================
      2 // GLFW 3.3 - www.glfw.org
      3 //------------------------------------------------------------------------
      4 // Copyright (c) 2002-2006 Marcus Geelnard
      5 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
      6 //
      7 // This software is provided 'as-is', without any express or implied
      8 // warranty. In no event will the authors be held liable for any damages
      9 // arising from the use of this software.
     10 //
     11 // Permission is granted to anyone to use this software for any purpose,
     12 // including commercial applications, and to alter it and redistribute it
     13 // freely, subject to the following restrictions:
     14 //
     15 // 1. The origin of this software must not be misrepresented; you must not
     16 //    claim that you wrote the original software. If you use this software
     17 //    in a product, an acknowledgment in the product documentation would
     18 //    be appreciated but is not required.
     19 //
     20 // 2. Altered source versions must be plainly marked as such, and must not
     21 //    be misrepresented as being the original software.
     22 //
     23 // 3. This notice may not be removed or altered from any source
     24 //    distribution.
     25 //
     26 //========================================================================
     27 
     28 #pragma once
     29 
     30 #if defined(_GLFW_USE_CONFIG_H)
     31  #include "glfw_config.h"
     32 #endif
     33 
     34 #if defined(GLFW_INCLUDE_GLCOREARB) || \
     35     defined(GLFW_INCLUDE_ES1)       || \
     36     defined(GLFW_INCLUDE_ES2)       || \
     37     defined(GLFW_INCLUDE_ES3)       || \
     38     defined(GLFW_INCLUDE_ES31)      || \
     39     defined(GLFW_INCLUDE_ES32)      || \
     40     defined(GLFW_INCLUDE_NONE)      || \
     41     defined(GLFW_INCLUDE_GLEXT)     || \
     42     defined(GLFW_INCLUDE_GLU)       || \
     43     defined(GLFW_INCLUDE_VULKAN)    || \
     44     defined(GLFW_DLL)
     45  #error "You must not define any header option macros when compiling GLFW"
     46 #endif
     47 
     48 #define GLFW_INCLUDE_NONE
     49 #include "../include/GLFW/glfw3.h"
     50 
     51 #define _GLFW_INSERT_FIRST      0
     52 #define _GLFW_INSERT_LAST       1
     53 
     54 #define _GLFW_POLL_PRESENCE     0
     55 #define _GLFW_POLL_AXES         1
     56 #define _GLFW_POLL_BUTTONS      2
     57 #define _GLFW_POLL_ALL          (_GLFW_POLL_AXES | _GLFW_POLL_BUTTONS)
     58 
     59 #define _GLFW_MESSAGE_SIZE      1024
     60 
     61 typedef int GLFWbool;
     62 
     63 typedef struct _GLFWerror       _GLFWerror;
     64 typedef struct _GLFWinitconfig  _GLFWinitconfig;
     65 typedef struct _GLFWwndconfig   _GLFWwndconfig;
     66 typedef struct _GLFWctxconfig   _GLFWctxconfig;
     67 typedef struct _GLFWfbconfig    _GLFWfbconfig;
     68 typedef struct _GLFWcontext     _GLFWcontext;
     69 typedef struct _GLFWwindow      _GLFWwindow;
     70 typedef struct _GLFWlibrary     _GLFWlibrary;
     71 typedef struct _GLFWmonitor     _GLFWmonitor;
     72 typedef struct _GLFWcursor      _GLFWcursor;
     73 typedef struct _GLFWmapelement  _GLFWmapelement;
     74 typedef struct _GLFWmapping     _GLFWmapping;
     75 typedef struct _GLFWjoystick    _GLFWjoystick;
     76 typedef struct _GLFWtls         _GLFWtls;
     77 typedef struct _GLFWmutex       _GLFWmutex;
     78 
     79 typedef void (* _GLFWmakecontextcurrentfun)(_GLFWwindow*);
     80 typedef void (* _GLFWswapbuffersfun)(_GLFWwindow*);
     81 typedef void (* _GLFWswapintervalfun)(int);
     82 typedef int (* _GLFWextensionsupportedfun)(const char*);
     83 typedef GLFWglproc (* _GLFWgetprocaddressfun)(const char*);
     84 typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*);
     85 
     86 #define GL_VERSION 0x1f02
     87 #define GL_NONE 0
     88 #define GL_COLOR_BUFFER_BIT 0x00004000
     89 #define GL_UNSIGNED_BYTE 0x1401
     90 #define GL_EXTENSIONS 0x1f03
     91 #define GL_NUM_EXTENSIONS 0x821d
     92 #define GL_CONTEXT_FLAGS 0x821e
     93 #define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
     94 #define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
     95 #define GL_CONTEXT_PROFILE_MASK 0x9126
     96 #define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
     97 #define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
     98 #define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
     99 #define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
    100 #define GL_NO_RESET_NOTIFICATION_ARB 0x8261
    101 #define GL_CONTEXT_RELEASE_BEHAVIOR 0x82fb
    102 #define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc
    103 #define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
    104 
    105 typedef int GLint;
    106 typedef unsigned int GLuint;
    107 typedef unsigned int GLenum;
    108 typedef unsigned int GLbitfield;
    109 typedef unsigned char GLubyte;
    110 
    111 typedef void (APIENTRY * PFNGLCLEARPROC)(GLbitfield);
    112 typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGPROC)(GLenum);
    113 typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*);
    114 typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint);
    115 
    116 #define VK_NULL_HANDLE 0
    117 
    118 typedef void* VkInstance;
    119 typedef void* VkPhysicalDevice;
    120 typedef uint64_t VkSurfaceKHR;
    121 typedef uint32_t VkFlags;
    122 typedef uint32_t VkBool32;
    123 
    124 typedef enum VkStructureType
    125 {
    126     VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
    127     VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
    128     VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
    129     VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
    130     VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
    131     VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000,
    132     VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
    133 } VkStructureType;
    134 
    135 typedef enum VkResult
    136 {
    137     VK_SUCCESS = 0,
    138     VK_NOT_READY = 1,
    139     VK_TIMEOUT = 2,
    140     VK_EVENT_SET = 3,
    141     VK_EVENT_RESET = 4,
    142     VK_INCOMPLETE = 5,
    143     VK_ERROR_OUT_OF_HOST_MEMORY = -1,
    144     VK_ERROR_OUT_OF_DEVICE_MEMORY = -2,
    145     VK_ERROR_INITIALIZATION_FAILED = -3,
    146     VK_ERROR_DEVICE_LOST = -4,
    147     VK_ERROR_MEMORY_MAP_FAILED = -5,
    148     VK_ERROR_LAYER_NOT_PRESENT = -6,
    149     VK_ERROR_EXTENSION_NOT_PRESENT = -7,
    150     VK_ERROR_FEATURE_NOT_PRESENT = -8,
    151     VK_ERROR_INCOMPATIBLE_DRIVER = -9,
    152     VK_ERROR_TOO_MANY_OBJECTS = -10,
    153     VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
    154     VK_ERROR_SURFACE_LOST_KHR = -1000000000,
    155     VK_SUBOPTIMAL_KHR = 1000001003,
    156     VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
    157     VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
    158     VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
    159     VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
    160     VK_RESULT_MAX_ENUM = 0x7FFFFFFF
    161 } VkResult;
    162 
    163 typedef struct VkAllocationCallbacks VkAllocationCallbacks;
    164 
    165 typedef struct VkExtensionProperties
    166 {
    167     char            extensionName[256];
    168     uint32_t        specVersion;
    169 } VkExtensionProperties;
    170 
    171 typedef void (APIENTRY * PFN_vkVoidFunction)(void);
    172 
    173 #if defined(_GLFW_VULKAN_STATIC)
    174   PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance,const char*);
    175   VkResult vkEnumerateInstanceExtensionProperties(const char*,uint32_t*,VkExtensionProperties*);
    176 #else
    177   typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*);
    178   typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*);
    179   #define vkEnumerateInstanceExtensionProperties _glfw.vk.EnumerateInstanceExtensionProperties
    180   #define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr
    181 #endif
    182 
    183 #if defined(_GLFW_COCOA)
    184  #include "cocoa_platform.h"
    185 #elif defined(_GLFW_WIN32)
    186  #include "win32_platform.h"
    187 #elif defined(_GLFW_X11)
    188  #include "x11_platform.h"
    189 #elif defined(_GLFW_WAYLAND)
    190  #include "wl_platform.h"
    191 #elif defined(_GLFW_OSMESA)
    192  #include "null_platform.h"
    193 #else
    194  #error "No supported window creation API selected"
    195 #endif
    196 
    197 // Constructs a version number string from the public header macros
    198 #define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r
    199 #define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r)
    200 #define _GLFW_VERSION_NUMBER _GLFW_MAKE_VERSION(GLFW_VERSION_MAJOR, \
    201                                                 GLFW_VERSION_MINOR, \
    202                                                 GLFW_VERSION_REVISION)
    203 
    204 // Checks for whether the library has been initialized
    205 #define _GLFW_REQUIRE_INIT()                         \
    206     if (!_glfw.initialized)                          \
    207     {                                                \
    208         _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
    209         return;                                      \
    210     }
    211 #define _GLFW_REQUIRE_INIT_OR_RETURN(x)              \
    212     if (!_glfw.initialized)                          \
    213     {                                                \
    214         _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
    215         return x;                                    \
    216     }
    217 
    218 // Swaps the provided pointers
    219 #define _GLFW_SWAP_POINTERS(x, y) \
    220     {                             \
    221         void* t;                  \
    222         t = x;                    \
    223         x = y;                    \
    224         y = t;                    \
    225     }
    226 
    227 // Per-thread error structure
    228 //
    229 struct _GLFWerror
    230 {
    231     _GLFWerror*     next;
    232     int             code;
    233     char            description[_GLFW_MESSAGE_SIZE];
    234 };
    235 
    236 // Initialization configuration
    237 //
    238 // Parameters relating to the initialization of the library
    239 //
    240 struct _GLFWinitconfig
    241 {
    242     GLFWbool      hatButtons;
    243     struct {
    244         GLFWbool  menubar;
    245         GLFWbool  chdir;
    246     } ns;
    247 };
    248 
    249 // Window configuration
    250 //
    251 // Parameters relating to the creation of the window but not directly related
    252 // to the framebuffer.  This is used to pass window creation parameters from
    253 // shared code to the platform API.
    254 //
    255 struct _GLFWwndconfig
    256 {
    257     int           width;
    258     int           height;
    259     const char*   title;
    260     GLFWbool      resizable;
    261     GLFWbool      visible;
    262     GLFWbool      decorated;
    263     GLFWbool      focused;
    264     GLFWbool      autoIconify;
    265     GLFWbool      floating;
    266     GLFWbool      maximized;
    267     GLFWbool      centerCursor;
    268     GLFWbool      focusOnShow;
    269     GLFWbool      scaleToMonitor;
    270     struct {
    271         GLFWbool  retina;
    272         char      frameName[256];
    273     } ns;
    274     struct {
    275         char      className[256];
    276         char      instanceName[256];
    277     } x11;
    278 };
    279 
    280 // Context configuration
    281 //
    282 // Parameters relating to the creation of the context but not directly related
    283 // to the framebuffer.  This is used to pass context creation parameters from
    284 // shared code to the platform API.
    285 //
    286 struct _GLFWctxconfig
    287 {
    288     int           client;
    289     int           source;
    290     int           major;
    291     int           minor;
    292     GLFWbool      forward;
    293     GLFWbool      debug;
    294     GLFWbool      noerror;
    295     int           profile;
    296     int           robustness;
    297     int           release;
    298     _GLFWwindow*  share;
    299     struct {
    300         GLFWbool  offline;
    301     } nsgl;
    302 };
    303 
    304 // Framebuffer configuration
    305 //
    306 // This describes buffers and their sizes.  It also contains
    307 // a platform-specific ID used to map back to the backend API object.
    308 //
    309 // It is used to pass framebuffer parameters from shared code to the platform
    310 // API and also to enumerate and select available framebuffer configs.
    311 //
    312 struct _GLFWfbconfig
    313 {
    314     int         redBits;
    315     int         greenBits;
    316     int         blueBits;
    317     int         alphaBits;
    318     int         depthBits;
    319     int         stencilBits;
    320     int         accumRedBits;
    321     int         accumGreenBits;
    322     int         accumBlueBits;
    323     int         accumAlphaBits;
    324     int         auxBuffers;
    325     GLFWbool    stereo;
    326     int         samples;
    327     GLFWbool    sRGB;
    328     GLFWbool    doublebuffer;
    329     GLFWbool    transparent;
    330     uintptr_t   handle;
    331 };
    332 
    333 // Context structure
    334 //
    335 struct _GLFWcontext
    336 {
    337     int                 client;
    338     int                 source;
    339     int                 major, minor, revision;
    340     GLFWbool            forward, debug, noerror;
    341     int                 profile;
    342     int                 robustness;
    343     int                 release;
    344 
    345     PFNGLGETSTRINGIPROC  GetStringi;
    346     PFNGLGETINTEGERVPROC GetIntegerv;
    347     PFNGLGETSTRINGPROC   GetString;
    348 
    349     _GLFWmakecontextcurrentfun  makeCurrent;
    350     _GLFWswapbuffersfun         swapBuffers;
    351     _GLFWswapintervalfun        swapInterval;
    352     _GLFWextensionsupportedfun  extensionSupported;
    353     _GLFWgetprocaddressfun      getProcAddress;
    354     _GLFWdestroycontextfun      destroy;
    355 
    356     // This is defined in the context API's context.h
    357     _GLFW_PLATFORM_CONTEXT_STATE;
    358     // This is defined in egl_context.h
    359     _GLFW_EGL_CONTEXT_STATE;
    360     // This is defined in osmesa_context.h
    361     _GLFW_OSMESA_CONTEXT_STATE;
    362 };
    363 
    364 // Window and context structure
    365 //
    366 struct _GLFWwindow
    367 {
    368     struct _GLFWwindow* next;
    369 
    370     // Window settings and state
    371     GLFWbool            resizable;
    372     GLFWbool            decorated;
    373     GLFWbool            autoIconify;
    374     GLFWbool            floating;
    375     GLFWbool            focusOnShow;
    376     GLFWbool            shouldClose;
    377     void*               userPointer;
    378     GLFWbool            doublebuffer;
    379     GLFWvidmode         videoMode;
    380     _GLFWmonitor*       monitor;
    381     _GLFWcursor*        cursor;
    382 
    383     int                 minwidth, minheight;
    384     int                 maxwidth, maxheight;
    385     int                 numer, denom;
    386 
    387     GLFWbool            stickyKeys;
    388     GLFWbool            stickyMouseButtons;
    389     GLFWbool            lockKeyMods;
    390     int                 cursorMode;
    391     char                mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1];
    392     char                keys[GLFW_KEY_LAST + 1];
    393     // Virtual cursor position when cursor is disabled
    394     double              virtualCursorPosX, virtualCursorPosY;
    395     GLFWbool            rawMouseMotion;
    396 
    397     _GLFWcontext        context;
    398 
    399     struct {
    400         GLFWwindowposfun          pos;
    401         GLFWwindowsizefun         size;
    402         GLFWwindowclosefun        close;
    403         GLFWwindowrefreshfun      refresh;
    404         GLFWwindowfocusfun        focus;
    405         GLFWwindowiconifyfun      iconify;
    406         GLFWwindowmaximizefun     maximize;
    407         GLFWframebuffersizefun    fbsize;
    408         GLFWwindowcontentscalefun scale;
    409         GLFWmousebuttonfun        mouseButton;
    410         GLFWcursorposfun          cursorPos;
    411         GLFWcursorenterfun        cursorEnter;
    412         GLFWscrollfun             scroll;
    413         GLFWkeyfun                key;
    414         GLFWcharfun               character;
    415         GLFWcharmodsfun           charmods;
    416         GLFWdropfun               drop;
    417     } callbacks;
    418 
    419     // This is defined in the window API's platform.h
    420     _GLFW_PLATFORM_WINDOW_STATE;
    421 };
    422 
    423 // Monitor structure
    424 //
    425 struct _GLFWmonitor
    426 {
    427     char            name[128];
    428     void*           userPointer;
    429 
    430     // Physical dimensions in millimeters.
    431     int             widthMM, heightMM;
    432 
    433     // The window whose video mode is current on this monitor
    434     _GLFWwindow*    window;
    435 
    436     GLFWvidmode*    modes;
    437     int             modeCount;
    438     GLFWvidmode     currentMode;
    439 
    440     GLFWgammaramp   originalRamp;
    441     GLFWgammaramp   currentRamp;
    442 
    443     // This is defined in the window API's platform.h
    444     _GLFW_PLATFORM_MONITOR_STATE;
    445 };
    446 
    447 // Cursor structure
    448 //
    449 struct _GLFWcursor
    450 {
    451     _GLFWcursor*    next;
    452 
    453     // This is defined in the window API's platform.h
    454     _GLFW_PLATFORM_CURSOR_STATE;
    455 };
    456 
    457 // Gamepad mapping element structure
    458 //
    459 struct _GLFWmapelement
    460 {
    461     uint8_t         type;
    462     uint8_t         index;
    463     int8_t          axisScale;
    464     int8_t          axisOffset;
    465 };
    466 
    467 // Gamepad mapping structure
    468 //
    469 struct _GLFWmapping
    470 {
    471     char            name[128];
    472     char            guid[33];
    473     _GLFWmapelement buttons[15];
    474     _GLFWmapelement axes[6];
    475 };
    476 
    477 // Joystick structure
    478 //
    479 struct _GLFWjoystick
    480 {
    481     GLFWbool        allocated;
    482     GLFWbool        connected;
    483     float*          axes;
    484     int             axisCount;
    485     unsigned char*  buttons;
    486     int             buttonCount;
    487     unsigned char*  hats;
    488     int             hatCount;
    489     char            name[128];
    490     void*           userPointer;
    491     char            guid[33];
    492     _GLFWmapping*   mapping;
    493 
    494     // This is defined in the joystick API's joystick.h
    495     _GLFW_PLATFORM_JOYSTICK_STATE;
    496 };
    497 
    498 // Thread local storage structure
    499 //
    500 struct _GLFWtls
    501 {
    502     // This is defined in the platform's thread.h
    503     _GLFW_PLATFORM_TLS_STATE;
    504 };
    505 
    506 // Mutex structure
    507 //
    508 struct _GLFWmutex
    509 {
    510     // This is defined in the platform's thread.h
    511     _GLFW_PLATFORM_MUTEX_STATE;
    512 };
    513 
    514 // Library global data
    515 //
    516 struct _GLFWlibrary
    517 {
    518     GLFWbool            initialized;
    519 
    520     struct {
    521         _GLFWinitconfig init;
    522         _GLFWfbconfig   framebuffer;
    523         _GLFWwndconfig  window;
    524         _GLFWctxconfig  context;
    525         int             refreshRate;
    526     } hints;
    527 
    528     _GLFWerror*         errorListHead;
    529     _GLFWcursor*        cursorListHead;
    530     _GLFWwindow*        windowListHead;
    531 
    532     _GLFWmonitor**      monitors;
    533     int                 monitorCount;
    534 
    535     _GLFWjoystick       joysticks[GLFW_JOYSTICK_LAST + 1];
    536     _GLFWmapping*       mappings;
    537     int                 mappingCount;
    538 
    539     _GLFWtls            errorSlot;
    540     _GLFWtls            contextSlot;
    541     _GLFWmutex          errorLock;
    542 
    543     struct {
    544         uint64_t        offset;
    545         // This is defined in the platform's time.h
    546         _GLFW_PLATFORM_LIBRARY_TIMER_STATE;
    547     } timer;
    548 
    549     struct {
    550         GLFWbool        available;
    551         void*           handle;
    552         char*           extensions[2];
    553 #if !defined(_GLFW_VULKAN_STATIC)
    554         PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties;
    555         PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
    556 #endif
    557         GLFWbool        KHR_surface;
    558 #if defined(_GLFW_WIN32)
    559         GLFWbool        KHR_win32_surface;
    560 #elif defined(_GLFW_COCOA)
    561         GLFWbool        MVK_macos_surface;
    562         GLFWbool        EXT_metal_surface;
    563 #elif defined(_GLFW_X11)
    564         GLFWbool        KHR_xlib_surface;
    565         GLFWbool        KHR_xcb_surface;
    566 #elif defined(_GLFW_WAYLAND)
    567         GLFWbool        KHR_wayland_surface;
    568 #endif
    569     } vk;
    570 
    571     struct {
    572         GLFWmonitorfun  monitor;
    573         GLFWjoystickfun joystick;
    574     } callbacks;
    575 
    576     // This is defined in the window API's platform.h
    577     _GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
    578     // This is defined in the context API's context.h
    579     _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE;
    580     // This is defined in the platform's joystick.h
    581     _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE;
    582     // This is defined in egl_context.h
    583     _GLFW_EGL_LIBRARY_CONTEXT_STATE;
    584     // This is defined in osmesa_context.h
    585     _GLFW_OSMESA_LIBRARY_CONTEXT_STATE;
    586 };
    587 
    588 // Global state shared between compilation units of GLFW
    589 //
    590 extern _GLFWlibrary _glfw;
    591 
    592 
    593 //////////////////////////////////////////////////////////////////////////
    594 //////                       GLFW platform API                      //////
    595 //////////////////////////////////////////////////////////////////////////
    596 
    597 int _glfwPlatformInit(void);
    598 void _glfwPlatformTerminate(void);
    599 const char* _glfwPlatformGetVersionString(void);
    600 
    601 void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos);
    602 void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos);
    603 void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode);
    604 void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled);
    605 GLFWbool _glfwPlatformRawMouseMotionSupported(void);
    606 int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
    607                               const GLFWimage* image, int xhot, int yhot);
    608 int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape);
    609 void _glfwPlatformDestroyCursor(_GLFWcursor* cursor);
    610 void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor);
    611 
    612 const char* _glfwPlatformGetScancodeName(int scancode);
    613 int _glfwPlatformGetKeyScancode(int key);
    614 
    615 void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor);
    616 void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos);
    617 void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
    618                                          float* xscale, float* yscale);
    619 void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int *width, int *height);
    620 GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count);
    621 void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode);
    622 GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
    623 void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
    624 
    625 void _glfwPlatformSetClipboardString(const char* string);
    626 const char* _glfwPlatformGetClipboardString(void);
    627 
    628 int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode);
    629 void _glfwPlatformUpdateGamepadGUID(char* guid);
    630 
    631 uint64_t _glfwPlatformGetTimerValue(void);
    632 uint64_t _glfwPlatformGetTimerFrequency(void);
    633 
    634 int _glfwPlatformCreateWindow(_GLFWwindow* window,
    635                               const _GLFWwndconfig* wndconfig,
    636                               const _GLFWctxconfig* ctxconfig,
    637                               const _GLFWfbconfig* fbconfig);
    638 void _glfwPlatformDestroyWindow(_GLFWwindow* window);
    639 void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title);
    640 void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
    641                                 int count, const GLFWimage* images);
    642 void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos);
    643 void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos);
    644 void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height);
    645 void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
    646 void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
    647                                       int minwidth, int minheight,
    648                                       int maxwidth, int maxheight);
    649 void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom);
    650 void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height);
    651 void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
    652                                      int* left, int* top,
    653                                      int* right, int* bottom);
    654 void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
    655                                         float* xscale, float* yscale);
    656 void _glfwPlatformIconifyWindow(_GLFWwindow* window);
    657 void _glfwPlatformRestoreWindow(_GLFWwindow* window);
    658 void _glfwPlatformMaximizeWindow(_GLFWwindow* window);
    659 void _glfwPlatformShowWindow(_GLFWwindow* window);
    660 void _glfwPlatformHideWindow(_GLFWwindow* window);
    661 void _glfwPlatformRequestWindowAttention(_GLFWwindow* window);
    662 void _glfwPlatformFocusWindow(_GLFWwindow* window);
    663 void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor,
    664                                    int xpos, int ypos, int width, int height,
    665                                    int refreshRate);
    666 int _glfwPlatformWindowFocused(_GLFWwindow* window);
    667 int _glfwPlatformWindowIconified(_GLFWwindow* window);
    668 int _glfwPlatformWindowVisible(_GLFWwindow* window);
    669 int _glfwPlatformWindowMaximized(_GLFWwindow* window);
    670 int _glfwPlatformWindowHovered(_GLFWwindow* window);
    671 int _glfwPlatformFramebufferTransparent(_GLFWwindow* window);
    672 float _glfwPlatformGetWindowOpacity(_GLFWwindow* window);
    673 void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled);
    674 void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled);
    675 void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled);
    676 void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity);
    677 
    678 void _glfwPlatformPollEvents(void);
    679 void _glfwPlatformWaitEvents(void);
    680 void _glfwPlatformWaitEventsTimeout(double timeout);
    681 void _glfwPlatformPostEmptyEvent(void);
    682 
    683 void _glfwPlatformGetRequiredInstanceExtensions(char** extensions);
    684 int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
    685                                                       VkPhysicalDevice device,
    686                                                       uint32_t queuefamily);
    687 VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
    688                                           _GLFWwindow* window,
    689                                           const VkAllocationCallbacks* allocator,
    690                                           VkSurfaceKHR* surface);
    691 
    692 GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls);
    693 void _glfwPlatformDestroyTls(_GLFWtls* tls);
    694 void* _glfwPlatformGetTls(_GLFWtls* tls);
    695 void _glfwPlatformSetTls(_GLFWtls* tls, void* value);
    696 
    697 GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex);
    698 void _glfwPlatformDestroyMutex(_GLFWmutex* mutex);
    699 void _glfwPlatformLockMutex(_GLFWmutex* mutex);
    700 void _glfwPlatformUnlockMutex(_GLFWmutex* mutex);
    701 
    702 
    703 //////////////////////////////////////////////////////////////////////////
    704 //////                         GLFW event API                       //////
    705 //////////////////////////////////////////////////////////////////////////
    706 
    707 void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused);
    708 void _glfwInputWindowPos(_GLFWwindow* window, int xpos, int ypos);
    709 void _glfwInputWindowSize(_GLFWwindow* window, int width, int height);
    710 void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height);
    711 void _glfwInputWindowContentScale(_GLFWwindow* window,
    712                                   float xscale, float yscale);
    713 void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified);
    714 void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized);
    715 void _glfwInputWindowDamage(_GLFWwindow* window);
    716 void _glfwInputWindowCloseRequest(_GLFWwindow* window);
    717 void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor);
    718 
    719 void _glfwInputKey(_GLFWwindow* window,
    720                    int key, int scancode, int action, int mods);
    721 void _glfwInputChar(_GLFWwindow* window,
    722                     uint32_t codepoint, int mods, GLFWbool plain);
    723 void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset);
    724 void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods);
    725 void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos);
    726 void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered);
    727 void _glfwInputDrop(_GLFWwindow* window, int count, const char** names);
    728 void _glfwInputJoystick(_GLFWjoystick* js, int event);
    729 void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value);
    730 void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value);
    731 void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value);
    732 
    733 void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement);
    734 void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window);
    735 
    736 #if defined(__GNUC__)
    737 void _glfwInputError(int code, const char* format, ...)
    738     __attribute__((format(printf, 2, 3)));
    739 #else
    740 void _glfwInputError(int code, const char* format, ...);
    741 #endif
    742 
    743 
    744 //////////////////////////////////////////////////////////////////////////
    745 //////                       GLFW internal API                      //////
    746 //////////////////////////////////////////////////////////////////////////
    747 
    748 GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions);
    749 const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
    750                                          const _GLFWfbconfig* alternatives,
    751                                          unsigned int count);
    752 GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
    753                                     const _GLFWctxconfig* ctxconfig);
    754 GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig);
    755 
    756 const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
    757                                         const GLFWvidmode* desired);
    758 int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second);
    759 _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM);
    760 void _glfwFreeMonitor(_GLFWmonitor* monitor);
    761 void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size);
    762 void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
    763 void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
    764 
    765 void _glfwInitGamepadMappings(void);
    766 _GLFWjoystick* _glfwAllocJoystick(const char* name,
    767                                   const char* guid,
    768                                   int axisCount,
    769                                   int buttonCount,
    770                                   int hatCount);
    771 void _glfwFreeJoystick(_GLFWjoystick* js);
    772 void _glfwCenterCursorInContentArea(_GLFWwindow* window);
    773 
    774 GLFWbool _glfwInitVulkan(int mode);
    775 void _glfwTerminateVulkan(void);
    776 const char* _glfwGetVulkanResultString(VkResult result);
    777 
    778 size_t _glfwEncodeUTF8(char* s, uint32_t codepoint);
    779 char** _glfwParseUriList(char* text, int* count);
    780 
    781 char* _glfw_strdup(const char* source);
    782 int _glfw_min(int a, int b);
    783 int _glfw_max(int a, int b);
    784 float _glfw_fminf(float a, float b);
    785 float _glfw_fmaxf(float a, float b);
    786