diff --git a/src/gui/views/gcal-month-cell.blp b/src/gui/views/gcal-month-cell.blp index 13b909d4..8b7a2643 100644 --- a/src/gui/views/gcal-month-cell.blp +++ b/src/gui/views/gcal-month-cell.blp @@ -12,6 +12,10 @@ template $GcalMonthCell: Widget { receives-default: true; focusable: true; + EventControllerMotion { + motion => $on_motion_controller_motion_cb(template); + } + Adw.BreakpointBin breakpoint_bin { width-request: 50; height-request: 50; diff --git a/src/gui/views/gcal-month-cell.c b/src/gui/views/gcal-month-cell.c index 01e1ec08..6fec3d08 100644 --- a/src/gui/views/gcal-month-cell.c +++ b/src/gui/views/gcal-month-cell.c @@ -199,6 +199,22 @@ overflow_button_clicked_cb (GtkWidget *button, g_signal_emit (self, signals[SHOW_OVERFLOW], 0, button); } +static void +on_motion_controller_motion_cb (GcalMonthCell *self, + gdouble x, + gdouble y, + GtkEventControllerMotion *controller) +{ + GtkStateFlags overflow_button_state_flags; + + overflow_button_state_flags = gtk_widget_get_state_flags (self->overflow_button); + + if (overflow_button_state_flags & GTK_STATE_FLAG_PRELIGHT) + gtk_widget_add_css_class (GTK_WIDGET (self), "overflow-hovered"); + else + gtk_widget_remove_css_class (GTK_WIDGET (self), "overflow-hovered"); +} + static void on_weather_service_weather_changed_cb (GcalWeatherService *weather_service, GcalMonthCell *self) @@ -295,6 +311,7 @@ gcal_month_cell_class_init (GcalMonthCellClass *klass) gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, weather_icon); gtk_widget_class_bind_template_callback (widget_class, overflow_button_clicked_cb); + gtk_widget_class_bind_template_callback (widget_class, on_motion_controller_motion_cb); gtk_widget_class_set_css_name (widget_class, "monthcell"); diff --git a/src/theme/style.css b/src/theme/style.css index 97b1dd25..212e93b6 100644 --- a/src/theme/style.css +++ b/src/theme/style.css @@ -280,6 +280,10 @@ monthcell { outline-offset: 4px; } +monthcell.overflow-hovered:hover { + background-color: var(--bg-color); +} + monthcell .overflow { border-radius: 6px; }