From c6f40ce1aee9a37c0fd3d3a5f750dae16a046823 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Fri, 21 Sep 2018 15:05:43 +0900 Subject: [PATCH] els_tooltip: Fix to show correct arrow type Summary: Current calculation for arrow type is not based on mouse position. Consequently, tooltip arrow type is incorrect when tooltip shows on mouse position with ELM_TOOLTIP_ORIENT_NONE. Test Plan: 1. Execute "Tooltip" in elementary_test 2. Hover mouse on any button and move mouse Reviewers: Hermet, raster, woohyun Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7074 --- src/lib/elementary/els_tooltip.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/lib/elementary/els_tooltip.c b/src/lib/elementary/els_tooltip.c index 3603221b4e..4ffcf79e6d 100644 --- a/src/lib/elementary/els_tooltip.c +++ b/src/lib/elementary/els_tooltip.c @@ -654,12 +654,18 @@ _elm_tooltip_reconfigure(Elm_Tooltip *tt) if ((py + cy) > (ch / 2)) ty = cy + py - 1 - th; else ty = cy + py + 1; } - if (ow > 1) rel_x = (double)((ox + (ow / 2)) - ((tx - cx) + (tw / 2))) / - (double)(ow / 2); - else rel_x = 0.0; - if (oh > 1) rel_y = (double)((oy + (oh / 2)) - ((ty - cy) + (th / 2))) / - (double)(oh / 2); - else rel_y = 0.0; + + if (inside_eventarea) + { + rel_x = (px - (tx - cx)) / (double)tw; + rel_y = (py - (ty - cy)) / (double)th; + } + else + { + rel_x = (ox + (ow / 2) - (tx - cx)) / (double)tw; + rel_y = (oy + (oh / 2) - (ty - cy)) / (double)th; + } + tx += basex; ty += basey; // XXX: if this is a window for toolkit this relies on abs positioning