|
@@ -302,13 +302,13 @@ void ImGui_ImplGlfw_NewFrame()
|
|
|
// Platform Windows
|
|
|
// --------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
-struct ImGuiPlatformDataGlfw
|
|
|
+struct ImGuiViewportDataGlfw
|
|
|
{
|
|
|
GLFWwindow* Window;
|
|
|
bool WindowOwned;
|
|
|
|
|
|
- ImGuiPlatformDataGlfw() { Window = NULL; WindowOwned = false; }
|
|
|
- ~ImGuiPlatformDataGlfw() { IM_ASSERT(Window == NULL); }
|
|
|
+ ImGuiViewportDataGlfw() { Window = NULL; WindowOwned = false; }
|
|
|
+ ~ImGuiViewportDataGlfw() { IM_ASSERT(Window == NULL); }
|
|
|
};
|
|
|
|
|
|
static void ImGui_ImplGlfw_WindowCloseCallback(GLFWwindow* window)
|
|
@@ -331,7 +331,7 @@ static void ImGui_ImplGlfw_WindowSizeCallback(GLFWwindow* window, int, int)
|
|
|
|
|
|
static void ImGui_ImplGlfw_CreateWindow(ImGuiViewport* viewport)
|
|
|
{
|
|
|
- ImGuiPlatformDataGlfw* data = IM_NEW(ImGuiPlatformDataGlfw)();
|
|
|
+ ImGuiViewportDataGlfw* data = IM_NEW(ImGuiViewportDataGlfw)();
|
|
|
viewport->PlatformUserData = data;
|
|
|
|
|
|
// GLFW 3.2 unfortunately always set focus on glfwCreateWindow() if GLFW_VISIBLE is set, regardless of GLFW_FOCUSED
|
|
@@ -350,7 +350,7 @@ static void ImGui_ImplGlfw_CreateWindow(ImGuiViewport* viewport)
|
|
|
|
|
|
static void ImGui_ImplGlfw_DestroyWindow(ImGuiViewport* viewport)
|
|
|
{
|
|
|
- if (ImGuiPlatformDataGlfw* data = (ImGuiPlatformDataGlfw*)viewport->PlatformUserData)
|
|
|
+ if (ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData)
|
|
|
{
|
|
|
#if GLFW_HAS_GLFW_HOVERED
|
|
|
HWND hwnd = glfwGetWin32Window(data->Window);
|
|
@@ -380,7 +380,7 @@ static LRESULT CALLBACK WndProcNoInputs(HWND hWnd, UINT msg, WPARAM wParam, LPAR
|
|
|
|
|
|
static void ImGui_ImplGlfw_ShowWindow(ImGuiViewport* viewport)
|
|
|
{
|
|
|
- ImGuiPlatformDataGlfw* data = (ImGuiPlatformDataGlfw*)viewport->PlatformUserData;
|
|
|
+ ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
|
|
|
|
|
|
#if defined(_WIN32)
|
|
|
// GLFW hack: Hide icon from task bar
|
|
@@ -416,7 +416,7 @@ static void ImGui_ImplGlfw_ShowWindow(ImGuiViewport* viewport)
|
|
|
|
|
|
static ImVec2 ImGui_ImplGlfw_GetWindowPos(ImGuiViewport* viewport)
|
|
|
{
|
|
|
- ImGuiPlatformDataGlfw* data = (ImGuiPlatformDataGlfw*)viewport->PlatformUserData;
|
|
|
+ ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
|
|
|
int x = 0, y = 0;
|
|
|
glfwGetWindowPos(data->Window, &x, &y);
|
|
|
return ImVec2((float)x, (float)y);
|
|
@@ -424,13 +424,13 @@ static ImVec2 ImGui_ImplGlfw_GetWindowPos(ImGuiViewport* viewport)
|
|
|
|
|
|
static void ImGui_ImplGlfw_SetWindowPos(ImGuiViewport* viewport, ImVec2 pos)
|
|
|
{
|
|
|
- ImGuiPlatformDataGlfw* data = (ImGuiPlatformDataGlfw*)viewport->PlatformUserData;
|
|
|
+ ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
|
|
|
glfwSetWindowPos(data->Window, (int)pos.x, (int)pos.y);
|
|
|
}
|
|
|
|
|
|
static ImVec2 ImGui_ImplGlfw_GetWindowSize(ImGuiViewport* viewport)
|
|
|
{
|
|
|
- ImGuiPlatformDataGlfw* data = (ImGuiPlatformDataGlfw*)viewport->PlatformUserData;
|
|
|
+ ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
|
|
|
int w = 0, h = 0;
|
|
|
glfwGetWindowSize(data->Window, &w, &h);
|
|
|
return ImVec2((float)w, (float)h);
|
|
@@ -438,26 +438,26 @@ static ImVec2 ImGui_ImplGlfw_GetWindowSize(ImGuiViewport* viewport)
|
|
|
|
|
|
static void ImGui_ImplGlfw_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
|
|
|
{
|
|
|
- ImGuiPlatformDataGlfw* data = (ImGuiPlatformDataGlfw*)viewport->PlatformUserData;
|
|
|
+ ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
|
|
|
glfwSetWindowSize(data->Window, (int)size.x, (int)size.y);
|
|
|
}
|
|
|
|
|
|
static void ImGui_ImplGlfw_SetWindowTitle(ImGuiViewport* viewport, const char* title)
|
|
|
{
|
|
|
- ImGuiPlatformDataGlfw* data = (ImGuiPlatformDataGlfw*)viewport->PlatformUserData;
|
|
|
+ ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
|
|
|
glfwSetWindowTitle(data->Window, title);
|
|
|
}
|
|
|
|
|
|
static void ImGui_ImplGlfw_RenderWindow(ImGuiViewport* viewport)
|
|
|
{
|
|
|
- ImGuiPlatformDataGlfw* data = (ImGuiPlatformDataGlfw*)viewport->PlatformUserData;
|
|
|
+ ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
|
|
|
if (g_ClientApi == GlfwClientApi_OpenGL)
|
|
|
glfwMakeContextCurrent(data->Window);
|
|
|
}
|
|
|
|
|
|
static void ImGui_ImplGlfw_SwapBuffers(ImGuiViewport* viewport)
|
|
|
{
|
|
|
- ImGuiPlatformDataGlfw* data = (ImGuiPlatformDataGlfw*)viewport->PlatformUserData;
|
|
|
+ ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
|
|
|
if (g_ClientApi == GlfwClientApi_OpenGL)
|
|
|
glfwSwapBuffers(data->Window);
|
|
|
}
|
|
@@ -480,7 +480,7 @@ enum VkResult { VK_RESULT_MAX_ENUM = 0x7FFFFFFF };
|
|
|
extern "C" { extern GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); }
|
|
|
static int ImGui_ImplGlfw_CreateVkSurface(ImGuiViewport* viewport, ImU64 vk_instance, const void* vk_allocator, ImU64* out_vk_surface)
|
|
|
{
|
|
|
- ImGuiPlatformDataGlfw* data = (ImGuiPlatformDataGlfw*)viewport->PlatformUserData;
|
|
|
+ ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
|
|
|
IM_ASSERT(g_ClientApi == GlfwClientApi_Vulkan);
|
|
|
VkResult err = glfwCreateWindowSurface((VkInstance)vk_instance, data->Window, (const VkAllocationCallbacks*)vk_allocator, (VkSurfaceKHR*)out_vk_surface);
|
|
|
return (int)err;
|
|
@@ -507,7 +507,7 @@ static void ImGui_ImplGlfw_InitPlatformInterface()
|
|
|
|
|
|
// Register main window handle
|
|
|
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
|
|
- ImGuiPlatformDataGlfw* data = IM_NEW(ImGuiPlatformDataGlfw)();
|
|
|
+ ImGuiViewportDataGlfw* data = IM_NEW(ImGuiViewportDataGlfw)();
|
|
|
data->Window = g_Window;
|
|
|
data->WindowOwned = false;
|
|
|
main_viewport->PlatformUserData = data;
|