summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2013-08-26 16:16:21 +0200
committerBoris Faure <billiob@gmail.com>2013-08-26 16:16:21 +0200
commitec577e396c1e81d22a8e8cf06cfc09e8e39c09a7 (patch)
tree2f3e5c51a2a528482c2cdae8ffee25c2e5d392d1
parent373e878595c82685e58b2e5b91e4cf11a85bea21 (diff)
remove links on mouse out/focus out. Closes T299
-rw-r--r--src/bin/termio.c72
1 files changed, 43 insertions, 29 deletions
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 8b8d2d3..60512bf 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -434,10 +434,9 @@ _cb_link_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event)
434} 434}
435 435
436static void 436static void
437_update_link(Evas_Object *obj, Eina_Bool same_link, Eina_Bool same_geom) 437_update_link(Evas_Object *obj, Termio *sd,
438 Eina_Bool same_link, Eina_Bool same_geom)
438{ 439{
439 Termio *sd = evas_object_smart_data_get(obj);
440
441 if (!sd) return; 440 if (!sd) return;
442 441
443 if (!same_link) 442 if (!same_link)
@@ -527,6 +526,36 @@ _update_link(Evas_Object *obj, Eina_Bool same_link, Eina_Bool same_geom)
527} 526}
528 527
529static void 528static void
529_remove_links(Termio *sd, Evas_Object *obj)
530{
531 Eina_Bool same_link = EINA_FALSE, same_geom = EINA_FALSE;
532
533 if (sd->link.string)
534 {
535 if ((sd->link.string[0] == '/') || (link_is_url(sd->link.string)))
536 {
537 Evas_Coord ox, oy;
538 Ecore_Window xwin;
539
540 evas_object_geometry_get(obj, &ox, &oy, NULL, NULL);
541
542 ox += sd->mouse.cx * sd->font.chw;
543 oy += sd->mouse.cy * sd->font.chh;
544 xwin = elm_win_xwindow_get(sd->win);
545 ty_dbus_link_mouseout(xwin, sd->link.string, ox, oy);
546 }
547 free(sd->link.string);
548 sd->link.string = NULL;
549 }
550 sd->link.x1 = -1;
551 sd->link.y1 = -1;
552 sd->link.x2 = -1;
553 sd->link.y2 = -1;
554 sd->link.suspend = EINA_FALSE;
555 _update_link(obj, sd, same_link, same_geom);
556}
557
558static void
530_smart_mouseover_apply(Evas_Object *obj) 559_smart_mouseover_apply(Evas_Object *obj)
531{ 560{
532 char *s; 561 char *s;
@@ -534,34 +563,13 @@ _smart_mouseover_apply(Evas_Object *obj)
534 Eina_Bool same_link = EINA_FALSE, same_geom = EINA_FALSE; 563 Eina_Bool same_link = EINA_FALSE, same_geom = EINA_FALSE;
535 Termio *sd = evas_object_smart_data_get(obj); 564 Termio *sd = evas_object_smart_data_get(obj);
536 565
537 if (!sd) return; 566 if (!sd || (sd->mouse.cx < 0) || (sd->mouse.cy < 0)) return;
538 567
539 s = _termio_link_find(obj, sd->mouse.cx, sd->mouse.cy, 568 s = _termio_link_find(obj, sd->mouse.cx, sd->mouse.cy,
540 &x1, &y1, &x2, &y2); 569 &x1, &y1, &x2, &y2);
541 if (!s) 570 if (!s)
542 { 571 {
543 if (sd->link.string) 572 _remove_links(sd, obj);
544 {
545 if ((sd->link.string[0] == '/') || (link_is_url(sd->link.string)))
546 {
547 Evas_Coord ox, oy;
548 Ecore_Window xwin;
549
550 evas_object_geometry_get(obj, &ox, &oy, NULL, NULL);
551
552 ox += sd->mouse.cx * sd->font.chw;
553 oy += sd->mouse.cy * sd->font.chh;
554 xwin = elm_win_xwindow_get(sd->win);
555 ty_dbus_link_mouseout(xwin, sd->link.string, ox, oy);
556 }
557 free(sd->link.string);
558 sd->link.string = NULL;
559 }
560 sd->link.x1 = -1;
561 sd->link.y1 = -1;
562 sd->link.x2 = -1;
563 sd->link.y2 = -1;
564 _update_link(obj, same_link, same_geom);
565 return; 573 return;
566 } 574 }
567 575
@@ -580,7 +588,7 @@ _smart_mouseover_apply(Evas_Object *obj)
580 sd->link.y1 = y1; 588 sd->link.y1 = y1;
581 sd->link.x2 = x2; 589 sd->link.x2 = x2;
582 sd->link.y2 = y2; 590 sd->link.y2 = y2;
583 _update_link(obj, same_link, same_geom); 591 _update_link(obj, sd, same_link, same_geom);
584} 592}
585 593
586static Eina_Bool 594static Eina_Bool
@@ -2197,7 +2205,8 @@ _smart_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
2197} 2205}
2198 2206
2199void 2207void
2200_smart_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 2208_smart_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj,
2209 void *event __UNUSED__)
2201{ 2210{
2202 Termio *sd; 2211 Termio *sd;
2203 2212
@@ -2213,6 +2222,7 @@ _smart_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
2213 ecore_imf_context_focus_out(sd->imf); 2222 ecore_imf_context_focus_out(sd->imf);
2214 ecore_imf_context_input_panel_hide(sd->imf); 2223 ecore_imf_context_input_panel_hide(sd->imf);
2215 } 2224 }
2225 _remove_links(sd, obj);
2216} 2226}
2217 2227
2218static void 2228static void
@@ -3057,7 +3067,8 @@ _smart_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
3057} 3067}
3058 3068
3059static void 3069static void
3060_smart_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 3070_smart_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj,
3071 void *event __UNUSED__)
3061{ 3072{
3062 Termio *sd; 3073 Termio *sd;
3063 3074
@@ -3065,6 +3076,9 @@ _smart_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
3065 if (!sd) return; 3076 if (!sd) return;
3066 termio_mouseover_suspend_pushpop(data, 1); 3077 termio_mouseover_suspend_pushpop(data, 1);
3067 ty_dbus_link_hide(); 3078 ty_dbus_link_hide();
3079 sd->mouse.cx = -1;
3080 sd->mouse.cy = -1;
3081 _remove_links(sd, obj);
3068} 3082}
3069 3083
3070static void 3084static void