change dbus link_detect to mousein/out
This commit is contained in:
parent
f1c3bf52ca
commit
6d8c81050e
|
@ -6,26 +6,78 @@
|
|||
|
||||
static Eldbus_Connection *ty_dbus_conn = NULL;
|
||||
static Eldbus_Object *ty_e_object = NULL;
|
||||
static Eina_Stringshare *_current_url = NULL;
|
||||
|
||||
void
|
||||
ty_dbus_link_detect(const char *url)
|
||||
_cleanup_current_url(void)
|
||||
{
|
||||
Eldbus_Message *msg;
|
||||
|
||||
if ((!ty_e_object) || (!_current_url)) return;
|
||||
|
||||
msg = eldbus_message_method_call_new("org.enlightenment.wm.service",
|
||||
"/org/enlightenment/wm/RemoteObject",
|
||||
"org.enlightenment.wm.Teamwork",
|
||||
"LinkDetect");
|
||||
"LinkMouseOut");
|
||||
|
||||
eldbus_message_arguments_append(msg, "s", _current_url);
|
||||
eldbus_object_send(ty_e_object, msg, NULL, NULL, -1);
|
||||
|
||||
eina_stringshare_del(_current_url);
|
||||
_current_url = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ty_dbus_link_mouseout(const char *url)
|
||||
{
|
||||
Eldbus_Message *msg;
|
||||
|
||||
if (!ty_e_object) return;
|
||||
|
||||
if ((!url) ||
|
||||
((_current_url) && (!strcmp(url, _current_url))))
|
||||
{
|
||||
_cleanup_current_url();
|
||||
return;
|
||||
}
|
||||
|
||||
_cleanup_current_url();
|
||||
|
||||
msg = eldbus_message_method_call_new("org.enlightenment.wm.service",
|
||||
"/org/enlightenment/wm/RemoteObject",
|
||||
"org.enlightenment.wm.Teamwork",
|
||||
"LinkMouseOut");
|
||||
|
||||
eldbus_message_arguments_append(msg, "s", url);
|
||||
eldbus_object_send(ty_e_object, msg, NULL, NULL, -1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ty_dbus_link_mousein(const char *url)
|
||||
{
|
||||
Eldbus_Message *msg;
|
||||
|
||||
if (!ty_e_object) return;
|
||||
|
||||
if ((_current_url) && (!strcmp(url, _current_url))) return;
|
||||
|
||||
msg = eldbus_message_method_call_new("org.enlightenment.wm.service",
|
||||
"/org/enlightenment/wm/RemoteObject",
|
||||
"org.enlightenment.wm.Teamwork",
|
||||
"LinkMouseIn");
|
||||
|
||||
_cleanup_current_url();
|
||||
|
||||
_current_url = eina_stringshare_add(url);
|
||||
|
||||
eldbus_message_arguments_append(msg, "s", _current_url);
|
||||
eldbus_object_send(ty_e_object, msg, NULL, NULL, -1);
|
||||
}
|
||||
|
||||
void
|
||||
ty_dbus_init(void)
|
||||
{
|
||||
Eldbus_Service_Interface *iface;
|
||||
|
||||
if (ty_dbus_conn) return;
|
||||
|
||||
eldbus_init();
|
||||
|
@ -39,6 +91,7 @@ ty_dbus_init(void)
|
|||
void
|
||||
ty_dbus_shutdown(void)
|
||||
{
|
||||
_cleanup_current_url();
|
||||
if (ty_dbus_conn) eldbus_connection_unref(ty_dbus_conn);
|
||||
ty_dbus_conn = NULL;
|
||||
ty_e_object = NULL;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#ifndef _DBUS_H__
|
||||
#define _DBUS_H__ 1
|
||||
|
||||
void ty_dbus_link_detect(const char *url);
|
||||
void ty_dbus_link_mousein(const char *url);
|
||||
void ty_dbus_link_mouseout(const char *url);
|
||||
void ty_dbus_init(void);
|
||||
void ty_dbus_shutdown(void);
|
||||
|
||||
|
|
|
@ -527,8 +527,13 @@ _smart_mouseover_apply(Evas_Object *obj)
|
|||
&x1, &y1, &x2, &y2);
|
||||
if (!s)
|
||||
{
|
||||
if (sd->link.string) free(sd->link.string);
|
||||
sd->link.string = NULL;
|
||||
if (sd->link.string)
|
||||
{
|
||||
if (link_is_url(sd->link.string))
|
||||
ty_dbus_link_mouseout(sd->link.string);
|
||||
free(sd->link.string);
|
||||
sd->link.string = NULL;
|
||||
}
|
||||
sd->link.x1 = -1;
|
||||
sd->link.y1 = -1;
|
||||
sd->link.x2 = -1;
|
||||
|
@ -541,6 +546,12 @@ _smart_mouseover_apply(Evas_Object *obj)
|
|||
same_link = EINA_TRUE;
|
||||
if (sd->link.string) free(sd->link.string);
|
||||
sd->link.string = s;
|
||||
|
||||
if ((!same_link) && (link_is_url(s)))
|
||||
{
|
||||
ty_dbus_link_mousein(s);
|
||||
}
|
||||
|
||||
if ((x1 == sd->link.x1) && (y1 == sd->link.y1) &&
|
||||
(x2 == sd->link.x2) && (y2 == sd->link.y2))
|
||||
same_geom = EINA_TRUE;
|
||||
|
|
|
@ -205,10 +205,10 @@ _termio_link_find(Evas_Object *obj, int cx, int cy,
|
|||
if ((len > 1) && (!endmatch))
|
||||
{
|
||||
Eina_Bool is_file = _is_file(s);
|
||||
Eina_Bool is_url = link_is_url(s);
|
||||
|
||||
if (is_file ||
|
||||
link_is_email(s) ||
|
||||
is_url)
|
||||
link_is_url(s))
|
||||
{
|
||||
if (x1r) *x1r = x1;
|
||||
if (y1r) *y1r = y1;
|
||||
|
@ -221,10 +221,6 @@ _termio_link_find(Evas_Object *obj, int cx, int cy,
|
|||
free(s);
|
||||
return ret;
|
||||
}
|
||||
else if (is_url)
|
||||
{
|
||||
ty_dbus_link_detect(s);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue