Add glfwIsWindowLightTheme function

This commit is contained in:
Santiago 2023-08-19 15:22:26 +02:00
parent d63766c99f
commit 8b991ae051
4 changed files with 13 additions and 0 deletions

View File

@ -3388,6 +3388,8 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
*/ */
GLFWAPI void glfwSetWindowPos(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. /*! @brief Retrieves the size of the content area of the specified window.
* *
* This function retrieves the size, in screen coordinates, of the content area * This function retrieves the size, in screen coordinates, of the content area

View File

@ -533,6 +533,7 @@ struct _GLFWwindow
GLFWbool focusOnShow; GLFWbool focusOnShow;
GLFWbool mousePassthrough; GLFWbool mousePassthrough;
GLFWbool shouldClose; GLFWbool shouldClose;
GLFWbool isLightTheme;
void* userPointer; void* userPointer;
GLFWbool doublebuffer; GLFWbool doublebuffer;
GLFWvidmode videoMode; GLFWvidmode videoMode;

View File

@ -1372,6 +1372,7 @@ static int createNativeWindow(_GLFWwindow* window,
should_use_light_mode = wndconfig->theme == GLFW_THEME_LIGHT; should_use_light_mode = wndconfig->theme == GLFW_THEME_LIGHT;
_glfwSetWindowTheme(!should_use_light_mode, window->win32.handle); _glfwSetWindowTheme(!should_use_light_mode, window->win32.handle);
window->isLightTheme = should_use_light_mode ? GLFW_TRUE : GLFW_FALSE;
_glfw_free(wideTitle); _glfw_free(wideTitle);

View File

@ -588,6 +588,15 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos)
_glfw.platform.setWindowPos(window, xpos, 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) GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height)
{ {
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;