2012-12-05 13:15:42 -08:00
|
|
|
#include "ecore_evas_wayland_private.h"
|
2012-01-11 05:02:27 -08:00
|
|
|
|
|
|
|
#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
|
2011-12-26 15:27:20 -08:00
|
|
|
# include <stdlib.h>
|
|
|
|
# include <string.h>
|
|
|
|
# include <unistd.h>
|
|
|
|
# include <sys/types.h>
|
|
|
|
# include <sys/mman.h>
|
2016-11-01 13:46:35 -07:00
|
|
|
# include <Evas_Engine_Wayland.h>
|
2012-12-05 13:15:42 -08:00
|
|
|
|
2015-04-28 05:24:48 -07:00
|
|
|
#ifdef EAPI
|
|
|
|
# undef EAPI
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
# ifdef DLL_EXPORT
|
|
|
|
# define EAPI __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif /* ! DLL_EXPORT */
|
|
|
|
#else
|
|
|
|
# ifdef __GNUC__
|
|
|
|
# if __GNUC__ >= 4
|
|
|
|
# define EAPI __attribute__ ((visibility("default")))
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
|
|
|
#endif /* ! _WIN32 */
|
|
|
|
|
2016-05-05 07:45:59 -07:00
|
|
|
extern EAPI Eina_List *_evas_canvas_image_data_unset(Evas *eo_e);
|
|
|
|
extern EAPI void _evas_canvas_image_data_regenerate(Eina_List *list);
|
|
|
|
|
2011-12-26 15:27:20 -08:00
|
|
|
static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
|
|
|
|
{
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_free,
|
|
|
|
_ecore_evas_wl_common_callback_resize_set,
|
|
|
|
_ecore_evas_wl_common_callback_move_set,
|
2012-02-28 13:56:39 -08:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_callback_delete_request_set,
|
2012-02-28 13:56:39 -08:00
|
|
|
NULL,
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_callback_focus_in_set,
|
|
|
|
_ecore_evas_wl_common_callback_focus_out_set,
|
|
|
|
_ecore_evas_wl_common_callback_mouse_in_set,
|
|
|
|
_ecore_evas_wl_common_callback_mouse_out_set,
|
2012-02-28 13:56:39 -08:00
|
|
|
NULL, // sticky_set
|
|
|
|
NULL, // unsticky_set
|
|
|
|
NULL, // pre_render_set
|
|
|
|
NULL, // post_render_set
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_move,
|
2012-02-28 13:56:39 -08:00
|
|
|
NULL, // managed_move
|
2013-11-15 00:11:09 -08:00
|
|
|
_ecore_evas_wl_common_resize,
|
2016-11-01 05:42:23 -07:00
|
|
|
_ecore_evas_wl_common_move_resize,
|
2016-11-01 15:16:07 -07:00
|
|
|
_ecore_evas_wl_common_rotation_set,
|
2012-02-28 13:56:39 -08:00
|
|
|
NULL, // shaped_set
|
2016-11-01 14:20:49 -07:00
|
|
|
_ecore_evas_wl_common_show,
|
|
|
|
_ecore_evas_wl_common_hide,
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_raise,
|
2012-02-28 13:56:39 -08:00
|
|
|
NULL, // lower
|
|
|
|
NULL, // activate
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_title_set,
|
|
|
|
_ecore_evas_wl_common_name_class_set,
|
|
|
|
_ecore_evas_wl_common_size_min_set,
|
|
|
|
_ecore_evas_wl_common_size_max_set,
|
|
|
|
_ecore_evas_wl_common_size_base_set,
|
|
|
|
_ecore_evas_wl_common_size_step_set,
|
2012-11-07 08:12:14 -08:00
|
|
|
_ecore_evas_wl_common_object_cursor_set,
|
2015-02-06 14:54:08 -08:00
|
|
|
_ecore_evas_wl_common_object_cursor_unset,
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_layer_set,
|
2012-02-28 13:56:39 -08:00
|
|
|
NULL, // focus set
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_iconified_set,
|
2013-05-08 15:18:55 -07:00
|
|
|
_ecore_evas_wl_common_borderless_set,
|
2012-02-28 13:56:39 -08:00
|
|
|
NULL, // override set
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_maximized_set,
|
|
|
|
_ecore_evas_wl_common_fullscreen_set,
|
2012-02-28 13:56:39 -08:00
|
|
|
NULL, // func avoid_damage set
|
2013-11-30 04:14:05 -08:00
|
|
|
_ecore_evas_wl_common_withdrawn_set,
|
2011-12-26 15:27:20 -08:00
|
|
|
NULL, // func sticky set
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_ignore_events_set,
|
2016-11-01 14:34:26 -07:00
|
|
|
_ecore_evas_wl_common_alpha_set,
|
2016-11-01 15:15:24 -07:00
|
|
|
_ecore_evas_wl_common_transparent_set,
|
2012-07-03 00:44:17 -07:00
|
|
|
NULL, // func profiles set
|
2012-12-04 22:48:46 -08:00
|
|
|
NULL, // func profile set
|
2012-10-08 07:09:53 -07:00
|
|
|
NULL, // window group set
|
2013-12-05 03:47:44 -08:00
|
|
|
_ecore_evas_wl_common_aspect_set,
|
2012-10-08 07:09:53 -07:00
|
|
|
NULL, // urgent set
|
|
|
|
NULL, // modal set
|
|
|
|
NULL, // demand attention set
|
|
|
|
NULL, // focus skip set
|
2013-06-07 00:09:55 -07:00
|
|
|
NULL, // _ecore_evas_wl_common_render,
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_screen_geometry_get,
|
2013-02-15 01:32:40 -08:00
|
|
|
_ecore_evas_wl_common_screen_dpi_get,
|
2013-06-07 00:09:55 -07:00
|
|
|
NULL, // msg parent send
|
2013-07-08 03:00:28 -07:00
|
|
|
NULL, // msg_send
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_pointer_xy_get,
|
2014-02-08 16:46:51 -08:00
|
|
|
NULL, // pointer warp
|
|
|
|
|
|
|
|
NULL, // wm_rot_preferred_rotation_set
|
|
|
|
NULL, // wm_rot_available_rotations_set
|
|
|
|
NULL, // wm_rot_manual_rotation_done_set
|
2014-02-27 14:20:01 -08:00
|
|
|
NULL, // wm_rot_manual_rotation_done
|
|
|
|
|
2016-01-25 15:18:28 -08:00
|
|
|
NULL, // aux_hints_set
|
|
|
|
|
|
|
|
NULL, // fn_animator_register
|
2016-08-30 13:47:17 -07:00
|
|
|
NULL, // fn_animator_unregister
|
|
|
|
|
|
|
|
NULL, // fn_evas_changed
|
2011-12-26 15:27:20 -08:00
|
|
|
};
|
|
|
|
|
2012-02-28 13:56:39 -08:00
|
|
|
/* external variables */
|
2011-12-26 15:27:20 -08:00
|
|
|
|
2016-05-05 07:45:59 -07:00
|
|
|
void
|
|
|
|
_ee_egl_display_unset(Ecore_Evas *ee)
|
|
|
|
{
|
2016-11-01 13:46:35 -07:00
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
2016-05-05 07:45:59 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
2016-11-01 13:46:35 -07:00
|
|
|
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
|
2016-11-01 10:07:10 -07:00
|
|
|
einfo->info.wl_display = NULL;
|
2016-05-05 07:45:59 -07:00
|
|
|
wdata = ee->engine.data;
|
|
|
|
wdata->regen_objs = _evas_canvas_image_data_unset(ecore_evas_get(ee));
|
|
|
|
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
|
|
|
|
}
|
|
|
|
|
2015-12-11 08:26:24 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_ee_cb_sync_done(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
2016-11-01 13:46:35 -07:00
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
2015-12-11 08:26:24 -08:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
ee = data;
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (wdata->sync_done) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
wdata->sync_done = EINA_TRUE;
|
|
|
|
|
2016-11-01 13:46:35 -07:00
|
|
|
if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas)))
|
2015-12-11 08:26:24 -08:00
|
|
|
{
|
2016-11-01 10:07:10 -07:00
|
|
|
einfo->info.wl_display = ecore_wl2_display_get(wdata->display);
|
2015-12-11 08:26:24 -08:00
|
|
|
einfo->info.destination_alpha = EINA_TRUE;
|
|
|
|
einfo->info.rotation = ee->rotation;
|
2016-11-01 09:41:47 -07:00
|
|
|
einfo->info.wl_surface = ecore_wl2_window_surface_get(wdata->win);
|
2015-12-11 08:26:24 -08:00
|
|
|
|
2016-05-05 07:45:59 -07:00
|
|
|
if (wdata->reset_pending)
|
|
|
|
{
|
|
|
|
ecore_evas_manual_render_set(ee, 0);
|
|
|
|
}
|
|
|
|
if (evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
2015-12-11 08:26:24 -08:00
|
|
|
{
|
2016-05-05 07:45:59 -07:00
|
|
|
if (wdata->reset_pending)
|
|
|
|
_evas_canvas_image_data_regenerate(wdata->regen_objs);
|
|
|
|
wdata->regen_objs = NULL;
|
2015-12-11 08:26:24 -08:00
|
|
|
}
|
2016-05-05 07:45:59 -07:00
|
|
|
else
|
|
|
|
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
|
|
|
|
wdata->reset_pending = 0;
|
2015-12-11 08:26:24 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wdata->defer_show)
|
|
|
|
{
|
|
|
|
int fw, fh;
|
|
|
|
|
|
|
|
wdata->defer_show = EINA_FALSE;
|
|
|
|
|
|
|
|
ecore_wl2_window_show(wdata->win);
|
|
|
|
ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
|
|
|
|
ecore_wl2_window_transparent_set(wdata->win, ee->transparent);
|
|
|
|
|
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
|
|
|
|
|
|
|
if (wdata->win)
|
|
|
|
{
|
|
|
|
|
2016-11-01 13:46:35 -07:00
|
|
|
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
|
2015-12-11 08:26:24 -08:00
|
|
|
if (einfo)
|
|
|
|
{
|
2016-05-05 07:45:59 -07:00
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
|
2016-03-24 10:46:42 -07:00
|
|
|
einfo->www_avail = !!wdata->win->www_surface;
|
|
|
|
einfo->just_mapped = EINA_TRUE;
|
2015-12-11 08:26:24 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wdata->frame)
|
|
|
|
{
|
|
|
|
evas_object_show(wdata->frame);
|
|
|
|
evas_object_resize(wdata->frame, ee->w + fw, ee->h + fh);
|
|
|
|
}
|
|
|
|
|
|
|
|
ee->prop.withdrawn = EINA_FALSE;
|
|
|
|
if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
|
|
|
|
|
|
|
|
if (!ee->visible)
|
|
|
|
{
|
|
|
|
ee->visible = 1;
|
|
|
|
ee->should_be_visible = 1;
|
|
|
|
ee->draw_ok = EINA_TRUE;
|
|
|
|
if (ee->func.fn_show) ee->func.fn_show(ee);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2016-03-24 10:46:42 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wl_egl_render_flush_pre(void *data, Evas *e, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
2016-11-01 13:46:35 -07:00
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
2016-03-24 10:46:42 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
int fx, fy;
|
|
|
|
|
2016-11-01 13:46:35 -07:00
|
|
|
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(e);
|
2016-03-24 10:46:42 -07:00
|
|
|
wdata = ee->engine.data;
|
|
|
|
einfo->window.x = wdata->win->geometry.x;
|
|
|
|
einfo->window.y = wdata->win->geometry.y;
|
|
|
|
einfo->window.w = wdata->win->geometry.w;
|
|
|
|
einfo->window.h = wdata->win->geometry.h;
|
|
|
|
if (einfo->resizing)
|
|
|
|
{
|
|
|
|
einfo->x_rel = 0;
|
|
|
|
einfo->y_rel = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
einfo->x_rel = wdata->x_rel;
|
|
|
|
einfo->y_rel = wdata->y_rel;
|
|
|
|
}
|
|
|
|
einfo->timestamp = wdata->timestamp;
|
|
|
|
evas_canvas_pointer_canvas_xy_get(e, &einfo->x_cursor, &einfo->y_cursor);
|
|
|
|
evas_output_framespace_get(e, &fx, &fy, NULL, NULL);
|
|
|
|
einfo->x_cursor -= fx;
|
|
|
|
einfo->y_cursor -= fy;
|
|
|
|
wdata->x_rel = wdata->y_rel = 0;
|
|
|
|
einfo->resizing = wdata->win->resizing;
|
|
|
|
einfo->dragging = wdata->dragging;
|
|
|
|
einfo->drag_start = EINA_FALSE;
|
|
|
|
einfo->drag_stop = EINA_FALSE;
|
|
|
|
if (einfo->drag_ack && !einfo->dragging) einfo->drag_stop = EINA_TRUE;
|
|
|
|
if (einfo->dragging && !einfo->drag_ack) einfo->drag_start = EINA_TRUE;
|
|
|
|
einfo->drag_ack = wdata->dragging;
|
|
|
|
}
|
|
|
|
|
2012-02-28 13:56:39 -08:00
|
|
|
/* external functions */
|
2011-12-26 15:27:20 -08:00
|
|
|
EAPI Ecore_Evas *
|
2012-12-05 13:15:42 -08:00
|
|
|
ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
|
|
|
|
int x, int y, int w, int h, Eina_Bool frame)
|
2011-12-26 15:27:20 -08:00
|
|
|
{
|
2015-09-28 10:42:38 -07:00
|
|
|
Ecore_Wl2_Display *ewd;
|
|
|
|
Ecore_Wl2_Window *p = NULL;
|
2016-11-01 13:46:35 -07:00
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
2012-12-05 13:15:42 -08:00
|
|
|
Ecore_Evas_Interface_Wayland *iface;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2016-08-10 19:34:00 -07:00
|
|
|
Ecore_Evas *ee = NULL;
|
2015-09-28 10:42:38 -07:00
|
|
|
int method = 0;
|
2013-05-02 03:00:49 -07:00
|
|
|
int fx = 0, fy = 0, fw = 0, fh = 0;
|
2011-12-26 15:27:20 -08:00
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-02-28 13:56:39 -08:00
|
|
|
if (!(method = evas_render_method_lookup("wayland_egl")))
|
2011-12-26 15:27:20 -08:00
|
|
|
{
|
2012-02-28 13:56:39 -08:00
|
|
|
ERR("Render method lookup failed for Wayland_Egl");
|
2011-12-26 15:27:20 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-09-28 10:42:38 -07:00
|
|
|
if (!ecore_wl2_init())
|
2011-12-26 15:27:20 -08:00
|
|
|
{
|
2015-10-19 12:18:41 -07:00
|
|
|
ERR("Failed to initialize Ecore_Wl2");
|
2011-12-26 15:27:20 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-09-28 10:42:38 -07:00
|
|
|
ewd = ecore_wl2_display_connect(disp_name);
|
|
|
|
if (!ewd)
|
|
|
|
{
|
|
|
|
ERR("Failed to connect to Wayland Display %s", disp_name);
|
2015-12-04 08:40:54 -08:00
|
|
|
goto conn_err;
|
2015-09-28 10:42:38 -07:00
|
|
|
}
|
|
|
|
|
2012-02-28 13:56:39 -08:00
|
|
|
if (!(ee = calloc(1, sizeof(Ecore_Evas))))
|
2012-01-11 05:02:27 -08:00
|
|
|
{
|
2012-02-28 13:56:39 -08:00
|
|
|
ERR("Failed to allocate Ecore_Evas");
|
2016-08-10 19:34:00 -07:00
|
|
|
goto err;
|
2012-01-11 05:02:27 -08:00
|
|
|
}
|
2011-12-26 15:27:20 -08:00
|
|
|
|
2012-12-05 13:15:42 -08:00
|
|
|
if (!(wdata = calloc(1, sizeof(Ecore_Evas_Engine_Wl_Data))))
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate Ecore_Evas_Engine_Wl_Data");
|
|
|
|
free(ee);
|
2016-08-10 19:34:00 -07:00
|
|
|
goto err;
|
2012-12-05 13:15:42 -08:00
|
|
|
}
|
|
|
|
|
2011-12-26 15:27:20 -08:00
|
|
|
ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_init();
|
2011-12-26 15:27:20 -08:00
|
|
|
|
|
|
|
ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func;
|
2012-12-05 13:15:42 -08:00
|
|
|
ee->engine.data = wdata;
|
|
|
|
|
|
|
|
iface = _ecore_evas_wl_interface_new();
|
|
|
|
ee->engine.ifaces = eina_list_append(ee->engine.ifaces, iface);
|
2011-12-26 15:27:20 -08:00
|
|
|
|
|
|
|
ee->driver = "wayland_egl";
|
|
|
|
if (disp_name) ee->name = strdup(disp_name);
|
|
|
|
|
|
|
|
if (w < 1) w = 1;
|
|
|
|
if (h < 1) h = 1;
|
2012-01-11 05:02:27 -08:00
|
|
|
|
2012-02-28 13:56:39 -08:00
|
|
|
ee->x = x;
|
|
|
|
ee->y = y;
|
|
|
|
ee->w = w;
|
|
|
|
ee->h = h;
|
|
|
|
ee->req.x = ee->x;
|
|
|
|
ee->req.y = ee->y;
|
|
|
|
ee->req.w = ee->w;
|
|
|
|
ee->req.h = ee->h;
|
2012-01-11 05:02:27 -08:00
|
|
|
ee->rotation = 0;
|
2012-02-28 13:56:39 -08:00
|
|
|
ee->prop.max.w = 32767;
|
|
|
|
ee->prop.max.h = 32767;
|
2011-12-26 15:27:20 -08:00
|
|
|
ee->prop.layer = 4;
|
2014-01-12 21:26:36 -08:00
|
|
|
ee->prop.request_pos = EINA_FALSE;
|
|
|
|
ee->prop.sticky = EINA_FALSE;
|
2011-12-26 15:27:20 -08:00
|
|
|
ee->prop.draw_frame = frame;
|
2014-10-29 03:33:16 -07:00
|
|
|
ee->prop.withdrawn = EINA_TRUE;
|
2013-09-10 06:34:16 -07:00
|
|
|
ee->alpha = EINA_FALSE;
|
2011-12-26 15:27:20 -08:00
|
|
|
|
2013-06-07 07:40:46 -07:00
|
|
|
/* NB: Disabled for right now as it causes textgrid (terminology)
|
|
|
|
* to not draw text anymore */
|
|
|
|
/* if (getenv("ECORE_EVAS_FORCE_SYNC_RENDER")) */
|
2015-10-05 10:53:36 -07:00
|
|
|
ee->can_async_render = 0;
|
2013-06-07 07:40:46 -07:00
|
|
|
/* else */
|
2015-09-28 10:42:38 -07:00
|
|
|
/* ee->can_async_render = 1; */
|
2013-06-06 23:26:53 -07:00
|
|
|
|
2013-01-21 08:05:12 -08:00
|
|
|
/* frame offset and size */
|
2013-05-02 03:00:49 -07:00
|
|
|
if (ee->prop.draw_frame)
|
|
|
|
{
|
|
|
|
fx = 4;
|
|
|
|
fy = 18;
|
|
|
|
fw = 8;
|
|
|
|
fh = 22;
|
|
|
|
}
|
2013-01-21 08:05:12 -08:00
|
|
|
|
2013-06-07 07:40:46 -07:00
|
|
|
if (parent)
|
2015-01-09 10:23:55 -08:00
|
|
|
{
|
2015-10-13 11:56:20 -07:00
|
|
|
p = ecore_wl2_display_window_find(ewd, parent);
|
2015-09-28 10:42:38 -07:00
|
|
|
ee->alpha = ecore_wl2_window_alpha_get(p);
|
2015-01-09 10:23:55 -08:00
|
|
|
}
|
2013-06-07 07:40:46 -07:00
|
|
|
|
2015-12-11 08:26:24 -08:00
|
|
|
wdata->sync_done = EINA_FALSE;
|
2013-06-07 07:40:46 -07:00
|
|
|
wdata->parent = p;
|
2015-09-28 10:42:38 -07:00
|
|
|
wdata->display = ewd;
|
2016-05-05 07:45:59 -07:00
|
|
|
wdata->display_unset = _ee_egl_display_unset;
|
2015-09-28 10:42:38 -07:00
|
|
|
wdata->win = ecore_wl2_window_new(ewd, p, x, y, w + fw, h + fh);
|
|
|
|
ee->prop.window = ecore_wl2_window_id_get(wdata->win);
|
2013-06-07 07:40:46 -07:00
|
|
|
|
2011-12-26 15:27:20 -08:00
|
|
|
ee->evas = evas_new();
|
|
|
|
evas_data_attach_set(ee->evas, ee);
|
|
|
|
evas_output_method_set(ee->evas, method);
|
2013-01-21 08:05:12 -08:00
|
|
|
evas_output_size_set(ee->evas, ee->w + fw, ee->h + fh);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
|
2011-12-26 15:27:20 -08:00
|
|
|
|
2013-06-06 23:26:53 -07:00
|
|
|
if (ee->can_async_render)
|
|
|
|
evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST,
|
|
|
|
_ecore_evas_wl_common_render_updates, ee);
|
|
|
|
|
2015-12-09 06:38:01 -08:00
|
|
|
evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE,
|
|
|
|
_ecore_evas_wl_common_render_flush_pre, ee);
|
2016-03-24 10:46:42 -07:00
|
|
|
evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE,
|
|
|
|
_ecore_evas_wl_egl_render_flush_pre, ee);
|
2015-12-09 06:38:01 -08:00
|
|
|
|
2012-02-28 13:56:39 -08:00
|
|
|
/* FIXME: This needs to be set based on theme & scale */
|
|
|
|
if (ee->prop.draw_frame)
|
2013-01-21 08:05:12 -08:00
|
|
|
evas_output_framespace_set(ee->evas, fx, fy, fw, fh);
|
2011-12-26 15:27:20 -08:00
|
|
|
|
2015-12-11 08:26:24 -08:00
|
|
|
if (ewd->sync_done)
|
2011-12-26 15:27:20 -08:00
|
|
|
{
|
2015-12-11 08:26:24 -08:00
|
|
|
wdata->sync_done = EINA_TRUE;
|
2016-11-01 13:46:35 -07:00
|
|
|
if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas)))
|
2011-12-26 15:27:20 -08:00
|
|
|
{
|
2016-11-01 10:07:10 -07:00
|
|
|
einfo->info.wl_display = ecore_wl2_display_get(ewd);
|
2015-12-11 08:26:24 -08:00
|
|
|
einfo->info.destination_alpha = EINA_TRUE;
|
|
|
|
einfo->info.rotation = ee->rotation;
|
|
|
|
einfo->info.depth = 32;
|
2016-11-01 09:41:47 -07:00
|
|
|
einfo->info.wl_surface = ecore_wl2_window_surface_get(wdata->win);
|
2015-12-11 08:26:24 -08:00
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
{
|
|
|
|
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
|
2012-10-08 07:09:53 -07:00
|
|
|
goto err;
|
2011-12-26 15:27:20 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-09 08:54:07 -07:00
|
|
|
/* ecore_wl2_display_animator_source_set(ewd, ECORE_ANIMATOR_SOURCE_CUSTOM); */
|
2015-10-05 10:53:36 -07:00
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_common_pre_free);
|
2012-01-11 05:02:27 -08:00
|
|
|
|
2013-04-26 11:01:44 -07:00
|
|
|
if (ee->prop.draw_frame)
|
2012-01-11 05:02:27 -08:00
|
|
|
{
|
2012-12-05 13:15:42 -08:00
|
|
|
wdata->frame = _ecore_evas_wl_common_frame_add(ee->evas);
|
2013-04-22 12:44:43 -07:00
|
|
|
_ecore_evas_wl_common_frame_border_size_set(wdata->frame, fx, fy, fw, fh);
|
2013-04-26 11:01:44 -07:00
|
|
|
evas_object_move(wdata->frame, -fx, -fy);
|
2013-04-22 12:44:43 -07:00
|
|
|
evas_object_layer_set(wdata->frame, EVAS_LAYER_MAX - 1);
|
2012-01-11 05:02:27 -08:00
|
|
|
}
|
|
|
|
|
2013-06-07 00:09:55 -07:00
|
|
|
ee->engine.func->fn_render = _ecore_evas_wl_common_render;
|
|
|
|
|
2011-12-26 15:27:20 -08:00
|
|
|
_ecore_evas_register(ee);
|
2012-05-15 05:01:46 -07:00
|
|
|
ecore_evas_input_event_register(ee);
|
2011-12-26 15:27:20 -08:00
|
|
|
|
|
|
|
ecore_event_window_register(ee->prop.window, ee, ee->evas,
|
|
|
|
(Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
|
|
|
|
(Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
|
|
|
|
(Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
|
|
|
|
(Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
|
2016-06-13 10:00:13 -07:00
|
|
|
_ecore_event_window_direct_cb_set(ee->prop.window,
|
|
|
|
_ecore_evas_input_direct_cb);
|
|
|
|
|
|
|
|
wdata->sync_handler =
|
|
|
|
ecore_event_handler_add(ECORE_WL2_EVENT_SYNC_DONE, _ee_cb_sync_done, ee);
|
2011-12-26 15:27:20 -08:00
|
|
|
|
2016-05-05 07:45:59 -07:00
|
|
|
ee_list = eina_list_append(ee_list, ee);
|
2015-12-11 08:26:24 -08:00
|
|
|
|
2011-12-26 15:27:20 -08:00
|
|
|
return ee;
|
2012-01-12 01:06:47 -08:00
|
|
|
|
2015-12-04 08:40:54 -08:00
|
|
|
err:
|
2016-08-10 19:34:00 -07:00
|
|
|
if (ee) ecore_evas_free(ee);
|
|
|
|
else ecore_wl2_display_disconnect(ewd);
|
2015-12-04 08:40:54 -08:00
|
|
|
conn_err:
|
|
|
|
ecore_wl2_shutdown();
|
2012-10-08 07:09:53 -07:00
|
|
|
return NULL;
|
2011-12-26 15:27:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|