From 69859aec283875870f81325dcf651c60d2eccbad Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sun, 13 Nov 2022 15:19:49 +0200 Subject: [PATCH] kwineffects: Bring back OffscreenEffect::setShader() OffscreenEffect can be still used to apply a shader effect to a window. --- src/libkwineffects/kwinoffscreeneffect.cpp | 7 +++++++ src/libkwineffects/kwinoffscreeneffect.h | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/libkwineffects/kwinoffscreeneffect.cpp b/src/libkwineffects/kwinoffscreeneffect.cpp index 5caf3f3d32..82c1977ccc 100644 --- a/src/libkwineffects/kwinoffscreeneffect.cpp +++ b/src/libkwineffects/kwinoffscreeneffect.cpp @@ -72,6 +72,13 @@ void OffscreenEffect::unredirect(EffectWindow *window) } } +void OffscreenEffect::setShader(EffectWindow *window, GLShader *shader) +{ + if (const auto it = d->windows.find(window); it != d->windows.end()) { + it->second->setShader(shader); + } +} + void OffscreenEffect::apply(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads) { } diff --git a/src/libkwineffects/kwinoffscreeneffect.h b/src/libkwineffects/kwinoffscreeneffect.h index fba5b787d5..fee4b5a2ee 100644 --- a/src/libkwineffects/kwinoffscreeneffect.h +++ b/src/libkwineffects/kwinoffscreeneffect.h @@ -13,6 +13,7 @@ namespace KWin class OffscreenEffectPrivate; class CrossFadeEffectPrivate; +class ShaderEffectPrivate; /** * The OffscreenEffect class is the base class for effects that paint deformed windows. @@ -56,6 +57,11 @@ protected: */ virtual void apply(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads); + /** + * Allows to specify a @p shader to draw the redirected texture for @p window. + * Can only be called once the window is redirected. + **/ + void setShader(EffectWindow *window, GLShader *shader); private Q_SLOTS: void handleWindowDamaged(EffectWindow *window);