[gnome-calendar] month-view: don't show popover when clicking an invalid cell
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] month-view: don't show popover when clicking an invalid cell
- Date: Tue, 27 Oct 2015 14:05:41 +0000 (UTC)
commit b6bec55185ca92bdf03bbdec91cfdcd033d65127
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Oct 27 12:00:49 2015 -0200
month-view: don't show popover when clicking an invalid cell
Because we're using a simple (gint) cast to round y value of
the clicked point, a negative y was rounding to a valid cell
position and showing the popover even when the user clicked
on the blank cells before the actual month view.
Fix that by properly checking if y is negative.
https://bugzilla.gnome.org/show_bug.cgi?id=755910
src/gcal-month-view.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index fdb77c5..299326d 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -186,6 +186,9 @@ static gint
real_cell (gint cell,
gboolean rtl)
{
+ if (cell < 0)
+ return cell;
+
return rtl ? MIRROR (cell, 0, 7) - 1 : cell;
}
@@ -349,7 +352,12 @@ gather_button_event_data (GcalMonthView *view,
y = y - start_grid_y - first_row_gap * cell_height;
- cell = 7 * (gint)(y / cell_height) + (gint)(x / cell_width);
+ /* When we're dealing with 5-row months, the first_row_gap
+ * is never big enought, and (gint)(y / cell_height) always
+ * rounds to 0, resulting in a valid cell number when it is
+ * actually invalid.
+ */
+ cell = y < 0 ? -1 : 7 * (gint)(y / cell_height) + (gint)(x / cell_width);
if (out_on_indicator != NULL)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]