From: Changyeon Lee Date: Thu, 25 Jan 2024 08:28:36 +0000 (+0900) Subject: e_comp_object: add e_comp_object_color_visible_set_listener_add X-Git-Tag: accepted/tizen/unified/20240219.160457~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a882513a9fecb463df0e174e1d62c63e155de47;p=platform%2Fupstream%2Fenlightenment.git e_comp_object: add e_comp_object_color_visible_set_listener_add Change-Id: Ic3c291697bf59dd964b5520be66210a01880b9ef --- diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index ad8d0d767c..aa52406918 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -1238,6 +1238,96 @@ _e_comp_object_mouse_event_callback_unset(E_Comp_Object *cw) cw->set_mouse_callbacks = EINA_FALSE; } +static Eina_Bool +_e_comp_object_color_visible_set(E_Comp_Object *cw, Eina_Bool set) +{ + if (cw->color_visible == set) return EINA_TRUE; + + cw->color_visible = set; + + ELOGF("COMP", "color_visible set:%d", cw->ec, set); + + wl_signal_emit_mutable(&cw->events.color_visible_set, NULL); + + return EINA_TRUE; +} + +static void +_e_comp_object_color_visible_update(E_Comp_Object *cw) +{ + int a; + + e_comp_object_color_get(cw->smart_obj, NULL, NULL, NULL, &a); + if (a <= 0) + { + _e_comp_object_color_visible_set(cw, EINA_FALSE); + return; + } + + if (cw->effect_obj) + { + evas_object_color_get(cw->effect_obj, NULL, NULL, NULL, &a); + if (a <= 0) + { + _e_comp_object_color_visible_set(cw, EINA_FALSE); + return; + } + } + + + if (cw->shobj) + { + evas_object_color_get(cw->shobj, NULL, NULL, NULL, &a); + if (a <= 0) + { + _e_comp_object_color_visible_set(cw, EINA_FALSE); + return; + } + } + + if (cw->obj) + { + evas_object_color_get(cw->obj, NULL, NULL, NULL, &a); + if (a <= 0) + { + _e_comp_object_color_visible_set(cw, EINA_FALSE); + return; + } + } + + _e_comp_object_color_visible_set(cw, EINA_TRUE); +} + +static void +_e_comp_intercept_effect_obj_color_set(void *data, Evas_Object *obj, int r, int g, int b, int a) +{ + E_Comp_Object *cw = data; + + evas_object_color_set(obj, r, g, b, a); + + _e_comp_object_color_visible_update(cw); +} + +static void +_e_comp_intercept_shobj_color_set(void *data, Evas_Object *obj, int r, int g, int b, int a) +{ + E_Comp_Object *cw = data; + + evas_object_color_set(obj, r, g, b, a); + + _e_comp_object_color_visible_update(cw); +} + +static void +_e_comp_intercept_obj_color_set(void *data, Evas_Object *obj, int r, int g, int b, int a) +{ + E_Comp_Object *cw = data; + + evas_object_color_set(obj, r, g, b, a); + + _e_comp_object_color_visible_update(cw); +} + static void _e_comp_object_setup(E_Comp_Object *cw) { @@ -1249,11 +1339,13 @@ _e_comp_object_setup(E_Comp_Object *cw) evas_object_move(cw->effect_obj, cw->x, cw->y); evas_object_clip_set(cw->effect_obj, cw->clip); evas_object_smart_member_add(cw->effect_obj, cw->smart_obj); + evas_object_intercept_color_set_callback_add(cw->effect_obj, _e_comp_intercept_effect_obj_color_set, cw); e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", "e/comp/effects/none"); cw->shobj = edje_object_add(e_comp->evas); evas_object_data_set(cw->shobj, "comp_smart_obj", cw->smart_obj); edje_object_part_swallow(cw->effect_obj, "e.swallow.content", cw->shobj); edje_object_signal_callback_add(cw->shobj, "e,action,*,done", "e", _e_comp_object_done_defer, cw); + evas_object_intercept_color_set_callback_add(cw->shobj, _e_comp_intercept_shobj_color_set, cw); /* name objects appropriately for nicer printing when using e_comp_util_wins_print() */ if (cw->ec->override) @@ -2575,6 +2667,7 @@ _e_comp_intercept_show(void *data, Evas_Object *obj EINA_UNUSED) evas_object_image_smooth_scale_set(cw->obj, e_comp_config_get()->smooth_windows); evas_object_name_set(cw->obj, "cw->obj"); evas_object_image_colorspace_set(cw->obj, EVAS_COLORSPACE_ARGB8888); + evas_object_intercept_color_set_callback_add(cw->obj, _e_comp_intercept_obj_color_set, cw); } _e_comp_object_alpha_set(cw); @@ -2714,7 +2807,10 @@ _e_comp_intercept_color_set(void *data, Evas_Object *obj, int r, int g, int b, i } wl_signal_emit_mutable(&cw->events.color_set, NULL); + + _e_comp_object_color_visible_update(cw); } + //////////////////////////////////////////////////// static void @@ -3089,6 +3185,7 @@ _e_comp_smart_add(Evas_Object *obj) wl_signal_init(&cw->events.render_op_set); wl_signal_init(&cw->events.content_type_set); wl_signal_init(&cw->events.color_set); + wl_signal_init(&cw->events.color_visible_set); cw->smart_obj = obj; cw->x = cw->y = cw->w = cw->h = -1; @@ -3100,6 +3197,7 @@ _e_comp_smart_add(Evas_Object *obj) cw->transform_bg_color.g = 0; cw->transform_bg_color.b = 0; cw->transform_bg_color.a = 255; + cw->color_visible = EINA_TRUE; evas_object_data_set(obj, "comp_obj", cw); evas_object_move(obj, -1, -1); /* intercept ALL the callbacks! */ @@ -4560,13 +4658,16 @@ _e_comp_object_transparent_set(Evas_Object *obj, Eina_Bool set) if (set) { evas_object_color_get(obj, &r, &g, &b, &a); - evas_object_color_set(obj, 0, 0, 0, 0); cw->transparent.user_r = r; cw->transparent.user_g = g; cw->transparent.user_b = b; cw->transparent.user_a = a; + cw->transparent.setting = EINA_TRUE; + evas_object_color_set(obj, 0, 0, 0, 0); + cw->transparent.setting = EINA_FALSE; + ELOGF("COMP", "Transparent enabled user_color(%d,%d,%d,%d)", cw->ec, cw->transparent.user_r, @@ -5857,6 +5958,7 @@ e_comp_object_content_unset(Evas_Object *obj) evas_object_image_smooth_scale_set(cw->obj, e_comp_config_get()->smooth_windows); evas_object_name_set(cw->obj, "cw->obj"); evas_object_image_colorspace_set(cw->obj, EVAS_COLORSPACE_ARGB8888); + evas_object_intercept_color_set_callback_add(obj, _e_comp_intercept_obj_color_set, cw); _e_comp_object_alpha_set(cw); if (cw->shobj) @@ -6397,27 +6499,8 @@ EINTERN Eina_Bool e_comp_object_color_visible_get(Evas_Object *obj) { API_ENTRY EINA_FALSE; - int a; - - EINA_SAFETY_ON_NULL_RETURN_VAL(cw->ec, EINA_FALSE); - - e_comp_object_color_get(obj, NULL, NULL, NULL, &a); - if (a <= 0) - return EINA_FALSE; - - evas_object_color_get(cw->effect_obj, NULL, NULL, NULL, &a); - if (a <= 0) - return EINA_FALSE; - - evas_object_color_get(cw->shobj, NULL, NULL, NULL, &a); - if (a <= 0) - return EINA_FALSE; - - evas_object_color_get(cw->obj, NULL, NULL, NULL, &a); - if (a <= 0) - return EINA_FALSE; - return EINA_TRUE; + return cw->color_visible; } E_API Eina_Bool @@ -6541,7 +6624,7 @@ e_comp_object_color_get(Evas_Object *obj, int *r, int *g, int *b, int *a) { API_ENTRY; - if (cw->transparent.set) + if ((cw->transparent.set) || (cw->transparent.setting)) { if (r) *r = cw->transparent.user_r; if (g) *g = cw->transparent.user_g; @@ -6659,3 +6742,10 @@ e_comp_object_color_set_listener_add(Evas_Object *obj, struct wl_listener *liste API_ENTRY; wl_signal_add(&cw->events.color_set, listener); } + +EINTERN void +e_comp_object_color_visible_set_listener_add(Evas_Object *obj, struct wl_listener *listener) +{ + API_ENTRY; + wl_signal_add(&cw->events.color_visible_set, listener); +} diff --git a/src/bin/e_comp_object_intern.h b/src/bin/e_comp_object_intern.h index 0e94431d69..fdac341b98 100644 --- a/src/bin/e_comp_object_intern.h +++ b/src/bin/e_comp_object_intern.h @@ -132,6 +132,7 @@ struct _E_Comp_Object struct { Eina_Bool set; + Eina_Bool setting; int user_r; int user_g; int user_b; @@ -152,7 +153,10 @@ struct _E_Comp_Object struct wl_signal render_op_set; struct wl_signal content_type_set; struct wl_signal color_set; + struct wl_signal color_visible_set; } events; + + Eina_Bool color_visible; }; //#endif @@ -287,5 +291,6 @@ EINTERN void e_comp_object_image_filter_set_listener_add(Evas_Object *obj, struc EINTERN void e_comp_object_render_op_set_listener_add(Evas_Object *obj, struct wl_listener *listener); EINTERN void e_comp_object_content_type_set_listener_add(Evas_Object *obj, struct wl_listener *listener); EINTERN void e_comp_object_color_set_listener_add(Evas_Object *obj, struct wl_listener *listener); +EINTERN void e_comp_object_color_visible_set_listener_add(Evas_Object *obj, struct wl_listener *listener); #endif