From ed1db0bf72c3d82d3c1716bd70d3abeca307d7e0 Mon Sep 17 00:00:00 2001 From: Hari Rana Date: Tue, 20 May 2025 22:53:42 -0400 Subject: [PATCH] views/month: Move out of the view when pressing tab This makes it so the user can easily skip the entire month view by pressing tab within the month view. This means, events can only be accessed with arrow keys in the month view. --- src/gui/views/gcal-month-view.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gui/views/gcal-month-view.c b/src/gui/views/gcal-month-view.c index 7d840b5c..5a196995 100644 --- a/src/gui/views/gcal-month-view.c +++ b/src/gui/views/gcal-month-view.c @@ -1368,6 +1368,19 @@ gtk_buildable_interface_init (GtkBuildableIface *iface) * GtkWidget overrides */ +static gboolean +gcal_month_view_focus (GtkWidget *widget, + GtkDirectionType direction) +{ + if (gtk_widget_get_focus_child (widget) && + (direction == GTK_DIR_TAB_FORWARD || direction == GTK_DIR_TAB_BACKWARD)) + { + return FALSE; + } + + return GTK_WIDGET_CLASS (gcal_month_view_parent_class)->focus (widget, direction); +} + static void gcal_month_view_measure (GtkWidget *widget, GtkOrientation orientation, @@ -1625,6 +1638,7 @@ gcal_month_view_class_init (GcalMonthViewClass *klass) object_class->get_property = gcal_month_view_get_property; object_class->set_property = gcal_month_view_set_property; + widget_class->focus = gcal_month_view_focus; widget_class->measure = gcal_month_view_measure; widget_class->size_allocate = gcal_month_view_size_allocate; widget_class->snapshot = gcal_month_view_snapshot;