summaryrefslogtreecommitdiff
path: root/gtk/gtkcellrenderer.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2011-01-06 02:29:18 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2011-01-06 02:31:42 +0900
commit9a80100e9ab2430ecc4375ba6bd2f66784ce34a9 (patch)
tree710b6b54d92e905bfc838c64fdfc05c1eb0ead68 /gtk/gtkcellrenderer.c
parente41fb7703ca810db1f391dc3237f0465a93f9140 (diff)
downloadgtk+-9a80100e9ab2430ecc4375ba6bd2f66784ce34a9.tar.gz
Fixed get_size() for GtkCellRendererText to clip to the input area
For ellipsize cells it's important to clip the result of get_size() so that the returned required rectangle is indeed less than or equal to the input rectangle... this is done so that GtkCellArea can accurately paint focus on cells by calling gtk_cell_renderer_get_aligned_area(). Patch also adds assertions to gtk_cell_renderer_get_aligned_area() to ensure this keeps working correctly.
Diffstat (limited to 'gtk/gtkcellrenderer.c')
-rw-r--r--gtk/gtkcellrenderer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index a6760ee1ac..b2ef07b4a5 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@ -1657,4 +1657,9 @@ gtk_cell_renderer_get_aligned_area (GtkCellRenderer *cell,
klass = GTK_CELL_RENDERER_GET_CLASS (cell);
klass->get_aligned_area (cell, widget, flags, cell_area, aligned_area);
+
+ g_assert (aligned_area->x >= cell_area->x && aligned_area->x < cell_area->x + cell_area->width);
+ g_assert (aligned_area->y >= cell_area->y && aligned_area->y < cell_area->y + cell_area->height);
+ g_assert ((aligned_area->x - cell_area->x) + aligned_area->width <= cell_area->width);
+ g_assert ((aligned_area->y - cell_area->y) + aligned_area->height <= cell_area->height);
}