[maemo-developers] how to set gtk widget translucent

From: Jun Xu Jun.Xu at plenware.com
Date: Mon Oct 27 12:04:48 EET 2008
Hi;
Thanks for your suggestion. I have notice that you wrote twice the words "cannot do this on maemo", that's too bad, but I hope strongly my application can run on maemo. I have met the problems some application with a transparent window can run on maemo successfully, but they will present on maemo with a gray window. That is so bad state I want not to happen. So do you have any ideas?

Thanks!

-----Original Message-----
From: Martin Grimme [mailto:martin.grimme at gmail.com] 
Sent: 2008年10月27日 16:07
To: Jun Xu
Cc: maemo-developers at maemo.org
Subject: Re: how to set gtk widget translucent

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