Adds more filters for conditional build of GetWindowHandle with glfw
This commit is contained in:
Didas72
2025-08-14 14:30:29 +01:00
parent 3c9d3d9bef
commit 93f86fa074

View File

@@ -75,13 +75,15 @@
#include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX #include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
//#define GLFW_EXPOSE_NATIVE_WAYLAND //#define GLFW_EXPOSE_NATIVE_WAYLAND
#define GLFW_EXPOSE_NATIVE_X11 #ifdef _GLFW_X11
#define Font X11Font // Hack to fix 'Font' name collision #define GLFW_EXPOSE_NATIVE_X11
// The definition and references to the X11 Font type will be replaced by 'X11Font' #define Font X11Font // Hack to fix 'Font' name collision
// Works as long as the current file consistently references any X11 Font as X11Font // The definition and references to the X11 Font type will be replaced by 'X11Font'
// Since it is never referenced (as of writting), this does not pose an issue // Works as long as the current file consistently references any X11 Font as X11Font
#include "GLFW/glfw3native.h" // Required for: glfwGetX11Window() // Since it is never referenced (as of writting), this does not pose an issue
#undef Font // Revert hack and allow normal raylib Font usage #include "GLFW/glfw3native.h" // Required for: glfwGetX11Window()
#undef Font // Revert hack and allow normal raylib Font usage
#endif
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__)
#include <unistd.h> // Required for: usleep() #include <unistd.h> // Required for: usleep()
@@ -710,7 +712,7 @@ void SetWindowFocused(void)
glfwFocusWindow(platform.handle); glfwFocusWindow(platform.handle);
} }
#if defined(__linux__) #if defined(__linux__) && defined(_GLFW_X11)
// Local storage for the window handle returned by glfwGetX11Window // Local storage for the window handle returned by glfwGetX11Window
// This is needed as X11 handles are integers and may not fit inside a pointer depending on platform // This is needed as X11 handles are integers and may not fit inside a pointer depending on platform
// Storing the handle locally and returning a pointer in GetWindowHandle allows the code to work regardless of pointer width // Storing the handle locally and returning a pointer in GetWindowHandle allows the code to work regardless of pointer width
@@ -723,7 +725,7 @@ void *GetWindowHandle(void)
// NOTE: Returned handle is: void *HWND (windows.h) // NOTE: Returned handle is: void *HWND (windows.h)
return glfwGetWin32Window(platform.handle); return glfwGetWin32Window(platform.handle);
#endif #endif
#if defined(__linux__) #if defined(__linux__) && defined(_GLFW_X11)
// Store the window handle localy and return a pointer to the variable instead // Store the window handle localy and return a pointer to the variable instead
// Reasoning detailed in the declaration of X11WindowHandle // Reasoning detailed in the declaration of X11WindowHandle
X11WindowHandle = glfwGetX11Window(platform.handle); X11WindowHandle = glfwGetX11Window(platform.handle);