win: Remove types socket and fake from EO

Fake: This should never have had the fake_canvas_set API. It already can
not work after efl_finalize. And Ecore_Evas isn't part of EO API so it
doesn't make sense at this point to try to expose the fake window as
part of EO API.

Socket: This is the only type of window that implements socket_listen.
So we can just move this function to a new subclass.

NOTE: Socket & plug are currently broken, even in 1.20 (at least for me)!

Ref T5322
This commit is contained in:
Jean-Philippe Andre 2017-08-18 00:29:02 +09:00
parent e9dffa723d
commit 5cfd698894
7 changed files with 123 additions and 59 deletions

View File

@ -75,6 +75,7 @@ elm_public_eolian_files = \
lib/elementary/elm_widget.eo \
lib/elementary/efl_ui_win.eo \
lib/elementary/efl_ui_win_inlined.eo \
lib/elementary/efl_ui_win_socket.eo \
lib/elementary/elm_widget_item.eo \
lib/elementary/elm_color_item.eo \
lib/elementary/elm_dayselector_item.eo \
@ -666,6 +667,7 @@ lib_elementary_libelementary_la_SOURCES = \
lib/elementary/elm_widget.c \
lib/elementary/efl_ui_win.c \
lib/elementary/efl_ui_win_inlined.c \
lib/elementary/efl_ui_win_socket.c \
lib/elementary/elm_helper.c \
lib/elementary/els_box.c \
lib/elementary/els_cursor.c \

View File

@ -271,6 +271,7 @@ EAPI extern Elm_Version *elm_version;
# include <efl_ui_image.eo.h>
# include <efl_ui_win.eo.h>
# include <efl_ui_win_inlined.eo.h>
# include <efl_ui_win_socket.eo.h>
# include <efl_ui_text_interactive.eo.h>
# include <efl_ui_text.eo.h>
# include <efl_ui_text_editable.eo.h>

View File

@ -6486,18 +6486,6 @@ _efl_ui_win_stack_pop_to(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
// win32/osx ?
}
EOLIAN static Eina_Bool
_efl_ui_win_socket_listen(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char *svcname, int svcnum, Eina_Bool svcsys)
{
if (!sd->ee) return EINA_FALSE;
if (sd->type != EFL_UI_WIN_SOCKET_IMAGE) return EINA_FALSE;
if (!ecore_evas_extn_socket_listen(sd->ee, svcname, svcnum, svcsys))
return EINA_FALSE;
return EINA_TRUE;
}
EAPI Eina_Bool
elm_win_trap_set(const Elm_Win_Trap *t)
{
@ -7901,16 +7889,6 @@ elm_win_window_id_get(const Evas_Object *obj)
return _elm_win_window_id_get(sd);
}
EAPI void
elm_win_fake_canvas_set(Evas_Object *obj, Ecore_Evas *oee)
{
Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
if (!sd) return;
sd->ee = oee;
_elm_win_need_frame_adjust(sd, ecore_evas_engine_name_get(oee));
}
EAPI Evas_Object *
elm_win_main_menu_get(Evas_Object *obj)
{
@ -7963,17 +7941,29 @@ elm_win_aspect_get(const Eo *obj)
/* legacy APIs */
static void
_fake_canvas_set(Evas_Object *obj, Ecore_Evas *oee)
{
Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
if (!sd) return;
sd->ee = oee;
_elm_win_need_frame_adjust(sd, ecore_evas_engine_name_get(oee));
}
EAPI Evas_Object *
elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
{
if (type == ELM_WIN_INLINED_IMAGE)
const Efl_Class *klass = MY_CLASS;
switch ((int) type)
{
return efl_add(EFL_UI_WIN_INLINED_CLASS, parent,
efl_canvas_object_legacy_ctor(efl_added),
efl_ui_win_name_set(efl_added, name));
case ELM_WIN_INLINED_IMAGE: klass = EFL_UI_WIN_INLINED_CLASS; break;
case ELM_WIN_SOCKET_IMAGE: klass = EFL_UI_WIN_SOCKET_CLASS; break;
default: break;
}
return efl_add(MY_CLASS, parent,
return efl_add(klass, parent,
efl_canvas_object_legacy_ctor(efl_added),
efl_ui_win_name_set(efl_added, name),
efl_ui_win_type_set(efl_added, type));
@ -7984,7 +7974,7 @@ elm_win_fake_add(Ecore_Evas *ee)
{
return efl_add(MY_CLASS, NULL,
efl_canvas_object_legacy_ctor(efl_added),
elm_win_fake_canvas_set(efl_added, ee),
_fake_canvas_set(efl_added, ee),
efl_ui_win_name_set(efl_added, NULL),
efl_ui_win_type_set(efl_added, ELM_WIN_FAKE));
}
@ -8169,7 +8159,20 @@ elm_win_keygrab_unset(Elm_Win *obj, const char *key,
EFL_INPUT_MODIFIER_NONE);
}
EAPI Eina_Bool
elm_win_socket_listen(Efl_Ui_Win *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
{
return efl_ui_win_socket_listen(obj, svcname, svcnum, svcsys);
}
// deprecated
EAPI void
elm_win_fake_canvas_set(Evas_Object *obj EINA_UNUSED, Ecore_Evas *oee EINA_UNUSED)
{
ERR("Calling deprecrated function '%s'", __FUNCTION__);
}
EAPI void
elm_win_name_set(Evas_Object *obj, const char *name)
{

View File

@ -39,18 +39,7 @@ enum Efl.Ui.Win.Type
dnd, [[Used to indicate the window is a representation of an object being
dragged across different windows, or even applications. Typically
used with elm_win_override_set().]]
/* FIXME: The below types are to be removed */
socket_image = 15, [[The window is rendered onto an image buffer and can be shown
other process's plug image object. No actual window is
created for this type, instead the window and all of its
contents will be rendered to an image buffer and can be
shown other process's plug image object.
]]
fake = 16, [[This window was created using a pre-existing canvas. The window
widget can be deleted, but the canvas must be managed externally.
@since 1.13
]]
/* Some types have been removed from EO. Skipping to 17. */
naviframe_basic = 17 [[Used for naviframe style replacement with a back
button instead of a close button.
@since 1.19
@ -788,22 +777,6 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Elm.Interface.Atspi.Window,
This will try and delete all the windows in the stack that
are above the window.]]
}
socket_listen {
[[Create a socket to provide the service for Plug widget.]]
return: bool; [[$true on success, $false otherwise]]
params {
@in svcname: string; [[The name of the service to be advertised.
Eensure that it is unique (when combined with
$svcnum) otherwise creation may fail.]]
@in svcnum: int; [[A number (any value, 0 being the common default) to
differentiate multiple instances of services with
the same name.]]
@in svcsys: bool; [[A boolean that if true, specifies to create a
system-wide service all users can connect to,
otherwise the service is private to the user
id that created the service.]]
}
}
activate {
[[Activate a window object.

View File

@ -0,0 +1,35 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#define EFL_UI_WIN_PROTECTED
#define EFL_UI_WIN_SOCKET_PROTECTED
#include <Elementary.h>
#define MY_CLASS EFL_UI_WIN_SOCKET_CLASS
#define MY_CLASS_NAME "Efl.Ui.Win_Socket"
typedef struct
{
} Efl_Ui_Win_Socket_Data;
EOLIAN static Efl_Object *
_efl_ui_win_socket_efl_object_finalize(Eo *obj, Efl_Ui_Win_Socket_Data *pd EINA_UNUSED)
{
efl_ui_win_type_set(obj, ELM_WIN_SOCKET_IMAGE);
obj = efl_finalize(efl_super(obj, MY_CLASS));
return obj;
}
EOLIAN static Eina_Bool
_efl_ui_win_socket_socket_listen(Eo *obj, Efl_Ui_Win_Socket_Data *pd EINA_UNUSED, const char *svcname, int svcnum, Eina_Bool svcsys)
{
Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
if (!ee) return EINA_FALSE;
return ecore_evas_extn_socket_listen(ee, svcname, svcnum, svcsys);
}
#include "efl_ui_win_socket.eo.c"

View File

@ -0,0 +1,31 @@
class Efl.Ui.Win_Socket (Efl.Ui.Win)
{
[[An off-screen window to be displayed in a remote process.
The window is rendered onto an image buffer to be displayed in another
process' plug image object. No actual window is created for this type. The
window contents can then be sent over a socket so that another process
displays it inside a plug image.
]]
methods {
socket_listen {
[[Create a socket to provide the service for Plug widget.]]
return: bool; [[$true on success, $false otherwise]]
params {
@in svcname: string; [[The name of the service to be advertised.
Ensure that it is unique (when combined with
$svcnum) otherwise creation may fail.]]
@in svcnum: int; [[A number (any value, 0 being the common default)
to differentiate multiple instances of services
with the same name.]]
@in svcsys: bool; [[A boolean that if true, specifies to create a
system-wide service all users can connect to,
otherwise the service is private to the user
id that created the service.]]
}
}
}
implements {
Efl.Object.finalize;
}
}

View File

@ -68,8 +68,8 @@ typedef Efl_Ui_Win_Type Elm_Win_Type;
#define ELM_WIN_COMBO EFL_UI_WIN_COMBO
#define ELM_WIN_DND EFL_UI_WIN_DND
#define ELM_WIN_INLINED_IMAGE 14
#define ELM_WIN_SOCKET_IMAGE EFL_UI_WIN_SOCKET_IMAGE
#define ELM_WIN_FAKE EFL_UI_WIN_FAKE
#define ELM_WIN_SOCKET_IMAGE 15
#define ELM_WIN_FAKE 16 /**< See elm_win_fake_add(). @since 1.13 */
#define ELM_WIN_NAVIFRAME_BASIC EFL_UI_WIN_NAVIFRAME_BASIC
typedef Efl_Ui_Win_Keyboard_Mode Elm_Win_Keyboard_Mode;
@ -1028,8 +1028,10 @@ EAPI Evas_Object *elm_win_inlined_image_object_get(const Evas_Object *obj);
* @param[in] oee
*
* @ingroup Elm_Win
*
* @deprecated
*/
EAPI void elm_win_fake_canvas_set(Evas_Object *obj, Ecore_Evas *oee);
EAPI void elm_win_fake_canvas_set(Evas_Object *obj, Ecore_Evas *oee) EINA_DEPRECATED;
/**
* Get the Ecore_Window of an Evas_Object
@ -1129,3 +1131,20 @@ EAPI Eina_Bool elm_win_keygrab_unset(Elm_Win *obj, const char *key, Evas_Modifie
* @since 1.20
*/
EAPI Evas_Object *elm_win_get(Evas_Object *obj);
/**
* @brief Create a socket to provide the service for Plug widget.
*
* @param[in] svcname The name of the service to be advertised. Eensure that it
* is unique (when combined with @c svcnum) otherwise creation may fail.
* @param[in] svcnum A number (any value, 0 being the common default) to
* differentiate multiple instances of services with the same name.
* @param[in] svcsys A boolean that if true, specifies to create a system-wide
* service all users can connect to, otherwise the service is private to the
* user id that created the service.
*
* @return @c true on success, @c false otherwise
*
* @ingroup Efl_Ui_Win
*/
EAPI Eina_Bool elm_win_socket_listen(Efl_Ui_Win *obj, const char *svcname, int svcnum, Eina_Bool svcsys);