From acf76d6cffca9b57dd1c96c934a4f7e87685420f Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Tue, 20 Dec 2022 16:22:08 +0000 Subject: [PATCH] steamcompmgr: Add GAMESCOPE_HDR_OUTPUT_FEEDBACK Exposes whether HDR output is currently enabled. --- src/steamcompmgr.cpp | 12 ++++++++++++ src/xwayland_ctx.hpp | 1 + 2 files changed, 13 insertions(+) diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index be2d513..9d7f04d 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -5395,6 +5395,7 @@ void init_xwayland_ctx(gamescope_xwayland_server_t *xwayland_server) ctx->atoms.gamescopeDisplayHDREnabled = XInternAtom( ctx->dpy, "GAMESCOPE_DISPLAY_HDR_ENABLED", false ); ctx->atoms.gamescopeDisplayHDRForceWideGammutForSDR = XInternAtom( ctx->dpy, "GAMESCOPE_DISPLAY_HDR_FORCE_WIDE_GAMMUT_FOR_SDR", false ); ctx->atoms.gamescopeDebugForceHDR10OutputSupport = XInternAtom( ctx->dpy, "GAMESCOPE_DEBUG_FORCE_HDR10_OUTPUT_SUPPORT", false ); + ctx->atoms.gamescopeHDROutputFeedback = XInternAtom( ctx->dpy, "GAMESCOPE_HDR_OUTPUT_FEEDBACK", false ); ctx->atoms.wineHwndStyle = XInternAtom( ctx->dpy, "_WINE_HWND_STYLE", false ); ctx->atoms.wineHwndStyleEx = XInternAtom( ctx->dpy, "_WINE_HWND_EXSTYLE", false ); @@ -5825,6 +5826,17 @@ steamcompmgr_main(int argc, char **argv) vulkan_remake_output_images(); } + + { + gamescope_xwayland_server_t *server = NULL; + for (size_t i = 0; (server = wlserver_get_xwayland_server(i)); i++) + { + uint32_t hdr_value = g_bOutputHDREnabled ? 1 : 0; + XChangeProperty(root_ctx->dpy, root_ctx->root, root_ctx->atoms.gamescopeHDROutputFeedback, XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&hdr_value, 1 ); + } + } + currentOutputWidth = g_nOutputWidth; currentOutputHeight = g_nOutputHeight; currentHDROutput = g_bOutputHDREnabled; diff --git a/src/xwayland_ctx.hpp b/src/xwayland_ctx.hpp index 5048f9a..89a29aa 100644 --- a/src/xwayland_ctx.hpp +++ b/src/xwayland_ctx.hpp @@ -172,6 +172,7 @@ struct xwayland_ctx_t Atom gamescopeDisplayHDREnabled; Atom gamescopeDisplayHDRForceWideGammutForSDR; Atom gamescopeDebugForceHDR10OutputSupport; + Atom gamescopeHDROutputFeedback; Atom wineHwndStyle; Atom wineHwndStyleEx;