efl_ui_win - teamwork really has issues and i think needs deprecation

teamwork api in elm win (efl_ui_win) has a few issues:

1. it directly ddigs into ecore_wl2 and uses internal headers to use
zwp_* api's directly... which effectively tied elementary directly to
libwayland and thats not a good thing - thats why ecore_wl2 exists -
to act as a layer in between
2. the only thing that supports it is e and only wiht a module and
there is no fallback code in elm to work outside this environment, so
it's kind of broken by design and will not actually reliably work
3. from a stability and security point of view, and api and protocol
that allow a client to ask your wm/compositor to open ANY url - go
make a network request possibly to a hostile url/site is bad. needing
to handle so so so so many protocols, file types etc. etc. is going to
lead to issues that SHOULD at least be isolated in the app, but now it
spreads into your wm/compositor too. :(
4. there is ZERO benefit to asking the wm to do this. the app is
using efl already. it already has all the same abilities with the same
libraries to download/display etc. so why doesnt the app do it itself?
5. doesnt work in windows, osx, framebuffer (fbcon or drm)... only in
x11 and wayland. (and then only with e + module)
6. there is no way to detect if it's going to work and write your own
fallback (which shouldnt be needed/done anyway).

nice work and enthusiasm on making teamwork but it just isn't the right
thing - not in its current form and not by design (security reasons) :(

@deprecate
This commit is contained in:
Carsten Haitzler 2016-12-08 19:14:32 +09:00
parent 56b0b6490d
commit 75a429328a
3 changed files with 78 additions and 142 deletions

View File

@ -99,7 +99,6 @@ struct _Efl_Ui_Win_Data
Ecore_Win32_Window *win;
} win32;
#endif
Eina_Stringshare *teamwork_uri;
Efl_Ui_Win_Type type;
Efl_Ui_Win_Keyboard_Mode kbdmode;
@ -2763,7 +2762,6 @@ _efl_ui_win_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Win_Data *sd)
eina_stringshare_del(sd->shot.info);
ecore_timer_del(sd->shot.timer);
eina_stringshare_replace(&sd->teamwork_uri, NULL);
#ifdef HAVE_ELEMENTARY_X
ecore_event_handler_del(sd->x.client_message_handler);
@ -6659,109 +6657,6 @@ ELM_PART_IMPLEMENT_CONTENT_UNSET(efl_ui_win, EFL_UI_WIN, Efl_Ui_Win_Data, Elm_Pa
/* Efl.Part end */
#ifndef EFL_TEAMWORK_VERSION
# define EFL_TEAMWORK_VERSION 2
#endif
static EOLIAN void
_efl_ui_win_teamwork_uri_preload(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char *uri)
{
#ifdef HAVE_ELEMENTARY_X
if (sd->x.xwin)
{
ecore_x_window_prop_string_set(sd->x.xwin, ECORE_X_ATOM_TEAMWORK_PROPERTY, uri);
ecore_x_client_message32_send(sd->x.xwin, ECORE_X_ATOM_TEAMWORK_PRELOAD,
ECORE_X_EVENT_MASK_WINDOW_MANAGE | ECORE_X_EVENT_MASK_WINDOW_CHILD_CONFIGURE, EFL_TEAMWORK_VERSION, 0, 0, 0, 0);
}
#endif
#ifdef HAVE_ELEMENTARY_WL2
if (sd->wl.win)
{
Ecore_Wl2_Display *ewd = ecore_wl2_window_display_get(sd->wl.win);
if (ewd->wl.teamwork)
zwp_teamwork_preload_uri(ewd->wl.teamwork, ecore_wl2_window_surface_get(sd->wl.win), uri);
}
#endif
eina_stringshare_replace(&sd->teamwork_uri, uri);
}
static EOLIAN void
_efl_ui_win_teamwork_uri_show(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char *uri)
{
int x, y;
EINA_SAFETY_ON_NULL_RETURN(uri);
if (eina_streq(uri, sd->teamwork_uri)) return;
evas_pointer_canvas_xy_get(sd->evas, &x, &y);
#ifdef HAVE_ELEMENTARY_X
if (sd->x.xwin)
{
ecore_x_window_prop_string_set(sd->x.xwin, ECORE_X_ATOM_TEAMWORK_PROPERTY, uri);
ecore_x_client_message32_send(sd->x.xwin, ECORE_X_ATOM_TEAMWORK_ACTIVATE,
ECORE_X_EVENT_MASK_WINDOW_MANAGE | ECORE_X_EVENT_MASK_WINDOW_CHILD_CONFIGURE, EFL_TEAMWORK_VERSION, x, y, 0, 0);
}
#endif
#ifdef HAVE_ELEMENTARY_WL2
if (sd->wl.win)
{
Ecore_Wl2_Display *ewd = ecore_wl2_window_display_get(sd->wl.win);
if (ewd->wl.teamwork)
zwp_teamwork_activate_uri(ewd->wl.teamwork, ecore_wl2_window_surface_get(sd->wl.win),
uri, wl_fixed_from_int(x), wl_fixed_from_int(y));
}
#endif
eina_stringshare_replace(&sd->teamwork_uri, uri);
}
static EOLIAN void
_efl_ui_win_teamwork_uri_hide(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
{
if (!sd->teamwork_uri) return;
#ifdef HAVE_ELEMENTARY_X
if (sd->x.xwin)
{
ecore_x_window_prop_string_set(sd->x.xwin, ECORE_X_ATOM_TEAMWORK_PROPERTY, sd->teamwork_uri);
ecore_x_client_message32_send(sd->x.xwin, ECORE_X_ATOM_TEAMWORK_DEACTIVATE,
ECORE_X_EVENT_MASK_WINDOW_MANAGE | ECORE_X_EVENT_MASK_WINDOW_CHILD_CONFIGURE, EFL_TEAMWORK_VERSION, 0, 0, 0, 0);
}
#endif
#ifdef HAVE_ELEMENTARY_WL2
if (sd->wl.win)
{
Ecore_Wl2_Display *ewd = ecore_wl2_window_display_get(sd->wl.win);
if (ewd->wl.teamwork)
zwp_teamwork_deactivate_uri(ewd->wl.teamwork, ecore_wl2_window_surface_get(sd->wl.win), sd->teamwork_uri);
}
#endif
eina_stringshare_replace(&sd->teamwork_uri, NULL);
}
static EOLIAN void
_efl_ui_win_teamwork_uri_open(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char *uri)
{
EINA_SAFETY_ON_NULL_RETURN(uri);
#ifdef HAVE_ELEMENTARY_X
if (sd->x.xwin)
{
ecore_x_window_prop_string_set(sd->x.xwin, ECORE_X_ATOM_TEAMWORK_PROPERTY, uri);
ecore_x_client_message32_send(sd->x.xwin, ECORE_X_ATOM_TEAMWORK_OPEN,
ECORE_X_EVENT_MASK_WINDOW_MANAGE | ECORE_X_EVENT_MASK_WINDOW_CHILD_CONFIGURE, EFL_TEAMWORK_VERSION, 0, 0, 0, 0);
}
#endif
#ifdef HAVE_ELEMENTARY_WL2
if (sd->wl.win)
{
Ecore_Wl2_Display *ewd = ecore_wl2_window_display_get(sd->wl.win);
if (ewd->wl.teamwork)
zwp_teamwork_open_uri(ewd->wl.teamwork, ecore_wl2_window_surface_get(sd->wl.win), uri);
}
#endif
#if !defined(HAVE_ELEMENTARY_WL2) && !defined(HAVE_ELEMENTARY_X)
(void)sd;
#endif
}
EOLIAN static Eina_Bool
_efl_ui_win_move_resize_start(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Efl_Ui_Win_Move_Resize_Mode mode)
{
@ -7884,4 +7779,28 @@ elm_win_type_set(Evas_Object *obj, Elm_Win_Type type)
efl_ui_win_type_set(obj, type);
}
EAPI void
elm_win_teamwork_uri_preload(Efl_Ui_Win *obj EINA_UNUSED, const char *uri EINA_UNUSED)
{
ERR("Calling deprecrated function '%s'", __FUNCTION__);
}
EAPI void
elm_win_teamwork_uri_show(Efl_Ui_Win *obj EINA_UNUSED, const char *uri EINA_UNUSED)
{
ERR("Calling deprecrated function '%s'", __FUNCTION__);
}
EAPI void
elm_win_teamwork_uri_hide(Efl_Ui_Win *obj EINA_UNUSED)
{
ERR("Calling deprecrated function '%s'", __FUNCTION__);
}
EAPI void
elm_win_teamwork_uri_open(Efl_Ui_Win *obj EINA_UNUSED, const char *uri EINA_UNUSED)
{
ERR("Calling deprecrated function '%s'", __FUNCTION__);
}
#include "efl_ui_win.eo.c"

View File

@ -862,43 +862,6 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Elm.Interface.Atspi.Window,
@in not_modifiers: Evas.Modifier_Mask; [[This is for the keymask feature. Currently this feature is not supported.]]
}
}
teamwork_uri_preload {
[[Notify the compositor that a uri should be preloaded
@since 1.18
]]
params {
@in uri: string; [[This is the uri to notify with]]
}
}
teamwork_uri_show {
[[Notify the compositor that a uri should be displayed
Sends the current mouse coordinates as a hint for displaying the
related uri in the compositor.
@since 1.18
]]
params {
@in uri: string; [[This is the uri to notify with]]
}
}
teamwork_uri_hide {
[[Notify the compositor that a uri should be hidden
Hides any uri-related media displayed in the compositor through
previous \@ref elm_win_teamwork_uri_show request
@since 1.18
]]
}
teamwork_uri_open {
[[Notify the compositor that a uri should be opened
Use the compositor's default application to open a uri
@since 1.18
]]
params {
@in uri: string; [[This is the uri to open]]
}
}
move_resize_start {
[[Start moving or resizing the window.

View File

@ -6442,6 +6442,60 @@ EINA_DEPRECATED EAPI void elm_genlist_edit_mode_set(Evas_Object *o
*/
EINA_DEPRECATED EAPI Eina_Bool elm_genlist_edit_mode_get(const Evas_Object *obj);
/**
* @brief Notify the compositor that a uri should be preloaded
*
* @param[in] uri This is the uri to notify with
*
* @since 1.18
*
* @ingroup Efl_Ui_Win
* @deprecated This is a possibly security issue and is non-portable outside enlightenment and there is no code to detect if it exists and even works, so better not to have this
*/
EINA_DEPRECATED EAPI void elm_win_teamwork_uri_preload(Efl_Ui_Win *obj, const char *uri);
/**
* @brief Notify the compositor that a uri should be displayed
*
* Sends the current mouse coordinates as a hint for displaying the related uri
* in the compositor.
*
* @param[in] uri This is the uri to notify with
*
* @since 1.18
*
* @ingroup Efl_Ui_Win
* @deprecated This is a possibly security issue and is non-portable outside enlightenment and there is no code to detect if it exists and even works, so better not to have this
*/
EINA_DEPRECATED EAPI void elm_win_teamwork_uri_show(Efl_Ui_Win *obj, const char *uri);
/**
* @brief Notify the compositor that a uri should be hidden
*
* Hides any uri-related media displayed in the compositor through previous
* @ref elm_win_teamwork_uri_show request
*
* @since 1.18
*
* @ingroup Efl_Ui_Win
* @deprecated This is a possibly security issue and is non-portable outside enlightenment and there is no code to detect if it exists and even works, so better not to have this
*/
EINA_DEPRECATED EAPI void elm_win_teamwork_uri_hide(Efl_Ui_Win *obj);
/**
* @brief Notify the compositor that a uri should be opened
*
* Use the compositor's default application to open a uri
*
* @param[in] uri This is the uri to open
*
* @since 1.18
*
* @ingroup Efl_Ui_Win
* @deprecated This is a possibly security issue and is non-portable outside enlightenment and there is no code to detect if it exists and even works, so better not to have this
*/
EINA_DEPRECATED EAPI void elm_win_teamwork_uri_open(Efl_Ui_Win *obj, const char *uri);
/**
* @}
*/