From: MinJeong Kim Date: Wed, 17 Feb 2016 11:19:55 +0000 (+0900) Subject: Prepared for wayland X-Git-Tag: accepted/tizen/common/20160318.145521~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F63%2F53863%2F4;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-effect.git Prepared for wayland - removed e_comp_get - fixed skip for mouse_event - brought wayland options - refer buffer resource when buffer changed Change-Id: I3df895e3fcdbbc238a1253b325bbd74347cefe38 --- diff --git a/configure.ac b/configure.ac index d1e0713..79f2465 100644 --- a/configure.ac +++ b/configure.ac @@ -94,6 +94,18 @@ AC_ARG_ENABLE(homedir-install, [ datadir="${HOME}/.e/e/modules/${PACKAGE}" ] ) +have_wayland_only=no +AC_ARG_ENABLE([wayland-only], + AS_HELP_STRING([--enable-wayland-only],[enable wayland-only version of enlightenment @<:@default=disabled@:>@]), + [have_wayland_only=$enableval], + [have_wayland_only=no]) +AC_MSG_CHECKING([whether wayland-only version is enabled]) +if test "x${have_wayland_only}" != "xno"; then + AC_DEFINE_UNQUOTED([HAVE_WAYLAND_ONLY],[1],[enable wayland-only version of enlightenment]) + AC_DEFINE_UNQUOTED([HAVE_WAYLAND],[1],[enable wayland version]) +fi +AM_CONDITIONAL(HAVE_WAYLAND_ONLY, [test "x${have_wayland_only}" = xyes]) + dnl ======================================================================== # output files dnl ======================================================================== diff --git a/data/group/fade.edc b/data/group/fade.edc index 8ad3788..3ca7aa7 100644 --- a/data/group/fade.edc +++ b/data/group/fade.edc @@ -66,7 +66,6 @@ group { name: "e/comp/effects/fade"; } part { name: "shower"; type: SPACER; - mouse_events: 0; description { state: "default" 0.0; rel1.relative: 0.02 0.02; rel2.relative: 0.98 0.98; @@ -93,7 +92,6 @@ group { name: "e/comp/effects/fade"; part { name: "e.swallow.content"; type: SWALLOW; type: SWALLOW; clip_to: "clipper"; - mouse_events: 0; description { state: "default" 0.0; rel1.to: "shower"; rel2.to: "shower"; diff --git a/data/group/keyboard.edc b/data/group/keyboard.edc index 1442cf6..ae8dd2b 100644 --- a/data/group/keyboard.edc +++ b/data/group/keyboard.edc @@ -66,7 +66,6 @@ group { name: "e/comp/effects/keyboard"; } part { name: "shower"; type: SPACER; - mouse_events: 0; description { state: "default" 0.0; rel1.relative: 0 1; rel2.relative: 1 2; @@ -93,7 +92,6 @@ group { name: "e/comp/effects/keyboard"; part { name: "e.swallow.content"; type: SWALLOW; type: SWALLOW; clip_to: "clipper"; - mouse_events: 0; description { state: "default" 0.0; rel1.to: "shower"; rel2.to: "shower"; diff --git a/data/group/no_effect.edc b/data/group/no_effect.edc index bd23ae1..d61dd5e 100644 --- a/data/group/no_effect.edc +++ b/data/group/no_effect.edc @@ -45,7 +45,6 @@ group { name: "e/comp/effects/no-effect"; } part { name: "shower"; type: SPACER; - mouse_events: 0; description { state: "default" 0.0; rel1.relative: 0 0; rel2.relative: 1 1; @@ -66,7 +65,6 @@ group { name: "e/comp/effects/no-effect"; part { name: "e.swallow.content"; type: SWALLOW; type: SWALLOW; clip_to: "clipper"; - mouse_events: 0; description { state: "default" 0.0; rel1.to: "shower"; rel2.to: "shower"; diff --git a/packaging/e-mod-tizen-effect.spec b/packaging/e-mod-tizen-effect.spec index 231bc33..cc27e05 100644 --- a/packaging/e-mod-tizen-effect.spec +++ b/packaging/e-mod-tizen-effect.spec @@ -1,4 +1,5 @@ %bcond_with x +%bcond_with wayland Name: e-mod-tizen-effect Version: 0.0.2 @@ -15,9 +16,11 @@ BuildRequires: pkgconfig(edje) BuildRequires: gettext BuildRequires: edje-tools +## for wayland build plz remove below lines %if !%{with x} ExclusiveArch: %endif +### %description This package provides various window effect(animation) @@ -33,7 +36,11 @@ export CFLAGS+=" -Wall -g -fPIC -rdynamic ${GC_SECTIONS_FLAGS}" export LDFLAGS+=" -Wl,--hash-style=both -Wl,--as-needed -Wl,--rpath=/usr/lib" %autogen -%configure --prefix=/usr +%configure \ +%if %{with wayland} + --enable-wayland-only \ +%endif + --prefix=/usr make %install diff --git a/src/e_mod_effect.c b/src/e_mod_effect.c index 8228494..6cf7724 100644 --- a/src/e_mod_effect.c +++ b/src/e_mod_effect.c @@ -1,3 +1,6 @@ +#ifdef HAVE_WAYLAND + #define E_COMP_WL +#endif #include "e.h" #include "e_mod_effect.h" @@ -8,9 +11,40 @@ typedef struct _E_Effect_Client { E_Client *ec; unsigned int animating; +#ifdef HAVE_WAYLAND + E_Comp_Wl_Buffer_Ref buffer_ref; +#else E_Pixmap *ep; +#endif } E_Effect_Client; +static E_Effect_Client* +_e_mod_effect_client_new(E_Client *ec) +{ + E_Effect_Client* efc; + + efc = E_NEW(E_Effect_Client, 1); + efc->ec = ec; + efc->animating = 0; +#ifndef HAVE_WAYLAND + efc->ep = NULL; +#endif + + return efc; +} + +static E_Effect_Client * +_e_mod_effect_client_get(E_Client *ec) +{ + E_Effect_Client *efc; + + if (!_effect) return NULL; + + efc = eina_hash_find(_effect->clients, &ec); + + return efc; +} + static void _e_mod_effect_ref(E_Client *ec) { @@ -24,12 +58,14 @@ _e_mod_effect_ref(E_Client *ec) return; } - efc = eina_hash_find(_effect->clients, &ec); + efc = _e_mod_effect_client_get(ec); if (!efc) return; efc->animating ++; e_object_ref(E_OBJECT(ec)); +#ifndef HAVE_WAYLAND efc->ep = e_pixmap_ref(ec->pixmap); +#endif } static void @@ -39,14 +75,17 @@ _e_mod_effect_unref(E_Client *ec) if (!_effect) return; - efc = eina_hash_find(_effect->clients, &ec); + efc = _e_mod_effect_client_get(ec); if (!efc) return; while(efc->animating) { +#ifndef HAVE_WAYLAND e_pixmap_free(efc->ep); +#endif if (!e_object_unref(E_OBJECT(ec))) { + efc = NULL; eina_hash_del_by_key(_effect->clients, &ec); break; } @@ -54,7 +93,10 @@ _e_mod_effect_unref(E_Client *ec) efc->animating --; } - efc->ep = NULL; +#ifndef HAVE_WAYLAND + if (efc) + efc->ep = NULL; +#endif } static void @@ -89,7 +131,7 @@ _e_mod_effect_stack_update() _effect->stack.old = eina_list_free(_effect->stack.old); _effect->stack.old = eina_list_clone(_effect->stack.cur); - for (o = evas_object_top_get(_effect->comp->evas); o; o = evas_object_below_get(o)) + for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o)) { ec = evas_object_data_get(o, "E_Client"); if (!ec) continue; @@ -188,7 +230,7 @@ _e_mod_effect_cb_hidden_done(void *data, Evas_Object *obj, const char *sig, cons _e_mod_effect_unref(ec); - if (ec->iconic) + if (_e_mod_effect_client_get(ec)) evas_object_hide(ec->frame); } @@ -275,20 +317,6 @@ _e_mod_effect_cb_restack(void *data, Evas_Object *obj, const char *signal) return EINA_TRUE; } - -static E_Effect_Client* -_e_mod_effect_client_new(E_Client *ec) -{ - E_Effect_Client* efc; - - efc = E_NEW(E_Effect_Client, 1); - efc->ec = ec; - efc->animating = 0; - efc->ep = NULL; - - return efc; -} - static Eina_Bool _e_mod_effect_cb_client_add(void *data, int type, void *event) { @@ -299,11 +327,12 @@ _e_mod_effect_cb_client_add(void *data, int type, void *event) if (!_effect) return ECORE_CALLBACK_PASS_ON; ec = ev->ec; - efc = eina_hash_find(_effect->clients, &ec); + efc = _e_mod_effect_client_get(ec); if (!efc) { efc = _e_mod_effect_client_new(ec); - eina_hash_add(_effect->clients, &ec, efc); + if (efc) + eina_hash_add(_effect->clients, &ec, efc); } return ECORE_CALLBACK_PASS_ON; @@ -313,6 +342,7 @@ static Eina_Bool _e_mod_effect_cb_client_remove(void *data, int type, void *event) { E_Client *ec; + E_Effect_Client *efc = NULL; E_Event_Client *ev = event; if (!_effect) return ECORE_CALLBACK_PASS_ON; @@ -321,6 +351,12 @@ _e_mod_effect_cb_client_remove(void *data, int type, void *event) _effect->stack.old = eina_list_remove(_effect->stack.old, ec); _effect->stack.cur = eina_list_remove(_effect->stack.cur, ec); + if ((efc = _e_mod_effect_client_get(ec))) + { + if (!efc->animating) + eina_hash_del_by_key(_effect->clients, &ec); + } + return ECORE_CALLBACK_PASS_ON; } @@ -339,21 +375,56 @@ _e_mod_effect_cb_client_restack(void *data, int type, void *event) return ECORE_CALLBACK_PASS_ON; } +#ifdef HAVE_WAYLAND +static Eina_Bool +_e_mod_effect_cb_client_buffer_change(void *data, int ev_type, void *event) +{ + E_Event_Client *ev = event; + E_Client *ec; + E_Effect_Client *efc; + E_Comp_Wl_Buffer *buffer = NULL; + + ec = ev->ec; + if (!ec) return ECORE_CALLBACK_PASS_ON; + + efc = _e_mod_effect_client_get(ec); + if (!efc) return NULL; + + if (ec->pixmap) + { + buffer = e_pixmap_resource_get(ec->pixmap); + + if ((buffer) && (buffer != efc->buffer_ref.buffer)) + { + e_comp_wl_buffer_reference(&efc->buffer_ref, buffer); + } + } + + return ECORE_CALLBACK_PASS_ON; +} + +#endif static void _e_mod_effect_cb_client_data_free(void *data) { +#ifdef HAVE_WAYLAND + E_Effect_Client *efc = data; + + if (efc->buffer_ref.buffer) + e_comp_wl_buffer_reference(&efc->buffer_ref, NULL); + +#endif free(data); } EAPI Eina_Bool e_mod_effect_init(void) { - E_Comp *comp; E_Effect *effect; E_Comp_Config *config; + if (!e_comp) return EINA_FALSE; if (!(effect = E_NEW(E_Effect, 1))) return EINA_FALSE; - if (!(effect->comp = e_comp_get(NULL))) return EINA_FALSE; if ((config = e_comp_config_get())) { @@ -368,21 +439,20 @@ e_mod_effect_init(void) effect->clients = eina_hash_pointer_new(_e_mod_effect_cb_client_data_free); - effect->event_hdlrs = - eina_list_append(effect->event_hdlrs, - ecore_event_handler_add(E_EVENT_CLIENT_ADD, - _e_mod_effect_cb_client_add, - effect)); - effect->event_hdlrs = - eina_list_append(effect->event_hdlrs, - ecore_event_handler_add(E_EVENT_CLIENT_REMOVE, - _e_mod_effect_cb_client_remove, - effect)); - effect->event_hdlrs = - eina_list_append(effect->event_hdlrs, - ecore_event_handler_add(E_EVENT_CLIENT_STACK, - _e_mod_effect_cb_client_restack, - effect)); + E_LIST_HANDLER_APPEND(effect->event_hdlrs, E_EVENT_CLIENT_ADD, + _e_mod_effect_cb_client_add, effect); + + E_LIST_HANDLER_APPEND(effect->event_hdlrs, E_EVENT_CLIENT_REMOVE, + _e_mod_effect_cb_client_remove, effect); + + E_LIST_HANDLER_APPEND(effect->event_hdlrs, E_EVENT_CLIENT_STACK, + _e_mod_effect_cb_client_restack, effect); + +#ifdef HAVE_WAYLAND + E_LIST_HANDLER_APPEND(effect->event_hdlrs, E_EVENT_CLIENT_BUFFER_CHANGE, + _e_mod_effect_cb_client_buffer_change, effect); +#endif + effect->providers = eina_list_append(effect->providers, e_comp_object_effect_mover_add(100, diff --git a/src/e_mod_effect.h b/src/e_mod_effect.h index 45b463a..6a56e9b 100644 --- a/src/e_mod_effect.h +++ b/src/e_mod_effect.h @@ -5,8 +5,6 @@ typedef struct _E_Effect E_Effect; struct _E_Effect { - E_Comp *comp; - const char *file; const char *style;