mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 19:12:04 +00:00
2007-05-25 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-color.c: (clutter_color_parse): Handle #rrggbbaa color setting strings (i.e with alpha). Set alpha to 0xff if it is not specified. * clutter/clutter-stage.c: (clutter_stage_get_actor_at_pos) Increase select buffer. * examples/super-oh.c: Fix up use of clutter_group_show_all()
This commit is contained in:
parent
bf8996215e
commit
a64b6b7ee7
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
2007-05-25 Matthew Allum <mallum@openedhand.com>
|
||||
|
||||
* clutter/clutter-color.c: (clutter_color_parse):
|
||||
Handle #rrggbbaa color setting strings (i.e with alpha).
|
||||
Set alpha to 0xff if it is not specified.
|
||||
|
||||
* clutter/clutter-stage.c: (clutter_stage_get_actor_at_pos)
|
||||
Increase select buffer.
|
||||
|
||||
* examples/super-oh.c:
|
||||
Fix up use of clutter_group_show_all()
|
||||
|
||||
2007-05-25 Tomas Frydrych <tf@openedhand.com>
|
||||
|
||||
* clutter/clutter-actor.c:
|
||||
|
@ -452,17 +452,17 @@ clutter_color_from_pixel (ClutterColor *dest,
|
||||
|
||||
/**
|
||||
* clutter_color_parse:
|
||||
* @color: a string specifiying a color
|
||||
* @color: a string specifiying a color (named color or #RRGGBBAA)
|
||||
* @dest: return location for a #ClutterColor
|
||||
*
|
||||
* Parses a string definition of a color, filling the
|
||||
* <structfield>red</structfield>, <structfield>green</structfield> and
|
||||
* <structfield>blue</structfield> channels of @dest. The
|
||||
* <structfield>alpha</structfield> channel is not changed. The
|
||||
* color in @dest is not allocated.
|
||||
* <structfield>red</structfield>, <structfield>green</structfield>,
|
||||
* <structfield>blue</structfield> and <structfield>alpha</structfield>
|
||||
* channels of @dest. If alpha is not specified it will be set full opaque.
|
||||
* The color in @dest is not allocated.
|
||||
*
|
||||
* The color may be defined by any of the formats understood by
|
||||
* <function>XParseColor</function>; these include literal color
|
||||
* <function>pango_color_parse</function>; these include literal color
|
||||
* names, like <literal>Red</literal> or <literal>DarkSlateGray</literal>,
|
||||
* or hexadecimal specifications like <literal>#3050b2</literal> or
|
||||
* <literal>#333</literal>.
|
||||
@ -477,16 +477,43 @@ clutter_color_parse (const gchar *color,
|
||||
{
|
||||
PangoColor pango_color;
|
||||
|
||||
/* parse ourselves to get alpha */
|
||||
if (color[0] == '#')
|
||||
{
|
||||
gint32 result;
|
||||
|
||||
if (sscanf (color+1, "%x", &result))
|
||||
{
|
||||
if (strlen(color) == 9)
|
||||
{
|
||||
dest->red = result >> 24 & 0xff;
|
||||
dest->green = (result >> 16) & 0xff;
|
||||
dest->blue = (result >> 8) & 0xff;
|
||||
dest->alpha = result & 0xff;
|
||||
return TRUE;
|
||||
}
|
||||
else if (strlen(color) == 7)
|
||||
{
|
||||
dest->red = (result >> 16) & 0xff;
|
||||
dest->green = (result >> 8) & 0xff;
|
||||
dest->blue = result & 0xff;
|
||||
dest->alpha = 0xff;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fall back to pango for named colors - note pango does not handle alpha */
|
||||
if (pango_color_parse (&pango_color, color))
|
||||
{
|
||||
dest->red = pango_color.red;
|
||||
dest->red = pango_color.red;
|
||||
dest->green = pango_color.green;
|
||||
dest->blue = pango_color.blue;
|
||||
|
||||
dest->blue = pango_color.blue;
|
||||
dest->alpha = 0xff;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -773,21 +773,17 @@ clutter_stage_get_actor_at_pos (ClutterStage *stage,
|
||||
*/
|
||||
|
||||
ClutterActor *found = NULL;
|
||||
GLuint buff[64] = { 0 };
|
||||
GLuint buff[512] = { 0 };
|
||||
GLint hits;
|
||||
GLint view[4];
|
||||
ClutterMainContext *ctx;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
|
||||
|
||||
ctx = clutter_context_get_default ();
|
||||
|
||||
glSelectBuffer (sizeof (buff), buff);
|
||||
glSelectBuffer (512, buff);
|
||||
glGetIntegerv (GL_VIEWPORT, view);
|
||||
glRenderMode (GL_SELECT);
|
||||
|
||||
glInitNames ();
|
||||
|
||||
glPushName (0);
|
||||
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
|
@ -248,12 +248,15 @@ main (int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
clutter_actor_show_all (oh->group);
|
||||
|
||||
/* Add the group to the stage */
|
||||
clutter_group_add (CLUTTER_GROUP (stage), CLUTTER_ACTOR(oh->group));
|
||||
|
||||
/* Show everying ( and map window ) */
|
||||
clutter_actor_show_all (stage);
|
||||
|
||||
|
||||
g_signal_connect (stage, "button-press-event",
|
||||
G_CALLBACK (input_cb),
|
||||
oh);
|
||||
|
Loading…
Reference in New Issue
Block a user