From 9d5be1660d8f74038ebed3d74fdbc809e43787ae Mon Sep 17 00:00:00 2001 From: Nippy Date: Fri, 9 Oct 2026 17:23:53 +0200 Subject: gnome fix --- .../blur-my-shell@aunetx/effects/downscale.js | 80 +++++++++++++++------- 1 file changed, 56 insertions(+), 24 deletions(-) (limited to 'raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/effects/downscale.js') diff --git a/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/effects/downscale.js b/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/effects/downscale.js index 8103486..b6e08c4 100644 --- a/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/effects/downscale.js +++ b/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/effects/downscale.js @@ -1,18 +1,18 @@ import GObject from 'gi://GObject'; import * as utils from '../conveniences/utils.js'; +import * as uniforms from '../conveniences/shader_uniforms.js'; const Shell = await utils.import_in_shell_only('gi://Shell'); const Clutter = await utils.import_in_shell_only('gi://Clutter'); const SHADER_FILENAME = 'downscale.glsl'; +const SHADER_SOURCE = utils.get_shader_source(Shell, SHADER_FILENAME, import.meta.url); const DEFAULT_PARAMS = { - divider: 8, downsampling_mode: 0, width: 0, height: 0 + divider: 8, downsampling_mode: 0, opacity_factor: 1, width: 0, height: 0 }; -export const DownscaleEffect = utils.IS_IN_PREFERENCES ? - { default_params: DEFAULT_PARAMS } : - new GObject.registerClass({ +const DOWNSCALE_EFFECT_META = { GTypeName: "DownscaleEffect", Properties: { 'divider': GObject.ParamSpec.int( @@ -31,6 +31,14 @@ export const DownscaleEffect = utils.IS_IN_PREFERENCES ? 0, 2, 0, ), + 'opacity_factor': GObject.ParamSpec.double( + `opacity_factor`, + `Opacity factor`, + `Opacity factor`, + GObject.ParamFlags.READWRITE, + 0.0, 1.0, + 1.0, + ), 'width': GObject.ParamSpec.double( `width`, `Width`, @@ -48,16 +56,17 @@ export const DownscaleEffect = utils.IS_IN_PREFERENCES ? 0.0, ) } - }, class DownscaleEffect extends Clutter.ShaderEffect { +}; + +const DownscaleEffectClass = utils.IS_IN_PREFERENCES ? null : class DownscaleEffect extends Clutter.ShaderEffect { + constructor(params) { - super(params); + super(); + + utils.initialize_shader_effect(this, SHADER_SOURCE); - utils.setup_params(this, params); - // set shader source - this._source = utils.get_shader_source(Shell, SHADER_FILENAME, import.meta.url); - if (this._source) - this.set_shader_source(this._source); + utils.setup_params(this, params); } static get default_params() { @@ -69,10 +78,11 @@ export const DownscaleEffect = utils.IS_IN_PREFERENCES ? } set divider(value) { - if (this._divider !== value) { - this._divider = value; + const v = Math.max(1, value || 1); + if (this._divider !== v) { + this._divider = v; - this.set_uniform_value('divider', this._divider); + uniforms.set_uniform(this, 'divider', this._divider); } } @@ -84,7 +94,19 @@ export const DownscaleEffect = utils.IS_IN_PREFERENCES ? if (this._downsampling_mode !== value) { this._downsampling_mode = value; - this.set_uniform_value('downsampling_mode', this._downsampling_mode); + uniforms.set_uniform(this, 'downsampling_mode', this._downsampling_mode); + } + } + + get opacity_factor() { + return this._opacity_factor; + } + + set opacity_factor(value) { + if (this._opacity_factor !== value) { + this._opacity_factor = value; + + uniforms.set_uniform(this, 'opacity_factor', parseFloat(this._opacity_factor)); } } @@ -93,10 +115,11 @@ export const DownscaleEffect = utils.IS_IN_PREFERENCES ? } set width(value) { - if (this._width !== value) { - this._width = value; + const v = Math.max(1, value || 1); + if (this._width !== v) { + this._width = v; - this.set_uniform_value('width', parseFloat(this._width - 1e-6)); + uniforms.set_uniform(this, 'width', parseFloat(this._width - 1e-6)); } } @@ -105,10 +128,11 @@ export const DownscaleEffect = utils.IS_IN_PREFERENCES ? } set height(value) { - if (this._height !== value) { - this._height = value; + const v = Math.max(1, value || 1); + if (this._height !== v) { + this._height = v; - this.set_uniform_value('height', parseFloat(this._height - 1e-6)); + uniforms.set_uniform(this, 'height', parseFloat(this._height - 1e-6)); } } @@ -132,9 +156,17 @@ export const DownscaleEffect = utils.IS_IN_PREFERENCES ? } vfunc_paint_target(paint_node, paint_context) { - // force setting nearest-neighbour texture filtering - this.get_pipeline().set_layer_filters(0, 9728, 9728); + uniforms.upload_uniforms(this); + + const pipeline = this.get_pipeline(); + if (pipeline) { + pipeline.set_layer_filters(0, 9728, 9728); + } super.vfunc_paint_target(paint_node, paint_context); } - }); \ No newline at end of file +}; + +export const DownscaleEffect = utils.IS_IN_PREFERENCES + ? { default_params: DEFAULT_PARAMS } + : utils.register_shader_effect(DOWNSCALE_EFFECT_META, DownscaleEffectClass, SHADER_SOURCE); -- cgit v1.3