Re: Background color problem

Oh! Thank you very much.
The thing with "style-set" works. As you said, I decided to add this
handler to my mainwindow (parent) and apply it's color to Stage.

Sorry, I've asked this question, but I can't find any explanation:
 GdkColor gdk_color = { 0, };
 ClutterColor clutter_color = { 0, };
They are structures, why do you use commas before the last brackets?
I've found C99 standard, where the same rule is applied to enum type
too. What is the purpose of it? (I've tried "1,", "2,", and only the
first field is assigned. So, it doesn't look as it able to clear all
the structure).

Thank you and everybody, who has helped me, again

Best wishes,
Vlad Volodin

2009/3/17 Emmanuele Bassi <ebassi gmail com>:
On Mon, 2009-03-16 at 23:28 +0300, Vlad Volodin wrote:

first of all, you really want to use the clutter list.

I'm using libclutter-gtk (with GtkClutterEmbed widget), where I want
to display some graphics. If somebody doesn't know it, I'll describe
it a bit. It is derived from GtkWidget. Then it uses it's own canvas.
The canvas is white, and it doesn't have some kind of transparency.

So, as I thought, I decided to fill it's background with color, got
from it's GtkStyle. After some experiments I realized, that widgets
(main window, container and GtkClutterEmbed) don't have needed color:

Containers in GTK+ do not usually have a background: they are assumed to
be transparent transparent. GtkWindow does have a background color,
though, since it'll have to provide the background for most widgets.

to set the color of the Stage embedded inside GtkClutterEmbed you can
get a specific color out of the GtkWindow style; you cannot do this at
any time you like: you'll have to connect to the style-set signal of the
GtkWindow that contains the GtkClutterEmbed-- at which point you have a
guarantee that a GtkStyle has been applied to the widget.

also, you have to remember that GdkColor and ClutterColor are not
compatible structures: you have to convert between the two.

ÂGdkColor gdk_color = { 0, };
ÂClutterColor clutter_color = { 0, };

Âgdk_color = widget->style->bg[GTK_STATE_NORMAL];

Â  = CLAMP (((  / 65535.0) * 255), 0, 255);
Â = CLAMP ((( / 65535.0) * 255), 0, 255);
Â Â= CLAMP ((( Â/ 65535.0) * 255), 0, 255);
Âclutter_color.alpha = 255;


Emmanuele Bassi,

gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]