windowManager: Change effect's brightness property
The set_brightness() method is the most convenient way of controlling the effect's brightness, but Clutter animations only deal with properties, so start using the (ClutterColor) brightness property instead. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/666
This commit is contained in:
parent
fc958f4215
commit
928595fe21
@ -127,7 +127,8 @@ var WindowDimmer = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_syncEnabled() {
|
_syncEnabled() {
|
||||||
this._brightnessEffect.enabled = (this._enabled && this._dimFactor > 0);
|
let dimmed = this._brightnessEffect.brightness.red != 127;
|
||||||
|
this._brightnessEffect.enabled = (this._enabled && dimmed);
|
||||||
}
|
}
|
||||||
|
|
||||||
setEnabled(enabled) {
|
setEnabled(enabled) {
|
||||||
@ -144,14 +145,17 @@ var WindowDimmer = class {
|
|||||||
time: (dimmed ? DIM_TIME : UNDIM_TIME) / 1000,
|
time: (dimmed ? DIM_TIME : UNDIM_TIME) / 1000,
|
||||||
transition: 'linear',
|
transition: 'linear',
|
||||||
onUpdate: () => {
|
onUpdate: () => {
|
||||||
let brightness = this._dimFactor * DIM_BRIGHTNESS;
|
let val = 127 * (1 + this._dimFactor * DIM_BRIGHTNESS);
|
||||||
this._brightnessEffect.set_brightness(brightness);
|
let color = Clutter.Color.new(val, val, val, 255);
|
||||||
|
this._brightnessEffect.brightness = color;
|
||||||
this._syncEnabled();
|
this._syncEnabled();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._dimFactor = factor;
|
this._dimFactor = factor;
|
||||||
this._brightnessEffect.set_brightness(factor * DIM_BRIGHTNESS);
|
let val = 127 * (1 + this._dimFactor * DIM_BRIGHTNESS);
|
||||||
|
let color = Clutter.Color.new(val, val, val, 255);
|
||||||
|
this._brightnessEffect.brightness = color;
|
||||||
this._syncEnabled();
|
this._syncEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user