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

Evan Martin martine at danga.com
Sat Jul 15 00:48:00 PDT 2006


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