From 32eb50b75ea42aeba5aa57c406eac385d446c821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 6 Dec 2016 20:10:51 +0100 Subject: [PATCH] Move to Vulkan style function typedefs PFN_FunctionName is more readable than SCREAMSOUP_T. Context creation API function typedefs are kept as-is where the original header provided them, for compatibility and familiarity reasons. --- src/egl_context.c | 32 +++++++++++----------- src/egl_context.h | 64 ++++++++++++++++++++++---------------------- src/glx_context.h | 7 ++--- src/osmesa_context.c | 14 +++++----- src/osmesa_context.h | 28 +++++++++---------- src/wgl_context.c | 12 ++++----- src/wgl_context.h | 24 ++++++++--------- src/win32_init.c | 18 ++++++------- src/win32_platform.h | 36 ++++++++++++------------- src/x11_init.c | 2 +- src/x11_platform.h | 4 +-- 11 files changed, 121 insertions(+), 120 deletions(-) diff --git a/src/egl_context.c b/src/egl_context.c index f60a17cf..9640cc6f 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -315,37 +315,37 @@ GLFWbool _glfwInitEGL(void) _glfw.egl.prefix = (strncmp(sonames[i], "lib", 3) == 0); - _glfw.egl.GetConfigAttrib = (PFNEGLGETCONFIGATTRIBPROC) + _glfw.egl.GetConfigAttrib = (PFN_eglGetConfigAttrib) _glfw_dlsym(_glfw.egl.handle, "eglGetConfigAttrib"); - _glfw.egl.GetConfigs = (PFNEGLGETCONFIGSPROC) + _glfw.egl.GetConfigs = (PFN_eglGetConfigs) _glfw_dlsym(_glfw.egl.handle, "eglGetConfigs"); - _glfw.egl.GetDisplay = (PFNEGLGETDISPLAYPROC) + _glfw.egl.GetDisplay = (PFN_eglGetDisplay) _glfw_dlsym(_glfw.egl.handle, "eglGetDisplay"); - _glfw.egl.GetError = (PFNEGLGETERRORPROC) + _glfw.egl.GetError = (PFN_eglGetError) _glfw_dlsym(_glfw.egl.handle, "eglGetError"); - _glfw.egl.Initialize = (PFNEGLINITIALIZEPROC) + _glfw.egl.Initialize = (PFN_eglInitialize) _glfw_dlsym(_glfw.egl.handle, "eglInitialize"); - _glfw.egl.Terminate = (PFNEGLTERMINATEPROC) + _glfw.egl.Terminate = (PFN_eglTerminate) _glfw_dlsym(_glfw.egl.handle, "eglTerminate"); - _glfw.egl.BindAPI = (PFNEGLBINDAPIPROC) + _glfw.egl.BindAPI = (PFN_eglBindAPI) _glfw_dlsym(_glfw.egl.handle, "eglBindAPI"); - _glfw.egl.CreateContext = (PFNEGLCREATECONTEXTPROC) + _glfw.egl.CreateContext = (PFN_eglCreateContext) _glfw_dlsym(_glfw.egl.handle, "eglCreateContext"); - _glfw.egl.DestroySurface = (PFNEGLDESTROYSURFACEPROC) + _glfw.egl.DestroySurface = (PFN_eglDestroySurface) _glfw_dlsym(_glfw.egl.handle, "eglDestroySurface"); - _glfw.egl.DestroyContext = (PFNEGLDESTROYCONTEXTPROC) + _glfw.egl.DestroyContext = (PFN_eglDestroyContext) _glfw_dlsym(_glfw.egl.handle, "eglDestroyContext"); - _glfw.egl.CreateWindowSurface = (PFNEGLCREATEWINDOWSURFACEPROC) + _glfw.egl.CreateWindowSurface = (PFN_eglCreateWindowSurface) _glfw_dlsym(_glfw.egl.handle, "eglCreateWindowSurface"); - _glfw.egl.MakeCurrent = (PFNEGLMAKECURRENTPROC) + _glfw.egl.MakeCurrent = (PFN_eglMakeCurrent) _glfw_dlsym(_glfw.egl.handle, "eglMakeCurrent"); - _glfw.egl.SwapBuffers = (PFNEGLSWAPBUFFERSPROC) + _glfw.egl.SwapBuffers = (PFN_eglSwapBuffers) _glfw_dlsym(_glfw.egl.handle, "eglSwapBuffers"); - _glfw.egl.SwapInterval = (PFNEGLSWAPINTERVALPROC) + _glfw.egl.SwapInterval = (PFN_eglSwapInterval) _glfw_dlsym(_glfw.egl.handle, "eglSwapInterval"); - _glfw.egl.QueryString = (PFNEGLQUERYSTRINGPROC) + _glfw.egl.QueryString = (PFN_eglQueryString) _glfw_dlsym(_glfw.egl.handle, "eglQueryString"); - _glfw.egl.GetProcAddress = (PFNEGLGETPROCADDRESSPROC) + _glfw.egl.GetProcAddress = (PFN_eglGetProcAddress) _glfw_dlsym(_glfw.egl.handle, "eglGetProcAddress"); if (!_glfw.egl.GetConfigAttrib || diff --git a/src/egl_context.h b/src/egl_context.h index 3aab0d83..219a6c51 100644 --- a/src/egl_context.h +++ b/src/egl_context.h @@ -116,22 +116,22 @@ typedef void* EGLDisplay; typedef void* EGLSurface; // EGL function pointer typedefs -typedef EGLBoolean (EGLAPIENTRY * PFNEGLGETCONFIGATTRIBPROC)(EGLDisplay,EGLConfig,EGLint,EGLint*); -typedef EGLBoolean (EGLAPIENTRY * PFNEGLGETCONFIGSPROC)(EGLDisplay,EGLConfig*,EGLint,EGLint*); -typedef EGLDisplay (EGLAPIENTRY * PFNEGLGETDISPLAYPROC)(EGLNativeDisplayType); -typedef EGLint (EGLAPIENTRY * PFNEGLGETERRORPROC)(void); -typedef EGLBoolean (EGLAPIENTRY * PFNEGLINITIALIZEPROC)(EGLDisplay,EGLint*,EGLint*); -typedef EGLBoolean (EGLAPIENTRY * PFNEGLTERMINATEPROC)(EGLDisplay); -typedef EGLBoolean (EGLAPIENTRY * PFNEGLBINDAPIPROC)(EGLenum); -typedef EGLContext (EGLAPIENTRY * PFNEGLCREATECONTEXTPROC)(EGLDisplay,EGLConfig,EGLContext,const EGLint*); -typedef EGLBoolean (EGLAPIENTRY * PFNEGLDESTROYSURFACEPROC)(EGLDisplay,EGLSurface); -typedef EGLBoolean (EGLAPIENTRY * PFNEGLDESTROYCONTEXTPROC)(EGLDisplay,EGLContext); -typedef EGLSurface (EGLAPIENTRY * PFNEGLCREATEWINDOWSURFACEPROC)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*); -typedef EGLBoolean (EGLAPIENTRY * PFNEGLMAKECURRENTPROC)(EGLDisplay,EGLSurface,EGLSurface,EGLContext); -typedef EGLBoolean (EGLAPIENTRY * PFNEGLSWAPBUFFERSPROC)(EGLDisplay,EGLSurface); -typedef EGLBoolean (EGLAPIENTRY * PFNEGLSWAPINTERVALPROC)(EGLDisplay,EGLint); -typedef const char* (EGLAPIENTRY * PFNEGLQUERYSTRINGPROC)(EGLDisplay,EGLint); -typedef GLFWglproc (EGLAPIENTRY * PFNEGLGETPROCADDRESSPROC)(const char*); +typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*); +typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*); +typedef EGLDisplay (EGLAPIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType); +typedef EGLint (EGLAPIENTRY * PFN_eglGetError)(void); +typedef EGLBoolean (EGLAPIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*); +typedef EGLBoolean (EGLAPIENTRY * PFN_eglTerminate)(EGLDisplay); +typedef EGLBoolean (EGLAPIENTRY * PFN_eglBindAPI)(EGLenum); +typedef EGLContext (EGLAPIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*); +typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface); +typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext); +typedef EGLSurface (EGLAPIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*); +typedef EGLBoolean (EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext); +typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface); +typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint); +typedef const char* (EGLAPIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint); +typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*); #define eglGetConfigAttrib _glfw.egl.GetConfigAttrib #define eglGetConfigs _glfw.egl.GetConfigs #define eglGetDisplay _glfw.egl.GetDisplay @@ -180,22 +180,22 @@ typedef struct _GLFWlibraryEGL void* handle; - PFNEGLGETCONFIGATTRIBPROC GetConfigAttrib; - PFNEGLGETCONFIGSPROC GetConfigs; - PFNEGLGETDISPLAYPROC GetDisplay; - PFNEGLGETERRORPROC GetError; - PFNEGLINITIALIZEPROC Initialize; - PFNEGLTERMINATEPROC Terminate; - PFNEGLBINDAPIPROC BindAPI; - PFNEGLCREATECONTEXTPROC CreateContext; - PFNEGLDESTROYSURFACEPROC DestroySurface; - PFNEGLDESTROYCONTEXTPROC DestroyContext; - PFNEGLCREATEWINDOWSURFACEPROC CreateWindowSurface; - PFNEGLMAKECURRENTPROC MakeCurrent; - PFNEGLSWAPBUFFERSPROC SwapBuffers; - PFNEGLSWAPINTERVALPROC SwapInterval; - PFNEGLQUERYSTRINGPROC QueryString; - PFNEGLGETPROCADDRESSPROC GetProcAddress; + PFN_eglGetConfigAttrib GetConfigAttrib; + PFN_eglGetConfigs GetConfigs; + PFN_eglGetDisplay GetDisplay; + PFN_eglGetError GetError; + PFN_eglInitialize Initialize; + PFN_eglTerminate Terminate; + PFN_eglBindAPI BindAPI; + PFN_eglCreateContext CreateContext; + PFN_eglDestroySurface DestroySurface; + PFN_eglDestroyContext DestroyContext; + PFN_eglCreateWindowSurface CreateWindowSurface; + PFN_eglMakeCurrent MakeCurrent; + PFN_eglSwapBuffers SwapBuffers; + PFN_eglSwapInterval SwapInterval; + PFN_eglQueryString QueryString; + PFN_eglGetProcAddress GetProcAddress; } _GLFWlibraryEGL; diff --git a/src/glx_context.h b/src/glx_context.h index 57aa2415..285861f9 100644 --- a/src/glx_context.h +++ b/src/glx_context.h @@ -85,14 +85,15 @@ typedef const char* (*PFNGLXQUERYEXTENSIONSSTRINGPROC)(Display*,int); typedef GLXFBConfig* (*PFNGLXGETFBCONFIGSPROC)(Display*,int,int*); typedef GLXContext (*PFNGLXCREATENEWCONTEXTPROC)(Display*,GLXFBConfig,int,GLXContext,Bool); typedef __GLXextproc (* PFNGLXGETPROCADDRESSPROC)(const GLubyte *procName); -typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int); -typedef int (*PFNGLXSWAPINTERVALSGIPROC)(int); typedef void (*PFNGLXSWAPINTERVALEXTPROC)(Display*,GLXDrawable,int); -typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display*,GLXFBConfig,GLXContext,Bool,const int*); typedef XVisualInfo* (*PFNGLXGETVISUALFROMFBCONFIGPROC)(Display*,GLXFBConfig); typedef GLXWindow (*PFNGLXCREATEWINDOWPROC)(Display*,GLXFBConfig,Window,const int*); typedef void (*PFNGLXDESTROYWINDOWPROC)(Display*,GLXWindow); +typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int); +typedef int (*PFNGLXSWAPINTERVALSGIPROC)(int); +typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display*,GLXFBConfig,GLXContext,Bool,const int*); + // libGL.so function pointer typedefs #define glXGetFBConfigs _glfw.glx.GetFBConfigs #define glXGetFBConfigAttrib _glfw.glx.GetFBConfigAttrib diff --git a/src/osmesa_context.c b/src/osmesa_context.c index c9fd7d09..70daa5ab 100644 --- a/src/osmesa_context.c +++ b/src/osmesa_context.c @@ -142,19 +142,19 @@ GLFWbool _glfwInitOSMesa(void) return GLFW_FALSE; } - _glfw.osmesa.CreateContextExt = (PFNOSMESACREATECONTEXTEXTPROC) + _glfw.osmesa.CreateContextExt = (PFN_OSMesaCreateContextExt) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaCreateContextExt"); - _glfw.osmesa.CreateContextAttribs = (PFNOSMESACREATECONTEXTATTRIBSPROC) + _glfw.osmesa.CreateContextAttribs = (PFN_OSMesaCreateContextAttribs) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaCreateContextAttribs"); - _glfw.osmesa.DestroyContext = (PFNOSMESADESTROYCONTEXTPROC) + _glfw.osmesa.DestroyContext = (PFN_OSMesaDestroyContext) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaDestroyContext"); - _glfw.osmesa.MakeCurrent = (PFNOSMESAMAKECURRENTPROC) + _glfw.osmesa.MakeCurrent = (PFN_OSMesaMakeCurrent) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaMakeCurrent"); - _glfw.osmesa.GetColorBuffer = (PFNOSMESAGETCOLORBUFFERPROC) + _glfw.osmesa.GetColorBuffer = (PFN_OSMesaGetColorBuffer) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetColorBuffer"); - _glfw.osmesa.GetDepthBuffer = (PFNOSMESAGETDEPTHBUFFERPROC) + _glfw.osmesa.GetDepthBuffer = (PFN_OSMesaGetDepthBuffer) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetDepthBuffer"); - _glfw.osmesa.GetProcAddress = (PFNOSMESAGETPROCADDRESSPROC) + _glfw.osmesa.GetProcAddress = (PFN_OSMesaGetProcAddress) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetProcAddress"); if (!_glfw.osmesa.CreateContextExt || diff --git a/src/osmesa_context.h b/src/osmesa_context.h index c44fbb05..2fa59542 100644 --- a/src/osmesa_context.h +++ b/src/osmesa_context.h @@ -42,13 +42,13 @@ typedef void* OSMesaContext; typedef void (*OSMESAproc)(); -typedef OSMesaContext (* PFNOSMESACREATECONTEXTATTRIBSPROC)(const int*,OSMesaContext); -typedef OSMesaContext (* PFNOSMESACREATECONTEXTEXTPROC)(GLenum,GLint,GLint,GLint,OSMesaContext); -typedef void (* PFNOSMESADESTROYCONTEXTPROC)(OSMesaContext); -typedef int (* PFNOSMESAMAKECURRENTPROC)(OSMesaContext,void*,int,int,int); -typedef int (* PFNOSMESAGETCOLORBUFFERPROC)(OSMesaContext,int*,int*,int*,void**); -typedef int (* PFNOSMESAGETDEPTHBUFFERPROC)(OSMesaContext,int*,int*,int*,void**); -typedef GLFWglproc (* PFNOSMESAGETPROCADDRESSPROC)(const char*); +typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum,GLint,GLint,GLint,OSMesaContext); +typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int*,OSMesaContext); +typedef void (GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext); +typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int); +typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**); +typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**); +typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*); #define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt #define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs #define OSMesaDestroyContext _glfw.osmesa.DestroyContext @@ -78,13 +78,13 @@ typedef struct _GLFWlibraryOSMesa { void* handle; - PFNOSMESACREATECONTEXTEXTPROC CreateContextExt; - PFNOSMESACREATECONTEXTATTRIBSPROC CreateContextAttribs; - PFNOSMESADESTROYCONTEXTPROC DestroyContext; - PFNOSMESAMAKECURRENTPROC MakeCurrent; - PFNOSMESAGETCOLORBUFFERPROC GetColorBuffer; - PFNOSMESAGETDEPTHBUFFERPROC GetDepthBuffer; - PFNOSMESAGETPROCADDRESSPROC GetProcAddress; + PFN_OSMesaCreateContextExt CreateContextExt; + PFN_OSMesaCreateContextAttribs CreateContextAttribs; + PFN_OSMesaDestroyContext DestroyContext; + PFN_OSMesaMakeCurrent MakeCurrent; + PFN_OSMesaGetColorBuffer GetColorBuffer; + PFN_OSMesaGetDepthBuffer GetDepthBuffer; + PFN_OSMesaGetProcAddress GetProcAddress; } _GLFWlibraryOSMesa; diff --git a/src/wgl_context.c b/src/wgl_context.c index a6cb4ce5..75232466 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -434,17 +434,17 @@ GLFWbool _glfwInitWGL(void) return GLFW_FALSE; } - _glfw.wgl.CreateContext = (WGLCREATECONTEXT_T) + _glfw.wgl.CreateContext = (PFN_wglCreateContext) GetProcAddress(_glfw.wgl.instance, "wglCreateContext"); - _glfw.wgl.DeleteContext = (WGLDELETECONTEXT_T) + _glfw.wgl.DeleteContext = (PFN_wglDeleteContext) GetProcAddress(_glfw.wgl.instance, "wglDeleteContext"); - _glfw.wgl.GetProcAddress = (WGLGETPROCADDRESS_T) + _glfw.wgl.GetProcAddress = (PFN_wglGetProcAddress) GetProcAddress(_glfw.wgl.instance, "wglGetProcAddress"); - _glfw.wgl.GetCurrentDC = (WGLGETCURRENTDC_T) + _glfw.wgl.GetCurrentDC = (PFN_wglGetCurrentDC) GetProcAddress(_glfw.wgl.instance, "wglGetCurrentDC"); - _glfw.wgl.MakeCurrent = (WGLMAKECURRENT_T) + _glfw.wgl.MakeCurrent = (PFN_wglMakeCurrent) GetProcAddress(_glfw.wgl.instance, "wglMakeCurrent"); - _glfw.wgl.ShareLists = (WGLSHARELISTS_T) + _glfw.wgl.ShareLists = (PFN_wglShareLists) GetProcAddress(_glfw.wgl.instance, "wglShareLists"); return GLFW_TRUE; diff --git a/src/wgl_context.h b/src/wgl_context.h index 03b92d86..e3a7e372 100644 --- a/src/wgl_context.h +++ b/src/wgl_context.h @@ -82,12 +82,12 @@ typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void); typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC); typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*); -typedef HGLRC (WINAPI * WGLCREATECONTEXT_T)(HDC); -typedef BOOL (WINAPI * WGLDELETECONTEXT_T)(HGLRC); -typedef PROC (WINAPI * WGLGETPROCADDRESS_T)(LPCSTR); -typedef HDC (WINAPI * WGLGETCURRENTDC_T)(void); -typedef BOOL (WINAPI * WGLMAKECURRENT_T)(HDC,HGLRC); -typedef BOOL (WINAPI * WGLSHARELISTS_T)(HGLRC,HGLRC); +typedef HGLRC (WINAPI * PFN_wglCreateContext)(HDC); +typedef BOOL (WINAPI * PFN_wglDeleteContext)(HGLRC); +typedef PROC (WINAPI * PFN_wglGetProcAddress)(LPCSTR); +typedef HDC (WINAPI * PFN_wglGetCurrentDC)(void); +typedef BOOL (WINAPI * PFN_wglMakeCurrent)(HDC,HGLRC); +typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC); // opengl32.dll function pointer typedefs #define wglCreateContext _glfw.wgl.CreateContext @@ -120,12 +120,12 @@ typedef struct _GLFWcontextWGL typedef struct _GLFWlibraryWGL { HINSTANCE instance; - WGLCREATECONTEXT_T CreateContext; - WGLDELETECONTEXT_T DeleteContext; - WGLGETPROCADDRESS_T GetProcAddress; - WGLGETCURRENTDC_T GetCurrentDC; - WGLMAKECURRENT_T MakeCurrent; - WGLSHARELISTS_T ShareLists; + PFN_wglCreateContext CreateContext; + PFN_wglDeleteContext DeleteContext; + PFN_wglGetProcAddress GetProcAddress; + PFN_wglGetCurrentDC GetCurrentDC; + PFN_wglMakeCurrent MakeCurrent; + PFN_wglShareLists ShareLists; GLFWbool extensionsLoaded; diff --git a/src/win32_init.c b/src/win32_init.c index 1d629812..e00baff4 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -71,7 +71,7 @@ static GLFWbool loadLibraries(void) return GLFW_FALSE; } - _glfw.win32.winmm.timeGetTime = (TIMEGETTIME_T) + _glfw.win32.winmm.timeGetTime = (PFN_timeGetTime) GetProcAddress(_glfw.win32.winmm.instance, "timeGetTime"); _glfw.win32.user32.instance = LoadLibraryA("user32.dll"); @@ -81,15 +81,15 @@ static GLFWbool loadLibraries(void) return GLFW_FALSE; } - _glfw.win32.user32.SetProcessDPIAware = (SETPROCESSDPIAWARE_T) + _glfw.win32.user32.SetProcessDPIAware = (PFN_SetProcessDPIAware) GetProcAddress(_glfw.win32.user32.instance, "SetProcessDPIAware"); - _glfw.win32.user32.ChangeWindowMessageFilterEx = (CHANGEWINDOWMESSAGEFILTEREX_T) + _glfw.win32.user32.ChangeWindowMessageFilterEx = (PFN_ChangeWindowMessageFilterEx) GetProcAddress(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx"); _glfw.win32.dinput8.instance = LoadLibraryA("dinput8.dll"); if (_glfw.win32.dinput8.instance) { - _glfw.win32.dinput8.DirectInput8Create = (DIRECTINPUT8CREATE_T) + _glfw.win32.dinput8.DirectInput8Create = (PFN_DirectInput8Create) GetProcAddress(_glfw.win32.dinput8.instance, "DirectInput8Create"); } @@ -110,9 +110,9 @@ static GLFWbool loadLibraries(void) _glfw.win32.xinput.instance = LoadLibraryA(names[i]); if (_glfw.win32.xinput.instance) { - _glfw.win32.xinput.XInputGetCapabilities = (XINPUTGETCAPABILITIES_T) + _glfw.win32.xinput.XInputGetCapabilities = (PFN_XInputGetCapabilities) GetProcAddress(_glfw.win32.xinput.instance, "XInputGetCapabilities"); - _glfw.win32.xinput.XInputGetState = (XINPUTGETSTATE_T) + _glfw.win32.xinput.XInputGetState = (PFN_XInputGetState) GetProcAddress(_glfw.win32.xinput.instance, "XInputGetState"); break; @@ -123,16 +123,16 @@ static GLFWbool loadLibraries(void) _glfw.win32.dwmapi.instance = LoadLibraryA("dwmapi.dll"); if (_glfw.win32.dwmapi.instance) { - _glfw.win32.dwmapi.DwmIsCompositionEnabled = (DWMISCOMPOSITIONENABLED_T) + _glfw.win32.dwmapi.DwmIsCompositionEnabled = (PFN_DwmIsCompositionEnabled) GetProcAddress(_glfw.win32.dwmapi.instance, "DwmIsCompositionEnabled"); - _glfw.win32.dwmapi.DwmFlush = (DWMFLUSH_T) + _glfw.win32.dwmapi.DwmFlush = (PFN_DwmFlush) GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush"); } _glfw.win32.shcore.instance = LoadLibraryA("shcore.dll"); if (_glfw.win32.shcore.instance) { - _glfw.win32.shcore.SetProcessDpiAwareness = (SETPROCESSDPIAWARENESS_T) + _glfw.win32.shcore.SetProcessDpiAwareness = (PFN_SetProcessDpiAwareness) GetProcAddress(_glfw.win32.shcore.instance, "SetProcessDpiAwareness"); } diff --git a/src/win32_platform.h b/src/win32_platform.h index 9e8daecc..0e6f0aaa 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -161,33 +161,33 @@ typedef enum PROCESS_DPI_AWARENESS #endif // winmm.dll function pointer typedefs -typedef DWORD (WINAPI * TIMEGETTIME_T)(void); +typedef DWORD (WINAPI * PFN_timeGetTime)(void); #define _glfw_timeGetTime _glfw.win32.winmm.timeGetTime // xinput.dll function pointer typedefs -typedef DWORD (WINAPI * XINPUTGETCAPABILITIES_T)(DWORD,DWORD,XINPUT_CAPABILITIES*); -typedef DWORD (WINAPI * XINPUTGETSTATE_T)(DWORD,XINPUT_STATE*); +typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*); +typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*); #define _glfw_XInputGetCapabilities _glfw.win32.xinput.XInputGetCapabilities #define _glfw_XInputGetState _glfw.win32.xinput.XInputGetState // dinput8.dll function pointer typedefs -typedef HRESULT (WINAPI * DIRECTINPUT8CREATE_T)(HINSTANCE,DWORD,REFIID,LPVOID*,LPUNKNOWN); +typedef HRESULT (WINAPI * PFN_DirectInput8Create)(HINSTANCE,DWORD,REFIID,LPVOID*,LPUNKNOWN); #define _glfw_DirectInput8Create _glfw.win32.dinput8.DirectInput8Create // user32.dll function pointer typedefs -typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void); -typedef BOOL (WINAPI * CHANGEWINDOWMESSAGEFILTEREX_T)(HWND,UINT,DWORD,PCHANGEFILTERSTRUCT); +typedef BOOL (WINAPI * PFN_SetProcessDPIAware)(void); +typedef BOOL (WINAPI * PFN_ChangeWindowMessageFilterEx)(HWND,UINT,DWORD,PCHANGEFILTERSTRUCT); #define _glfw_SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware #define _glfw_ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx // dwmapi.dll function pointer typedefs -typedef HRESULT (WINAPI * DWMISCOMPOSITIONENABLED_T)(BOOL*); -typedef HRESULT (WINAPI * DWMFLUSH_T)(VOID); +typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*); +typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID); #define _glfw_DwmIsCompositionEnabled _glfw.win32.dwmapi.DwmIsCompositionEnabled #define _glfw_DwmFlush _glfw.win32.dwmapi.DwmFlush // shcore.dll function pointer typedefs -typedef HRESULT (WINAPI * SETPROCESSDPIAWARENESS_T)(PROCESS_DPI_AWARENESS); +typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS); #define _glfw_SetProcessDpiAwareness _glfw.win32.shcore.SetProcessDpiAwareness typedef VkFlags VkWin32SurfaceCreateFlagsKHR; @@ -259,36 +259,36 @@ typedef struct _GLFWlibraryWin32 struct { HINSTANCE instance; - TIMEGETTIME_T timeGetTime; + PFN_timeGetTime timeGetTime; } winmm; struct { HINSTANCE instance; - DIRECTINPUT8CREATE_T DirectInput8Create; + PFN_DirectInput8Create DirectInput8Create; IDirectInput8W* api; } dinput8; struct { HINSTANCE instance; - XINPUTGETCAPABILITIES_T XInputGetCapabilities; - XINPUTGETSTATE_T XInputGetState; + PFN_XInputGetCapabilities XInputGetCapabilities; + PFN_XInputGetState XInputGetState; } xinput; struct { HINSTANCE instance; - SETPROCESSDPIAWARE_T SetProcessDPIAware; - CHANGEWINDOWMESSAGEFILTEREX_T ChangeWindowMessageFilterEx; + PFN_SetProcessDPIAware SetProcessDPIAware; + PFN_ChangeWindowMessageFilterEx ChangeWindowMessageFilterEx; } user32; struct { HINSTANCE instance; - DWMISCOMPOSITIONENABLED_T DwmIsCompositionEnabled; - DWMFLUSH_T DwmFlush; + PFN_DwmIsCompositionEnabled DwmIsCompositionEnabled; + PFN_DwmFlush DwmFlush; } dwmapi; struct { HINSTANCE instance; - SETPROCESSDPIAWARENESS_T SetProcessDpiAwareness; + PFN_SetProcessDpiAwareness SetProcessDpiAwareness; } shcore; } _GLFWlibraryWin32; diff --git a/src/x11_init.c b/src/x11_init.c index a5c5b9e3..5c2b72b6 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -545,7 +545,7 @@ static GLFWbool initExtensions(void) _glfw.x11.x11xcb.handle = dlopen("libX11-xcb.so", RTLD_LAZY | RTLD_GLOBAL); if (_glfw.x11.x11xcb.handle) { - _glfw.x11.x11xcb.XGetXCBConnection = (XGETXCBCONNECTION_T) + _glfw.x11.x11xcb.XGetXCBConnection = (PFN_XGetXCBConnection) dlsym(_glfw.x11.x11xcb.handle, "XGetXCBConnection"); } diff --git a/src/x11_platform.h b/src/x11_platform.h index 4268f262..33f15d34 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -55,7 +55,7 @@ typedef XID xcb_window_t; typedef XID xcb_visualid_t; typedef struct xcb_connection_t xcb_connection_t; -typedef xcb_connection_t* (* XGETXCBCONNECTION_T)(Display*); +typedef xcb_connection_t* (* PFN_XGetXCBConnection)(Display*); typedef VkFlags VkXlibSurfaceCreateFlagsKHR; typedef VkFlags VkXcbSurfaceCreateFlagsKHR; @@ -247,7 +247,7 @@ typedef struct _GLFWlibraryX11 struct { void* handle; - XGETXCBCONNECTION_T XGetXCBConnection; + PFN_XGetXCBConnection XGetXCBConnection; } x11xcb; #if defined(_GLFW_HAS_XF86VM)