From 7bb8ffc29e5c31edf2875ac7aaca38316cfe45e5 Mon Sep 17 00:00:00 2001 From: Daijiro Fukuda Date: Sun, 21 Aug 2022 18:44:16 +0900 Subject: [PATCH] Win32: resolve some symbols re-definition of windows.h in glfw3native.h (#2643) * Win32: resolve some symbols re-definition of windows.h in glfw3native.h This reflects GLFW's fix: https://github.com/glfw/glfw/issues/1348 This enables to build with a external GLFW containing the following fix: * https://github.com/glfw/glfw/commit/05f6c13d119ea2662c97527d2421fb4cffd3dbfc Currently, glfw3native.h of the internal GLFW is customized at https://github.com/raysan5/raylib/commit/2feea87b616292b5bce4454a42c2d048f1cce7d8 This fix is compatible with the current customized glfw3native.h. This fix enables us to update it to the latest and remove the customization. * Win32: remove unneeded typedef --- src/external/glfw/include/GLFW/glfw3native.h | 3 --- src/rcore.c | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/external/glfw/include/GLFW/glfw3native.h b/src/external/glfw/include/GLFW/glfw3native.h index f67f54025570..323d3c77e0e5 100644 --- a/src/external/glfw/include/GLFW/glfw3native.h +++ b/src/external/glfw/include/GLFW/glfw3native.h @@ -92,9 +92,6 @@ extern "C" { // @raysan5: Actually, only HWND handler needs to be defined // Including windows.h could suppose symbols re-definition issues (i.e Rectangle type) //#include - typedef void *PVOID; - typedef PVOID HANDLE; - typedef HANDLE HWND; #elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL) #if defined(__OBJC__) #import diff --git a/src/rcore.c b/src/rcore.c index d90acf6ce20c..c150222304f1 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -214,8 +214,12 @@ // Support retrieving native window handlers #if defined(_WIN32) + typedef void *PVOID; + typedef PVOID HANDLE; + typedef HANDLE HWND; #define GLFW_EXPOSE_NATIVE_WIN32 - #include "GLFW/glfw3native.h" // WARNING: It requires customization to avoid windows.h inclusion! + #define GLFW_NATIVE_INCLUDE_NONE // To avoid some symbols re-definition in windows.h + #include "GLFW/glfw3native.h" #if defined(SUPPORT_WINMM_HIGHRES_TIMER) && !defined(SUPPORT_BUSY_WAIT_LOOP) // NOTE: Those functions require linking with winmm library