[gnome-calendar] week-grid: make sure events span at least 1 minute
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] week-grid: make sure events span at least 1 minute
- Date: Wed, 1 Feb 2017 17:07:17 +0000 (UTC)
commit cdc5bde96a56bf338216158dc1e9ebb34f8f054d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Jan 26 19:14:42 2017 -0200
week-grid: make sure events span at least 1 minute
When adding an event with the same start and end dates and
times, the event effectively spans 0 minutes, leading a division
by zero and causing varius UI glitches.
Fix that by making sure events span at least 1 minute.
https://bugzilla.gnome.org/show_bug.cgi?id=777414
src/views/gcal-week-grid.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/views/gcal-week-grid.c b/src/views/gcal-week-grid.c
index 15b5892..54fb6af 100644
--- a/src/views/gcal-week-grid.c
+++ b/src/views/gcal-week-grid.c
@@ -166,6 +166,14 @@ get_event_range (GcalWeekGrid *self,
diff = g_date_time_difference (event_end, week_start);
*end = CLAMP (diff / G_TIME_SPAN_MINUTE, 0, MAX_MINUTES);
+ /*
+ * XXX: it may happen that the event has the same start and end
+ * dates. For this case, just enforce that the event is at least
+ * 1 minute long.
+ */
+ if (start && *start == *end)
+ *end = *end + 1;
+
g_clear_pointer (&event_end, g_date_time_unref);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]