discomfitor pushed a commit to branch master. http://git.enlightenment.org/core/enlightenment.git/commit/?id=e1181c4d033e764fb7b4024ad707da588b2f80a6
commit e1181c4d033e764fb7b4024ad707da588b2f80a6 Author: Mike Blumenkrantz <zm...@osg.samsung.com> Date: Wed Apr 22 16:58:00 2015 -0400 create e_comp during e_comp_init, set comp_type automatically this simplifies comp creation slightly --- src/bin/e_comp.c | 16 +++++++++++++--- src/bin/e_comp_wl.c | 8 ++------ src/bin/e_comp_x.c | 2 -- src/modules/wl_drm/e_mod_main.c | 6 ------ src/modules/wl_fb/e_mod_main.c | 11 ++--------- src/modules/wl_x11/e_mod_main.c | 31 ++++++++++++------------------- 6 files changed, 29 insertions(+), 45 deletions(-) diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index ea37d52..5efd3ad 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -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; } diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 719bcec..0977a8b 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -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))) diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c index e34fc98..569330c 100644 --- a/src/bin/e_comp_x.c +++ b/src/bin/e_comp_x.c @@ -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; } diff --git a/src/modules/wl_drm/e_mod_main.c b/src/modules/wl_drm/e_mod_main.c index b6cf3cc..e6f1691 100644 --- a/src/modules/wl_drm/e_mod_main.c +++ b/src/modules/wl_drm/e_mod_main.c @@ -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); diff --git a/src/modules/wl_fb/e_mod_main.c b/src/modules/wl_fb/e_mod_main.c index 3a1c596..406dbe1 100644 --- a/src/modules/wl_fb/e_mod_main.c +++ b/src/modules/wl_fb/e_mod_main.c @@ -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); diff --git a/src/modules/wl_x11/e_mod_main.c b/src/modules/wl_x11/e_mod_main.c index 7263893..8efd490 100644 --- a/src/modules/wl_x11/e_mod_main.c +++ b/src/modules/wl_x11/e_mod_main.c @@ -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; } --