From 46114c251bf37f4b576831ab1920e0a4771b7523 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 31 Jul 2025 15:24:21 +0530 Subject: [PATCH] Create the color manager object for a window surface --- glfw/wl_platform.h | 1 + glfw/wl_window.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index df9c287cb..46c02e962 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -172,6 +172,7 @@ typedef struct _GLFWwindowWayland bool hovered; bool transparent; struct wl_surface* surface; + struct wp_color_management_surface_v1 *color_management; bool waiting_for_swap_to_commit; struct wl_egl_window* native; struct wl_callback* callback; diff --git a/glfw/wl_window.c b/glfw/wl_window.c index 85a6475b7..e6ada06d7 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -583,6 +583,9 @@ static bool createSurface(_GLFWwindow* window, window); wl_surface_set_user_data(window->wl.surface, window); + if (_glfw.wl.wp_color_manager_v1 != NULL) { + window->wl.color_management = wp_color_manager_v1_get_surface(_glfw.wl.wp_color_manager_v1, window->wl.surface); + } // If we already have been notified of the primary monitor scale, assume // the window will be created on it and so avoid a rescale roundtrip in the common @@ -1513,6 +1516,9 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) if (window->wl.layer_shell.zwlr_layer_surface_v1) zwlr_layer_surface_v1_destroy(window->wl.layer_shell.zwlr_layer_surface_v1); + if (window->wl.color_management) + wp_color_management_surface_v1_destroy(window->wl.color_management); + if (window->wl.surface) wl_surface_destroy(window->wl.surface);