}
}
-static Eina_Bool
+static E_Comp_Wl_Data *
_e_comp_wl_display_create(void)
{
E_Comp_Data *comp;
- E_Comp_Wl_Data *wl_cdata;
+ E_Comp_Wl_Data *comp_wl;
const char *name;
int fd = 0;
Eina_Bool res;
ERR("Could not create compositor data: %m");
return EINA_FALSE;
}
- wl_cdata = &comp->base;
+ comp_wl = &comp->base;
/* set compositor wayland data */
- e_comp_wl = e_comp->wl_comp_data = wl_cdata;
+ e_comp_wl = e_comp->wl_comp_data = comp_wl;
g_mutex_init(&connection_mutex);
/* try to create a wayland display */
- if (!(wl_cdata->wl.disp = wl_display_create()))
+ if (!(comp_wl->wl.disp = wl_display_create()))
{
ERR("Could not create a Wayland display: %m");
goto disp_err;
}
/* try to setup wayland socket */
- if (!(name = wl_display_add_socket_auto(wl_cdata->wl.disp)))
+ if (!(name = wl_display_add_socket_auto(comp_wl->wl.disp)))
{
ERR("Could not create Wayland display socket: %m");
PRCTL("[Winsys] Could not create Wayland display socket: /run/wayland-0");
/* set wayland display environment variable */
e_env_set("WAYLAND_DISPLAY", name);
- /* wl_cdata->output.transform = WL_OUTPUT_TRANSFORM_NORMAL; */
- /* wl_cdata->output.scale = e_scale; */
+ /* comp_wl->output.transform = WL_OUTPUT_TRANSFORM_NORMAL; */
+ /* comp_wl->output.scale = e_scale; */
ds_log_init(DS_DBG, _e_comp_wl_ds_log_handler);
- if (!e_compositor_init(wl_cdata->wl.disp))
+ if (!e_compositor_init(comp_wl->wl.disp))
{
ERR("Failed to initialize compositor");
goto comp_err;
}
/* initialize shm mechanism */
- wl_display_init_shm(wl_cdata->wl.disp);
+ wl_display_init_shm(comp_wl->wl.disp);
/* get the wayland display loop */
- wl_cdata->wl.loop = wl_display_get_event_loop(wl_cdata->wl.disp);
+ comp_wl->wl.loop = wl_display_get_event_loop(comp_wl->wl.disp);
/* get the file descriptor of the wayland event loop */
- fd = wl_event_loop_get_fd(wl_cdata->wl.loop);
+ fd = wl_event_loop_get_fd(comp_wl->wl.loop);
comp->client_created.notify = _e_comp_wl_cb_client_created;
wl_display_add_client_created_listener(comp->base.wl.disp, &comp->client_created);
// TODO: this function has to move to compmgr module
if (e_comp_gl_get())
- _e_comp_wl_gl_init(NULL);
+ _e_comp_wl_gl_init(comp_wl);
/* create a listener for wayland main loop events */
- wl_cdata->fd_hdlr =
+ comp_wl->fd_hdlr =
ecore_main_fd_handler_add(fd, (ECORE_FD_READ | ECORE_FD_ERROR),
- _e_comp_wl_cb_read, wl_cdata, NULL, NULL);
- ecore_main_fd_handler_prepare_callback_set(wl_cdata->fd_hdlr,
- _e_comp_wl_cb_prepare, wl_cdata);
+ _e_comp_wl_cb_read, comp_wl, NULL, NULL);
+ ecore_main_fd_handler_prepare_callback_set(comp_wl->fd_hdlr,
+ _e_comp_wl_cb_prepare, comp_wl);
/* add awake handler */
- ecore_main_awake_handler_add(_e_comp_wl_cb_awake, NULL);
+ ecore_main_awake_handler_add(_e_comp_wl_cb_awake, comp_wl);
- return EINA_TRUE;
+ return comp_wl;
comp_err:
e_env_unset("WAYLAND_DISPLAY");
sock_err:
- wl_display_destroy(wl_cdata->wl.disp);
+ wl_display_destroy(comp_wl->wl.disp);
disp_err:
g_mutex_clear(&connection_mutex);
+ e_comp_wl = NULL;
+ e_comp->wl_comp_data = NULL;
free(comp);
- return EINA_FALSE;
+ return NULL;
}
static void
EINTERN Eina_Bool
e_comp_wl_init(void)
{
+ E_Comp_Wl_Data *comp_wl;
+
TRACE_DS_BEGIN(COMP_WL:INIT);
/* try to create a wayland compositor */
- if (!_e_comp_wl_display_create())
+ if (!(comp_wl = _e_comp_wl_display_create()))
{
e_error_message_show(_("Enlightenment cannot create a Wayland Compositor!\n"));
TRACE_DS_END();
e_comp_wl_capture_init();
// TODO: make a file and call the init function at e_server_init func
- ds_single_pixel_buffer_manager_v1_create(e_comp_wl->wl.disp);
+ ds_single_pixel_buffer_manager_v1_create(comp_wl->wl.disp);
/* add event handlers to catch E events */
E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREEN_CHANGE, _e_comp_wl_cb_randr_change, NULL);
free(comp);
}
+EINTERN E_Comp_Wl_Data *
+e_comp_wl_get(void)
+{
+ return e_comp_wl;
+}
+
static void
e_comp_wl_surface_event_simple_free(void *d EINA_UNUSED, E_Event_Client *ev)
{