From d0bdc9f2afc40bec13f037fa155a2c6fa9a0197e Mon Sep 17 00:00:00 2001 From: Hari Rana Date: Sat, 21 Mar 2026 10:39:16 -0400 Subject: [PATCH] gui/month-view-row: Add `upward` variable `!downward` is disambiguous and could merely be interpreted as "not downward and not upward either". The `upward` variable is explicit and describes literally the condition. Part-of: --- src/gui/views/gcal-month-view-row.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/views/gcal-month-view-row.c b/src/gui/views/gcal-month-view-row.c index 31e8d9a5..5f3ba76b 100644 --- a/src/gui/views/gcal-month-view-row.c +++ b/src/gui/views/gcal-month-view-row.c @@ -264,12 +264,14 @@ find_nearest_vertical_event_widget (GcalMonthViewRow *self, g_autoptr (FocusEventData) candidate = NULL; g_autoptr (FocusEventData) nearest = NULL; GtkWidget *child; - gboolean downward, forward_or_backward; + gboolean downward, upward, forward_or_backward; gboolean is_rtl; GCAL_ENTRY; downward = direction == GTK_DIR_DOWN || direction == GTK_DIR_TAB_FORWARD; + upward = !downward; + is_rtl = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL; forward_or_backward = direction == GTK_DIR_TAB_FORWARD || direction == GTK_DIR_TAB_BACKWARD; @@ -297,13 +299,13 @@ find_nearest_vertical_event_widget (GcalMonthViewRow *self, continue; if ((downward && candidate->rect.origin.y < focused->rect.origin.y) || - (!downward && candidate->rect.origin.y > focused->rect.origin.y)) + (upward && candidate->rect.origin.y > focused->rect.origin.y)) continue; if (nearest == NULL) swap_focus_event_data (&nearest, g_steal_pointer (&candidate)); else if ((downward && candidate->rect.origin.y < nearest->rect.origin.y) || - (!downward && candidate->rect.origin.y > nearest->rect.origin.y)) + (upward && candidate->rect.origin.y > nearest->rect.origin.y)) swap_focus_event_data (&nearest, g_steal_pointer (&candidate)); else if (downward && candidate->rect.origin.y == nearest->rect.origin.y && ((is_rtl && candidate->focal_x > nearest->focal_x) ||