create e_comp during e_comp_init, set comp_type automatically

this simplifies comp creation slightly
This commit is contained in:
Mike Blumenkrantz 2015-04-22 16:58:00 -04:00
parent de0b1b2d39
commit e1181c4d03
6 changed files with 29 additions and 45 deletions

View File

@ -1016,6 +1016,8 @@ e_comp_init(void)
actions = eina_list_append(actions, act);
}
e_comp_new();
e_comp->comp_type = E_PIXMAP_TYPE_NONE;
{
const char *eng;
@ -1026,12 +1028,17 @@ e_comp_init(void)
snprintf(buf, sizeof(buf), "wl_%s", eng);
if (e_module_enable(e_module_new(buf)))
goto out;
{
e_comp->comp_type = E_PIXMAP_TYPE_WL;
goto out;
}
}
}
#ifndef HAVE_WAYLAND_ONLY
if (!e_comp_x_init())
if (e_comp_x_init())
e_comp->comp_type = E_PIXMAP_TYPE_X;
else
#endif
{
const char **test, *eng[] =
@ -1050,7 +1057,10 @@ e_comp_init(void)
for (test = eng; *test; test++)
{
if (e_module_enable(e_module_new(*test)))
goto out;
{
e_comp->comp_type = E_PIXMAP_TYPE_WL;
goto out;
}
}
return EINA_FALSE;
}

View File

@ -2309,12 +2309,8 @@ _e_comp_wl_compositor_create(void)
int fd = 0;
/* check for existing compositor. create if needed */
if (!e_comp)
{
e_comp_new();
e_comp->comp_type = E_PIXMAP_TYPE_WL;
E_OBJECT_DEL_SET(e_comp, _e_comp_wl_compositor_cb_del);
}
if (e_comp->comp_type == E_PIXMAP_TYPE_NONE)
E_OBJECT_DEL_SET(e_comp, _e_comp_wl_compositor_cb_del);
/* create new compositor data */
if (!(cdata = E_NEW(E_Comp_Data, 1)))

View File

@ -5196,8 +5196,6 @@ _e_comp_x_screens_setup(void)
if (!success) break;
}
if (!success) break;
e_comp_new();
e_comp->comp_type = E_PIXMAP_TYPE_X;
success = _e_comp_x_setup(root, rw, rh);
if (!success) break;
}

View File

@ -99,12 +99,6 @@ e_modapi_init(E_Module *m)
/* return NULL; */
/* } */
if (!e_comp)
{
e_comp_new();
e_comp->comp_type = E_PIXMAP_TYPE_WL;
}
if (e_comp_config_get()->engine == E_COMP_ENGINE_GL)
{
e_comp->ee = ecore_evas_new("gl_drm", 0, 0, 1, 1, NULL);

View File

@ -9,7 +9,6 @@ e_modapi_init(E_Module *m)
{
Ecore_Evas *ee;
E_Screen *screen;
E_Comp *comp;
int w, h;
printf("LOAD WL_FB MODULE\n");
@ -24,13 +23,7 @@ e_modapi_init(E_Module *m)
ecore_fb_size_get(&w, &h);
ee = ecore_evas_fb_new(NULL, 0, w, h);
if (!(comp = e_comp))
{
comp = e_comp_new();
comp->comp_type = E_PIXMAP_TYPE_WL;
}
comp->ee = ee;
e_comp->ee = ee;
if (!e_xinerama_fake_screens_exist())
{
@ -44,7 +37,7 @@ e_modapi_init(E_Module *m)
}
e_comp_canvas_init(w, h);
e_comp_wl_init();
comp->pointer = e_pointer_canvas_new(comp->ee, EINA_TRUE);
e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE);
ecore_wl_init(NULL);
ecore_wl_server_mode_set(1);

View File

@ -67,7 +67,6 @@ e_modapi_init(E_Module *m)
{
Ecore_Evas *ee;
E_Screen *screen;
E_Comp *comp;
int w = 0, h = 0;
printf("LOAD WL_X11 MODULE\n");
@ -75,20 +74,14 @@ e_modapi_init(E_Module *m)
ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
ecore_evas_callback_delete_request_set(ee, _cb_delete_request);
if (!(comp = e_comp))
{
comp = e_comp_new();
comp->comp_type = E_PIXMAP_TYPE_WL;
}
comp->ee = ee;
if (!comp->ee)
e_comp->ee = ee;
if (!e_comp->ee)
{
ERR("Could not create ecore_evas canvas");
return NULL;
}
ecore_evas_screen_geometry_get(comp->ee, NULL, NULL, &w, &h);
ecore_evas_screen_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
if (!e_xinerama_fake_screens_exist())
{
@ -104,24 +97,24 @@ e_modapi_init(E_Module *m)
if (!e_comp_canvas_init(w, h)) return NULL;
/* NB: This needs to be called AFTER comp_canvas has been setup as it
* makes reference to the comp->evas */
* makes reference to the e_comp->evas */
if (!e_comp_wl_init()) return NULL;
e_comp_wl_input_pointer_enabled_set(comp->wl_comp_data, EINA_TRUE);
e_comp_wl_input_keyboard_enabled_set(comp->wl_comp_data, EINA_TRUE);
e_comp_wl_input_pointer_enabled_set(e_comp->wl_comp_data, EINA_TRUE);
e_comp_wl_input_keyboard_enabled_set(e_comp->wl_comp_data, EINA_TRUE);
/* comp->pointer = */
/* e_pointer_window_new(ecore_evas_window_get(comp->ee), EINA_TRUE); */
comp->pointer = e_pointer_canvas_new(comp->ee, EINA_TRUE);
comp->pointer->color = EINA_TRUE;
/* e_comp->pointer = */
/* e_pointer_window_new(ecore_evas_window_get(e_comp->ee), EINA_TRUE); */
e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE);
e_comp->pointer->color = EINA_TRUE;
/* force a keymap update so compositor keyboard gets setup */
_cb_keymap_changed(comp->wl_comp_data, 0, NULL);
_cb_keymap_changed(e_comp->wl_comp_data, 0, NULL);
/* setup keymap_change event handler */
kbd_hdlr =
ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY,
_cb_keymap_changed, comp->wl_comp_data);
_cb_keymap_changed, e_comp->wl_comp_data);
return m;
}