diff options
Diffstat (limited to 'src/lib/elementary')
-rw-r--r-- | src/lib/elementary/els_tooltip.c | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/src/lib/elementary/els_tooltip.c b/src/lib/elementary/els_tooltip.c index 4357336359..89febf6647 100644 --- a/src/lib/elementary/els_tooltip.c +++ b/src/lib/elementary/els_tooltip.c | |||
@@ -284,6 +284,9 @@ _elm_tooltip_reconfigure_orient(Elm_Tooltip *tt, | |||
284 | Evas_Coord tw, Evas_Coord th, Evas_Coord cw, Evas_Coord ch) | 284 | Evas_Coord tw, Evas_Coord th, Evas_Coord cw, Evas_Coord ch) |
285 | { | 285 | { |
286 | Evas_Coord mx, my; | 286 | Evas_Coord mx, my; |
287 | Evas_Coord dx, dy; | ||
288 | Evas_Coord tcw, tch; | ||
289 | Evas_Coord px, py; | ||
287 | 290 | ||
288 | switch (tt->orient) | 291 | switch (tt->orient) |
289 | { | 292 | { |
@@ -345,11 +348,54 @@ _elm_tooltip_reconfigure_orient(Elm_Tooltip *tt, | |||
345 | return; | 348 | return; |
346 | } | 349 | } |
347 | 350 | ||
348 | if (mx < 0) mx = 0; | 351 | evas_object_geometry_get(tt->content, NULL, NULL, &tcw, &tch); |
349 | else if (mx + tw > cw) mx = cw - tw; | 352 | if (tcw <= 0 || tcw > tw) tcw = tw; |
353 | if (tch <= 0 || tch > th) tch = th; | ||
350 | 354 | ||
351 | if (my < 0) my = 0; | 355 | px = (tw - tcw) / 2; |
352 | else if (my + th > ch) my = ch - th; | 356 | py = (th - tch) / 2; |
357 | |||
358 | if (mx < 0) | ||
359 | { | ||
360 | dx = -mx; | ||
361 | mx = -(px / 2); | ||
362 | if (tt->rel_pos.x == 0.5) | ||
363 | { | ||
364 | tt->rel_pos.x = 0.5 - dx / (double)tcw; | ||
365 | if (tt->rel_pos.x < 0.0) tt->rel_pos.x = 0.0; | ||
366 | } | ||
367 | } | ||
368 | else if (mx + tw > cw) | ||
369 | { | ||
370 | dx = mx + tw - cw; | ||
371 | mx = cw - tw + px / 2; | ||
372 | if (tt->rel_pos.x == 0.5) | ||
373 | { | ||
374 | tt->rel_pos.x = 0.5 + dx / (double)tcw; | ||
375 | if (tt->rel_pos.x > 1.0) tt->rel_pos.x = 1.0; | ||
376 | } | ||
377 | } | ||
378 | |||
379 | if (my < 0) | ||
380 | { | ||
381 | dy = -my; | ||
382 | my = -(py / 2); | ||
383 | if (tt->rel_pos.y == 0.5) | ||
384 | { | ||
385 | tt->rel_pos.y = 0.5 - dy / (double)tch; | ||
386 | if (tt->rel_pos.y < 0.0) tt->rel_pos.y = 0.0; | ||
387 | } | ||
388 | } | ||
389 | else if (my + th > ch) | ||
390 | { | ||
391 | dy = my + th - ch; | ||
392 | my = ch - th + py / 2; | ||
393 | if (tt->rel_pos.y == 0.5) | ||
394 | { | ||
395 | tt->rel_pos.y = 0.5 + dy / (double)tch; | ||
396 | if (tt->rel_pos.y > 1.0) tt->rel_pos.y = 1.0; | ||
397 | } | ||
398 | } | ||
353 | 399 | ||
354 | evas_object_move(tt->tooltip, mx, my); | 400 | evas_object_move(tt->tooltip, mx, my); |
355 | evas_object_show(tt->tooltip); | 401 | evas_object_show(tt->tooltip); |