views/month-view-row: Allow navigating through overflow buttons
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/598>
This commit is contained in:
@@ -163,12 +163,21 @@ static FocusEventData *
|
|||||||
create_focus_event_data_candidate (GcalMonthViewRow *self,
|
create_focus_event_data_candidate (GcalMonthViewRow *self,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
|
g_autoptr (FocusEventData) candidate = NULL;
|
||||||
|
|
||||||
g_assert (GTK_IS_WIDGET (child));
|
g_assert (GTK_IS_WIDGET (child));
|
||||||
|
|
||||||
if (!GCAL_IS_EVENT_WIDGET (child) || !gtk_widget_get_child_visible (child))
|
if (GCAL_IS_EVENT_WIDGET (child))
|
||||||
|
candidate = create_focus_event_data (self, child);
|
||||||
|
else if (GCAL_IS_MONTH_CELL (child) && gcal_month_cell_get_overflow (GCAL_MONTH_CELL (child)))
|
||||||
|
candidate = create_focus_event_data (self, gcal_month_cell_get_overflow_button (GCAL_MONTH_CELL (child)));
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!gtk_widget_get_child_visible (candidate->widget))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return create_focus_event_data (self, child);
|
return g_steal_pointer (&candidate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
@@ -387,6 +396,19 @@ find_nearest_horizontal_event_widget (GcalMonthViewRow *self,
|
|||||||
GCAL_RETURN (nearest ? g_steal_pointer (&nearest->widget) : NULL);
|
GCAL_RETURN (nearest ? g_steal_pointer (&nearest->widget) : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
is_overflow_focused (GtkWidget *focused)
|
||||||
|
{
|
||||||
|
GtkWidget *cell, *overflow;
|
||||||
|
|
||||||
|
if ((cell = gtk_widget_get_ancestor (focused, GCAL_TYPE_MONTH_CELL)))
|
||||||
|
overflow = gcal_month_cell_get_overflow_button (GCAL_MONTH_CELL (cell));
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return gtk_widget_is_focus (overflow);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
layout_block_free (gpointer data)
|
layout_block_free (gpointer data)
|
||||||
{
|
{
|
||||||
@@ -797,7 +819,7 @@ gcal_month_view_row_focus (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GCAL_IS_EVENT_WIDGET (focused))
|
if (GCAL_IS_EVENT_WIDGET (focused) || is_overflow_focused (focused))
|
||||||
{
|
{
|
||||||
g_autoptr (FocusEventData) focus_event_data = create_focus_event_data (self, focused);
|
g_autoptr (FocusEventData) focus_event_data = create_focus_event_data (self, focused);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user