mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
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
1 changed files with 15 additions and 12 deletions
|
|
@ -121,7 +121,8 @@ var BarLevel = class {
|
|||
cr.lineTo(x, (height - barLevelHeight) / 2);
|
||||
cr.lineTo(x, (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();
|
||||
Clutter.cairo_set_source_color(cr, barLevelActiveBorderColor);
|
||||
cr.setLineWidth(barLevelBorderWidth);
|
||||
|
|
@ -143,17 +144,19 @@ var BarLevel = class {
|
|||
}
|
||||
|
||||
/* end progress bar arc */
|
||||
if (this._value <= this._overdriveStart)
|
||||
Clutter.cairo_set_source_color(cr, barLevelActiveColor);
|
||||
else
|
||||
Clutter.cairo_set_source_color(cr, barLevelOverdriveColor);
|
||||
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.fillPreserve();
|
||||
cr.setLineWidth(barLevelBorderWidth);
|
||||
cr.stroke();
|
||||
if (this._value > 0) {
|
||||
if (this._value <= this._overdriveStart)
|
||||
Clutter.cairo_set_source_color(cr, barLevelActiveColor);
|
||||
else
|
||||
Clutter.cairo_set_source_color(cr, barLevelOverdriveColor);
|
||||
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.fillPreserve();
|
||||
cr.setLineWidth(barLevelBorderWidth);
|
||||
cr.stroke();
|
||||
}
|
||||
|
||||
/* draw overdrive separator */
|
||||
if (overdriveActive) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue