From f1e1a6edd8f5e80be5aa80d01845ae6054c1c4f4 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 20 May 2016 14:10:49 -0400 Subject: [PATCH] upgrade to teamwork v2, remove dbus (v1) usage --- configure.ac | 10 ---- src/bin/Makefile.am | 3 +- src/bin/dbus.c | 114 -------------------------------------------- src/bin/dbus.h | 10 ---- src/bin/main.c | 4 -- src/bin/termio.c | 42 +++------------- src/bin/win.c | 5 +- 7 files changed, 11 insertions(+), 177 deletions(-) delete mode 100644 src/bin/dbus.c delete mode 100644 src/bin/dbus.h diff --git a/configure.ac b/configure.ac index 8a99fcfc..b97ab3d2 100644 --- a/configure.ac +++ b/configure.ac @@ -87,15 +87,6 @@ AM_CONDITIONAL([ENABLE_FUZZING], [test "${want_fuzzing}" = "yes"]) PKG_CHECK_MODULES([TERMINOLOGY], [${requirements}]) -PKG_CHECK_MODULES([ELDBUS], - [eldbus], - [ - AC_DEFINE(HAVE_ELDBUS, 1, [DBUS support]) - have_eldbus="yes" - ], - [have_eldbus="no"] - ) - AC_CHECK_FUNCS(mkstemps) AC_MSG_CHECKING([for ecore_con_url_head]) @@ -185,7 +176,6 @@ echo "Installation...............: make install (as root if needed, with 'su' or echo " prefix...................: $prefix" echo echo "Features:" -echo " dbus................: $have_eldbus" echo " gettext.............: $have_po" echo " fuzzing.............: $want_fuzzing" echo diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 7fb3a705..f34b1687 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -10,7 +10,7 @@ terminology_CPPFLAGS = -I. \ -DPACKAGE_BIN_DIR=\"$(bindir)\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \ -DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" @TERMINOLOGY_CFLAGS@ -terminology_LDADD = @TERMINOLOGY_LIBS@ @ELDBUS_LIBS@ +terminology_LDADD = @TERMINOLOGY_LIBS@ if HAVE_PO terminology_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\" terminology_LDADD += @LIBINTL@ @@ -58,7 +58,6 @@ md5/md5.c md5/md5.h \ utf8.c utf8.h \ win.c win.h \ utils.c utils.h \ -dbus.c dbus.h \ extns.c extns.h \ gravatar.c gravatar.h \ tty_keys.h diff --git a/src/bin/dbus.c b/src/bin/dbus.c deleted file mode 100644 index da241084..00000000 --- a/src/bin/dbus.c +++ /dev/null @@ -1,114 +0,0 @@ -#include "private.h" -#include -#include "dbus.h" -#ifdef HAVE_ELDBUS -#include - -static Eldbus_Connection *ty_dbus_conn = NULL; -static Eldbus_Object *ty_e_object = NULL; -static Eina_Stringshare *_current_url = NULL; - -void -ty_dbus_link_hide(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", - "LinkHide"); - - eldbus_message_arguments_append(msg, "s", _current_url); - eldbus_object_send(ty_e_object, msg, NULL, NULL, -1); - - eina_stringshare_replace(&_current_url, NULL); -} - -void -ty_dbus_link_mouseout(uint64_t win, const char *url, int x, int y) -{ - Eldbus_Message *msg; - - if (!ty_e_object) return; - - msg = eldbus_message_method_call_new("org.enlightenment.wm.service", - "/org/enlightenment/wm/RemoteObject", - "org.enlightenment.wm.Teamwork", - "LinkMouseOut"); -#if (ELM_VERSION_MAJOR > 1) || (ELM_VERSION_MINOR > 8) // not a typo - eldbus_message_arguments_append(msg, "sutii", url, time(NULL), win, x, y); -#else - eldbus_message_arguments_append(msg, "suxii", url, time(NULL), (int64_t)win, x, y); -#endif - eldbus_object_send(ty_e_object, msg, NULL, NULL, -1); - eina_stringshare_replace(&_current_url, NULL); -} - - -void -ty_dbus_link_mousein(uint64_t win, const char *url, int x, int y) -{ - Eldbus_Message *msg; - Eina_Stringshare *u; - - if (!ty_e_object) return; - - u = eina_stringshare_add(url); - /* if previous link exists, do MouseOut now */ - if (_current_url && (u != _current_url)) - ty_dbus_link_mouseout(win, _current_url, x, y); - eina_stringshare_del(_current_url); - _current_url = u; - - msg = eldbus_message_method_call_new("org.enlightenment.wm.service", - "/org/enlightenment/wm/RemoteObject", - "org.enlightenment.wm.Teamwork", - "LinkMouseIn"); - -#if (ELM_VERSION_MAJOR > 1) || (ELM_VERSION_MINOR > 8) // not a typo - eldbus_message_arguments_append(msg, "sutii", _current_url, time(NULL), win, x, y); -#else - eldbus_message_arguments_append(msg, "suxii", _current_url, time(NULL), (int64_t)win, x, y); -#endif - eldbus_object_send(ty_e_object, msg, NULL, NULL, -1); -} - -void -ty_dbus_init(void) -{ - if (ty_dbus_conn) return; - - eldbus_init(); - - if (!elm_need_sys_notify()) - { - WRN("no elementary system notification support"); - } - - ty_dbus_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION); - ty_e_object = eldbus_object_get(ty_dbus_conn, - "org.enlightenment.wm.service", - "/org/enlightenment/wm/RemoteObject"); -} - -void -ty_dbus_shutdown(void) -{ - ty_dbus_link_hide(); - if (ty_dbus_conn) eldbus_connection_unref(ty_dbus_conn); - ty_dbus_conn = NULL; - ty_e_object = NULL; - eldbus_shutdown(); -} - -#else - -void ty_dbus_link_hide(void) {} -void ty_dbus_link_mousein (uint64_t win EINA_UNUSED, const char *url EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED) {} -void ty_dbus_link_mouseout(uint64_t win EINA_UNUSED, const char *url EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED) {} -void ty_dbus_init(void) {} -void ty_dbus_shutdown(void) {} - -#endif diff --git a/src/bin/dbus.h b/src/bin/dbus.h deleted file mode 100644 index 583539d1..00000000 --- a/src/bin/dbus.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _DBUS_H__ -#define _DBUS_H__ 1 - -void ty_dbus_link_hide(void); -void ty_dbus_link_mousein(uint64_t win, const char *url, int x, int y); -void ty_dbus_link_mouseout(uint64_t win, const char *url, int x, int y); -void ty_dbus_init(void); -void ty_dbus_shutdown(void); - -#endif diff --git a/src/bin/main.c b/src/bin/main.c index 5a76422f..0dc43de9 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -15,7 +15,6 @@ #include "utils.h" #include "ipc.h" #include "sel.h" -#include "dbus.h" #include "miniview.h" #include "gravatar.h" #include "keyin.h" @@ -974,8 +973,6 @@ remote: ecore_evas_focus_set(ecore_evas_ecore_evas_get( evas_object_evas_get(win)), 1); - ty_dbus_init(); - ecore_con_init(); ecore_con_url_init(); @@ -986,7 +983,6 @@ remote: ecore_con_url_shutdown(); ecore_con_shutdown(); - ty_dbus_shutdown(); config = NULL; end: #if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8) diff --git a/src/bin/termio.c b/src/bin/termio.c index f6434a47..0d77a031 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -14,7 +14,6 @@ #include "config.h" #include "utils.h" #include "media.h" -#include "dbus.h" #include "miniview.h" #include "gravatar.h" @@ -1138,21 +1137,9 @@ _update_link(Evas_Object *obj, Termio *sd, if ((!popup_exists) && ((sd->link.string[0] == '/') || (link_is_url(sd->link.string)))) { - Evas_Coord _x = ox, _y = oy; - uint64_t xwin; - - _x += sd->mouse.cx * sd->font.chw; - _y += sd->mouse.cy * sd->font.chh; -#if (ELM_VERSION_MAJOR > 1) || (ELM_VERSION_MINOR >= 8) - xwin = elm_win_window_id_get(sd->win); -# if (ELM_VERSION_MAJOR > 1) || ((ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR > 8)) // not a typo - if (strstr(ecore_evas_engine_name_get(ecore_evas_ecore_evas_get(evas_object_evas_get(sd->win))), "wayland")) - xwin = ((uint64_t)xwin << 32) + (uint64_t)getpid(); -# endif -#else - xwin = elm_win_xwindow_get(sd->win); +#ifdef EFL_VERSION_1_18 + elm_win_teamwork_uri_show(win_evas_object_get(term_win_get(sd->term)), sd->link.string); #endif - ty_dbus_link_mousein(xwin, sd->link.string, _x, _y); } for (y = sd->link.y1; y <= sd->link.y2; y++) { @@ -1210,26 +1197,9 @@ _remove_links(Termio *sd, Evas_Object *obj) if (sd->link.string) { - if ((sd->link.string[0] == '/') || (link_is_url(sd->link.string))) - { - Evas_Coord ox, oy; - uint64_t xwin; - - evas_object_geometry_get(obj, &ox, &oy, NULL, NULL); - - ox += sd->mouse.cx * sd->font.chw; - oy += sd->mouse.cy * sd->font.chh; -#if (ELM_VERSION_MAJOR > 1) || (ELM_VERSION_MINOR >= 8) - xwin = elm_win_window_id_get(sd->win); -# if (ELM_VERSION_MAJOR > 1) || ((ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR > 8)) // not a typo - if (strstr(ecore_evas_engine_name_get(ecore_evas_ecore_evas_get(evas_object_evas_get(sd->win))), "wayland")) - xwin = ((uint64_t)xwin << 32) + (uint64_t)getpid(); -# endif -#else - xwin = elm_win_xwindow_get(sd->win); +#ifdef EFL_VERSION_1_18 + elm_win_teamwork_uri_hide(win_evas_object_get(term_win_get(sd->term))); #endif - ty_dbus_link_mouseout(xwin, sd->link.string, ox, oy); - } free(sd->link.string); sd->link.string = NULL; } @@ -4439,7 +4409,9 @@ _smart_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, if (sd->ctxpopup) return; /* ctxp triggers mouse out we should ignore */ termio_mouseover_suspend_pushpop(data, 1); - ty_dbus_link_hide(); +#ifdef EFL_VERSION_1_18 + elm_win_teamwork_uri_hide(win_evas_object_get(term_win_get(sd->term))); +#endif if ((ev->canvas.x == 0) || (ev->canvas.y == 0)) { sd->mouse.cx = -1; diff --git a/src/bin/win.c b/src/bin/win.c index 4eb85f80..3cdea68b 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -10,7 +10,6 @@ #include "termio.h" #include "utils.h" #include "private.h" -#include "dbus.h" #include "sel.h" #include "controls.h" #include "term_container.h" @@ -2981,7 +2980,9 @@ _popmedia_show(Term *term, const char *src, Media_Type type) Config *config = termio_config_get(term->termio); EINA_SAFETY_ON_NULL_RETURN(config); - ty_dbus_link_hide(); +#ifdef EFL_VERSION_1_18 + elm_win_teamwork_uri_hide(term->wn->win); +#endif if (term->popmedia) { const char *s;