[maemo-developers] how to set gtk widget translucent

From: Martin Grimme martin.grimme at gmail.com
Date: Mon Oct 27 10:07:00 EET 2008
Hi,

there are different sorts of GTK widgets. Some widgets simply draw on
their parent window, and some widgets (those that can receive user
events) draw on their own low-level window.
The widgets with their own windows (e.g. GtkButton, GtkEntry) are
opaque and completely hide what's behind. However, you can punch holes
into their shape (gtk_widget_shape_combine_mask) to reveal what's
behind. Alpha blending is not possible though. So, this wouldn't work
with your findbar idea.
Windowless widgets (e,g, GtkImage, GtkLabel) can be composed on top of
each other and support alpha blending just fine. Your findbar needs
text input, so it's not a windowless window.
On modern Linux desktops (but not on the current maemo) you can also
use an RGBA colorspace to draw onto the window. The composition
manager then blends the window according to the alpha pixel values.
This would be the perfect solution for your findbar, as the bar could
be implemented as another toplevel window layered above your
application window. However, you can't do this on maemo.

I suggest looking into GtkStyle to change the background image of the
GtkEntry widget. You can grab the screen contents, dim it, and paste
into the entry widget. This would create the illusion of translucency.


Regards,
Martin


2008/10/27, Jun Xu <Jun.Xu at plenware.com>:
> Hi, All,
> I want to add a gtk widget on top of another gtk widget, and then set
> Alpha value to the widget above, make it translucent. for example, I
> want to add a translucent findbar on a window. I have tried kinds of way
> to do that, however, there is no any available means that can perform
> the special effect. So, if you have any good idea, share me PLS. if any
> sample, that will be delicious:-)
>
>
>
> Looking forwards to anyone's help.
>
>
>
>
>
>

More information about the maemo-developers mailing list