From 2f2867179d7c18ccb7f12eef0c553d40fbe5c4b0 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 28 Mar 2017 23:57:17 -0300 Subject: [PATCH] week-grid: fix event creation on RTL languages On RTL languages, the calcs to detect the start and end of the new event were wrong, leading to the weird behavior it currently has. Fix that by correctly calculating the start and end cells on RTL languages. https://bugzilla.gnome.org/show_bug.cgi?id=777429 --- src/views/gcal-week-grid.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/views/gcal-week-grid.c b/src/views/gcal-week-grid.c index 3b7284e2..126a33be 100644 --- a/src/views/gcal-week-grid.c +++ b/src/views/gcal-week-grid.c @@ -913,8 +913,15 @@ gcal_week_grid_button_release (GtkWidget *widget, } else { - start = g_date_time_add_minutes (week_start, MAX_MINUTES - column * MINUTES_PER_DAY + minute); - end = g_date_time_add_minutes (week_start, MAX_MINUTES - column * MINUTES_PER_DAY + (end_cell + 1) * 30); + guint rtl_start_cell, rtl_end_cell, rtl_column; + + /* Fix the minute */ + rtl_column = 6 - column; + rtl_start_cell = start_cell + (rtl_column - column) * 48; + rtl_end_cell = (rtl_column * MINUTES_PER_DAY + minute) / 30; + + start = g_date_time_add_minutes (week_start, rtl_start_cell * 30); + end = g_date_time_add_minutes (week_start, (rtl_end_cell + 1) * 30); } x = round ((column + 0.5) * (alloc.width / 7.0));