[cairo] need help making background on custom cairo widget transparent

Michael L. Gualtieri mikeg at cs.pitt.edu
Sat Jul 15 08:53:18 PDT 2006


Thanks for the suggestion.  Unfortunatly it doesn't seem to work.  I tried
to change the widget's parent class to be a GtkImage, GtkLayout, and now
GtkWidget.  The gtkimage and gtklayout didn't spit any errors, however the
gtkwidget spit this out when running it:

Gtk-CRITICAL **: gtk_widget_real_realize: assertion `GTK_WIDGET_NO_WINDOW
(widget)' failed

Gtk-CRITICAL **: gtk_widget_real_map: assertion `GTK_WIDGET_REALIZED
(widget) == TRUE' failed


If I set my widget to be GTK_NO_WINDOW, then the errors disappear, but of
course no animation appears.

These errors probably aren't important however, since I think I *need* to
use a GtkDrawingArea.  When I have tried other classes my cairo animation
never shows up.



--
On Sat, 15 Jul 2006, Evan Martin wrote:

> GTK has two types of widgets, as I think you've figured out: widgets
> with windows and those without.  If a widget has a window, then on
> today's X servers it's solely responsible for its region of the screen
> and it can't let the background show through.  A GtkDrawingArea is a
> windowed widget, and I suspect unsetting its no_window flag may just
> confuse things.
>
> It might work if you instead subclass a non-windowed widget, or just
> GtkWidget itself.
> (http://developer.gnome.org/doc/API/2.0/gtk/ch01.html -- object
> hierarchy)
>
> On 7/15/06, Michael L. Gualtieri <mikeg at cs.pitt.edu> wrote:
> > Hi all,
> >
> > After many hours trying to get this working I broke down and decided to
> > join the mailing list here :-)
> >
> > I am writing a GTK application where I plan on using some custom Cairo
> > Widgits.
> >
> > Thus far I created two custom widgits based on the article by Davyd
> > Madeley inthe Gnome Journal found here:
> > http://www.gnomejournal.org/article/34/writing-a-widget-using-cairo-and-gtk28
> >
> > My plans are to have one cairo widget be the background image of the
> > application (let's call it "background widget") and another widget that
> > rests on top of the "background widget" (let's call it "image widget").
> >
> > The problem is that the "image widget" appears in an ugly grey box.  I
> > would like the background of the image widget to show what is under it
> > (namely the "background widget" or whatever else I decide to put it on),
> > leaving only the image inside the "image widget" visible.  I have tried
> > countless ways to make this happen but have had no luck.
> >
> > I have been able to change the color of the widget, but when I use
> > the rgba channel, 100% alpha just shows up as a black background.  I have
> > also tried to set the GTK_NO_WINDOW flag for the "image widget", but this
> > makes it disappear completely.
> >
> > Can anyone point me in the right direction to get things working?  Thanks
> > in advance!
> >
> >
> > _______________________________________________
> > cairo mailing list
> > cairo at cairographics.org
> > http://cairographics.org/cgi-bin/mailman/listinfo/cairo
> >
>



More information about the cairo mailing list