panel: Animate opacity changes of the panel corner

This is a requirement for fading the transparent panel in and out
smoothly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1397>
This commit is contained in:
Jonas Dreßler 2019-02-11 23:05:31 +01:00 committed by Marge Bot
parent c894ec95cd
commit 0cbccf7403
2 changed files with 11 additions and 4 deletions

View File

@ -34,6 +34,7 @@ $panel_height: 2.2em;
-panel-corner-radius: $panel_corner_radius; -panel-corner-radius: $panel_corner_radius;
-panel-corner-background-color: $panel_bg_color; -panel-corner-background-color: $panel_bg_color;
-panel-corner-border-width: 2px; -panel-corner-border-width: 2px;
-panel-corner-opacity: 1;
} }
// panel menus // panel menus

View File

@ -574,10 +574,6 @@ class PanelCorner extends St.DrawingArea {
let pseudoClass = button.get_style_pseudo_class(); let pseudoClass = button.get_style_pseudo_class();
this.set_style_pseudo_class(pseudoClass); this.set_style_pseudo_class(pseudoClass);
}); });
// The corner doesn't support theme transitions, so override
// the .panel-button default
button.style = 'transition-duration: 0ms';
} }
} }
@ -618,8 +614,18 @@ class PanelCorner extends St.DrawingArea {
let cornerRadius = node.get_length("-panel-corner-radius"); let cornerRadius = node.get_length("-panel-corner-radius");
let borderWidth = node.get_length('-panel-corner-border-width'); let borderWidth = node.get_length('-panel-corner-border-width');
const transitionDuration = node.get_transition_duration();
const opacity = node.get_double('-panel-corner-opacity');
this.set_size(cornerRadius, borderWidth + cornerRadius); this.set_size(cornerRadius, borderWidth + cornerRadius);
this.translation_y = -borderWidth; this.translation_y = -borderWidth;
this.remove_transition('opacity');
this.ease({
opacity: opacity * 255,
duration: transitionDuration,
mode: Clutter.AnimationMode.EASE_IN_OUT_QUAD,
});
} }
}); });