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



On Fri, Oct 20, 2006 at 04:58:50PM +0100, Peter Clifton wrote:
> 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
> usefully.

We changed the code to improve the placement of the editable widget --
it makes things look much nicer.  Before, we always forced the window of
the editable to cover the entire cell.  In case of GtkEntry,
GtkSpinButton, etc the entry was misdrawing (?) the border, which
didn't look really nice (compare 2.8 and 2.10 and you'll see what
I mean).  Now we request the size of the editable widget, if the
requested height is less than the height of the cell we set the height
of the editable window to the requested height and put it nicely
aligned/centered above the cell.

> 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?

It appears the text view requests 4 pixels for width and height (that's
what I get here) if it's empty.  So the height is set to 4, this used to
be the height of the row.

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

I am not sure if we should mark this as a bug -- it's probably a
behavioral change though.  I didn't see any problems with existing cell
renderers before applying this, also this is the first time I see apps
which use a text view as editable widget.

> ** The solution in our application was a simple patch: 
> 
> Passing the property "height-request" property when initialising the
> cell-renderer 
>   +                         /* GtkWidget */
>   +                         "height-request", cell_area->height,

I don't full understand what this property does.  Does it set the size
request of the editable widget?



regards,

-kris.



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