calendar: Only apply the marked_day to the current month
authorCorey Berla <corey@berla.me>
Sat, 7 Jan 2023 04:12:10 +0000 (20:12 -0800)
committerCorey Berla <corey@berla.me>
Sat, 7 Jan 2023 04:21:35 +0000 (20:21 -0800)
The marked day gets applied to the current month, and either the previous
or subsequent month if they are visible within the current month.
This doesn't make any sense and likely was an accidental regression
in a6f9052cf1c1c7b4224834ed18a63e70477d8729.  Clarify the docs.

gtk/gtkcalendar.c

index 6f9e80653c60283fb84c88efce98f575de0100f0..c671fb118585e22fd7fe2275c681c4aff3ef0188 100644 (file)
@@ -1438,7 +1438,8 @@ gtk_calendar_select_day (GtkCalendar *calendar,
         else
           gtk_widget_remove_css_class (label, "other-month");
 
-        if (calendar->marked_date[day-1])
+        if (calendar->marked_date[day-1] &&
+            calendar->day_month[y][x] == MONTH_CURRENT)
           gtk_widget_set_state_flags (label, GTK_STATE_FLAG_CHECKED, FALSE);
         else
           gtk_widget_unset_state_flags (label, GTK_STATE_FLAG_CHECKED);
@@ -1538,7 +1539,7 @@ gtk_calendar_clear_marks (GtkCalendar *calendar)
  * @calendar: a `GtkCalendar`
  * @day: the day number to mark between 1 and 31.
  *
- * Places a visual marker on a particular day.
+ * Places a visual marker on a particular day of the current month.
  */
 void
 gtk_calendar_mark_day (GtkCalendar *calendar,