+GtkCellRenderer *
+_gtk_tree_view_column_get_cell_at_pos (GtkTreeViewColumn *column,
+ GdkRectangle *cell_area,
+ GdkRectangle *background_area,
+ gint x,
+ gint y)
+{
+ GtkCellRenderer *match = NULL;
+ GtkTreeViewColumnPrivate *priv = column->priv;
+
+ /* If (x, y) is outside of the background area, immediately return */
+ if (x < background_area->x ||
+ x > background_area->x + background_area->width ||
+ y < background_area->y ||
+ y > background_area->y + background_area->height)
+ return NULL;
+
+ /* If (x, y) is inside the background area, clamp it to the cell_area
+ * so that a cell is still returned. The main reason for doing this
+ * (on the x axis) is for handling clicks in the indentation area
+ * (either at the left or right depending on RTL setting). Another
+ * reason is for handling clicks on the area where the focus rectangle
+ * is drawn (this is outside of cell area), this manifests itself
+ * mainly when a large setting is used for focus-line-width.
+ */
+ if (x < cell_area->x)
+ x = cell_area->x;
+ else if (x > cell_area->x + cell_area->width)
+ x = cell_area->x + cell_area->width;
+
+ if (y < cell_area->y)
+ y = cell_area->y;
+ else if (y > cell_area->y + cell_area->height)
+ y = cell_area->y + cell_area->height;
+
+ match = gtk_cell_area_get_cell_at_position (priv->cell_area,
+ priv->cell_area_context,
+ priv->tree_view,
+ cell_area,
+ x, y,
+ NULL);
+
+ return match;
+}
+
+gboolean
+_gtk_tree_view_column_is_blank_at_pos (GtkTreeViewColumn *column,
+ GdkRectangle *cell_area,
+ GdkRectangle *background_area,
+ gint x,
+ gint y)
+{
+ GtkCellRenderer *match;
+ GdkRectangle cell_alloc, aligned_area, inner_area;
+ GtkTreeViewColumnPrivate *priv = column->priv;
+
+ match = _gtk_tree_view_column_get_cell_at_pos (column,
+ cell_area,
+ background_area,
+ x, y);
+ if (!match)
+ return FALSE;
+
+ gtk_cell_area_get_cell_allocation (priv->cell_area,
+ priv->cell_area_context,
+ priv->tree_view,
+ match,
+ cell_area,
+ &cell_alloc);
+
+ gtk_cell_area_inner_cell_area (priv->cell_area, priv->tree_view,
+ &cell_alloc, &inner_area);
+ gtk_cell_renderer_get_aligned_area (match, priv->tree_view, 0,
+ &inner_area, &aligned_area);
+
+ if (x < aligned_area.x ||
+ x > aligned_area.x + aligned_area.width ||
+ y < aligned_area.y ||
+ y > aligned_area.y + aligned_area.height)
+ return TRUE;
+
+ return FALSE;
+}
+