[gtk+/gtk-3-14] GtkCalendar: deal better with a large allocation
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-14] GtkCalendar: deal better with a large allocation
- Date: Thu, 2 Oct 2014 00:53:09 +0000 (UTC)
commit 84f5091459cd61ca5123ad8c503c249b8db31bb7
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 1 20:09:10 2014 -0400
GtkCalendar: deal better with a large allocation
When allocated more than the requested height, GtkCalendar
was 'falling apart'. Not only was the main part rendered
at the far end of the allocation, clicking on days was
broken in this scenario.
Fix this by always placing the main part directly under
the header and day names.
https://bugzilla.gnome.org/show_bug.cgi?id=737670
gtk/gtkcalendar.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 3156f2a..d3f1c2d 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -1253,17 +1253,14 @@ static gint
calendar_top_y_for_row (GtkCalendar *calendar,
gint row)
{
- GtkAllocation allocation;
- gint inner_border = calendar_get_inner_border (calendar);
+ GtkCalendarPrivate *priv = calendar->priv;
GtkBorder padding;
+ gint inner_border = calendar_get_inner_border (calendar);
- gtk_widget_get_allocation (GTK_WIDGET (calendar), &allocation);
get_component_paddings (calendar, &padding, NULL, NULL, NULL);
- return allocation.height
- - padding.top - inner_border
- - (CALENDAR_MARGIN + (6 - row)
- * calendar_row_height (calendar));
+ return priv->header_h + priv->day_name_h + padding.top + inner_border
+ + row * calendar_row_height (calendar);
}
/* row_from_y: returns the row 0-5 that the
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]