ecore-wl2: Port Ecore_Evas engines to use Ecore_Wl2 code

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-09-28 13:42:38 -04:00
parent 590c278a46
commit cd1d9ec196
6 changed files with 162 additions and 109 deletions

View File

@ -187,15 +187,19 @@ modules_ecore_evas_engines_wayland_module_la_SOURCES = $(WAYLANDSOURCES)
modules_ecore_evas_engines_wayland_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
@ECORE_EVAS_CFLAGS@ \
@ECORE_WAYLAND_CFLAGS@ \
@ECORE_WL2_CFLAGS@ \
-I$(top_srcdir)/src/modules/evas/engines/wayland_shm \
-I$(top_srcdir)/src/modules/evas/engines/wayland_egl \
@ECORE_WAYLAND_CFLAGS@
@ECORE_WAYLAND_CFLAGS@ \
@ECORE_WL2_CFLAGS@
modules_ecore_evas_engines_wayland_module_la_LIBADD = \
@USE_ECORE_EVAS_LIBS@ \
@USE_ECORE_WAYLAND_LIBS@
@USE_ECORE_WAYLAND_LIBS@ \
@USE_ECORE_WL2_LIBS@
modules_ecore_evas_engines_wayland_module_la_DEPENDENCIES = \
@USE_ECORE_EVAS_INTERNAL_LIBS@ \
@USE_ECORE_WAYLAND_INTERNAL_LIBS@
@USE_ECORE_WAYLAND_INTERNAL_LIBS@ \
@USE_ECORE_WL2_INTERNAL_LIBS@
modules_ecore_evas_engines_wayland_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
modules_ecore_evas_engines_wayland_module_la_LIBTOOLFLAGS = --tag=disable-static
endif

View File

@ -48,6 +48,11 @@ typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for s
typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
#endif
#ifndef _ECORE_WL2_H_
#define _ECORE_WAYLAND_WINDOW_PREDEF
typedef struct _Ecore_Wl2_Window Ecore_Wl2_Window;
#endif
#ifndef _ECORE_GETOPT_PREDEF
typedef struct _Ecore_Getopt Ecore_Getopt;
#define _ECORE_GETOPT_PREDEF 1

View File

@ -80,7 +80,7 @@ static Eina_Bool
_ecore_evas_wl_common_cb_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Evas *ee;
Ecore_Wl_Event_Mouse_In *ev;
Ecore_Event_Mouse_IO *ev;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -166,7 +166,7 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
{
Ecore_Evas *ee;
Ecore_Evas_Engine_Wl_Data *wdata;
Ecore_Wl_Event_Window_Configure *ev;
Ecore_Wl2_Event_Window_Configure *ev;
int nw = 0, nh = 0;
int fw = 0, fh = 0;
Eina_Bool prev_max, prev_full;
@ -232,7 +232,7 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
if (rot_dif < 0) rot_dif = -rot_dif;
/* set ecore_wayland window rotation */
ecore_wl_window_rotation_set(wdata->win, rotation);
ecore_wl2_window_rotation_set(wdata->win, rotation);
/* check if rotation is just a flip */
if (rot_dif != 180)
@ -253,8 +253,8 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
if (!ee->prop.fullscreen)
{
/* resize the ecore_wayland window */
ecore_wl_window_resize(wdata->win,
ee->req.h + fw, ee->req.w + fh, 0);
ecore_wl2_window_resize(wdata->win,
ee->req.h + fw, ee->req.w + fh, 0);
}
else
{
@ -262,8 +262,8 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
if ((rotation == 0) || (rotation == 180))
{
/* resize the ecore_wayland window */
ecore_wl_window_resize(wdata->win,
ee->req.w, ee->req.h, 0);
ecore_wl2_window_resize(wdata->win,
ee->req.w, ee->req.h, 0);
/* resize the canvas */
evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
@ -273,8 +273,8 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
else
{
/* resize the ecore_wayland window */
ecore_wl_window_resize(wdata->win,
ee->req.h, ee->req.w, 0);
ecore_wl2_window_resize(wdata->win,
ee->req.h, ee->req.w, 0);
/* resize the canvas */
evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
@ -346,7 +346,7 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
else
{
/* resize the ecore_wayland window */
ecore_wl_window_resize(wdata->win, ee->w, ee->h, 0);
ecore_wl2_window_resize(wdata->win, ee->w, ee->h, 0);
/* record the current rotation of the ecore_evas */
ee->rotation = rotation;
@ -391,19 +391,19 @@ _ecore_evas_wl_common_init(void)
return _ecore_evas_wl_init_count;
_ecore_evas_wl_event_hdls[0] =
ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN,
ecore_event_handler_add(ECORE_EVENT_MOUSE_IN,
_ecore_evas_wl_common_cb_mouse_in, NULL);
_ecore_evas_wl_event_hdls[1] =
ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT,
ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT,
_ecore_evas_wl_common_cb_mouse_out, NULL);
_ecore_evas_wl_event_hdls[2] =
ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN,
ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN,
_ecore_evas_wl_common_cb_focus_in, NULL);
_ecore_evas_wl_event_hdls[3] =
ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT,
ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT,
_ecore_evas_wl_common_cb_focus_out, NULL);
_ecore_evas_wl_event_hdls[4] =
ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE,
ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE,
_ecore_evas_wl_common_cb_window_configure, NULL);
ecore_event_evas_init();
@ -452,18 +452,24 @@ _ecore_evas_wl_common_free(Ecore_Evas *ee)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ee) return;
wdata = ee->engine.data;
if (wdata->anim_callback)
wl_callback_destroy(wdata->anim_callback);
if (wdata->win) ecore_wl_window_free(wdata->win);
if (wdata->anim_callback) wl_callback_destroy(wdata->anim_callback);
wdata->anim_callback = NULL;
if (wdata->win) ecore_wl2_window_free(wdata->win);
wdata->win = NULL;
ecore_wl2_display_disconnect(wdata->display);
free(wdata);
ecore_event_window_unregister(ee->prop.window);
ecore_evas_input_event_unregister(ee);
_ecore_evas_wl_common_shutdown();
ecore_wl_shutdown();
ecore_wl2_shutdown();
}
void
@ -636,6 +642,14 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
if (wdata->frame)
evas_object_resize(wdata->frame, w, h);
if (wdata->win)
{
int x, y;
ecore_wl2_window_geometry_get(wdata->win, &x, &y, NULL, NULL);
ecore_wl2_window_geometry_set(wdata->win, x, y, w, h);
}
if (ee->func.fn_resize) ee->func.fn_resize(ee);
}
@ -936,11 +950,14 @@ _ecore_evas_wl_common_frame_border_size_get(Evas_Object *obj, int *fx, int *fy,
}
void
_ecore_evas_wl_common_pointer_xy_get(const Ecore_Evas *ee EINA_UNUSED, Evas_Coord *x, Evas_Coord *y)
_ecore_evas_wl_common_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
{
Ecore_Evas_Engine_Wl_Data *wdata;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_wl_pointer_xy_get(x, y);
wdata = ee->engine.data;
ecore_wl2_window_pointer_xy_get(wdata->win, x, y);
}
void
@ -952,7 +969,7 @@ _ecore_evas_wl_common_raise(Ecore_Evas *ee)
if ((!ee) || (!ee->visible)) return;
wdata = ee->engine.data;
ecore_wl_window_raise(wdata->win);
ecore_wl2_window_raise(wdata->win);
}
void
@ -977,7 +994,7 @@ _ecore_evas_wl_common_title_set(Ecore_Evas *ee, const char *title)
}
if (ee->prop.title)
ecore_wl_window_title_set(wdata->win, ee->prop.title);
ecore_wl2_window_title_set(wdata->win, ee->prop.title);
}
void
@ -1001,8 +1018,9 @@ _ecore_evas_wl_common_name_class_set(Ecore_Evas *ee, const char *n, const char *
ee->prop.clas = NULL;
if (c) ee->prop.clas = strdup(c);
}
if (ee->prop.clas)
ecore_wl_window_class_name_set(wdata->win, ee->prop.clas);
ecore_wl2_window_class_name_set(wdata->win, ee->prop.clas);
}
void
@ -1088,14 +1106,15 @@ void
_ecore_evas_wl_common_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
{
int x, y, fx, fy;
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
Ecore_Evas_Engine_Wl_Data *wdata;
Evas_Object *old;
if (!ee) return;
wdata = ee->engine.data;
old = ee->prop.cursor.object;
if (obj == NULL)
{
ecore_wl_window_pointer_set(wdata->win, NULL, 0, 0);
ecore_wl2_window_pointer_set(wdata->win, NULL, 0, 0);
ee->prop.cursor.object = NULL;
ee->prop.cursor.layer = 0;
ee->prop.cursor.hot.x = 0;
@ -1112,7 +1131,7 @@ _ecore_evas_wl_common_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int la
if (obj != old)
{
ecore_wl_window_pointer_set(wdata->win, NULL, 0, 0);
ecore_wl2_window_pointer_set(wdata->win, NULL, 0, 0);
evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
evas_object_pass_events_set(ee->prop.cursor.object, 1);
if (evas_pointer_inside_get(ee->evas))
@ -1158,7 +1177,7 @@ _ecore_evas_wl_common_iconified_set(Ecore_Evas *ee, Eina_Bool on)
ee->prop.iconified = on;
wdata = ee->engine.data;
ecore_wl_window_iconified_set(wdata->win, on);
ecore_wl2_window_iconified_set(wdata->win, on);
}
static void
@ -1208,9 +1227,9 @@ _ecore_evas_wl_common_maximized_set(Ecore_Evas *ee, Eina_Bool on)
if (!ee) return;
if (ee->prop.maximized == on) return;
wdata = ee->engine.data;
ecore_wl_window_maximized_set(wdata->win, on);
// _ecore_evas_wl_common_state_update(ee);
ecore_wl2_window_maximized_set(wdata->win, on);
}
void
@ -1222,9 +1241,9 @@ _ecore_evas_wl_common_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
if (!ee) return;
if (ee->prop.fullscreen == on) return;
wdata = ee->engine.data;
ecore_wl_window_fullscreen_set(wdata->win, on);
// _ecore_evas_wl_common_state_update(ee);
ecore_wl2_window_fullscreen_set(wdata->win, on);
}
void
@ -1340,12 +1359,10 @@ _ecore_evas_wl_common_render(Ecore_Evas *ee)
int rend = 0;
Eina_List *l;
Ecore_Evas *ee2;
Ecore_Wl_Window *win = NULL;
Ecore_Evas_Engine_Wl_Data *wdata;
if (!ee) return 0;
if (!(wdata = ee->engine.data)) return 0;
if (!(win = wdata->win)) return 0;
/* TODO: handle comp no sync */
@ -1403,13 +1420,17 @@ _ecore_evas_wl_common_withdrawn_set(Ecore_Evas *ee, Eina_Bool on)
}
void
_ecore_evas_wl_common_screen_geometry_get(const Ecore_Evas *ee EINA_UNUSED, int *x, int *y, int *w, int *h)
_ecore_evas_wl_common_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
{
Ecore_Evas_Engine_Wl_Data *wdata;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (x) *x = 0;
if (y) *y = 0;
ecore_wl_screen_size_get(w, h);
wdata = ee->engine.data;
ecore_wl2_display_screen_size_get(wdata->display, w, h);
}
void
@ -1421,8 +1442,11 @@ _ecore_evas_wl_common_screen_dpi_get(const Ecore_Evas *ee EINA_UNUSED, int *xdpi
if (xdpi) *xdpi = 0;
if (ydpi) *ydpi = 0;
/* FIXME: Ideally this needs to get the DPI from a specific screen */
dpi = ecore_wl_dpi_get();
/* TODO */
/* dpi = ecore_wl_dpi_get(); */
if (xdpi) *xdpi = dpi;
if (ydpi) *ydpi = dpi;
}
@ -1479,32 +1503,33 @@ _ecore_evas_wayland_move(Ecore_Evas *ee, int x, int y)
{
wdata = ee->engine.data;
if (wdata->win)
ecore_wl_window_move(wdata->win, x, y);
ecore_wl2_window_move(wdata->win, x, y);
}
}
static void
_ecore_evas_wayland_type_set(Ecore_Evas *ee, int type)
{
Ecore_Evas_Engine_Wl_Data *wdata;
/* static void */
/* _ecore_evas_wayland_type_set(Ecore_Evas *ee, int type) */
/* { */
/* Ecore_Evas_Engine_Wl_Data *wdata; */
if (!ee) return;
wdata = ee->engine.data;
ecore_wl_window_type_set(wdata->win, type);
}
/* if (!ee) return; */
/* wdata = ee->engine.data; */
static Ecore_Wl_Window *
_ecore_evas_wayland_window_get(const Ecore_Evas *ee)
{
Ecore_Evas_Engine_Wl_Data *wdata;
/* TODO */
/* ecore_wl_window_type_set(wdata->win, type); */
/* } */
if (!(!strncmp(ee->driver, "wayland", 7)))
return NULL;
/* static Ecore_Wl2_Window * */
/* _ecore_evas_wayland_window_get(const Ecore_Evas *ee) */
/* { */
/* Ecore_Evas_Engine_Wl_Data *wdata; */
wdata = ee->engine.data;
return wdata->win;
}
/* if (!(!strncmp(ee->driver, "wayland", 7))) */
/* return NULL; */
/* wdata = ee->engine.data; */
/* return wdata->win; */
/* } */
#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
static void
@ -1525,11 +1550,11 @@ _ecore_evas_wayland_pre_post_swap_callback_set(const Ecore_Evas *ee, void *data,
}
#endif
static void
_ecore_evas_wayland_pointer_set(Ecore_Evas *ee EINA_UNUSED, int hot_x EINA_UNUSED, int hot_y EINA_UNUSED)
{
/* static void */
/* _ecore_evas_wayland_pointer_set(Ecore_Evas *ee EINA_UNUSED, int hot_x EINA_UNUSED, int hot_y EINA_UNUSED) */
/* { */
}
/* } */
Ecore_Evas_Interface_Wayland *
_ecore_evas_wl_interface_new(void)
@ -1544,9 +1569,9 @@ _ecore_evas_wl_interface_new(void)
iface->resize = _ecore_evas_wayland_resize;
iface->move = _ecore_evas_wayland_move;
iface->pointer_set = _ecore_evas_wayland_pointer_set;
iface->type_set = _ecore_evas_wayland_type_set;
iface->window_get = _ecore_evas_wayland_window_get;
/* iface->pointer_set = _ecore_evas_wayland_pointer_set; */
/* iface->type_set = _ecore_evas_wayland_type_set; */
/* iface->window_get = _ecore_evas_wayland_window_get; */
#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
iface->pre_post_swap_callback_set =

View File

@ -119,12 +119,13 @@ EAPI Ecore_Evas *
ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
int x, int y, int w, int h, Eina_Bool frame)
{
Ecore_Wl_Window *p = NULL;
Ecore_Wl2_Display *ewd;
Ecore_Wl2_Window *p = NULL;
Evas_Engine_Info_Wayland_Egl *einfo;
Ecore_Evas_Interface_Wayland *iface;
Ecore_Evas_Engine_Wl_Data *wdata;
Ecore_Evas *ee;
int method = 0, count = 0;
int method = 0;
int fx = 0, fy = 0, fw = 0, fh = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -135,13 +136,19 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
return NULL;
}
count = ecore_wl_init(disp_name);
if (!count)
if (!ecore_wl2_init())
{
ERR("Failed to initialize Ecore_Wayland");
return NULL;
}
ewd = ecore_wl2_display_connect(disp_name);
if (!ewd)
{
ERR("Failed to connect to Wayland Display %s", disp_name);
return NULL;
}
if (!(ee = calloc(1, sizeof(Ecore_Evas))))
{
ERR("Failed to allocate Ecore_Evas");
@ -194,7 +201,7 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
/* if (getenv("ECORE_EVAS_FORCE_SYNC_RENDER")) */
ee->can_async_render = 0;
/* else */
/* ee->can_async_render = 1; */
/* ee->can_async_render = 1; */
/* frame offset and size */
if (ee->prop.draw_frame)
@ -207,15 +214,14 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
if (parent)
{
p = ecore_wl_window_find(parent);
ee->alpha = ecore_wl_window_alpha_get(p);
p = ecore_wl2_window_find(ewd, parent);
ee->alpha = ecore_wl2_window_alpha_get(p);
}
wdata->parent = p;
wdata->win =
ecore_wl_window_new(p, x, y, w + fw, h + fh,
ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW);
ee->prop.window = ecore_wl_window_id_get(wdata->win);
wdata->display = ewd;
wdata->win = ecore_wl2_window_new(ewd, p, x, y, w + fw, h + fh);
ee->prop.window = ecore_wl2_window_id_get(wdata->win);
ee->evas = evas_new();
evas_data_attach_set(ee->evas, ee);
@ -236,11 +242,11 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
{
einfo->info.display = ecore_wl_display_get();
einfo->info.display = ecore_wl2_display_get(ewd);
einfo->info.destination_alpha = EINA_TRUE;
einfo->info.rotation = ee->rotation;
einfo->info.depth = 32;
einfo->info.surface = ecore_wl_window_surface_create(wdata->win);
einfo->info.surface = ecore_wl2_window_surface_get(wdata->win);
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
{
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
@ -253,7 +259,7 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
goto err;
}
/* ecore_wl_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM); */
ecore_wl2_display_animator_source_set(ewd, ECORE_ANIMATOR_SOURCE_CUSTOM);
ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_common_pre_free);
@ -335,15 +341,16 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
wdata = ee->engine.data;
if (wdata->win)
{
ecore_wl_window_show(wdata->win);
ecore_wl_window_alpha_set(wdata->win, ee->alpha);
ecore_wl2_window_show(wdata->win);
ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
/* ecore_wl_window_update_size(wdata->win, ee->w + fw, ee->h + fh); */
einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
if (einfo)
{
struct wl_surface *surf;
surf = ecore_wl_window_surface_get(wdata->win);
surf = ecore_wl2_window_surface_get(wdata->win);
if ((!einfo->info.surface) || (einfo->info.surface != surf))
{
einfo->info.surface = surf;
@ -390,7 +397,7 @@ _ecore_evas_wl_hide(Ecore_Evas *ee)
}
if (wdata->win)
ecore_wl_window_hide(wdata->win);
ecore_wl2_window_hide(wdata->win);
if (ee->prop.override)
{
@ -420,7 +427,7 @@ _ecore_evas_wayland_egl_alpha_do(Ecore_Evas *ee, int alpha)
ee->alpha = alpha;
wdata = ee->engine.data;
if (wdata->win) ecore_wl_window_alpha_set(wdata->win, ee->alpha);
if (wdata->win) ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
@ -461,7 +468,7 @@ _ecore_evas_wayland_egl_transparent_do(Ecore_Evas *ee, int transparent)
wdata = ee->engine.data;
if (wdata->win)
ecore_wl_window_transparent_set(wdata->win, ee->transparent);
ecore_wl2_window_transparent_set(wdata->win, ee->transparent);
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
@ -501,9 +508,9 @@ _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location)
_ecore_evas_wayland_egl_resize_edge_set(ee, location);
if (ECORE_EVAS_PORTRAIT(ee))
ecore_wl_window_resize(wdata->win, ee->w, ee->h, location);
ecore_wl2_window_resize(wdata->win, ee->w + fw, ee->h + fh, location);
else
ecore_wl_window_resize(wdata->win, ee->w, ee->h, location);
ecore_wl2_window_resize(wdata->win, ee->w + fh, ee->h + fw, location);
}
}

View File

@ -20,6 +20,7 @@
#include <Ecore_Input.h>
#include <Ecore_Input_Evas.h>
#include <Ecore_Wayland.h>
#include <Ecore_Wl2.h>
#include <Ecore_Evas.h>
#include "ecore_evas_private.h"
@ -29,7 +30,8 @@ typedef struct _Ecore_Evas_Engine_Wl_Data Ecore_Evas_Engine_Wl_Data;
struct _Ecore_Evas_Engine_Wl_Data
{
Ecore_Wl_Window *parent, *win;
Ecore_Wl2_Display *display;
Ecore_Wl2_Window *parent, *win;
Evas_Object *frame;
int fx, fy, fw, fh;
#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL

View File

@ -118,7 +118,8 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
EAPI Ecore_Evas *
ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame)
{
Ecore_Wl_Window *p = NULL;
Ecore_Wl2_Display *ewd;
Ecore_Wl2_Window *p = NULL;
Evas_Engine_Info_Wayland_Shm *einfo;
Ecore_Evas_Engine_Wl_Data *wdata;
Ecore_Evas_Interface_Wayland *iface;
@ -134,12 +135,19 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
return NULL;
}
if (!ecore_wl_init(disp_name))
if (!ecore_wl2_init())
{
ERR("Failed to initialize Ecore_Wayland");
return NULL;
}
ewd = ecore_wl2_display_connect(disp_name);
if (!ewd)
{
ERR("Failed to connect to Wayland Display %s", disp_name);
return NULL;
}
if (!(ee = calloc(1, sizeof(Ecore_Evas))))
{
ERR("Failed to allocate Ecore_Evas");
@ -202,15 +210,14 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
if (parent)
{
p = ecore_wl_window_find(parent);
ee->alpha = ecore_wl_window_alpha_get(p);
p = ecore_wl2_window_find(ewd, parent);
ee->alpha = ecore_wl2_window_alpha_get(p);
}
wdata->parent = p;
wdata->win =
ecore_wl_window_new(p, x, y, w + fw, h + fh,
ECORE_WL_WINDOW_BUFFER_TYPE_SHM);
ee->prop.window = ecore_wl_window_id_get(wdata->win);
wdata->display = ewd;
wdata->win = ecore_wl2_window_new(ewd, p, x, y, w + fw, h + fh);
ee->prop.window = ecore_wl2_window_id_get(wdata->win);
ee->evas = evas_new();
evas_data_attach_set(ee->evas, ee);
@ -231,11 +238,11 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
{
einfo->info.wl_disp = ecore_wl_display_get();
einfo->info.wl_shm = ecore_wl_shm_get();
einfo->info.wl_disp = ecore_wl2_display_get(ewd);
einfo->info.wl_shm = ecore_wl2_display_shm_get(ewd);
einfo->info.destination_alpha = EINA_TRUE;
einfo->info.rotation = ee->rotation;
einfo->info.wl_surface = ecore_wl_window_surface_create(wdata->win);
einfo->info.wl_surface = ecore_wl2_window_surface_get(wdata->win);
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
{
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
@ -248,7 +255,7 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
goto err;
}
/* ecore_wl_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM); */
ecore_wl2_display_animator_source_set(ewd, ECORE_ANIMATOR_SOURCE_CUSTOM);
ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_common_pre_free);
@ -278,7 +285,8 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
return NULL;
ee_err:
ecore_wl_shutdown();
ecore_wl2_display_disconnect(ewd);
ecore_wl2_shutdown();
return NULL;
}
@ -330,15 +338,17 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
if (wdata->win)
{
ecore_wl_window_show(wdata->win);
ecore_wl_window_alpha_set(wdata->win, ee->alpha);
ecore_wl2_window_show(wdata->win);
ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
/* TODO: Needed ?? */
/* ecore_wl_window_update_size(wdata->win, ee->w + fw, ee->h + fh); */
einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
if (einfo)
{
struct wl_surface *surf;
surf = ecore_wl_window_surface_get(wdata->win);
surf = ecore_wl2_window_surface_get(wdata->win);
if ((!einfo->info.wl_surface) || (einfo->info.wl_surface != surf))
{
einfo->info.wl_surface = surf;
@ -385,7 +395,7 @@ _ecore_evas_wl_hide(Ecore_Evas *ee)
}
if (wdata->win)
ecore_wl_window_hide(wdata->win);
ecore_wl2_window_hide(wdata->win);
if (ee->prop.override)
{
@ -415,7 +425,7 @@ _ecore_evas_wayland_shm_alpha_do(Ecore_Evas *ee, int alpha)
ee->alpha = alpha;
wdata = ee->engine.data;
if (wdata->win) ecore_wl_window_alpha_set(wdata->win, ee->alpha);
if (wdata->win) ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
@ -455,7 +465,7 @@ _ecore_evas_wayland_shm_transparent_do(Ecore_Evas *ee, int transparent)
wdata = ee->engine.data;
if (wdata->win)
ecore_wl_window_transparent_set(wdata->win, ee->transparent);
ecore_wl2_window_transparent_set(wdata->win, ee->transparent);
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
@ -494,9 +504,9 @@ _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location)
_ecore_evas_wayland_shm_resize_edge_set(ee, location);
if (ECORE_EVAS_PORTRAIT(ee))
ecore_wl_window_resize(wdata->win, ee->w, ee->h, location);
ecore_wl2_window_resize(wdata->win, ee->w + fw, ee->h + fh, location);
else
ecore_wl_window_resize(wdata->win, ee->w, ee->h, location);
ecore_wl2_window_resize(wdata->win, ee->w + fh, ee->h + fw, location);
}
}