views/month-view: Allow navigating with Tab
This also notifies if keyboard navigation fails.
This commit is contained in:
@@ -1306,22 +1306,21 @@ static gboolean
|
|||||||
gcal_month_view_focus (GtkWidget *widget,
|
gcal_month_view_focus (GtkWidget *widget,
|
||||||
GtkDirectionType direction)
|
GtkDirectionType direction)
|
||||||
{
|
{
|
||||||
GtkRoot *root;
|
|
||||||
GtkWidget *focused;
|
GtkWidget *focused;
|
||||||
gboolean forward_or_backward, is_event_widget, is_ancestor;
|
GtkRoot *root;
|
||||||
|
|
||||||
root = gtk_widget_get_root (widget);
|
root = gtk_widget_get_root (widget);
|
||||||
focused = gtk_root_get_focus (root);
|
focused = gtk_root_get_focus (root);
|
||||||
|
|
||||||
is_event_widget = GCAL_IS_EVENT_WIDGET (focused);
|
if (direction == GTK_DIR_TAB_FORWARD || direction == GTK_DIR_TAB_BACKWARD)
|
||||||
is_ancestor = (focused && gtk_widget_is_ancestor (focused, widget));
|
return GTK_WIDGET_CLASS (gcal_month_view_parent_class)->focus (widget, direction);
|
||||||
|
|
||||||
forward_or_backward = direction == GTK_DIR_TAB_FORWARD || direction == GTK_DIR_TAB_BACKWARD;
|
if (focused && !gtk_widget_is_ancestor (focused, widget))
|
||||||
|
|
||||||
if ((is_event_widget && forward_or_backward) || !(is_ancestor || forward_or_backward))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gcal_month_view_parent_class)->focus (widget, direction);
|
if (!GTK_WIDGET_CLASS (gcal_month_view_parent_class)->focus (widget, direction))
|
||||||
|
return gtk_widget_keynav_failed (widget, direction);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user