Re: Bug with custom cell renderers in gtk-2.10.x

Hi, I've seen this in a program I was working on.

Snipped from a post I sent to the app-devel list (and got no reply to):

Since GTK+-2.10.1, there is a rendering bug, where the widget to edit a
cell gets allocated zero height, and of course then doesn't display very

(Version number was inferred from the tags in the CVS viewer at this

2006-07-18  Kristian Rietveld  <kris imendio com>

        Fix for #335012, reported by Matteo Nastasi.

        * gtk/gtktreeview.c (gtk_tree_view_real_start_editing): if the
        requested space of the editable is smaller than the cell area,
        put it up above the middle of the cell area.

Since this change, as the tree view handles the initialisation of the
custom renderer, it asks the size of the widget. GtkTextView
(incorrectly?) returns zero height and width, which causes me to get a
zero/one(?) pixel high cell renderer when editing the cell. (Displaying
the cell works fine).

Could there be a "race" between the gtktreeview wanting to know the size
before realising / displaying the widget, and the gtktextview not
knowing its size
until afterwards?

[snip] (I removed a lot of gdb output showing how the gtktextview
datastructures weren't initialised when queried for its size), will post
if requested... or see the app-devel list.

Since I'm not particularly familiar with the (perhaps necessarily)
complicated way which GTK handles widget allocation, I'm not sure
exactly what is going on here.

Any thoughts?

Is it a bug in GTK, or simply a new "feature" which needs working around
since bug #335012 was fixed?

** The solution in our application was a simple patch: 

Passing the property "height-request" property when initialising the
  +                         /* GtkWidget */
  +                         "height-request", cell_area->height,

(In our function:

static GtkCellEditable* cellrenderermultilinetext_start_editing(
	GtkCellRenderer      *cell,
	GdkEvent             *event,
	GtkWidget            *widget,
	const gchar          *path,
	GdkRectangle         *background_area,
	GdkRectangle         *cell_area,
	GtkCellRendererState  flags)


Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,

Tel: +44 (0)7729 980173

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]