From 8b991ae051939b568404a5890545b99274c2b466 Mon Sep 17 00:00:00 2001 From: Santiago Date: Sat, 19 Aug 2023 15:22:26 +0200 Subject: [PATCH] Add glfwIsWindowLightTheme function --- include/GLFW/glfw3.h | 2 ++ src/internal.h | 1 + src/win32_window.c | 1 + src/window.c | 9 +++++++++ 4 files changed, 13 insertions(+) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index b1e5cf2b..c029787a 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -3388,6 +3388,8 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); */ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); +GLFWAPI int glfwIsWindowLightTheme(GLFWwindow* window); + /*! @brief Retrieves the size of the content area of the specified window. * * This function retrieves the size, in screen coordinates, of the content area diff --git a/src/internal.h b/src/internal.h index 9dace49c..b3a2962a 100644 --- a/src/internal.h +++ b/src/internal.h @@ -533,6 +533,7 @@ struct _GLFWwindow GLFWbool focusOnShow; GLFWbool mousePassthrough; GLFWbool shouldClose; + GLFWbool isLightTheme; void* userPointer; GLFWbool doublebuffer; GLFWvidmode videoMode; diff --git a/src/win32_window.c b/src/win32_window.c index e029fc7a..379bb64c 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1372,6 +1372,7 @@ static int createNativeWindow(_GLFWwindow* window, should_use_light_mode = wndconfig->theme == GLFW_THEME_LIGHT; _glfwSetWindowTheme(!should_use_light_mode, window->win32.handle); + window->isLightTheme = should_use_light_mode ? GLFW_TRUE : GLFW_FALSE; _glfw_free(wideTitle); diff --git a/src/window.c b/src/window.c index 5f212a98..9d399bfe 100644 --- a/src/window.c +++ b/src/window.c @@ -588,6 +588,15 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos) _glfw.platform.setWindowPos(window, xpos, ypos); } +GLFWAPI int glfwIsWindowLightTheme(GLFWwindow* handle) +{ + _GLFWwindow* window = (_GLFWwindow*)handle; + assert(window != NULL); + + _GLFW_REQUIRE_INIT_OR_RETURN(0); + return window->isLightTheme; +} + GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height) { _GLFWwindow* window = (_GLFWwindow*) handle;