#define SELF_VIDEO_SECTION_WIDTH 120
#define SELF_VIDEO_SECTION_HEIGHT 90
-#define SELF_VIDEO_SECTION_MARGIN 10
+#define SELF_VIDEO_SECTION_MARGIN 2
+#define SELF_VIDEO_SECTION_BORDER SELF_VIDEO_SECTION_MARGIN*2
#define FLOATING_TOOLBAR_OPACITY 192
#define FLOATING_TOOLBAR_WIDTH 280
/* The time interval in milliseconds between 2 outgoing rings */
#define MS_BETWEEN_RING 500
+/* The roundedness of preview box and placeholders */
+#define PREVIEW_ROUND_FACTOR 16
+
G_DEFINE_TYPE(EmpathyCallWindow, empathy_call_window, GTK_TYPE_WINDOW)
enum {
ClutterBinAlignment y)
{
ClutterLayoutManager *layout1, *layout2;
- ClutterActor *rectangle;
+ EmpathyRoundedRectangle *rectangle;
ClutterActor *box1, *box2;
layout1 = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
*box = box1;
rectangle = empathy_rounded_rectangle_new (
- SELF_VIDEO_SECTION_WIDTH + 5,
- SELF_VIDEO_SECTION_HEIGHT + 5);
+ SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_SECTION_MARGIN,
+ SELF_VIDEO_SECTION_HEIGHT + 2 * SELF_VIDEO_SECTION_MARGIN,
+ PREVIEW_ROUND_FACTOR);
clutter_actor_set_size (box1,
SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_SECTION_MARGIN,
SELF_VIDEO_SECTION_HEIGHT + 2 * SELF_VIDEO_SECTION_MARGIN);
clutter_container_add_actor (CLUTTER_CONTAINER (box1), box2);
- clutter_container_add_actor (CLUTTER_CONTAINER (box2), rectangle);
+ clutter_container_add_actor (CLUTTER_CONTAINER (box2), CLUTTER_ACTOR (rectangle));
clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (self->priv->video_layout),
box1, x, y);
- clutter_actor_hide (rectangle);
+ clutter_actor_hide (CLUTTER_ACTOR (rectangle));
- return rectangle;
+ return CLUTTER_ACTOR (rectangle);
}
static void
}
else if (box.width - SELF_VIDEO_SECTION_MARGIN >= event_x &&
event_x >= (box.width - SELF_VIDEO_SECTION_MARGIN - (gint) SELF_VIDEO_SECTION_WIDTH) &&
- box.height - SELF_VIDEO_SECTION_MARGIN - SELF_VIDEO_SECTION_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING >= event_y &&
+ box.height - 2 * SELF_VIDEO_SECTION_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING >= event_y &&
event_y >= (box.height - SELF_VIDEO_SECTION_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING - (gint) SELF_VIDEO_SECTION_HEIGHT))
{
pos = PREVIEW_POS_BOTTOM_RIGHT;
rectangle = empathy_call_window_get_preview_rectangle (self, pos);
empathy_rounded_rectangle_set_border_width (
- EMPATHY_ROUNDED_RECTANGLE (rectangle), 3);
+ EMPATHY_ROUNDED_RECTANGLE (rectangle), 2 * SELF_VIDEO_SECTION_MARGIN);
empathy_rounded_rectangle_set_border_color (
EMPATHY_ROUNDED_RECTANGLE (rectangle), CLUTTER_COLOR_Red);
}
/* Spinner for when changing the camera device */
priv->preview_spinner_widget = gtk_spinner_new ();
- priv->preview_spinner_actor = empathy_rounded_actor_new ();
- empathy_rounded_actor_set_round_factor (
- EMPATHY_ROUNDED_ACTOR (priv->preview_spinner_actor), 16);
+ priv->preview_spinner_actor = empathy_rounded_actor_new (PREVIEW_ROUND_FACTOR);
g_object_set (priv->preview_spinner_widget, "expand", TRUE, NULL);
gtk_widget_override_background_color (
/* Translators: this is an "Info" label. It should be as short
* as possible. */
button = gtk_button_new_with_label (_("i"));
- priv->preview_shown_button = b = empathy_rounded_actor_new ();
+ priv->preview_shown_button = b = empathy_rounded_actor_new (2);
gtk_container_add (
GTK_CONTAINER (gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (b))),
button);
box = clutter_box_new (layout_end);
clutter_actor_set_size (box,
SELF_VIDEO_SECTION_WIDTH,
- SELF_VIDEO_SECTION_HEIGHT + SELF_VIDEO_SECTION_MARGIN);
+ SELF_VIDEO_SECTION_HEIGHT + 2 * SELF_VIDEO_SECTION_MARGIN);
clutter_container_add_actor (CLUTTER_CONTAINER (box), b);
clutter_container_add_actor (CLUTTER_CONTAINER (priv->video_preview), box);
/* Translators: this is an "Info" label. It should be as short
* as possible. */
button = gtk_button_new_with_label (_("i"));
- b = empathy_rounded_actor_new ();
+ b = empathy_rounded_actor_new (2);
gtk_container_add (
GTK_CONTAINER (gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (b))),
button);
create_audio_input (self);
create_video_input (self);
- priv->floating_toolbar = empathy_rounded_actor_new ();
+ priv->floating_toolbar = empathy_rounded_actor_new (2);
gtk_widget_reparent (priv->bottom_toolbar,
gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (priv->floating_toolbar)));
guint width, height;
ClutterColor border_color;
guint border_width;
+ guint round_factor;
};
static gboolean
{
EmpathyRoundedRectangle *self = EMPATHY_ROUNDED_RECTANGLE (canvas);
guint width, height;
+ guint border_width;
guint tmp_alpha;
-
-#define RADIUS (height / 8.)
+ gdouble radius;
width = self->priv->width;
height = self->priv->height;
+ radius = self->priv->height / self->priv->round_factor;
+ border_width = self->priv->border_width;
/* compute the composited opacity of the actor taking into
* account the opacity of the color set by the user */
self->priv->border_color.blue,
tmp_alpha);
- cairo_set_line_width (cr, self->priv->border_width);
+ cairo_set_line_width (cr, border_width);
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_paint (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
/* make room for the portion of the border drawn on the outside */
- cairo_translate (cr, self->priv->border_width/2.0, self->priv->border_width/2.0);
+ cairo_translate (cr, border_width/2.0, border_width/2.0);
cairo_new_sub_path (cr);
- cairo_arc (cr, width - RADIUS, RADIUS, RADIUS,
+ cairo_arc (cr, width - radius, radius, radius,
-M_PI/2.0, 0);
- cairo_arc (cr, width - RADIUS, height - RADIUS, RADIUS,
+ cairo_arc (cr, width - radius, height - radius, radius,
0, M_PI/2.0);
- cairo_arc (cr, RADIUS, height - RADIUS, RADIUS,
+ cairo_arc (cr, radius, height - radius, radius,
M_PI/2.0, M_PI);
- cairo_arc (cr, RADIUS, RADIUS, RADIUS,
+ cairo_arc (cr, radius, radius, radius,
M_PI, -M_PI/2.0);
cairo_close_path (cr);
cairo_stroke (cr);
-#undef RADIUS
return TRUE;
}
EMPATHY_TYPE_ROUNDED_RECTANGLE, EmpathyRoundedRectanglePriv);
self->priv->border_width = 1;
+ self->priv->round_factor = 2;
}
static void
self->priv->height + self->priv->border_width);
}
-ClutterActor *
+EmpathyRoundedRectangle *
empathy_rounded_rectangle_new (guint width,
- guint height)
+ guint height,
+ guint round_factor)
{
EmpathyRoundedRectangle *self;
self->priv->width = width;
self->priv->height = height;
+ self->priv->round_factor = round_factor;
g_signal_connect (self, "draw", G_CALLBACK (draw_cb), NULL);
empathy_rounded_rectangle_update_surface_size (self);
clutter_cairo_texture_invalidate (CLUTTER_CAIRO_TEXTURE (self));
- return CLUTTER_ACTOR (self);
+ return self;
}
void