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/empathy-call-window.c') 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