views/month-view: Set focus to cell upon click release

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
This commit is contained in:
Hari Rana
2026-03-03 21:11:16 -03:00
committed by Georges Basile Stavracas Neto
parent 3102766c51
commit 4e54c18d06
+7 -2
View File
@@ -833,7 +833,8 @@ on_click_gesture_released_cb (GtkGestureClick *click_gesture,
g_autoptr (GcalRange) selection_range = NULL;
g_autoptr (GDateTime) selection_start = NULL;
g_autoptr (GDateTime) selection_end = NULL;
GtkWidget *widget_at_position;
GtkWidget *widget_at_position, *cell, *row;
GtkRoot *root;
GCAL_ENTRY;
@@ -843,12 +844,16 @@ on_click_gesture_released_cb (GtkGestureClick *click_gesture,
if (!self->selection.start ||
!widget_at_position ||
!gtk_widget_get_ancestor (widget_at_position, GCAL_TYPE_MONTH_VIEW_ROW))
!(row = gtk_widget_get_ancestor (widget_at_position, GCAL_TYPE_MONTH_VIEW_ROW)))
{
gcal_view_clear_marks (GCAL_VIEW (self));
GCAL_RETURN ();
}
root = gtk_widget_get_root (GTK_WIDGET (self));
cell = gcal_month_view_row_get_cell_at_x (GCAL_MONTH_VIEW_ROW (row), x);
gtk_root_set_focus (root, cell);
selection_start = self->selection.start;
selection_end = self->selection.end ?: selection_start;