From bd5efcd5d86ca07c259c264e0da34d5743fd694c Mon Sep 17 00:00:00 2001 From: Gwanglim Lee Date: Tue, 4 Aug 2015 16:34:44 +0900 Subject: [PATCH] fix coding conventions and style. Change-Id: I15c5416451f681c9363b2a2a263647c8b9f6a346 --- src/e_mod_main.c | 120 ++++++++++++++++++++++--------------------------------- src/e_mod_main.h | 0 2 files changed, 47 insertions(+), 73 deletions(-) mode change 100755 => 100644 src/e_mod_main.c mode change 100755 => 100644 src/e_mod_main.h diff --git a/src/e_mod_main.c b/src/e_mod_main.c old mode 100755 new mode 100644 index c5cc230..215d9ae --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -26,28 +26,14 @@ _e_eom_e_comp_wl_output_get(Eina_List *outputs, const char *id) EINA_LIST_FOREACH(outputs, l, output) { - if (!strcmp(output->id, id)) - return output; + if (!strcmp(output->id, id)) + return output; } return NULL; } static Eina_Bool -_e_eom_e_client_remove_cb(void *data, int type, void *event) -{ - E_Event_Client *ev = event; - E_Client *ec = ev->ec; - - (void) type; - (void) event; - (void) data; - - return ECORE_CALLBACK_PASS_ON; -} - - -static Eina_Bool _e_eom_ecore_drm_output_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { Ecore_Drm_Event_Output *e; @@ -64,7 +50,7 @@ _e_eom_ecore_drm_output_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *e if (!e->plug) goto end; EOM_DBG("id:%d (x,y,w,h):(%d,%d,%d,%d) (w_mm,h_mm):(%d,%d) refresh:%d subpixel_order:%d transform:%d make:%s model:%s plug:%d\n", - e->id, e->x, e->y, e->w, e->h, e->phys_width, e->phys_height, e->refresh, e->subpixel_order, e->transform, e->make, e->model, e->plug); + e->id, e->x, e->y, e->w, e->h, e->phys_width, e->phys_height, e->refresh, e->subpixel_order, e->transform, e->make, e->model, e->plug); if (!(cdata = e_comp->wl_comp_data)) goto end; @@ -78,24 +64,26 @@ _e_eom_ecore_drm_output_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *e goto end; } - /* TODO: we need ecore_drm_output_connector_get()/ecore_drm_output_conn_name_get() function to get the connector type */ - + /* TODO: + * we need ecore_drm_output_connector_get()/ecore_drm_output_conn_name_get() + * function to get the connector type + */ /* send notify in each outputs associated with e_comp_wl_output */ EINA_LIST_FOREACH(output->resources, l2, output_resource) { if (e->plug) - wl_eom_send_output_type(eom->resource, output_resource, eom_type, WL_EOM_STATUS_CONNECTION); + wl_eom_send_output_type(eom->resource, + output_resource, + eom_type, + WL_EOM_STATUS_CONNECTION); else - wl_eom_send_output_type(eom->resource, output_resource, eom_type, WL_EOM_STATUS_DISCONNECTION); + wl_eom_send_output_type(eom->resource, + output_resource, + eom_type, + WL_EOM_STATUS_DISCONNECTION); } -#if 0 - e_comp_wl_output_init(buff, e->make, e->model, e->x, e->y, e->w, e->h, - e->phys_width, e->phys_height, e->refresh, - e->subpixel_order, e->transform); -#endif - end: return ECORE_CALLBACK_PASS_ON; } @@ -112,34 +100,35 @@ _e_eom_ecore_drm_activate_cb(void *data, int type EINA_UNUSED, void *event) if (e->active) { - /* TODO: something do */ + /* TODO: do something */ } else { - /* TODO: something do */ + /* TODO: do something */ } end: return ECORE_CALLBACK_PASS_ON; } - /* wl_eom_set_keygrab request handler */ static void -_e_eom_wl_request_set_attribute_cb(struct wl_client *client, - struct wl_resource *resource, - struct wl_resource *output, - uint32_t attribute) +_e_eom_wl_request_set_attribute_cb(struct wl_client *client, struct wl_resource *resource, struct wl_resource *output, uint32_t attribute) { (void) client; (void) attribute; EOM_DBG("attribute:%d\n", attribute); - wl_eom_send_output_attribute(resource, output, attribute, WL_EOM_ATTRIBUTE_STATE_ACTIVE, WL_EOM_ERROR_NONE); + wl_eom_send_output_attribute(resource, + output, + attribute, + WL_EOM_ATTRIBUTE_STATE_ACTIVE, + WL_EOM_ERROR_NONE); } -static const struct wl_eom_interface _e_eom_wl_implementation = { +static const struct wl_eom_interface _e_eom_wl_implementation = +{ _e_eom_wl_request_set_attribute_cb }; @@ -147,9 +136,7 @@ static const struct wl_eom_interface _e_eom_wl_implementation = { static void _e_eom_wl_resource_destory_cb(struct wl_resource *resource) { - -/* TODO : destroy resources if exist */ - + /* TODO : destroy resources if exist */ } /* wl_eom global object bind function */ @@ -159,7 +146,10 @@ _e_eom_wl_bind_cb(struct wl_client *client, void *data, uint32_t version, uint32 E_EomPtr eom = data; struct wl_resource *resource; - resource = wl_resource_create(client, &wl_eom_interface, MIN(version, 1), id); + resource = wl_resource_create(client, + &wl_eom_interface, + MIN(version, 1), + id); if (!resource) { EOM_ERR("error. resource is null. (version :%d, id:%d)\n", version, id); @@ -167,7 +157,10 @@ _e_eom_wl_bind_cb(struct wl_client *client, void *data, uint32_t version, uint32 return; } - wl_resource_set_implementation(resource, &_e_eom_wl_implementation, eom, _e_eom_wl_resource_destory_cb); + wl_resource_set_implementation(resource, + &_e_eom_wl_implementation, + eom, + _e_eom_wl_resource_destory_cb); eom->resource = resource; @@ -177,11 +170,10 @@ _e_eom_wl_bind_cb(struct wl_client *client, void *data, uint32_t version, uint32 static void _e_eom_deinit() { - Ecore_Event_Handler *h = NULL; + Ecore_Event_Handler *h; if (!g_eom) return; - /* remove event handlers */ if (g_eom->handlers) { EINA_LIST_FREE(g_eom->handlers, h) @@ -191,7 +183,6 @@ _e_eom_deinit() if (g_eom->global) wl_global_destroy(g_eom->global); E_FREE(g_eom); - g_eom = NULL; } static Eina_Bool @@ -199,44 +190,29 @@ _e_eom_init() { E_Comp_Data *cdata = NULL; - g_eom = E_NEW(E_Eom, 1); - if (!g_eom) - { - EOM_ERR("error. fail to allocate the memory.\n"); - return EINA_FALSE; - } - - if (!e_comp) - { - EOM_ERR("error. e_comp is null.\n"); - goto err; - } + EINA_SAFETY_ON_NULL_GOTO(e_comp, err); cdata = e_comp->wl_comp_data; - if (!cdata) - { - EOM_ERR("error. e_comp->wl_comp_data is null.\n"); - goto err; - } + EINA_SAFETY_ON_NULL_GOTO(cdata, err); + + g_eom = E_NEW(E_Eom, 1); + EINA_SAFETY_ON_NULL_RETURN_VAL(g_eom, NULL); g_eom->cdata = cdata; - g_eom->global = wl_global_create(cdata->wl.disp, &wl_eom_interface, 1, g_eom, _e_eom_wl_bind_cb); - if (!g_eom->global) - { - EOM_ERR("error. g_eom->global is null.\n"); - goto err; - } + g_eom->global = wl_global_create(cdata->wl.disp, + &wl_eom_interface, + 1, + g_eom, + _e_eom_wl_bind_cb); + EINA_SAFETY_ON_NULL_GOTO(g_eom->global, err); - /* add event hanlders */ E_LIST_HANDLER_APPEND(g_eom->handlers, ECORE_DRM_EVENT_ACTIVATE, _e_eom_ecore_drm_activate_cb, g_eom); - E_LIST_HANDLER_APPEND(g_eom->handlers, ECORE_DRM_EVENT_OUTPUT, _e_eom_ecore_drm_output_cb, g_eom); - E_LIST_HANDLER_APPEND(g_eom->handlers, E_EVENT_CLIENT_REMOVE, _e_eom_e_client_remove_cb, g_eom); + E_LIST_HANDLER_APPEND(g_eom->handlers, ECORE_DRM_EVENT_OUTPUT, _e_eom_ecore_drm_output_cb, g_eom); return EINA_TRUE; err: _e_eom_deinit(); - return EINA_FALSE; } @@ -250,7 +226,6 @@ EAPI int e_modapi_shutdown(E_Module *m EINA_UNUSED) { _e_eom_deinit(); - return 1; } @@ -260,4 +235,3 @@ e_modapi_save(E_Module *m EINA_UNUSED) /* Save something to be kept */ return 1; } - diff --git a/src/e_mod_main.h b/src/e_mod_main.h old mode 100755 new mode 100644 -- 2.7.4