On Mon, Apr 6, 2009 at 2:43 PM, Dirk Vanden Boer <dirk....@gmail.com> wrote: > Hi, > > I have written a custom CellRenderer that displays a Gdk::Pixbuf and > some text using Pango::Layout. > Everything seems to work fine but when I try to drag an item in the > TreeView I see assertion failures in the console and no text is > displayed in the item that gets dragged around. > > Assertion failures: > (gejengel:9508): Gdk-CRITICAL **: gdk_drawable_get_depth: assertion > `GDK_IS_DRAWABLE (drawable)' failed > (gejengel:9508): Gtk-CRITICAL **: gtk_paint_layout: assertion > `style->depth == gdk_drawable_get_depth (window)' failed > > Is there something I am missing here? Do I need to do something > special when a drag is initiated? > > The source code of my CellRenderer can be found at: > http://code.google.com/p/gejengel/source/browse/trunk/src/ui/cellrendererplayqueue.cpp > > Best Regards, > Dirk >
I did some more digging and have found the cause of the problem: In the render function I cast the Gdk::Drawable that is passed as a function argument to a Gdk::Window because the paint_layout method of the current style requires Gdk::Window. Now I noticed that when I start dragging a cell the dynamic cast to Gdk::Window fails, I then tried to cast it to a Gdk::Pixmap and that worked like a charm. So during a drag the cell is not rendered to a Gdk::Window but to a Gdk::Pixmap. So in stead of calling widget.get_style()->paint_layout I call pixmap->draw_layout to draw directly to the pixmap. But isn't there an api call missing in Gtk::Style of Gtkmm that accepts a Gdk::Pixmap in stead of Gdk::Window, because painting the text on a pixmap using the widget style is possible using the c api. gtk_paint_layout (widget.get_style()->gobj(), window->gobj(), GTK_STATE_NORMAL, TRUE, const_cast<GdkRectangle*>(exposeArea.gobj()), widget.gobj(), "cellrendererplayqueue", cellArea.get_x() + (3 * xPad) + ALBUM_ART_WIDTH + xOffset, cellArea.get_y() + yPad, layout->gobj()); Regards, Dirk _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list