mirror of
https://github.com/Relintai/sfw.git
synced 2025-01-03 05:09:36 +01:00
Simplify glfw import on mac.
This commit is contained in:
parent
7dc440b01d
commit
ba38f48840
@ -5752,7 +5752,7 @@ GLFWAPI int glfwVulkanSupported(void);
|
||||
*/
|
||||
GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
|
||||
|
||||
/*! @brief Returns the `HWND` of the specified window as a void*, only works on windows
|
||||
/*! @brief Returns the `HWND` of the specified window as a void*, only works on windows, and osx
|
||||
*
|
||||
* @return The `HWND` of the specified window, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
@ -5774,7 +5774,7 @@ GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
GLFWAPI void *glfwGetWin32WindowAsVPTR(GLFWwindow* window);
|
||||
GLFWAPI void *glfwGetNativeWindowHandleAsVPTR(GLFWwindow* window);
|
||||
|
||||
#if defined(VK_VERSION_1_0)
|
||||
|
||||
@ -17070,12 +17070,16 @@ const char* _glfwGetVulkanResultString(VkResult result)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
GLFWAPI void *glfwGetWin32WindowAsVPTR(GLFWwindow* handle)
|
||||
GLFWAPI void *glfwGetNativeWindowHandleAsVPTR(GLFWwindow* handle)
|
||||
{
|
||||
#if defined(_WIN64) || defined(_WIN32)
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
return window->win32.handle;
|
||||
#elif defined(__APPLE__)
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(nil);
|
||||
return window->ns.object;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
@ -95,19 +95,13 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifndef GLFW_EXPOSE_NATIVE_COCOA
|
||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||
#endif
|
||||
//#include <GLFW/glfw3native.h> // for glfwGetCocoaWindow()
|
||||
#endif
|
||||
|
||||
#include "render_core/3rd_glfw3.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h> // for usleep()
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/html5.h>
|
||||
@ -117,6 +111,7 @@
|
||||
#define EMSCRIPTEN_USE_EMBEDDED_GLFW3
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
// We gather version tests as define in order to easily see which features are version-dependent.
|
||||
#define GLFW_VERSION_COMBINED (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 + GLFW_VERSION_REVISION)
|
||||
@ -625,9 +620,11 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
||||
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||
main_viewport->PlatformHandle = (void*)bd->Window;
|
||||
#ifdef _WIN32
|
||||
main_viewport->PlatformHandleRaw = glfwGetWin32WindowAsVPTR(bd->Window);
|
||||
//main_viewport->PlatformHandleRaw = glfwGetWin32Window(bd->Window);
|
||||
main_viewport->PlatformHandleRaw = glfwGetNativeWindowHandleAsVPTR(bd->Window);
|
||||
#elif defined(__APPLE__)
|
||||
main_viewport->PlatformHandleRaw = (void*)glfwGetCocoaWindow(bd->Window);
|
||||
//main_viewport->PlatformHandleRaw = (void*)glfwGetCocoaWindow(bd->Window);
|
||||
main_viewport->PlatformHandleRaw = glfwGetNativeWindowHandleAsVPTR(bd->Window);
|
||||
#else
|
||||
IM_UNUSED(main_viewport);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user