diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-03-12 20:02:18 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-03-12 20:02:18 +0800 |
commit | 1413b47d30284825bc81ed606c458a5fa60f830f (patch) | |
tree | 6b71f70b88a07f6ec1ada5826e38ba286e998bc2 | |
parent | afcd81098a2134d1421844ebf37a9ba90e1193bf (diff) | |
parent | 6fe60c87090fe013d7b803eb82a3ddb9568eccb9 (diff) | |
download | gsoc2013-empathy-1413b47d30284825bc81ed606c458a5fa60f830f.tar gsoc2013-empathy-1413b47d30284825bc81ed606c458a5fa60f830f.tar.gz gsoc2013-empathy-1413b47d30284825bc81ed606c458a5fa60f830f.tar.bz2 gsoc2013-empathy-1413b47d30284825bc81ed606c458a5fa60f830f.tar.lz gsoc2013-empathy-1413b47d30284825bc81ed606c458a5fa60f830f.tar.xz gsoc2013-empathy-1413b47d30284825bc81ed606c458a5fa60f830f.tar.zst gsoc2013-empathy-1413b47d30284825bc81ed606c458a5fa60f830f.zip |
Merge remote-tracking branch 'em/fix-highlight-roundedness-671720'
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | src/empathy-call-window.c | 35 | ||||
-rw-r--r-- | src/empathy-rounded-actor.c | 11 | ||||
-rw-r--r-- | src/empathy-rounded-actor.h | 5 | ||||
-rw-r--r-- | src/empathy-rounded-rectangle.c | 58 | ||||
-rw-r--r-- | src/empathy-rounded-rectangle.h | 5 |
6 files changed, 70 insertions, 55 deletions
diff --git a/configure.ac b/configure.ac index 42876013f..6e5caeceb 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,12 @@ GTK_REQUIRED=3.0.2 AC_DEFINE(GDK_VERSION_MIN_REQUIRED, GDK_VERSION_3_0, [Ignore post 3.0 deprecations]) AC_DEFINE(GDK_VERSION_MAX_REQUIRED, GDK_VERSION_3_0, [Prevent post 3.0 APIs]) +CLUTTER_REQUIRED=1.8.0 +AC_DEFINE(CLUTTER_VERSION_MIN_REQUIRED, CLUTTER_VERSION_1_8, [Ignore post 1.8 deprecations]) +AC_DEFINE(CLUTTER_VERSION_MAX, CLUTTER_VERSION_1_8, [Prevent post 1.8 APIs]) + +CLUTTER_GTK_REQUIRED=0.90.3 + GSTREAMER_REQUIRED=0.10.32 KEYRING_REQUIRED=2.26.0 GCR_REQUIRED=2.91.4 @@ -57,8 +63,6 @@ WEBKIT_REQUIRED=1.3.13 GOA_REQUIRED=3.3.0 # Optional deps -CLUTTER_REQUIRED=1.7.14 -CLUTTER_GTK_REQUIRED=0.90.3 ENCHANT_REQUIRED=1.2.0 GEOCLUE_REQUIRED=0.11 ISO_CODES_REQUIRED=0.35 @@ -73,9 +77,6 @@ CHAMPLAIN_REQUIRED=0.12.1 #ifelse(empathy_released, 1, [], [enable_maintainer_mode="yes"]) #GNOME_MAINTAINER_MODE_DEFINES -# FIXME: bgo #669673 -AC_DEFINE(CLUTTER_DISABLE_DEPRECATION_WARNINGS, 1, [Build with Clutter deprecated]) - AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_SRCDIR([configure.ac]) diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 8eaf2cc33..ada107c3c 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -79,7 +79,8 @@ #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 @@ -100,6 +101,9 @@ /* 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 { @@ -630,7 +634,7 @@ empathy_call_window_create_preview_rectangle (EmpathyCallWindow *self, ClutterBinAlignment y) { ClutterLayoutManager *layout1, *layout2; - ClutterActor *rectangle; + EmpathyRoundedRectangle *rectangle; ClutterActor *box1, *box2; layout1 = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, @@ -641,8 +645,9 @@ empathy_call_window_create_preview_rectangle (EmpathyCallWindow *self, *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, @@ -662,14 +667,14 @@ empathy_call_window_create_preview_rectangle (EmpathyCallWindow *self, 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 @@ -788,7 +793,7 @@ empathy_call_window_get_preview_position (EmpathyCallWindow *self, } 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; @@ -876,7 +881,7 @@ empathy_call_window_highlight_preview_rectangle (EmpathyCallWindow *self, 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); } @@ -1091,9 +1096,7 @@ create_video_preview (EmpathyCallWindow *self) /* 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 ( @@ -1134,7 +1137,7 @@ create_video_preview (EmpathyCallWindow *self) /* 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); @@ -1145,7 +1148,7 @@ create_video_preview (EmpathyCallWindow *self) 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); @@ -1157,7 +1160,7 @@ create_video_preview (EmpathyCallWindow *self) /* 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); @@ -1726,7 +1729,7 @@ empathy_call_window_init (EmpathyCallWindow *self) 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))); diff --git a/src/empathy-rounded-actor.c b/src/empathy-rounded-actor.c index 045f08de7..646682fb5 100644 --- a/src/empathy-rounded-actor.c +++ b/src/empathy-rounded-actor.c @@ -75,15 +75,12 @@ empathy_rounded_actor_class_init (EmpathyRoundedActorClass *klass) } ClutterActor * -empathy_rounded_actor_new (void) +empathy_rounded_actor_new (guint round_factor) { - return CLUTTER_ACTOR ( + EmpathyRoundedActor *self = EMPATHY_ROUNDED_ACTOR ( g_object_new (EMPATHY_TYPE_ROUNDED_ACTOR, NULL)); -} -void -empathy_rounded_actor_set_round_factor (EmpathyRoundedActor *self, - guint round_factor) -{ self->priv->round_factor = round_factor; + + return CLUTTER_ACTOR (self); } diff --git a/src/empathy-rounded-actor.h b/src/empathy-rounded-actor.h index 4287cf389..49fc03fd3 100644 --- a/src/empathy-rounded-actor.h +++ b/src/empathy-rounded-actor.h @@ -59,10 +59,7 @@ GType empathy_rounded_actor_get_type (void); (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_ROUNDED_ACTOR, \ EmpathyRoundedActorClass)) -ClutterActor *empathy_rounded_actor_new (void); - -void empathy_rounded_actor_set_round_factor (EmpathyRoundedActor *self, - guint round_factor); +ClutterActor *empathy_rounded_actor_new (guint round_factor); G_END_DECLS diff --git a/src/empathy-rounded-rectangle.c b/src/empathy-rounded-rectangle.c index 8e6dab3da..7b8951f80 100644 --- a/src/empathy-rounded-rectangle.c +++ b/src/empathy-rounded-rectangle.c @@ -35,19 +35,23 @@ struct _EmpathyRoundedRectanglePriv guint width, height; ClutterColor border_color; guint border_width; + guint round_factor; }; -static void -empathy_rounded_rectangle_paint (EmpathyRoundedRectangle *self) +static gboolean +draw_cb (ClutterCairoTexture *canvas, + cairo_t *cr) { + EmpathyRoundedRectangle *self = EMPATHY_ROUNDED_RECTANGLE (canvas); guint width, height; + guint border_width; guint tmp_alpha; - cairo_t *cr; - -#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 */ @@ -55,38 +59,35 @@ empathy_rounded_rectangle_paint (EmpathyRoundedRectangle *self) * self->priv->border_color.alpha / 255; - cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (self)); - cairo_set_source_rgba (cr, self->priv->border_color.red, self->priv->border_color.green, 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); - cairo_destroy (cr); -#undef RADIUS + return TRUE; } static void @@ -96,11 +97,22 @@ empathy_rounded_rectangle_init (EmpathyRoundedRectangle *self) EMPATHY_TYPE_ROUNDED_RECTANGLE, EmpathyRoundedRectanglePriv); self->priv->border_width = 1; + self->priv->round_factor = 2; +} + +static void +empathy_rounded_rectangle_finalize (GObject *object) +{ + G_OBJECT_CLASS (empathy_rounded_rectangle_parent_class)->finalize (object); } static void empathy_rounded_rectangle_class_init (EmpathyRoundedRectangleClass *klass) { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->finalize = empathy_rounded_rectangle_finalize; + g_type_class_add_private (klass, sizeof (EmpathyRoundedRectanglePriv)); } @@ -112,9 +124,10 @@ empathy_rounded_rectangle_update_surface_size (EmpathyRoundedRectangle *self) self->priv->height + self->priv->border_width); } -ClutterActor * +EmpathyRoundedRectangle * empathy_rounded_rectangle_new (guint width, - guint height) + guint height, + guint round_factor) { EmpathyRoundedRectangle *self; @@ -122,11 +135,14 @@ empathy_rounded_rectangle_new (guint width, 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); - empathy_rounded_rectangle_paint (self); + clutter_cairo_texture_invalidate (CLUTTER_CAIRO_TEXTURE (self)); - return CLUTTER_ACTOR (self); + return self; } void @@ -136,7 +152,7 @@ empathy_rounded_rectangle_set_border_width (EmpathyRoundedRectangle *self, self->priv->border_width = border_width; empathy_rounded_rectangle_update_surface_size (self); - empathy_rounded_rectangle_paint (self); + clutter_cairo_texture_invalidate (CLUTTER_CAIRO_TEXTURE (self)); } void @@ -145,5 +161,5 @@ empathy_rounded_rectangle_set_border_color (EmpathyRoundedRectangle *self, { self->priv->border_color = *color; - empathy_rounded_rectangle_paint (self); + clutter_cairo_texture_invalidate (CLUTTER_CAIRO_TEXTURE (self)); } diff --git a/src/empathy-rounded-rectangle.h b/src/empathy-rounded-rectangle.h index 38d396f39..e4bf72c6e 100644 --- a/src/empathy-rounded-rectangle.h +++ b/src/empathy-rounded-rectangle.h @@ -59,8 +59,9 @@ GType empathy_rounded_rectangle_get_type (void); (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_ROUNDED_RECTANGLE, \ EmpathyRoundedRectangleClass)) -ClutterActor *empathy_rounded_rectangle_new (guint width, - guint height); +EmpathyRoundedRectangle *empathy_rounded_rectangle_new (guint width, + guint height, + guint round_factor); void empathy_rounded_rectangle_set_border_width (EmpathyRoundedRectangle *self, |