summaryrefslogtreecommitdiff
path: root/src/protocols/Screencopy.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-07-31 18:07:59 +0200
committerGitHub <noreply@github.com>2025-07-31 18:07:59 +0200
commit9607e3b5a88f22017af64ab1ba360a39169a4bf7 (patch)
tree28e408434d4c7781c6b6f403b3093f19b56b6d86 /src/protocols/Screencopy.cpp
parenta907ecd4ff736a3a09410532b405a437eb48033c (diff)
screencopy: un-hdr screencopy buffers for cm-unaware clients (#11294)
Diffstat (limited to 'src/protocols/Screencopy.cpp')
-rw-r--r--src/protocols/Screencopy.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp
index ddbb371a..a9e0e5b3 100644
--- a/src/protocols/Screencopy.cpp
+++ b/src/protocols/Screencopy.cpp
@@ -11,6 +11,7 @@
#include "core/Output.hpp"
#include "types/WLBuffer.hpp"
#include "types/Buffer.hpp"
+#include "ColorManagement.hpp"
#include "../helpers/Format.hpp"
#include "../helpers/time/Time.hpp"
#include "XDGShell.hpp"
@@ -191,16 +192,22 @@ void CScreencopyFrame::share() {
}
void CScreencopyFrame::renderMon() {
- auto TEXTURE = makeShared<CTexture>(m_monitor->m_output->state->state().buffer);
+ auto TEXTURE = makeShared<CTexture>(m_monitor->m_output->state->state().buffer);
- CRegion fakeDamage = {0, 0, INT16_MAX, INT16_MAX};
+ CRegion fakeDamage = {0, 0, INT16_MAX, INT16_MAX};
+
+ const bool IS_CM_AWARE = PROTO::colorManagement->isClientCMAware(m_client->client());
- CBox monbox = CBox{0, 0, m_monitor->m_pixelSize.x, m_monitor->m_pixelSize.y}
+ CBox monbox = CBox{0, 0, m_monitor->m_pixelSize.x, m_monitor->m_pixelSize.y}
.translate({-m_box.x, -m_box.y}) // vvvv kinda ass-backwards but that's how I designed the renderer... sigh.
.transform(wlTransformToHyprutils(invertTransform(m_monitor->m_transform)), m_monitor->m_pixelSize.x, m_monitor->m_pixelSize.y);
g_pHyprOpenGL->pushMonitorTransformEnabled(true);
g_pHyprOpenGL->setRenderModifEnabled(false);
- g_pHyprOpenGL->renderTexture(TEXTURE, monbox, {});
+ g_pHyprOpenGL->renderTexture(TEXTURE, monbox,
+ {
+ .cmBackToSRGB = !IS_CM_AWARE,
+ .cmBackToSRGBSource = !IS_CM_AWARE ? m_monitor.lock() : nullptr,
+ });
g_pHyprOpenGL->setRenderModifEnabled(true);
g_pHyprOpenGL->popMonitorTransformEnabled();
@@ -453,6 +460,10 @@ bool CScreencopyClient::good() {
return m_resource->resource();
}
+wl_client* CScreencopyClient::client() {
+ return m_resource ? m_resource->client() : nullptr;
+}
+
CScreencopyProtocol::CScreencopyProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
;
}