From c5426c1a22ed0f16bd742bda88fb8a6740f2c9ee Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Tue, 9 Aug 2011 10:54:16 +0100 Subject: empathy-call: call gdk_disable_multidevice() Clutter needs this, and gtk_clutter_init() calls it, but g_option_context_parse() initializes GTK+ when parsing GTK+ options so it's too late for us then. https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/empathy-call.c b/src/empathy-call.c index 7503532c5..4adf5f48d 100644 --- a/src/empathy-call.c +++ b/src/empathy-call.c @@ -121,6 +121,9 @@ main (int argc, /* Init */ g_thread_init (NULL); + /* Clutter needs this */ + gdk_disable_multidevice (); + optcontext = g_option_context_new (N_("- Empathy Audio/Video Client")); g_option_context_add_group (optcontext, gst_init_get_option_group ()); g_option_context_add_group (optcontext, gtk_get_option_group (TRUE)); -- cgit v1.2.3 From e5658d67a38612c727091d7e91f9477333047870 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Mon, 8 Aug 2011 16:15:05 +0100 Subject: CallWindow: add top and right margin to the preview container So that when it's placed on another corner, it still has some margin. https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index ce0483099..a734b5b5a 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -549,12 +549,12 @@ create_video_preview (EmpathyCallWindow *self) 0.0); /* Add a little offset to the video preview */ - layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_END, - CLUTTER_BIN_ALIGNMENT_START); + layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, + CLUTTER_BIN_ALIGNMENT_CENTER); priv->video_preview = clutter_box_new (layout); clutter_actor_set_size (priv->video_preview, - SELF_VIDEO_SECTION_WIDTH + SELF_VIDEO_SECTION_MARGIN, - SELF_VIDEO_SECTION_HEIGTH + SELF_VIDEO_SECTION_MARGIN + + SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_SECTION_MARGIN, + SELF_VIDEO_SECTION_HEIGTH + 2 * SELF_VIDEO_SECTION_MARGIN + FLOATING_TOOLBAR_HEIGHT + FLOATING_TOOLBAR_SPACING); layout_center = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, -- cgit v1.2.3 From 6526ece345726300c7ab0c2b3c46c4bd2795a6ed Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Mon, 8 Aug 2011 17:54:50 +0100 Subject: CallWindow: allow to move the video preview https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index a734b5b5a..e57858797 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -79,6 +79,8 @@ #define FLOATING_TOOLBAR_HEIGHT 36 #define FLOATING_TOOLBAR_SPACING 20 +#define SELF_VIDEO_MARGIN 10 + /* The avatar's default width and height are set to the same value because we want a square icon. */ #define REMOTE_CONTACT_AVATAR_DEFAULT_WIDTH EMPATHY_VIDEO_WIDGET_DEFAULT_HEIGHT @@ -112,6 +114,14 @@ typedef enum { CAMERA_STATE_ON, } CameraState; +typedef enum { + PREVIEW_POS_NONE, + PREVIEW_POS_TOP_LEFT, + PREVIEW_POS_TOP_RIGHT, + PREVIEW_POS_BOTTOM_LEFT, + PREVIEW_POS_BOTTOM_RIGHT, +} PreviewPosition; + struct _EmpathyCallWindowPriv { gboolean dispose_has_run; @@ -522,6 +532,91 @@ empathy_call_window_preview_hidden_button_clicked_cb (GtkButton *button, gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE); } +static void +empathy_call_window_move_video_preview (EmpathyCallWindow *self, + PreviewPosition pos) +{ + ClutterBinLayout *layout = CLUTTER_BIN_LAYOUT (self->priv->video_layout); + + DEBUG ("moving the video preview to %d", pos); + + switch (pos) + { + case PREVIEW_POS_TOP_LEFT: + clutter_bin_layout_set_alignment (layout, + self->priv->video_preview, + CLUTTER_BIN_ALIGNMENT_START, + CLUTTER_BIN_ALIGNMENT_START); + break; + case PREVIEW_POS_TOP_RIGHT: + clutter_bin_layout_set_alignment (layout, + self->priv->video_preview, + CLUTTER_BIN_ALIGNMENT_END, + CLUTTER_BIN_ALIGNMENT_START); + break; + case PREVIEW_POS_BOTTOM_LEFT: + clutter_bin_layout_set_alignment (layout, + self->priv->video_preview, + CLUTTER_BIN_ALIGNMENT_START, + CLUTTER_BIN_ALIGNMENT_END); + break; + case PREVIEW_POS_BOTTOM_RIGHT: + clutter_bin_layout_set_alignment (layout, + self->priv->video_preview, + CLUTTER_BIN_ALIGNMENT_END, + CLUTTER_BIN_ALIGNMENT_END); + break; + default: + g_warn_if_reached (); + } +} + +static void +empathy_call_window_preview_on_drag_end_cb (ClutterDragAction *action, + ClutterActor *actor, + gfloat event_x, + gfloat event_y, + ClutterModifierType modifiers, + EmpathyCallWindow *self) +{ + ClutterGeometry box; + PreviewPosition pos = PREVIEW_POS_NONE; + + clutter_actor_get_geometry (self->priv->video_box, &box); + + if (0 + SELF_VIDEO_MARGIN <= event_x && + event_x <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_WIDTH) && + 0 + SELF_VIDEO_MARGIN <= event_y && + event_y <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_HEIGTH)) + { + pos = PREVIEW_POS_TOP_LEFT; + } + else if (box.width - SELF_VIDEO_MARGIN >= event_x && + event_x >= (box.width - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_WIDTH) && + 0 + SELF_VIDEO_MARGIN <= event_y && + event_y <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_HEIGTH)) + { + pos = PREVIEW_POS_TOP_RIGHT; + } + else if (0 + SELF_VIDEO_MARGIN <= event_x && + event_x <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_WIDTH) && + box.height - SELF_VIDEO_MARGIN >= event_y && + event_y >= (box.height - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_HEIGTH)) + { + pos = PREVIEW_POS_BOTTOM_LEFT; + } + else if (box.width - SELF_VIDEO_MARGIN >= event_x && + event_x >= (box.width - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_WIDTH) && + box.height - SELF_VIDEO_MARGIN >= event_y && + event_y >= (box.height - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_HEIGTH)) + { + pos = PREVIEW_POS_BOTTOM_RIGHT; + } + + if (pos != PREVIEW_POS_NONE) + empathy_call_window_move_video_preview (self, pos); +} + static void create_video_preview (EmpathyCallWindow *self) { @@ -530,6 +625,7 @@ create_video_preview (EmpathyCallWindow *self) ClutterActor *preview; ClutterActor *box; ClutterActor *b; + ClutterAction *action; GtkWidget *button; g_assert (priv->video_preview == NULL); @@ -606,6 +702,13 @@ create_video_preview (EmpathyCallWindow *self) priv->video_preview, CLUTTER_BIN_ALIGNMENT_START, CLUTTER_BIN_ALIGNMENT_END); + + action = clutter_drag_action_new (); + g_signal_connect (action, "drag-end", + G_CALLBACK (empathy_call_window_preview_on_drag_end_cb), self); + + clutter_actor_add_action (preview, action); + clutter_actor_set_reactive (preview, TRUE); } static void -- cgit v1.2.3 From 9fba3fff14e9628c46f667ca1022e0af46693cb2 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Tue, 9 Aug 2011 14:01:40 +0100 Subject: CallWindow: show drop zones when dragging the preview https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index e57858797..25fa04c3e 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -141,6 +141,10 @@ struct _EmpathyCallWindowPriv ClutterActor *video_output; ClutterActor *video_preview; ClutterActor *preview_hidden_button; + ClutterActor *preview_rectangle1; + ClutterActor *preview_rectangle2; + ClutterActor *preview_rectangle3; + ClutterActor *preview_rectangle4; GtkWidget *video_container; GtkWidget *remote_user_avatar_widget; GtkWidget *remote_user_avatar_toolbar; @@ -532,6 +536,70 @@ empathy_call_window_preview_hidden_button_clicked_cb (GtkButton *button, gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE); } +static ClutterActor * +empathy_call_window_create_preview_rectangle (EmpathyCallWindow *self, + ClutterBinAlignment x, + ClutterBinAlignment y) +{ + ClutterLayoutManager *layout; + ClutterActor *rectangle; + ClutterActor *box; + + layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, + CLUTTER_BIN_ALIGNMENT_CENTER); + + box = clutter_box_new (layout); + + rectangle = clutter_rectangle_new_with_color ( + CLUTTER_COLOR_Transparent); + + clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rectangle), + 1); + + clutter_actor_set_size (box, + SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_MARGIN, + SELF_VIDEO_SECTION_HEIGTH + 2 * SELF_VIDEO_MARGIN); + + clutter_actor_set_size (rectangle, + SELF_VIDEO_SECTION_WIDTH, SELF_VIDEO_SECTION_HEIGTH); + + clutter_container_add_actor (CLUTTER_CONTAINER (box), rectangle); + + clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (self->priv->video_layout), + box, x, y); + + clutter_actor_hide (rectangle); + + return rectangle; +} + +static void +empathy_call_window_create_preview_rectangles (EmpathyCallWindow *self) +{ + self->priv->preview_rectangle1 = + empathy_call_window_create_preview_rectangle (self, + CLUTTER_BIN_ALIGNMENT_START, CLUTTER_BIN_ALIGNMENT_START); + self->priv->preview_rectangle2 = + empathy_call_window_create_preview_rectangle (self, + CLUTTER_BIN_ALIGNMENT_START, CLUTTER_BIN_ALIGNMENT_END); + self->priv->preview_rectangle3 = + empathy_call_window_create_preview_rectangle (self, + CLUTTER_BIN_ALIGNMENT_END, CLUTTER_BIN_ALIGNMENT_START); + self->priv->preview_rectangle4 = + empathy_call_window_create_preview_rectangle (self, + CLUTTER_BIN_ALIGNMENT_END, CLUTTER_BIN_ALIGNMENT_END); +} + +static void +empathy_call_window_show_preview_rectangles (EmpathyCallWindow *self, + gboolean show) +{ + g_object_set (self->priv->preview_rectangle1, "visible", show, NULL); + g_object_set (self->priv->preview_rectangle2, "visible", show, NULL); + g_object_set (self->priv->preview_rectangle3, "visible", show, NULL); + g_object_set (self->priv->preview_rectangle4, "visible", show, NULL); +} + static void empathy_call_window_move_video_preview (EmpathyCallWindow *self, PreviewPosition pos) @@ -571,6 +639,17 @@ empathy_call_window_move_video_preview (EmpathyCallWindow *self, } } +static void +empathy_call_window_preview_on_drag_begin_cb (ClutterDragAction *action, + ClutterActor *actor, + gfloat event_x, + gfloat event_y, + ClutterModifierType modifiers, + EmpathyCallWindow *self) +{ + empathy_call_window_show_preview_rectangles (self, TRUE); +} + static void empathy_call_window_preview_on_drag_end_cb (ClutterDragAction *action, ClutterActor *actor, @@ -615,6 +694,8 @@ empathy_call_window_preview_on_drag_end_cb (ClutterDragAction *action, if (pos != PREVIEW_POS_NONE) empathy_call_window_move_video_preview (self, pos); + + empathy_call_window_show_preview_rectangles (self, FALSE); } static void @@ -704,6 +785,8 @@ create_video_preview (EmpathyCallWindow *self) CLUTTER_BIN_ALIGNMENT_END); action = clutter_drag_action_new (); + g_signal_connect (action, "drag-begin", + G_CALLBACK (empathy_call_window_preview_on_drag_begin_cb), self); g_signal_connect (action, "drag-end", G_CALLBACK (empathy_call_window_preview_on_drag_end_cb), self); @@ -1051,6 +1134,8 @@ empathy_call_window_init (EmpathyCallWindow *self) priv->video_box = clutter_box_new (priv->video_layout); + empathy_call_window_create_preview_rectangles (self); + priv->video_container = gtk_clutter_embed_new (); /* Set the background color to that of the rest of the window */ -- cgit v1.2.3 From c3b3b11b227dd8add44c83c264b79b8c9168f94d Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Tue, 9 Aug 2011 15:34:44 +0100 Subject: Factor out empathy_call_window_get_preview_position() https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 25fa04c3e..3ea6a3d07 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -650,13 +650,10 @@ empathy_call_window_preview_on_drag_begin_cb (ClutterDragAction *action, empathy_call_window_show_preview_rectangles (self, TRUE); } -static void -empathy_call_window_preview_on_drag_end_cb (ClutterDragAction *action, - ClutterActor *actor, +static PreviewPosition +empathy_call_window_get_preview_position (EmpathyCallWindow *self, gfloat event_x, - gfloat event_y, - ClutterModifierType modifiers, - EmpathyCallWindow *self) + gfloat event_y) { ClutterGeometry box; PreviewPosition pos = PREVIEW_POS_NONE; @@ -692,6 +689,21 @@ empathy_call_window_preview_on_drag_end_cb (ClutterDragAction *action, pos = PREVIEW_POS_BOTTOM_RIGHT; } + return pos; +} + +static void +empathy_call_window_preview_on_drag_end_cb (ClutterDragAction *action, + ClutterActor *actor, + gfloat event_x, + gfloat event_y, + ClutterModifierType modifiers, + EmpathyCallWindow *self) +{ + PreviewPosition pos; + + pos = empathy_call_window_get_preview_position (self, event_x, event_y); + if (pos != PREVIEW_POS_NONE) empathy_call_window_move_video_preview (self, pos); -- cgit v1.2.3 From 47f4a650200c9692f4b5e480b60f28ab309aecb4 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Tue, 9 Aug 2011 16:16:13 +0100 Subject: CallWindow: highlight drop zones when hovered https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 3ea6a3d07..5cffde99d 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -169,6 +169,10 @@ struct _EmpathyCallWindowPriv ClutterActor *video_box; ClutterLayoutManager *video_layout; + /* Coordinates of the preview drag event's start. */ + gfloat event_x; + gfloat event_y; + /* We keep a reference on the hbox which contains the main content so we can easilly repack everything when toggling fullscreen */ GtkWidget *content_hbox; @@ -639,6 +643,64 @@ empathy_call_window_move_video_preview (EmpathyCallWindow *self, } } +static void +empathy_call_window_highlight_preview_rectangle (EmpathyCallWindow *self, + PreviewPosition pos) +{ + ClutterActor *rectangle; + + switch (pos) + { + case PREVIEW_POS_TOP_LEFT: + rectangle = self->priv->preview_rectangle1; + break; + case PREVIEW_POS_TOP_RIGHT: + rectangle = self->priv->preview_rectangle3; + break; + case PREVIEW_POS_BOTTOM_LEFT: + rectangle = self->priv->preview_rectangle2; + break; + case PREVIEW_POS_BOTTOM_RIGHT: + rectangle = self->priv->preview_rectangle4; + break; + default: + g_warn_if_reached (); + rectangle = NULL; + } + + clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rectangle), 3); + clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (rectangle), + CLUTTER_COLOR_Red); +} + +static void +empathy_call_window_darken_preview_rectangles (EmpathyCallWindow *self) +{ + clutter_rectangle_set_border_width ( + CLUTTER_RECTANGLE (self->priv->preview_rectangle1), 1); + clutter_rectangle_set_border_color ( + CLUTTER_RECTANGLE (self->priv->preview_rectangle1), + CLUTTER_COLOR_Black); + + clutter_rectangle_set_border_width ( + CLUTTER_RECTANGLE (self->priv->preview_rectangle2), 1); + clutter_rectangle_set_border_color ( + CLUTTER_RECTANGLE (self->priv->preview_rectangle2), + CLUTTER_COLOR_Black); + + clutter_rectangle_set_border_width ( + CLUTTER_RECTANGLE (self->priv->preview_rectangle3), 1); + clutter_rectangle_set_border_color ( + CLUTTER_RECTANGLE (self->priv->preview_rectangle3), + CLUTTER_COLOR_Black); + + clutter_rectangle_set_border_width ( + CLUTTER_RECTANGLE (self->priv->preview_rectangle4), 1); + clutter_rectangle_set_border_color ( + CLUTTER_RECTANGLE (self->priv->preview_rectangle4), + CLUTTER_COLOR_Black); +} + static void empathy_call_window_preview_on_drag_begin_cb (ClutterDragAction *action, ClutterActor *actor, @@ -648,6 +710,9 @@ empathy_call_window_preview_on_drag_begin_cb (ClutterDragAction *action, EmpathyCallWindow *self) { empathy_call_window_show_preview_rectangles (self, TRUE); + + self->priv->event_x = event_x; + self->priv->event_y = event_y; } static PreviewPosition @@ -710,6 +775,24 @@ empathy_call_window_preview_on_drag_end_cb (ClutterDragAction *action, empathy_call_window_show_preview_rectangles (self, FALSE); } +static void +empathy_call_window_preview_on_drag_motion_cb (ClutterDragAction *action, + ClutterActor *actor, + gfloat delta_x, + gfloat delta_y, + EmpathyCallWindow *self) +{ + PreviewPosition pos; + + pos = empathy_call_window_get_preview_position (self, + self->priv->event_x - delta_x, self->priv->event_y + delta_y); + + if (pos != PREVIEW_POS_NONE) + empathy_call_window_highlight_preview_rectangle (self, pos); + else + empathy_call_window_darken_preview_rectangles (self); +} + static void create_video_preview (EmpathyCallWindow *self) { @@ -801,6 +884,8 @@ create_video_preview (EmpathyCallWindow *self) G_CALLBACK (empathy_call_window_preview_on_drag_begin_cb), self); g_signal_connect (action, "drag-end", G_CALLBACK (empathy_call_window_preview_on_drag_end_cb), self); + g_signal_connect (action, "drag-motion", + G_CALLBACK (empathy_call_window_preview_on_drag_motion_cb), self); clutter_actor_add_action (preview, action); clutter_actor_set_reactive (preview, TRUE); -- cgit v1.2.3 From 2848d12da55d0c4c9016d8f355ed9d1343e0f2e7 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Wed, 10 Aug 2011 10:13:13 +0100 Subject: Move empathy_call_window_get_preview_position around https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 84 +++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 5cffde99d..ecdd22ad9 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -604,6 +604,48 @@ empathy_call_window_show_preview_rectangles (EmpathyCallWindow *self, g_object_set (self->priv->preview_rectangle4, "visible", show, NULL); } +static PreviewPosition +empathy_call_window_get_preview_position (EmpathyCallWindow *self, + gfloat event_x, + gfloat event_y) +{ + ClutterGeometry box; + PreviewPosition pos = PREVIEW_POS_NONE; + + clutter_actor_get_geometry (self->priv->video_box, &box); + + if (0 + SELF_VIDEO_MARGIN <= event_x && + event_x <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_WIDTH) && + 0 + SELF_VIDEO_MARGIN <= event_y && + event_y <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_HEIGTH)) + { + pos = PREVIEW_POS_TOP_LEFT; + } + else if (box.width - SELF_VIDEO_MARGIN >= event_x && + event_x >= (box.width - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_WIDTH) && + 0 + SELF_VIDEO_MARGIN <= event_y && + event_y <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_HEIGTH)) + { + pos = PREVIEW_POS_TOP_RIGHT; + } + else if (0 + SELF_VIDEO_MARGIN <= event_x && + event_x <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_WIDTH) && + box.height - SELF_VIDEO_MARGIN >= event_y && + event_y >= (box.height - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_HEIGTH)) + { + pos = PREVIEW_POS_BOTTOM_LEFT; + } + else if (box.width - SELF_VIDEO_MARGIN >= event_x && + event_x >= (box.width - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_WIDTH) && + box.height - SELF_VIDEO_MARGIN >= event_y && + event_y >= (box.height - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_HEIGTH)) + { + pos = PREVIEW_POS_BOTTOM_RIGHT; + } + + return pos; +} + static void empathy_call_window_move_video_preview (EmpathyCallWindow *self, PreviewPosition pos) @@ -715,48 +757,6 @@ empathy_call_window_preview_on_drag_begin_cb (ClutterDragAction *action, self->priv->event_y = event_y; } -static PreviewPosition -empathy_call_window_get_preview_position (EmpathyCallWindow *self, - gfloat event_x, - gfloat event_y) -{ - ClutterGeometry box; - PreviewPosition pos = PREVIEW_POS_NONE; - - clutter_actor_get_geometry (self->priv->video_box, &box); - - if (0 + SELF_VIDEO_MARGIN <= event_x && - event_x <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_WIDTH) && - 0 + SELF_VIDEO_MARGIN <= event_y && - event_y <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_HEIGTH)) - { - pos = PREVIEW_POS_TOP_LEFT; - } - else if (box.width - SELF_VIDEO_MARGIN >= event_x && - event_x >= (box.width - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_WIDTH) && - 0 + SELF_VIDEO_MARGIN <= event_y && - event_y <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_HEIGTH)) - { - pos = PREVIEW_POS_TOP_RIGHT; - } - else if (0 + SELF_VIDEO_MARGIN <= event_x && - event_x <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_WIDTH) && - box.height - SELF_VIDEO_MARGIN >= event_y && - event_y >= (box.height - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_HEIGTH)) - { - pos = PREVIEW_POS_BOTTOM_LEFT; - } - else if (box.width - SELF_VIDEO_MARGIN >= event_x && - event_x >= (box.width - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_WIDTH) && - box.height - SELF_VIDEO_MARGIN >= event_y && - event_y >= (box.height - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_HEIGTH)) - { - pos = PREVIEW_POS_BOTTOM_RIGHT; - } - - return pos; -} - static void empathy_call_window_preview_on_drag_end_cb (ClutterDragAction *action, ClutterActor *actor, -- cgit v1.2.3 From 30d64de5341a8701ddfd3be24071846de82e121f Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Wed, 10 Aug 2011 10:14:25 +0100 Subject: Factor out empathy_call_window_get_preview_rectangle https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index ecdd22ad9..c8dc182fb 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -646,6 +646,33 @@ empathy_call_window_get_preview_position (EmpathyCallWindow *self, return pos; } +static ClutterActor * +empathy_call_window_get_preview_rectangle (EmpathyCallWindow *self, + PreviewPosition pos) +{ + ClutterActor *rectangle; + + switch (pos) + { + case PREVIEW_POS_TOP_LEFT: + rectangle = self->priv->preview_rectangle1; + break; + case PREVIEW_POS_TOP_RIGHT: + rectangle = self->priv->preview_rectangle3; + break; + case PREVIEW_POS_BOTTOM_LEFT: + rectangle = self->priv->preview_rectangle2; + break; + case PREVIEW_POS_BOTTOM_RIGHT: + rectangle = self->priv->preview_rectangle4; + break; + default: + rectangle = NULL; + } + + return rectangle; +} + static void empathy_call_window_move_video_preview (EmpathyCallWindow *self, PreviewPosition pos) @@ -691,24 +718,7 @@ empathy_call_window_highlight_preview_rectangle (EmpathyCallWindow *self, { ClutterActor *rectangle; - switch (pos) - { - case PREVIEW_POS_TOP_LEFT: - rectangle = self->priv->preview_rectangle1; - break; - case PREVIEW_POS_TOP_RIGHT: - rectangle = self->priv->preview_rectangle3; - break; - case PREVIEW_POS_BOTTOM_LEFT: - rectangle = self->priv->preview_rectangle2; - break; - case PREVIEW_POS_BOTTOM_RIGHT: - rectangle = self->priv->preview_rectangle4; - break; - default: - g_warn_if_reached (); - rectangle = NULL; - } + rectangle = empathy_call_window_get_preview_rectangle (self, pos); clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rectangle), 3); clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (rectangle), -- cgit v1.2.3 From c0a10ef3094f82a9d0532e942b0b27d7f34f0201 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Wed, 10 Aug 2011 10:16:40 +0100 Subject: Factor out empathy_call_window_darken_preview_rectangle https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index c8dc182fb..feb16a398 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -726,31 +726,28 @@ empathy_call_window_highlight_preview_rectangle (EmpathyCallWindow *self, } static void -empathy_call_window_darken_preview_rectangles (EmpathyCallWindow *self) +empathy_call_window_darken_preview_rectangle (EmpathyCallWindow *self, + ClutterActor *rectangle) { - clutter_rectangle_set_border_width ( - CLUTTER_RECTANGLE (self->priv->preview_rectangle1), 1); - clutter_rectangle_set_border_color ( - CLUTTER_RECTANGLE (self->priv->preview_rectangle1), + clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rectangle), 1); + clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (rectangle), CLUTTER_COLOR_Black); +} - clutter_rectangle_set_border_width ( - CLUTTER_RECTANGLE (self->priv->preview_rectangle2), 1); - clutter_rectangle_set_border_color ( - CLUTTER_RECTANGLE (self->priv->preview_rectangle2), - CLUTTER_COLOR_Black); +static void +empathy_call_window_darken_preview_rectangles (EmpathyCallWindow *self) +{ + empathy_call_window_darken_preview_rectangle (self, + self->priv->preview_rectangle1); - clutter_rectangle_set_border_width ( - CLUTTER_RECTANGLE (self->priv->preview_rectangle3), 1); - clutter_rectangle_set_border_color ( - CLUTTER_RECTANGLE (self->priv->preview_rectangle3), - CLUTTER_COLOR_Black); + empathy_call_window_darken_preview_rectangle (self, + self->priv->preview_rectangle2); - clutter_rectangle_set_border_width ( - CLUTTER_RECTANGLE (self->priv->preview_rectangle4), 1); - clutter_rectangle_set_border_color ( - CLUTTER_RECTANGLE (self->priv->preview_rectangle4), - CLUTTER_COLOR_Black); + empathy_call_window_darken_preview_rectangle (self, + self->priv->preview_rectangle3); + + empathy_call_window_darken_preview_rectangle (self, + self->priv->preview_rectangle4); } static void -- cgit v1.2.3 From ca2cb730d68620a638ef41d09cd25984e6cb4008 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Wed, 10 Aug 2011 10:27:10 +0100 Subject: Highlight the preview when hovered https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index feb16a398..78ff5cb57 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -565,7 +565,7 @@ empathy_call_window_create_preview_rectangle (EmpathyCallWindow *self, SELF_VIDEO_SECTION_HEIGTH + 2 * SELF_VIDEO_MARGIN); clutter_actor_set_size (rectangle, - SELF_VIDEO_SECTION_WIDTH, SELF_VIDEO_SECTION_HEIGTH); + SELF_VIDEO_SECTION_WIDTH + 5, SELF_VIDEO_SECTION_HEIGTH + 5); clutter_container_add_actor (CLUTTER_CONTAINER (box), rectangle); @@ -800,6 +800,42 @@ empathy_call_window_preview_on_drag_motion_cb (ClutterDragAction *action, empathy_call_window_darken_preview_rectangles (self); } +static gboolean +empathy_call_window_preview_enter_event_cb (ClutterActor *actor, + ClutterCrossingEvent *event, + EmpathyCallWindow *self) +{ + ClutterActor *rectangle; + PreviewPosition pos; + + pos = empathy_call_window_get_preview_position (self, event->x, event->y); + rectangle = empathy_call_window_get_preview_rectangle (self, pos); + + empathy_call_window_highlight_preview_rectangle (self, pos); + + clutter_actor_show (rectangle); + + return FALSE; +} + +static gboolean +empathy_call_window_preview_leave_event_cb (ClutterActor *actor, + ClutterCrossingEvent *event, + EmpathyCallWindow *self) +{ + ClutterActor *rectangle; + PreviewPosition pos; + + pos = empathy_call_window_get_preview_position (self, event->x, event->y); + rectangle = empathy_call_window_get_preview_rectangle (self, pos); + + empathy_call_window_darken_preview_rectangle (self, rectangle); + + clutter_actor_hide (rectangle); + + return FALSE; +} + static void create_video_preview (EmpathyCallWindow *self) { @@ -894,6 +930,11 @@ create_video_preview (EmpathyCallWindow *self) g_signal_connect (action, "drag-motion", G_CALLBACK (empathy_call_window_preview_on_drag_motion_cb), self); + g_signal_connect (preview, "enter-event", + G_CALLBACK (empathy_call_window_preview_enter_event_cb), self); + g_signal_connect (preview, "leave-event", + G_CALLBACK (empathy_call_window_preview_leave_event_cb), self); + clutter_actor_add_action (preview, action); clutter_actor_set_reactive (preview, TRUE); } -- cgit v1.2.3 From 724eac592d90da4e169adb7b675845650d9d770b Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Wed, 10 Aug 2011 10:32:09 +0100 Subject: Don't darken the preview when dragging it https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 78ff5cb57..5e15fba70 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -170,6 +170,7 @@ struct _EmpathyCallWindowPriv ClutterLayoutManager *video_layout; /* Coordinates of the preview drag event's start. */ + PreviewPosition preview_pos; gfloat event_x; gfloat event_y; @@ -681,6 +682,8 @@ empathy_call_window_move_video_preview (EmpathyCallWindow *self, DEBUG ("moving the video preview to %d", pos); + self->priv->preview_pos = pos; + switch (pos) { case PREVIEW_POS_TOP_LEFT: @@ -737,17 +740,29 @@ empathy_call_window_darken_preview_rectangle (EmpathyCallWindow *self, static void empathy_call_window_darken_preview_rectangles (EmpathyCallWindow *self) { - empathy_call_window_darken_preview_rectangle (self, - self->priv->preview_rectangle1); + ClutterActor *rectangle; + + rectangle = empathy_call_window_get_preview_rectangle (self, + self->priv->preview_pos); - empathy_call_window_darken_preview_rectangle (self, - self->priv->preview_rectangle2); + /* We don't want to darken the rectangle where the preview + * currently is. */ - empathy_call_window_darken_preview_rectangle (self, - self->priv->preview_rectangle3); + if (self->priv->preview_rectangle1 != rectangle) + empathy_call_window_darken_preview_rectangle (self, + self->priv->preview_rectangle1); - empathy_call_window_darken_preview_rectangle (self, - self->priv->preview_rectangle4); + if (self->priv->preview_rectangle2 != rectangle) + empathy_call_window_darken_preview_rectangle (self, + self->priv->preview_rectangle2); + + if (self->priv->preview_rectangle3 != rectangle) + empathy_call_window_darken_preview_rectangle (self, + self->priv->preview_rectangle3); + + if (self->priv->preview_rectangle4 != rectangle) + empathy_call_window_darken_preview_rectangle (self, + self->priv->preview_rectangle4); } static void @@ -911,6 +926,8 @@ create_video_preview (EmpathyCallWindow *self) CLUTTER_BIN_ALIGNMENT_START, CLUTTER_BIN_ALIGNMENT_END); + self->priv->preview_pos = PREVIEW_POS_BOTTOM_LEFT; + clutter_actor_hide (priv->preview_hidden_button); g_signal_connect (button, "clicked", -- cgit v1.2.3 From 4966277ef79ce962260764ed32408b5c1c73ddb9 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Wed, 10 Aug 2011 10:37:46 +0100 Subject: Darken the rectangles when starting a drag operation So that if we have just dragged it, the rectangle where it was before isn't highlighted. https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 5e15fba70..7f7ee8cd2 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -774,6 +774,7 @@ empathy_call_window_preview_on_drag_begin_cb (ClutterDragAction *action, EmpathyCallWindow *self) { empathy_call_window_show_preview_rectangles (self, TRUE); + empathy_call_window_darken_preview_rectangles (self); self->priv->event_x = event_x; self->priv->event_y = event_y; -- cgit v1.2.3 From f0eb3e344d09a63de219f71df85cbc2c8135cbd8 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Wed, 10 Aug 2011 11:10:14 +0100 Subject: Use self->priv->preview_pos to determine the preview position https://bugzilla.gnome.org/show_bug.cgi?id=656268 --- src/empathy-call-window.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 7f7ee8cd2..6fc9cf8e1 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -840,10 +840,9 @@ empathy_call_window_preview_leave_event_cb (ClutterActor *actor, EmpathyCallWindow *self) { ClutterActor *rectangle; - PreviewPosition pos; - pos = empathy_call_window_get_preview_position (self, event->x, event->y); - rectangle = empathy_call_window_get_preview_rectangle (self, pos); + rectangle = empathy_call_window_get_preview_rectangle (self, + self->priv->preview_pos); empathy_call_window_darken_preview_rectangle (self, rectangle); -- cgit v1.2.3 From 5e685d03af4b3f278236c27420a12302ea76e736 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Fri, 12 Aug 2011 16:34:28 +0100 Subject: empathy-call: add COGL and Clutter option groups --- src/empathy-call.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/empathy-call.c b/src/empathy-call.c index 4adf5f48d..1305645d5 100644 --- a/src/empathy-call.c +++ b/src/empathy-call.c @@ -127,6 +127,10 @@ main (int argc, optcontext = g_option_context_new (N_("- Empathy Audio/Video Client")); g_option_context_add_group (optcontext, gst_init_get_option_group ()); g_option_context_add_group (optcontext, gtk_get_option_group (TRUE)); + g_option_context_add_group (optcontext, cogl_get_option_group ()); + g_option_context_add_group (optcontext, + clutter_get_option_group_without_init ()); + g_option_context_add_group (optcontext, gtk_clutter_get_option_group ()); g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE); if (!g_option_context_parse (optcontext, &argc, &argv, &error)) { -- cgit v1.2.3 From 253837eb32f9fb2ab2b6cd8e60fb8880d04ba016 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Fri, 12 Aug 2011 16:51:45 +0100 Subject: CallWindow: create the rectangles after the avatar As we want them to be on top of the avatar when they're shown. --- src/empathy-call-window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 6fc9cf8e1..e8f5e092c 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -1296,8 +1296,6 @@ empathy_call_window_init (EmpathyCallWindow *self) priv->video_box = clutter_box_new (priv->video_layout); - empathy_call_window_create_preview_rectangles (self); - priv->video_container = gtk_clutter_embed_new (); /* Set the background color to that of the rest of the window */ @@ -1331,6 +1329,8 @@ empathy_call_window_init (EmpathyCallWindow *self) clutter_container_add_actor (CLUTTER_CONTAINER (priv->video_box), remote_avatar); + empathy_call_window_create_preview_rectangles (self); + gtk_box_pack_start (GTK_BOX (priv->content_hbox), priv->video_container, TRUE, TRUE, CONTENT_HBOX_CHILDREN_PACKING_PADDING); -- cgit v1.2.3 From f682f5076d65a3cc582493d340f409153503f9fe Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Mon, 15 Aug 2011 12:56:45 +0100 Subject: CallWindow: add extra bottom margin for the floating toolbar Otherwise the rectangles will be on top of the toolbar. --- src/empathy-call-window.c | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index e8f5e092c..aabe7c922 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -546,14 +546,14 @@ empathy_call_window_create_preview_rectangle (EmpathyCallWindow *self, ClutterBinAlignment x, ClutterBinAlignment y) { - ClutterLayoutManager *layout; + ClutterLayoutManager *layout1, *layout2; ClutterActor *rectangle; - ClutterActor *box; + ClutterActor *box1, *box2; - layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, - CLUTTER_BIN_ALIGNMENT_CENTER); + layout1 = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, + CLUTTER_BIN_ALIGNMENT_START); - box = clutter_box_new (layout); + box1 = clutter_box_new (layout1); rectangle = clutter_rectangle_new_with_color ( CLUTTER_COLOR_Transparent); @@ -561,17 +561,31 @@ empathy_call_window_create_preview_rectangle (EmpathyCallWindow *self, clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rectangle), 1); - clutter_actor_set_size (box, + clutter_actor_set_size (box1, + SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_MARGIN, + SELF_VIDEO_SECTION_HEIGTH + 2 * SELF_VIDEO_MARGIN + + FLOATING_TOOLBAR_HEIGHT + FLOATING_TOOLBAR_SPACING); + + layout2 = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, + CLUTTER_BIN_ALIGNMENT_CENTER); + + /* We have a box with the margins and the video in the middle inside + * a bigger box with an extra bottom margin so we're not on top of + * the floating toolbar. */ + box2 = clutter_box_new (layout2); + + clutter_actor_set_size (box2, SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_MARGIN, SELF_VIDEO_SECTION_HEIGTH + 2 * SELF_VIDEO_MARGIN); clutter_actor_set_size (rectangle, SELF_VIDEO_SECTION_WIDTH + 5, SELF_VIDEO_SECTION_HEIGTH + 5); - clutter_container_add_actor (CLUTTER_CONTAINER (box), rectangle); + clutter_container_add_actor (CLUTTER_CONTAINER (box1), box2); + clutter_container_add_actor (CLUTTER_CONTAINER (box2), rectangle); clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (self->priv->video_layout), - box, x, y); + box1, x, y); clutter_actor_hide (rectangle); @@ -631,15 +645,15 @@ empathy_call_window_get_preview_position (EmpathyCallWindow *self, } else if (0 + SELF_VIDEO_MARGIN <= event_x && event_x <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_WIDTH) && - box.height - SELF_VIDEO_MARGIN >= event_y && - event_y >= (box.height - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_HEIGTH)) + box.height - SELF_VIDEO_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING >= event_y && + event_y >= (box.height - SELF_VIDEO_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING - (gint) SELF_VIDEO_SECTION_HEIGTH)) { pos = PREVIEW_POS_BOTTOM_LEFT; } else if (box.width - SELF_VIDEO_MARGIN >= event_x && event_x >= (box.width - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_WIDTH) && - box.height - SELF_VIDEO_MARGIN >= event_y && - event_y >= (box.height - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_HEIGTH)) + box.height - SELF_VIDEO_MARGIN - SELF_VIDEO_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING >= event_y && + event_y >= (box.height - SELF_VIDEO_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING - (gint) SELF_VIDEO_SECTION_HEIGTH)) { pos = PREVIEW_POS_BOTTOM_RIGHT; } @@ -880,18 +894,22 @@ create_video_preview (EmpathyCallWindow *self) /* Add a little offset to the video preview */ layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, - CLUTTER_BIN_ALIGNMENT_CENTER); + CLUTTER_BIN_ALIGNMENT_START); priv->video_preview = clutter_box_new (layout); clutter_actor_set_size (priv->video_preview, SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_SECTION_MARGIN, SELF_VIDEO_SECTION_HEIGTH + 2 * SELF_VIDEO_SECTION_MARGIN + FLOATING_TOOLBAR_HEIGHT + FLOATING_TOOLBAR_SPACING); + /* We have a box with the margins and the video in the middle inside + * a bigger box with an extra bottom margin so we're not on top of + * the floating toolbar. */ layout_center = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_CENTER); box = clutter_box_new (layout_center); clutter_actor_set_size (box, - SELF_VIDEO_SECTION_WIDTH, SELF_VIDEO_SECTION_HEIGTH); + SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_SECTION_MARGIN, + SELF_VIDEO_SECTION_HEIGTH + 2 * SELF_VIDEO_SECTION_MARGIN); clutter_container_add_actor (CLUTTER_CONTAINER (box), preview); clutter_container_add_actor (CLUTTER_CONTAINER (priv->video_preview), box); -- cgit v1.2.3 From aeb15b72319f26a86ab30236013a11e6a611e05c Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Mon, 15 Aug 2011 12:58:48 +0100 Subject: Don't define the same thing twice --- src/empathy-call-window.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index aabe7c922..361e0235f 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -79,8 +79,6 @@ #define FLOATING_TOOLBAR_HEIGHT 36 #define FLOATING_TOOLBAR_SPACING 20 -#define SELF_VIDEO_MARGIN 10 - /* The avatar's default width and height are set to the same value because we want a square icon. */ #define REMOTE_CONTACT_AVATAR_DEFAULT_WIDTH EMPATHY_VIDEO_WIDGET_DEFAULT_HEIGHT @@ -562,8 +560,8 @@ empathy_call_window_create_preview_rectangle (EmpathyCallWindow *self, 1); clutter_actor_set_size (box1, - SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_MARGIN, - SELF_VIDEO_SECTION_HEIGTH + 2 * SELF_VIDEO_MARGIN + + SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_SECTION_MARGIN, + SELF_VIDEO_SECTION_HEIGTH + 2 * SELF_VIDEO_SECTION_MARGIN + FLOATING_TOOLBAR_HEIGHT + FLOATING_TOOLBAR_SPACING); layout2 = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, @@ -575,8 +573,8 @@ empathy_call_window_create_preview_rectangle (EmpathyCallWindow *self, box2 = clutter_box_new (layout2); clutter_actor_set_size (box2, - SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_MARGIN, - SELF_VIDEO_SECTION_HEIGTH + 2 * SELF_VIDEO_MARGIN); + SELF_VIDEO_SECTION_WIDTH + 2 * SELF_VIDEO_SECTION_MARGIN, + SELF_VIDEO_SECTION_HEIGTH + 2 * SELF_VIDEO_SECTION_MARGIN); clutter_actor_set_size (rectangle, SELF_VIDEO_SECTION_WIDTH + 5, SELF_VIDEO_SECTION_HEIGTH + 5); @@ -629,31 +627,31 @@ empathy_call_window_get_preview_position (EmpathyCallWindow *self, clutter_actor_get_geometry (self->priv->video_box, &box); - if (0 + SELF_VIDEO_MARGIN <= event_x && - event_x <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_WIDTH) && - 0 + SELF_VIDEO_MARGIN <= event_y && - event_y <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_HEIGTH)) + if (0 + SELF_VIDEO_SECTION_MARGIN <= event_x && + event_x <= (0 + SELF_VIDEO_SECTION_MARGIN + (gint) SELF_VIDEO_SECTION_WIDTH) && + 0 + SELF_VIDEO_SECTION_MARGIN <= event_y && + event_y <= (0 + SELF_VIDEO_SECTION_MARGIN + (gint) SELF_VIDEO_SECTION_HEIGTH)) { pos = PREVIEW_POS_TOP_LEFT; } - else if (box.width - SELF_VIDEO_MARGIN >= event_x && - event_x >= (box.width - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_WIDTH) && - 0 + SELF_VIDEO_MARGIN <= event_y && - event_y <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_HEIGTH)) + else if (box.width - SELF_VIDEO_SECTION_MARGIN >= event_x && + event_x >= (box.width - SELF_VIDEO_SECTION_MARGIN - (gint) SELF_VIDEO_SECTION_WIDTH) && + 0 + SELF_VIDEO_SECTION_MARGIN <= event_y && + event_y <= (0 + SELF_VIDEO_SECTION_MARGIN + (gint) SELF_VIDEO_SECTION_HEIGTH)) { pos = PREVIEW_POS_TOP_RIGHT; } - else if (0 + SELF_VIDEO_MARGIN <= event_x && - event_x <= (0 + SELF_VIDEO_MARGIN + (gint) SELF_VIDEO_SECTION_WIDTH) && - box.height - SELF_VIDEO_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING >= event_y && - event_y >= (box.height - SELF_VIDEO_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING - (gint) SELF_VIDEO_SECTION_HEIGTH)) + else if (0 + SELF_VIDEO_SECTION_MARGIN <= event_x && + event_x <= (0 + SELF_VIDEO_SECTION_MARGIN + (gint) SELF_VIDEO_SECTION_WIDTH) && + box.height - 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_HEIGTH)) { pos = PREVIEW_POS_BOTTOM_LEFT; } - else if (box.width - SELF_VIDEO_MARGIN >= event_x && - event_x >= (box.width - SELF_VIDEO_MARGIN - (gint) SELF_VIDEO_SECTION_WIDTH) && - box.height - SELF_VIDEO_MARGIN - SELF_VIDEO_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING >= event_y && - event_y >= (box.height - SELF_VIDEO_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING - (gint) SELF_VIDEO_SECTION_HEIGTH)) + 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 && + event_y >= (box.height - SELF_VIDEO_SECTION_MARGIN - FLOATING_TOOLBAR_HEIGHT - FLOATING_TOOLBAR_SPACING - (gint) SELF_VIDEO_SECTION_HEIGTH)) { pos = PREVIEW_POS_BOTTOM_RIGHT; } -- cgit v1.2.3