[gnome-calendar] month-view: improve dates calculation for RTL languages.



commit df08daad68a833571110c3f5d1b2ec2804d769a6
Author: Abdullahi Usman <abdullahismn7 gmail com>
Date:   Tue Jul 18 14:30:57 2017 +0100

    month-view: improve dates calculation for RTL languages.
    
    Month view used to calculate the event's start date and end date from
    the physical layout of the month and compare it with the event's
    original start date and end date to see if there is a change and then
    update as necessary by either slanted start or end, when either is/are
    not equal to the one in the original start and end dates.
    
    However, the way in which the start date and end date in RTL language are
    calculated must be different since the layering of the days in the weeks
    are opposite.  Month view uses precalculated days number to mirror the
    last week, which already chop off the days_delay number from cell_idx value.
    In RTL, this cause issues such that the days are calculated wrongly and a
    slanted start or end is visible.  Because the date is not the same as the
    original events date, month view thinks that the view needs an update and
    so tries to update the view wrongly.
    
    We can fix this by using the cell_idx value to calculate the days and then
    substracting the days_delay value after that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777426

 src/views/gcal-month-view.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/views/gcal-month-view.c b/src/views/gcal-month-view.c
index 5df47f3..3284a84 100644
--- a/src/views/gcal-month-view.c
+++ b/src/views/gcal-month-view.c
@@ -1307,7 +1307,7 @@ gcal_month_view_size_allocate (GtkWidget     *widget,
 
               /* Day number is calculated differently on RTL languages */
               if (self->k)
-                day = 7 * row + MIRROR (day % 7, 0, 7) - length;
+                day = 7 * row + MIRROR (cell_idx % 7, 0, 7) - self->days_delay - length + 1;
 
               if (i != 0)
                 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]