EAPI void * e_modapi_init(E_Module *m) { Ecore_Evas *ee; E_Screen *screen; E_Comp *comp; int w, h; printf("LOAD WL_FB MODULE\n"); /* try to init ecore_x */ if (!ecore_fb_init(NULL)) { fprintf(stderr, "Could not initialize ecore_fb"); return NULL; } ecore_fb_size_get(&w, &h); ee = ecore_evas_fb_new(NULL, 0, w, h); comp = e_comp_new(); comp->comp_type = E_PIXMAP_TYPE_WL; comp->ee = ee; if (!e_xinerama_fake_screens_exist()) { screen = E_NEW(E_Screen, 1); screen->escreen = screen->screen = 0; screen->x = 0; screen->y = 0; screen->w = w; screen->h = h; e_xinerama_screens_set(eina_list_append(NULL, screen)); } comp->man = e_manager_new(0, comp, w, h); e_comp_wl_init(); e_comp_canvas_init(comp); e_comp_canvas_fake_layers_init(comp); comp->pointer = e_pointer_canvas_new(comp->evas, 1); ecore_wl_init(NULL); ecore_wl_server_mode_set(1); return m; }
E_API void * e_modapi_init(E_Module *m) { Ecore_Evas *ee; E_Screen *screen; int w, h; printf("LOAD WL_FB MODULE\n"); /* try to init ecore_x */ if (!ecore_fb_init(NULL)) { fprintf(stderr, "Could not initialize ecore_fb"); return NULL; } ecore_fb_size_get(&w, &h); ee = ecore_evas_fb_new(NULL, 0, w, h); e_comp->ee = ee; if (!e_xinerama_fake_screens_exist()) { screen = E_NEW(E_Screen, 1); screen->escreen = screen->screen = 0; screen->x = 0; screen->y = 0; screen->w = w; screen->h = h; e_xinerama_screens_set(eina_list_append(NULL, screen)); } e_comp_wl_init(); e_comp_canvas_init(w, h); e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE); ecore_wl_init(NULL); ecore_wl_server_mode_set(1); return m; }
/* external functions */ 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; 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; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!(method = evas_render_method_lookup("wayland_egl"))) { ERR("Render method lookup failed for Wayland_Egl"); return NULL; } count = ecore_wl_init(disp_name); if (!count) { ERR("Failed to initialize Ecore_Wayland"); return NULL; } else if (count == 1) ecore_wl_display_iterate(); if (!(ee = calloc(1, sizeof(Ecore_Evas)))) { ERR("Failed to allocate Ecore_Evas"); goto ee_err; } if (!(wdata = calloc(1, sizeof(Ecore_Evas_Engine_Wl_Data)))) { ERR("Failed to allocate Ecore_Evas_Engine_Wl_Data"); free(ee); goto ee_err; } ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); _ecore_evas_wl_common_init(); ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func; ee->engine.data = wdata; iface = _ecore_evas_wl_interface_new(); ee->engine.ifaces = eina_list_append(ee->engine.ifaces, iface); ee->driver = "wayland_egl"; if (disp_name) ee->name = strdup(disp_name); if (w < 1) w = 1; if (h < 1) h = 1; 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; ee->rotation = 0; ee->prop.max.w = 32767; ee->prop.max.h = 32767; ee->prop.layer = 4; ee->prop.request_pos = 0; ee->prop.sticky = 0; ee->prop.draw_frame = frame; ee->alpha = EINA_FALSE; ee->evas = evas_new(); evas_data_attach_set(ee->evas, ee); evas_output_method_set(ee->evas, method); evas_output_size_set(ee->evas, ee->w, ee->h); evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); /* FIXME: This needs to be set based on theme & scale */ if (ee->prop.draw_frame) evas_output_framespace_set(ee->evas, 4, 18, 8, 22); if (parent) p = ecore_wl_window_find(parent); /* FIXME: Get if parent is alpha, and set */ wdata->parent = p; wdata->win = ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW); ee->prop.window = wdata->win->id; if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) { einfo->info.display = ecore_wl_display_get(); einfo->info.destination_alpha = ee->alpha; einfo->info.rotation = ee->rotation; einfo->info.depth = 32; 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); goto err; } ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_common_pre_free); if (ee->prop.draw_frame) { wdata->frame = _ecore_evas_wl_common_frame_add(ee->evas); evas_object_is_frame_object_set(wdata->frame, EINA_TRUE); evas_object_move(wdata->frame, 0, 0); } _ecore_evas_register(ee); ecore_evas_input_event_register(ee); 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); return ee; err: ecore_evas_free(ee); _ecore_evas_wl_common_shutdown(); ee_err: ecore_wl_shutdown(); return NULL; }