lookingGlass: Draw a red border around target actor
This commit is contained in:
@@ -178,3 +178,38 @@ shell_draw_glow (ClutterCairoTexture *texture,
|
||||
cairo_pattern_destroy (gradient);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
hook_paint_red_border (ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
CoglColor color;
|
||||
ClutterGeometry geom;
|
||||
float width = 2;
|
||||
float x2;
|
||||
float y2;
|
||||
|
||||
cogl_color_set_from_4ub (&color, 0xff, 0, 0, 0xc4);
|
||||
cogl_set_source_color (&color);
|
||||
|
||||
clutter_actor_get_allocation_geometry (actor, &geom);
|
||||
x2 = geom.x + geom.width;
|
||||
y2 = geom.y + geom.height;
|
||||
|
||||
/** clockwise order **/
|
||||
cogl_rectangle (geom.x, geom.y,
|
||||
x2, geom.y + width);
|
||||
cogl_rectangle (x2 - width, geom.y + width,
|
||||
x2, y2);
|
||||
cogl_rectangle (x2 - width, y2,
|
||||
geom.x, y2 - width);
|
||||
cogl_rectangle (geom.x + width, y2 - width,
|
||||
geom.x, geom.y + width);
|
||||
}
|
||||
|
||||
guint
|
||||
shell_add_hook_paint_red_border (ClutterActor *actor)
|
||||
{
|
||||
return g_signal_connect_after (G_OBJECT (actor), "paint",
|
||||
G_CALLBACK (hook_paint_red_border), NULL);
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@ void shell_draw_glow (ClutterCairoTexture *texture,
|
||||
double green,
|
||||
double alpha);
|
||||
|
||||
guint shell_add_hook_paint_red_border (ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __SHELL_GLOBAL_H__ */
|
||||
|
Reference in New Issue
Block a user