barLevel: Don't show border radius if the value is 0
Work around a known regression from [1] that caused the volume bar in the OSD window to never be hidden, even if the volume is set to 0. This happened because the border radius of the barLevel is always drawn without ensuring that the actual bar is visible. So simply check if the value to draw is 0, and if it is, don't draw the border radius of the bar at all. This will still result in incorrect representation of values that have a width smaller than 2*border-radius, but at least the bar looks right for a width of 0 now. [1] https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/2 https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/384
This commit is contained in:
parent
8e51fee5c1
commit
5be61bbb68
@ -121,7 +121,8 @@ var BarLevel = class {
|
|||||||
cr.lineTo(x, (height - barLevelHeight) / 2);
|
cr.lineTo(x, (height - barLevelHeight) / 2);
|
||||||
cr.lineTo(x, (height + barLevelHeight) / 2);
|
cr.lineTo(x, (height + barLevelHeight) / 2);
|
||||||
cr.lineTo(barLevelBorderRadius + barLevelBorderWidth, (height + barLevelHeight) / 2);
|
cr.lineTo(barLevelBorderRadius + barLevelBorderWidth, (height + barLevelHeight) / 2);
|
||||||
Clutter.cairo_set_source_color(cr, barLevelActiveColor);
|
if (this._value > 0)
|
||||||
|
Clutter.cairo_set_source_color(cr, barLevelActiveColor);
|
||||||
cr.fillPreserve();
|
cr.fillPreserve();
|
||||||
Clutter.cairo_set_source_color(cr, barLevelActiveBorderColor);
|
Clutter.cairo_set_source_color(cr, barLevelActiveBorderColor);
|
||||||
cr.setLineWidth(barLevelBorderWidth);
|
cr.setLineWidth(barLevelBorderWidth);
|
||||||
@ -143,17 +144,19 @@ var BarLevel = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* end progress bar arc */
|
/* end progress bar arc */
|
||||||
if (this._value <= this._overdriveStart)
|
if (this._value > 0) {
|
||||||
Clutter.cairo_set_source_color(cr, barLevelActiveColor);
|
if (this._value <= this._overdriveStart)
|
||||||
else
|
Clutter.cairo_set_source_color(cr, barLevelActiveColor);
|
||||||
Clutter.cairo_set_source_color(cr, barLevelOverdriveColor);
|
else
|
||||||
cr.arc(endX, height / 2, barLevelBorderRadius, TAU * 3 / 4, TAU * 1 / 4);
|
Clutter.cairo_set_source_color(cr, barLevelOverdriveColor);
|
||||||
cr.lineTo(Math.floor(endX), (height + barLevelHeight) / 2);
|
cr.arc(endX, height / 2, barLevelBorderRadius, TAU * 3 / 4, TAU * 1 / 4);
|
||||||
cr.lineTo(Math.floor(endX), (height - barLevelHeight) / 2);
|
cr.lineTo(Math.floor(endX), (height + barLevelHeight) / 2);
|
||||||
cr.lineTo(endX, (height - barLevelHeight) / 2);
|
cr.lineTo(Math.floor(endX), (height - barLevelHeight) / 2);
|
||||||
cr.fillPreserve();
|
cr.lineTo(endX, (height - barLevelHeight) / 2);
|
||||||
cr.setLineWidth(barLevelBorderWidth);
|
cr.fillPreserve();
|
||||||
cr.stroke();
|
cr.setLineWidth(barLevelBorderWidth);
|
||||||
|
cr.stroke();
|
||||||
|
}
|
||||||
|
|
||||||
/* draw overdrive separator */
|
/* draw overdrive separator */
|
||||||
if (overdriveActive) {
|
if (overdriveActive) {
|
||||||
|
Loading…
Reference in New Issue
Block a user