From 5af08640a7ee7e0412f91aff83332e8dac9339d2 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Thu, 6 Apr 2023 22:22:55 +0100 Subject: [PATCH] steamcompmgr: Fix HDR feedback only updating on mode change --- src/steamcompmgr.cpp | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 3e3ee88..55623fb 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -6620,26 +6620,6 @@ steamcompmgr_main(int argc, char **argv) } } - { - GamescopeAppTextureColorspace current_app_colorspace = GAMESCOPE_APP_TEXTURE_COLORSPACE_SRGB; - if ( g_HeldCommits[HELD_COMMIT_BASE] ) - current_app_colorspace = g_HeldCommits[HELD_COMMIT_BASE]->colorspace(); - - bool app_wants_hdr = ColorspaceIsHDR( current_app_colorspace ); - - static bool s_bAppWantsHDRCached = false; - - if ( app_wants_hdr != s_bAppWantsHDRCached ) - { - uint32_t app_wants_hdr_prop = app_wants_hdr ? 1 : 0; - - XChangeProperty(root_ctx->dpy, root_ctx->root, root_ctx->atoms.gamescopeColorAppWantsHDRFeedback, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&app_wants_hdr_prop, 1 ); - - s_bAppWantsHDRCached = app_wants_hdr; - } - } - currentOutputWidth = g_nOutputWidth; currentOutputHeight = g_nOutputHeight; currentHDROutput = g_bOutputHDREnabled; @@ -6662,6 +6642,27 @@ steamcompmgr_main(int argc, char **argv) check_new_xwayland_res(server->ctx.get()); } + + { + GamescopeAppTextureColorspace current_app_colorspace = GAMESCOPE_APP_TEXTURE_COLORSPACE_SRGB; + if ( g_HeldCommits[HELD_COMMIT_BASE] ) + current_app_colorspace = g_HeldCommits[HELD_COMMIT_BASE]->colorspace(); + + bool app_wants_hdr = ColorspaceIsHDR( current_app_colorspace ); + + static bool s_bAppWantsHDRCached = false; + + if ( app_wants_hdr != s_bAppWantsHDRCached ) + { + uint32_t app_wants_hdr_prop = app_wants_hdr ? 1 : 0; + + XChangeProperty(root_ctx->dpy, root_ctx->root, root_ctx->atoms.gamescopeColorAppWantsHDRFeedback, XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&app_wants_hdr_prop, 1 ); + + s_bAppWantsHDRCached = app_wants_hdr; + } + } + steamcompmgr_check_xdg(); // Handles if we got a commit for the window we want to focus