event-widget: Rework transparency of past events

Instead of applying the "dimmed" CSS class - which comes from Adwaita
and applies an overall opacity change - add a new custom "past" CSS
class and change the opacity of specific elements.

This avoids opacity in the group, which in turn allows GTK to avoid
rendering these event widgets in offscreens, which should be faster.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/828>
This commit is contained in:
Georges Basile Stavracas Neto
2026-09-16 11:57:32 +00:00
committed by Marge Bot
parent 2a3e1b02b5
commit c534f00366
2 changed files with 11 additions and 2 deletions
+2 -2
View File
@@ -196,9 +196,9 @@ update_color (GcalEventWidget *self)
/* Fades out an event that's earlier than the current date */
if (date_compare < 0)
gtk_widget_add_css_class (GTK_WIDGET (self), "dimmed");
gtk_widget_add_css_class (GTK_WIDGET (self), "past");
else
gtk_widget_remove_css_class (GTK_WIDGET (self), "dimmed");
gtk_widget_remove_css_class (GTK_WIDGET (self), "past");
/* Remove the old style class */
if (self->css_class)
+9
View File
@@ -41,6 +41,15 @@ event widget.edge {
min-width: 6px;
}
event.past {
background-color: color-mix(in srgb, var(--event-bg-color) 10%, var(--view-bg-color));
color: color-mix(in srgb, var(--view-fg-color) 60%, transparent);
}
event.past widget.edge {
background-color: color-mix(in srgb, var(--event-bg-color) 20%, transparent);
}
event.slanted widget.edge,
event.slanted-start widget.edge {
background-color: transparent;