panel: Simplify corner drawing
With the panel border removed, it is no longer necessary to account for it in the corner drawing code, so simplify the drawing code a bit. https://bugzilla.gnome.org/show_bug.cgi?id=669489
This commit is contained in:
parent
8b4c1a80d0
commit
d1fc87577a
@ -310,14 +310,14 @@ StTooltip StLabel {
|
||||
.panel-corner {
|
||||
-panel-corner-radius: 10px;
|
||||
-panel-corner-background-color: black;
|
||||
-panel-corner-inner-border-width: 2px;
|
||||
-panel-corner-inner-border-color: transparent;
|
||||
-panel-corner-border-width: 2px;
|
||||
-panel-corner-border-color: transparent;
|
||||
}
|
||||
|
||||
.panel-corner:active,
|
||||
.panel-corner:overview,
|
||||
.panel-corner:focus {
|
||||
-panel-corner-inner-border-color: rgba(255,255,255,0.8);
|
||||
-panel-corner-border-color: rgba(255,255,255,0.8);
|
||||
}
|
||||
|
||||
#appMenu {
|
||||
|
@ -841,12 +841,10 @@ const PanelCorner = new Lang.Class({
|
||||
let node = this.actor.get_theme_node();
|
||||
|
||||
let cornerRadius = node.get_length("-panel-corner-radius");
|
||||
let innerBorderWidth = node.get_length('-panel-corner-inner-border-width');
|
||||
let outerBorderWidth = node.get_length('-panel-corner-outer-border-width');
|
||||
let borderWidth = node.get_length('-panel-corner-border-width');
|
||||
|
||||
let backgroundColor = node.get_color('-panel-corner-background-color');
|
||||
let innerBorderColor = node.get_color('-panel-corner-inner-border-color');
|
||||
let outerBorderColor = node.get_color('-panel-corner-outer-border-color');
|
||||
let borderColor = node.get_color('-panel-corner-border-color');
|
||||
|
||||
let cr = this.actor.get_context();
|
||||
cr.setOperator(Cairo.Operator.SOURCE);
|
||||
@ -854,40 +852,23 @@ const PanelCorner = new Lang.Class({
|
||||
cr.moveTo(0, 0);
|
||||
if (this._side == St.Side.LEFT)
|
||||
cr.arc(cornerRadius,
|
||||
innerBorderWidth + cornerRadius,
|
||||
borderWidth + cornerRadius,
|
||||
cornerRadius, Math.PI, 3 * Math.PI / 2);
|
||||
else
|
||||
cr.arc(0,
|
||||
innerBorderWidth + cornerRadius,
|
||||
borderWidth + cornerRadius,
|
||||
cornerRadius, 3 * Math.PI / 2, 2 * Math.PI);
|
||||
cr.lineTo(cornerRadius, 0);
|
||||
cr.closePath();
|
||||
|
||||
let savedPath = cr.copyPath();
|
||||
|
||||
let over = _over(innerBorderColor,
|
||||
_over(outerBorderColor, backgroundColor));
|
||||
Clutter.cairo_set_source_color(cr, over);
|
||||
cr.fill();
|
||||
|
||||
let xOffsetDirection = this._side == St.Side.LEFT ? -1 : 1;
|
||||
let offset = outerBorderWidth;
|
||||
over = _over(innerBorderColor, backgroundColor);
|
||||
let over = _over(borderColor, backgroundColor);
|
||||
Clutter.cairo_set_source_color(cr, over);
|
||||
|
||||
cr.save();
|
||||
cr.translate(xOffsetDirection * offset, - offset);
|
||||
cr.appendPath(savedPath);
|
||||
cr.fill();
|
||||
cr.restore();
|
||||
|
||||
if (this._side == St.Side.LEFT)
|
||||
cr.rectangle(cornerRadius - offset, 0, offset, outerBorderWidth);
|
||||
else
|
||||
cr.rectangle(0, 0, offset, outerBorderWidth);
|
||||
cr.fill();
|
||||
|
||||
offset = innerBorderWidth;
|
||||
let offset = borderWidth;
|
||||
Clutter.cairo_set_source_color(cr, backgroundColor);
|
||||
|
||||
cr.save();
|
||||
@ -901,10 +882,10 @@ const PanelCorner = new Lang.Class({
|
||||
let node = this.actor.get_theme_node();
|
||||
|
||||
let cornerRadius = node.get_length("-panel-corner-radius");
|
||||
let innerBorderWidth = node.get_length('-panel-corner-inner-border-width');
|
||||
let borderWidth = node.get_length('-panel-corner-border-width');
|
||||
|
||||
this.actor.set_size(cornerRadius, innerBorderWidth + cornerRadius);
|
||||
this.actor.set_anchor_point(0, innerBorderWidth);
|
||||
this.actor.set_size(cornerRadius, borderWidth + cornerRadius);
|
||||
this.actor.set_anchor_point(0, borderWidth);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user