[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Background color problem
- From: Emmanuele Bassi <ebassi gmail com>
- To: Vlad Volodin <vest 84 gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Background color problem
- Date: Tue, 17 Mar 2009 11:46:57 +0000
On Tue, 2009-03-17 at 07:41 +0300, Vlad Volodin wrote:
> 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?
because it will initialize all the members of a struct to 0. it's
equivalent to:
GdkColor gdk_color = { 0, 0, 0, 0 };
ClutterColor clutter_color = { 0, 0, 0, 0 };
or to:
GdkColor gdk_color;
ClutterColor clutter_color;
memset (&gdk_color, 0, sizeof (GdkColor));
memset (&clutter_color, 0, sizeof (ClutterColor));
or, in C99:
GdkColor gdk_color = {
.pixel = 0,
.red = 0,
.green = 0,
.blue = 0
};
ClutterColor clutter_color = {
.red = 0,
.green = 0,
.blue = 0,
.alpha = 0
};
> I've found C99 standard, where the same rule is applied to enum type
> too.
it doesn't have anything to do with enumerations -- enumerations will
use the number to set their value explicitly, and it's something coming
from ANSI C, way before C99.
ciao,
Emmanuele.
> 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];
> >
> > clutter_color.red = CLAMP (((gdk_color.red / 65535.0) * 255), 0, 255);
> > clutter_color.green = CLAMP (((gdk_color.green / 65535.0) * 255), 0, 255);
> > clutter_color.blue = CLAMP (((gdk_color.blue / 65535.0) * 255), 0, 255);
> > clutter_color.alpha = 255;
> >
> > ciao,
> > Emmanuele.
> >
> > --
> > Emmanuele Bassi,
> > W: http://www.emmanuelebassi.net
> > B: http://log.emmanuelebassi.net
> >
> > _______________________________________________
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> >
--
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]