[gnome-shell] lightbox: Fix shader effect



commit ef777426d2bbc9584fa1d2805280109553105b11
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Feb 24 02:28:09 2021 +0100

    lightbox: Fix shader effect
    
    Since commit 0f1b566918e, we use gjs' automatic getters/setters for
    the shader properties. Those handle the properties on the JS and
    GObject side, but they don't update the corresponding uniform,
    whoops.
    
    Revert the lightbox bits of commit 0f1b566918 to get the effect back.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1712>

 js/ui/lightbox.js | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/lightbox.js b/js/ui/lightbox.js
index d8de7e7304..8348abada0 100644
--- a/js/ui/lightbox.js
+++ b/js/ui/lightbox.js
@@ -35,13 +35,16 @@ var RadialShaderEffect = GObject.registerClass({
     },
 }, class RadialShaderEffect extends Shell.GLSLEffect {
     _init(params) {
+        this._brightness = undefined;
+        this._sharpness = undefined;
+
         super._init(params);
 
         this._brightnessLocation = this.get_uniform_location('brightness');
         this._sharpnessLocation = this.get_uniform_location('vignette_sharpness');
 
-        this._setBrightnessUniform();
-        this._setSharpnessUniform();
+        this.brightness = 1.0;
+        this.sharpness = 0.0;
     }
 
     vfunc_build_pipeline() {
@@ -49,14 +52,30 @@ var RadialShaderEffect = GObject.registerClass({
                               VIGNETTE_DECLARATIONS, VIGNETTE_CODE, true);
     }
 
-    _setBrightnessUniform() {
+    get brightness() {
+        return this._brightness;
+    }
+
+    set brightness(v) {
+        if (this._brightness === v)
+            return;
+        this._brightness = v;
         this.set_uniform_float(this._brightnessLocation,
-            1, [this.brightness]);
+            1, [this._brightness]);
+        this.notify('brightness');
     }
 
-    _setSharpnessUniform() {
+    get sharpness() {
+        return this._sharpness;
+    }
+
+    set sharpness(v) {
+        if (this._sharpness === v)
+            return;
+        this._sharpness = v;
         this.set_uniform_float(this._sharpnessLocation,
-            1, [this.sharpness]);
+            1, [this._sharpness]);
+        this.notify('sharpness');
     }
 });
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]