Skip to content

Commit

Permalink
fix clutter effect in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Christophe Baptiste committed Dec 18, 2016
1 parent b332127 commit 05dd314
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function moveToTray() {
if (iconsContainer) {
if (iconsContainer.actor) {
iconsContainer.actor.destroy();
//iconsContainer.actor = null;
iconsContainer.actor = null;
}
iconsContainer = null;
}
Expand Down Expand Up @@ -234,15 +234,11 @@ function setIcon(icon) {

let effect = new Clutter.DesaturateEffect({factor : desaturationValue});
effect.set_factor(desaturationValue);
if (icon.get_effect('desaturate'))
icon.remove_effect_by_name('desaturate');
icon.add_effect_with_name('desaturate', effect);

let effect = new Clutter.BrightnessContrastEffect({});
effect.set_brightness(brightnessValue);
effect.set_contrast(contrastValue);
if (icon.get_effect('brightness-contrast'))
icon.remove_effect_by_name('brightness-contrast');
icon.add_effect_with_name('brightness-contrast',effect);

}
Expand Down Expand Up @@ -278,31 +274,24 @@ function setOpacity() {
function setSaturation() {

let desaturationValue = settings.get_double('icon-saturation');
let effect = new Clutter.DesaturateEffect({factor : desaturationValue});
effect.set_factor(desaturationValue);


for (let i = 0; i < icons.length; i++) {
let icon = icons[i];
if (icon.get_effect('desaturate'))
icon.remove_effect_by_name('desaturate');
icon.add_effect_with_name('desaturate', effect);
}

let icon = icons[i];
let effect = icon.get_effect('desaturate');
effect.set_factor(desaturationValue);
}
}

function setBrightnessContrast() {

let brightnessValue = settings.get_double('icon-brightness');
let contrastValue = settings.get_double('icon-contrast');
let effect = new Clutter.BrightnessContrastEffect({});
effect.set_brightness(brightnessValue);
effect.set_contrast(contrastValue);

for (let i = 0; i < icons.length; i++) {
let icon = icons[i];
if (icon.get_effect('brightness-contrast'))
icon.remove_effect_by_name('brightness-contrast');
icon.add_effect_with_name('brightness-contrast',effect);
let effect = icon.get_effect('brightness-contrast')
effect.set_brightness(brightnessValue);
effect.set_contrast(contrastValue);
}

}
Expand Down

0 comments on commit 05dd314

Please sign in to comment.