From 28d74a0f6aa87a8c744423015b40de36a9f888cd Mon Sep 17 00:00:00 2001 From: MinJeong Kim Date: Tue, 6 Jan 2015 14:39:52 +0900 Subject: [PATCH 2/8] Added Show/Hide/Restack Effect Change-Id: I8aa2aea4113c798b596be61332527a7899f84330 Signed-off-by: MinJeong Kim --- Makefile.am | 12 ++ autogen.sh | 10 ++ configure.ac | 116 ++++++++++++++++ data/Makefile.am | 19 +++ data/effect.edc | 16 +++ data/group/fade.edc | 174 ++++++++++++++++++++++++ data/group/no_effect.edc | 114 ++++++++++++++++ packaging/e-mod-tizen-effect.spec | 53 ++++++++ src/Makefile.am | 18 +++ src/e_mod_effect.c | 274 ++++++++++++++++++++++++++++++++++++++ src/e_mod_effect.h | 7 + src/e_mod_main.c | 28 ++++ src/e_mod_main.h | 11 ++ 13 files changed, 852 insertions(+) create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 data/Makefile.am create mode 100644 data/effect.edc create mode 100644 data/group/fade.edc create mode 100644 data/group/no_effect.edc create mode 100644 packaging/e-mod-tizen-effect.spec create mode 100644 src/Makefile.am create mode 100644 src/e_mod_effect.c create mode 100644 src/e_mod_effect.h create mode 100644 src/e_mod_main.c create mode 100644 src/e_mod_main.h diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..e0485d2 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,12 @@ +#maintainer-clean removes everything +MAINTAINERCLEANFILES = aclocal.m4 compile config.sub config.guess config.h.in \ + configure depcomp install-sh ltmain.sh Makefile.in missing + +SUBDIRS = src \ + data + +filesdir = $(datadir) + +uninstall: + rm -rf $(DESTDIR)$(datadir) + diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..5a30991 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +set -x +aclocal +autoconf +libtoolize --copy --force +autoheader +automake --foreign --add-missing --copy + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..d1e0713 --- /dev/null +++ b/configure.ac @@ -0,0 +1,116 @@ +# Process this file with autoconf to produce a configure script. +dnl Process this file with autoconf to produce a configure script. + +# Note ) +# +# AC_DEFINE(VARIABLE, VALUE, DESCRIPTION) +# output the following to config.h +# /* DESCRIPTION */ +# #define VARIABLE VALUE +# +# AC_SUBST(VARIABLE, [VALUE]) +# define $(VARIABLE) as VALUE in Makefile + +dnl ======================================================================== +# initialization +dnl ======================================================================== +AC_INIT([e-mod-tizen-effect], [0.1], [minjjj.kim@samsung.com]) + +# check for tools needed by automake generated Makefiles +# -Wall : Turn all warnings on. +# -Werror: report warings as errors. +# foreign: relax some GNU standard requirements +#AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AM_INIT_AUTOMAKE([-Wall foreign]) + +dnl ======================================================================== +# checks for programs +dnl ======================================================================== +AC_PROG_CC +AC_DISABLE_STATIC +AC_PROG_LIBTOOL + +dnl ======================================================================== +# checks for libraries +dnl ======================================================================== + +dnl ======================================================================== +# checks for header files +dnl ======================================================================== +#AC_HEADER_STDC +AC_CHECK_HEADERS([math.h fcntl.h stdlib.h string.h unistd.h]) + +dnl ======================================================================== +# checks for typedefs, structures, and compiler characteristics +AC_C_CONST + +dnl ======================================================================== +# checks for library functions +dnl ======================================================================== +#AC_FUNC_MALLOC +AC_FUNC_MMAP +AC_CHECK_FUNCS([memset munmap strcasecmp strdup]) + +dnl ======================================================================== +# checks for pkg-config +dnl ======================================================================== +PKG_PROG_PKG_CONFIG + + +dnl ======================================================================== +# checks for pkg-config +dnl ======================================================================== +PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment]) +AC_SUBST(ENLIGHTENMENT_CFLAGS) +AC_SUBST(ENLIGHTENMENT_LIBS) + +# Find edje_cc +PKG_CHECK_MODULES(EDJE, [edje >= 1.0.0]) +AC_ARG_WITH(edje-cc, + AC_HELP_STRING([--with-edje-cc=PATH], [specify a specific path to edje_cc]), + [ + v=$withval; + EDJE_CC=$v + ], + [ + EDJE_CC=$(pkg-config --variable=prefix edje)/bin/edje_cc + ] +) +AC_SUBST(EDJE_CC) +AC_MSG_CHECKING([Which edje_cc to use]) +AC_MSG_RESULT(${EDJE_CC}) + + +dnl ======================================================================= + +release=$(pkg-config --variable=release enlightenment) +MODULE_ARCH="$host_os-$host_cpu-$release" +AC_SUBST(MODULE_ARCH) +AC_DEFINE_UNQUOTED(MODULE_ARCH, "$MODULE_ARCH", "Module architecture") + +datadir=$(pkg-config --variable=modules enlightenment)/${PACKAGE} +AC_ARG_ENABLE(homedir-install, + AS_HELP_STRING([--enable-homedir-install], [Install module in homedir]), + [ datadir="${HOME}/.e/e/modules/${PACKAGE}" ] +) + +dnl ======================================================================== +# output files +dnl ======================================================================== + +# create HEADER for all HEADER.in. +# HEADERS contain definitions made with AC_DEFINE. +# the following command will create config.h from config.h.in +AC_CONFIG_HEADERS([config.h]) + +# create FILE for all FILE.in. +# FILES contains definitions made with AC_SUBST. +AC_CONFIG_FILES([ + Makefile + src/Makefile + data/Makefile + ]) + +AC_OUTPUT + + diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 0000000..d3f4d74 --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,19 @@ +MAINTAINERCLEANFILES = Makefile.in + +EDJE_CC = @EDJE_CC@ +EDJE_CC_FLAGS = -v + +filesdir = /usr/share/enlightenment/data/themes +files_DATA = effect.edj + +EXTRA_DIST = \ +effect.edc + +effect.edj: Makefile $(EXTRA_DIST) + $(EDJE_CC) $(EDJE_FLAGS) \ + $(top_srcdir)/data/effect.edc \ + $(top_builddir)/data/effect.edj + +clean-local: + rm -f *.edj + diff --git a/data/effect.edc b/data/effect.edc new file mode 100644 index 0000000..9640e49 --- /dev/null +++ b/data/effect.edc @@ -0,0 +1,16 @@ +#define COMP_EFFECT_DURATION 0.4 +#define COMP_EFFECT_DURATION_FAST 0.2 + +collections { + + /*-----------------------------------------------------*/ + /* group "e/comp/effects/no-effect" */ + /*-----------------------------------------------------*/ + #include "group/no_effect.edc" + + /*-----------------------------------------------------*/ + /* group "e/comp/effects/fade" */ + /*-----------------------------------------------------*/ + #include "group/fade.edc" +} + diff --git a/data/group/fade.edc b/data/group/fade.edc new file mode 100644 index 0000000..8ad3788 --- /dev/null +++ b/data/group/fade.edc @@ -0,0 +1,174 @@ +group { name: "e/comp/effects/fade"; + script { + public message(Msg_Type:type, id, ...) { + if ((type == MSG_INT_SET) && (id == 0)) { + /*set state */ + new st; + st = getarg(2); + if (st == 0) + { + set_state(PART:"clipper", "default", 0.0); + set_state(PART:"shower", "default", 0.0); + } + else if (st == 1) + { + set_state(PART:"clipper", "visible", 0.0); + set_state(PART:"shower", "visible", 0.0); + } + else if (st == 2) + { + set_state(PART:"clipper", "restack_hidden", 0.0); + set_state(PART:"shower", "restack_hidden", 0.0); + } + else if (st == 3) + { + set_state(PART:"clipper", "restack_visible", 0.0); + set_state(PART:"shower", "restack_visible", 0.0); + } + else if (st == 4) + { + set_state(PART:"clipper", "restack_done", 0.0); + set_state(PART:"shower", "restack_done", 0.0); + } + } else if ((type == MSG_INT_SET) && (id == 1)) + { + } + } + } + parts { + part { name: "clipper"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + color: 255 255 255 0; + rel1.relative: -1.0 -1.0; + rel1.offset: -9999 -9999; + rel2.relative: 2.0 2.0; + rel2.offset: 9999 9999; + visible: 1; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + description { state: "hide" 0.0; + inherit: "default" 0.0; + } + description { state: "restack_visible" 0.0; + inherit: "visible" 0.0; + } + description { state: "restack_hidden" 0.0; + inherit: "default" 0.0; + } + description { state: "restack_done" 0.0; + inherit: "visible" 0.0; + } + } + 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; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + rel1.relative: 0 0; + rel1.offset: 0 0; + rel2.relative: 1 1; + } + description { state: "hide" 0.0; + inherit: "default" 0.0; + } + description { state: "restack_visible" 0.0; + inherit: "visible" 0.0; + } + description { state: "restack_hidden" 0.0; + inherit: "default" 0.0; + } + description { state: "restack_done" 0.0; + inherit: "visible" 0.0; + } + } + 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"; + } + description { state: "visible" 0.0; + rel1.to: "shower"; + rel2.to: "shower"; + } + description { state: "hide" 0.0; + rel1.to: "shower"; + rel2.to: "shower"; + } + } + } + programs { + program { name: "show1"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "default"; + action: STATE_SET "visible" 0.0; + transition: ACCELERATE COMP_EFFECT_DURATION_FAST; + target: "shower"; + target: "clipper"; + target: "e.swallow.content"; + after: "done"; + } + program { name: "hide1"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "visible"; + action: STATE_SET "hide" 0.0; + transition: ACCELERATE COMP_EFFECT_DURATION_FAST; + target: "shower"; + target: "clipper"; + after: "hide2"; + } + program { name: "hide2"; + action: STATE_SET "default" 0.0; + target: "shower"; + target: "clipper"; + after: "done"; + } + program { name: "restack,hide"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "restack_visible"; + action: STATE_SET "hide" 0.0; + transition: ACCELERATE COMP_EFFECT_DURATION_FAST; + target: "shower"; + target: "clipper"; + after: "done"; + } + program { name: "restack,show"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "restack_hidden"; + action: STATE_SET "visible" 0.0; + transition: ACCELERATE COMP_EFFECT_DURATION_FAST; + target: "shower"; + target: "clipper"; + target: "e.swallow.content"; + after: "done"; + } + program { name: "restack,finish"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "restack_done"; + action: STATE_SET "visible" 0.0; + target: "shower"; + target: "clipper"; + target: "e.swallow.content"; + after: "done"; + } + program { name: "done"; + action: SIGNAL_EMIT "e,action,done" "e"; + } + } +} diff --git a/data/group/no_effect.edc b/data/group/no_effect.edc new file mode 100644 index 0000000..bd23ae1 --- /dev/null +++ b/data/group/no_effect.edc @@ -0,0 +1,114 @@ +group { name: "e/comp/effects/no-effect"; + alias: "e/comp/effects/none"; + script { + public message(Msg_Type:type, id, ...) { + if ((type == MSG_INT_SET) && (id == 0)) { + /*set state */ + new st; + st = getarg(2); + if (st == 0) + { + set_state(PART:"clipper", "default", 0.0); + set_state(PART:"shower", "default", 0.0); + set_state(PART:"e.swallow.content", "default", 0.0); + } + else if (st == 1) + { + set_state(PART:"clipper", "visible", 0.0); + set_state(PART:"shower", "visible", 0.0); + set_state(PART:"e.swallow.content", "visible", 0.0); + } + } else if ((type == MSG_INT_SET) && (id == 1)) + { + } + } + } + parts { + part { name: "clipper"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + color: 255 255 255 255; + rel1.relative: -1.0 -1.0; + rel1.offset: -9999 -9999; + rel2.relative: 2.0 2.0; + rel2.offset: 9999 9999; + visible: 1; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + description { state: "hide" 0.0; + inherit: "default" 0.0; + } + } + part { name: "shower"; + type: SPACER; + mouse_events: 0; + description { state: "default" 0.0; + rel1.relative: 0 0; + rel2.relative: 1 1; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + rel1.relative: 0 0; + rel1.offset: 0 0; + rel2.relative: 1 1; + } + description { state: "hide" 0.0; + inherit: "default" 0.0; + rel1.relative: 0.0 0.0; + rel1.offset: 0 0; + rel2.relative: 1.0 1.0; + } + } + 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"; + } + description { state: "visible" 0.0; + rel1.to: "shower"; + rel2.to: "shower"; + } + description { state: "hide" 0.0; + rel1.to: "shower"; + rel2.to: "shower"; + } + } + } + programs { + program { name: "show1"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "default"; + action: STATE_SET "visible" 0.0; + target: "shower"; + target: "clipper"; + target: "e.swallow.content"; + after: "done"; + } + program { name: "hide1"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "visible"; + action: STATE_SET "hide" 0.0; + target: "shower"; + target: "clipper"; + after: "hide2"; + } + program { name: "hide2"; + action: STATE_SET "default" 0.0; + target: "shower"; + target: "clipper"; + after: "done"; + } + program { name: "done"; + action: SIGNAL_EMIT "e,action,done" "e"; + } + } +} diff --git a/packaging/e-mod-tizen-effect.spec b/packaging/e-mod-tizen-effect.spec new file mode 100644 index 0000000..5a0d7ab --- /dev/null +++ b/packaging/e-mod-tizen-effect.spec @@ -0,0 +1,53 @@ +Name: e-mod-tizen-effect +Version: 0.0.1 +Release: 1 +Summary: The effect module for the enlightenment +URL: http://www.enlightenment.org +Group: Graphics & UI Framework/Other +Source0: %{name}-%{version}.tar.gz +License: BSD-2-Clause +BuildRequires: pkgconfig(enlightenment) +BuildRequires: pkgconfig(eina) +BuildRequires: pkgconfig(ecore) +BuildRequires: pkgconfig(edje) +BuildRequires: gettext +BuildRequires: edje-tools + +%description +This package provides various window effect(animation) +as one module of enlightenment. + +%prep +%setup -q + +%build + +export GC_SECTIONS_FLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections" +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 +make + +%install +rm -rf %{buildroot} + +# for license notification +#mkdir -p %{buildroot}/usr/share/license +#cp -a %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/%{name} + +# install +make install DESTDIR=%{buildroot} + +# clear useless textual files +find %{buildroot}/usr/lib/enlightenment/modules/%{name} -name *.la | xargs rm +#find %{buildroot}/usr/lib/enlightenment/modules/%{name} -name *.a | xargs rm + + +%files +%defattr(-,root,root,-) +%{_libdir}/enlightenment/modules/e-mod-tizen-effect +%{_datadir}/enlightenment/data/themes +#/usr/share/license/%{name} + diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..0da8baa --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,18 @@ +MAINTAINERCLEANFILES = Makefile.in +MODULE = e-mod-tizen-effect + +LDFLAGS += + +pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la +module_la_SOURCES = e_mod_main.c \ + e_mod_main.h \ + e_mod_effect.c \ + e_mod_effect.h +module_la_LIBADD = +module_la_CFLAGS = @ENLIGHTENMENT_CFLAGS@ +module_la_LDFLAGS = -module -avoid-version @ENLIGHTENMENT_LIBS@ +module_la_DEPENDENCIES = $(top_builddir)/config.h + +#uninstall: +# rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE) diff --git a/src/e_mod_effect.c b/src/e_mod_effect.c new file mode 100644 index 0000000..9e37b5d --- /dev/null +++ b/src/e_mod_effect.c @@ -0,0 +1,274 @@ +#include "e.h" +#include "e_mod_effect.h" + +E_Comp *_comp = NULL; +Eina_List *_providers = NULL; +Eina_List *_event_hdlrs = NULL; +Eina_List *_stack = NULL; + +static void +_e_mod_effect_object_setup(E_Client *ec) +{ + E_Comp_Config *config; + config = e_comp_config_get(); + + if ((config) && (config->effect_style)) + { + e_comp_object_effect_set(ec->frame , config->effect_style); + } + else + e_comp_object_effect_set(ec->frame, "no-effect"); +} + +static void +_e_mod_effect_stack_update() +{ + E_Client *ec; + Evas_Object *o; + + for (o = evas_object_top_get(_comp->evas); o; o = evas_object_below_get(o)) + { + ec = evas_object_data_get(o, "E_Client"); + if (!ec) continue; + if (!e_util_strcmp(evas_object_name_get(o), "layer_obj")) continue; + + _stack = eina_list_remove(_stack, ec); + _stack = eina_list_append(_stack, ec); + } +} + +static const char* +_e_mod_effect_restack_effect_check(E_Client *ec) +{ + Evas_Object *o; + const char* emission = NULL; + Eina_List *l; + E_Client *_ec; + + if (!ec->visible) return NULL; + if (ec->new_client) return NULL; + + o = evas_object_above_get(ec->frame); + if (o == _comp->layers[e_comp_canvas_layer_map(ec->layer)].obj) + { + if (_stack) + { + EINA_LIST_FOREACH(_stack, l, _ec) + { + if (_ec == ec) break; + if ((_ec->iconic) || (!_ec->visible)) continue; + + emission = "e,action,restack,show"; + } + } + else + emission = "e,action,restack,show"; + } + else + { + _ec = evas_object_data_get(o, "E_Client"); + if ((_ec) && (_ec->layer == ec->layer)) + { + if (_stack) + { + EINA_LIST_FOREACH(_stack, l, _ec) + { + if (_ec->layer > ec->layer) continue; + if ((_ec->iconic) || (!_ec->visible)) continue; + if (_ec != ec) break; + + emission = "e,action,restack,hide"; + } + } + else + emission = "e,action,restack,hide"; + } + } + + return emission; +} + +static Eina_Bool +_e_mod_effect_cb_client_remove(void *data, int type, void *event) +{ + E_Client *ec; + E_Event_Client *ev = event; + + ec = ev->ec; + _stack = eina_list_remove(_stack, ec); + + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_e_mod_effect_cb_client_restack(void *data, int type, void *event) +{ + E_Client *ec; + E_Event_Client *ev = event; + const char* emission = NULL; + + ec = ev->ec; + + if ((emission = _e_mod_effect_restack_effect_check(ec))) + e_comp_object_signal_emit(ec->frame, emission, "e"); + + _e_mod_effect_stack_update(); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_e_mod_effect_cb_visible(void *data, Evas_Object *obj, const char *signal) +{ + E_Client *ec; + + ec = e_comp_object_client_get(obj); + + _e_mod_effect_object_setup(ec); + e_comp_object_effect_params_set(ec->frame, 0, (int[]){0}, 1); + e_comp_object_effect_start(ec->frame, NULL, NULL); + + return EINA_TRUE; +} + +static void +_e_mod_effect_cb_hidden_done(void *data, Evas_Object *obj, const char *sig, const char *src) +{ + E_Client *ec; + ec = (E_Client*) data; + + if (ec->iconic) + evas_object_hide(ec->frame); +} + +static Eina_Bool +_e_mod_effect_cb_hidden(void *data, Evas_Object *obj, const char *signal) +{ + E_Client *ec; + + ec = e_comp_object_client_get(obj); + + _e_mod_effect_object_setup(ec); + e_comp_object_effect_params_set(ec->frame, 0, (int[]){1}, 1); + e_comp_object_effect_start(ec->frame, _e_mod_effect_cb_hidden_done, ec); + + return EINA_TRUE; +} + +static void +_e_mod_effect_cb_restack_show_done(void *data, Evas_Object *obj, const char *sig, const char *src) +{ + E_Client *ec; + + ec = (E_Client*)data; + evas_object_layer_set(ec->frame, ec->layer); + ec->layer_block = 0; + _e_mod_effect_stack_update(); +} + +static void +_e_mod_effect_cb_restack_hide_done(void *data, Evas_Object *obj, const char *sig, const char *src) +{ + E_Client *ec = data; + + ec = (E_Client*)data; + evas_object_layer_set(ec->frame, ec->layer); + ec->layer_block = 0; + _e_mod_effect_stack_update(); + + e_comp_object_signal_emit(ec->frame, "e,action,restack,finish", "e"); +} + +static Eina_Bool +_e_mod_effect_cb_restack(void *data, Evas_Object *obj, const char *signal) +{ + E_Client *ec; + + ec = e_comp_object_client_get(obj); + _e_mod_effect_object_setup(ec); + + if ((!e_util_strcmp(signal, "e,action,restack,show"))) + { + ec->layer_block = 1; + evas_object_layer_set(ec->frame, E_LAYER_CLIENT_PRIO); + e_comp_object_effect_params_set(ec->frame, 0, (int[]){2}, 1); + e_comp_object_effect_start(ec->frame, _e_mod_effect_cb_restack_show_done, ec); + } + else if (!e_util_strcmp(signal, "e,action,restack,hide")) + { + ec->layer_block = 1; + evas_object_layer_set(ec->frame, E_LAYER_CLIENT_PRIO); + e_comp_object_effect_params_set(ec->frame, 0, (int[]){3}, 1); + e_comp_object_effect_start(ec->frame, _e_mod_effect_cb_restack_hide_done, ec); + } + else if (!e_util_strcmp(signal, "e,action,restack,finish")) + { + e_comp_object_effect_params_set(ec->frame, 0, (int[]){4}, 1); + e_comp_object_effect_start(ec->frame, NULL, NULL); + } + + return EINA_TRUE; +} + +EAPI Eina_Bool +e_mod_effect_init() +{ + if (!(_comp = e_comp_get(NULL))) + return EINA_FALSE; + + _event_hdlrs = + eina_list_append(_event_hdlrs, + ecore_event_handler_add(E_EVENT_CLIENT_STACK, + _e_mod_effect_cb_client_restack, + _comp)); + _event_hdlrs = + eina_list_append(_event_hdlrs, + ecore_event_handler_add(E_EVENT_CLIENT_REMOVE, + _e_mod_effect_cb_client_remove, + _comp)); + _providers = + eina_list_append(_providers, + e_comp_object_effect_mover_add(100, + "e,state,visible", + _e_mod_effect_cb_visible, + _comp)); + _providers = + eina_list_append(_providers, + e_comp_object_effect_mover_add(100, + "e,state,hidden", + _e_mod_effect_cb_hidden, + _comp)); + _providers = + eina_list_append(_providers, + e_comp_object_effect_mover_add(100, + "e,action,iconify", + _e_mod_effect_cb_hidden, + _comp)); + _providers = + eina_list_append(_providers, + e_comp_object_effect_mover_add(100, + "e,action,uniconify", + _e_mod_effect_cb_visible, + _comp)); + _providers = + eina_list_append(_providers, + e_comp_object_effect_mover_add(100, + "e,action,restack*", + _e_mod_effect_cb_restack, + _comp)); + return EINA_TRUE; +} + +EAPI void +e_mod_effect_shutdown() +{ + E_Comp_Object_Mover *prov = NULL; + Ecore_Event_Handler *hdl = NULL; + + EINA_LIST_FREE(_providers, prov) + e_comp_object_effect_mover_del(prov); + + EINA_LIST_FREE(_event_hdlrs, hdl) + ecore_event_handler_del(hdl); + + _comp = NULL; +} diff --git a/src/e_mod_effect.h b/src/e_mod_effect.h new file mode 100644 index 0000000..30237d6 --- /dev/null +++ b/src/e_mod_effect.h @@ -0,0 +1,7 @@ +#ifndef E_MOD_EFFECT_H +#define E_MOD_EFFECT_H + +EAPI Eina_Bool e_mod_effect_init(void); +EAPI void e_mod_effect_shutdown(void); + +#endif diff --git a/src/e_mod_main.c b/src/e_mod_main.c new file mode 100644 index 0000000..60b932a --- /dev/null +++ b/src/e_mod_main.c @@ -0,0 +1,28 @@ +#include "e.h" +#include "e_mod_main.h" +#include "e_mod_effect.h" + +EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Effect Module" }; + +EAPI void * +e_modapi_init(E_Module *m) +{ + if (!e_mod_effect_init()) + return NULL; + + return m; +} +EAPI int +e_modapi_shutdown(E_Module *m EINA_UNUSED) +{ + e_mod_effect_shutdown(); + + return 1; +} + +EAPI int +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 new file mode 100644 index 0000000..474c1f2 --- /dev/null +++ b/src/e_mod_main.h @@ -0,0 +1,11 @@ +#ifndef E_MOD_MAIN_H +#define E_MOD_MAIN_H + +/*** E Module ***/ +EAPI extern E_Module_Api e_modapi; + +EAPI void *e_modapi_init (E_Module *m); +EAPI int e_modapi_shutdown (E_Module *m); +EAPI int e_modapi_save (E_Module *m); + +#endif -- 2.7.4 From 31be553e6a1095e80e4e593b4477865903bae586 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 6 Jan 2015 16:00:38 +0900 Subject: [PATCH 3/8] fix build error for aarch64 and wayland Change-Id: I853446fcaf845f3d17265dfdbfee1b8debac9279 --- packaging/e-mod-tizen-effect.spec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packaging/e-mod-tizen-effect.spec b/packaging/e-mod-tizen-effect.spec index 5a0d7ab..39893c3 100644 --- a/packaging/e-mod-tizen-effect.spec +++ b/packaging/e-mod-tizen-effect.spec @@ -1,3 +1,5 @@ +%bcond_with x + Name: e-mod-tizen-effect Version: 0.0.1 Release: 1 @@ -13,6 +15,10 @@ BuildRequires: pkgconfig(edje) BuildRequires: gettext BuildRequires: edje-tools +%if !%{with x} +ExclusiveArch: +%endif + %description This package provides various window effect(animation) as one module of enlightenment. @@ -41,8 +47,7 @@ rm -rf %{buildroot} make install DESTDIR=%{buildroot} # clear useless textual files -find %{buildroot}/usr/lib/enlightenment/modules/%{name} -name *.la | xargs rm -#find %{buildroot}/usr/lib/enlightenment/modules/%{name} -name *.a | xargs rm +find %{buildroot}%{_libdir}/enlightenment/modules/%{name} -name *.la | xargs rm %files -- 2.7.4 From 42b5d22b37c9b708117c06ddd50811c001a9adc8 Mon Sep 17 00:00:00 2001 From: MinJeong Kim Date: Tue, 6 Jan 2015 16:34:51 +0900 Subject: [PATCH 4/8] Added COPYING file Change-Id: Ie31806c7954b8f285b537c97b35ca0eb980359e1 Signed-off-by: MinJeong Kim --- COPYING | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 COPYING diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..f3bbff3 --- /dev/null +++ b/COPYING @@ -0,0 +1,25 @@ +Copyright notice for Enlightenment: + +Copyright (C) 2000-2012 Carsten Haitzler and various contributors (see AUTHORS) + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- 2.7.4 From a48ad4d5f1951f2c4b685021b88b193ffc361840 Mon Sep 17 00:00:00 2001 From: MinJeong Kim Date: Tue, 6 Jan 2015 16:47:05 +0900 Subject: [PATCH 5/8] Packaging with license file Change-Id: Ib97fc78e3e9a5936819d0b125a26966cda7c77b3 Signed-off-by: MinJeong Kim --- packaging/e-mod-tizen-effect.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/e-mod-tizen-effect.spec b/packaging/e-mod-tizen-effect.spec index 39893c3..e626687 100644 --- a/packaging/e-mod-tizen-effect.spec +++ b/packaging/e-mod-tizen-effect.spec @@ -40,8 +40,8 @@ make rm -rf %{buildroot} # for license notification -#mkdir -p %{buildroot}/usr/share/license -#cp -a %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/%{name} +mkdir -p %{buildroot}/usr/share/license +cp -a %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/%{name} # install make install DESTDIR=%{buildroot} @@ -54,5 +54,5 @@ find %{buildroot}%{_libdir}/enlightenment/modules/%{name} -name *.la | xargs rm %defattr(-,root,root,-) %{_libdir}/enlightenment/modules/e-mod-tizen-effect %{_datadir}/enlightenment/data/themes -#/usr/share/license/%{name} +/usr/share/license/%{name} -- 2.7.4 From 468512321aecdd80d1a50c6e29403b7108a4c695 Mon Sep 17 00:00:00 2001 From: MinJeong Kim Date: Thu, 8 Jan 2015 21:47:20 +0900 Subject: [PATCH 6/8] Compare visibility of the client for restack To improve processing restacking effect, simple visibility calculation using eina_tiler is added. Change-Id: I1c436cc98a44fe18483e3595618fe8becf1b81c9 Signed-off-by: MinJeong Kim --- src/e_mod_effect.c | 92 +++++++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/src/e_mod_effect.c b/src/e_mod_effect.c index 9e37b5d..f3b7abe 100644 --- a/src/e_mod_effect.c +++ b/src/e_mod_effect.c @@ -4,7 +4,8 @@ E_Comp *_comp = NULL; Eina_List *_providers = NULL; Eina_List *_event_hdlrs = NULL; -Eina_List *_stack = NULL; +Eina_List *_stack_old = NULL; +Eina_List *_stack_new = NULL; static void _e_mod_effect_object_setup(E_Client *ec) @@ -26,63 +27,70 @@ _e_mod_effect_stack_update() E_Client *ec; Evas_Object *o; + _stack_old = eina_list_free(_stack_old); + _stack_old = eina_list_clone(_stack_new); for (o = evas_object_top_get(_comp->evas); o; o = evas_object_below_get(o)) { ec = evas_object_data_get(o, "E_Client"); if (!ec) continue; if (!e_util_strcmp(evas_object_name_get(o), "layer_obj")) continue; - _stack = eina_list_remove(_stack, ec); - _stack = eina_list_append(_stack, ec); + _stack_new = eina_list_remove(_stack_new, ec); + _stack_new = eina_list_append(_stack_new, ec); } } -static const char* -_e_mod_effect_restack_effect_check(E_Client *ec) +static Eina_Bool +_e_mod_effect_visibility_check(E_Client *ec, Eina_List *stack) { - Evas_Object *o; - const char* emission = NULL; Eina_List *l; E_Client *_ec; + Eina_Tiler *tiler; + Eina_Rectangle r; + Eina_Bool vis = EINA_TRUE; - if (!ec->visible) return NULL; - if (ec->new_client) return NULL; + if (!stack) return EINA_FALSE; + + tiler = eina_tiler_new(ec->zone->w, ec->zone->h); + eina_tiler_tile_size_set(tiler, 1, 1); + EINA_RECTANGLE_SET(&r, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h); + eina_tiler_rect_add(tiler, &r); - o = evas_object_above_get(ec->frame); - if (o == _comp->layers[e_comp_canvas_layer_map(ec->layer)].obj) + EINA_LIST_FOREACH(stack, l, _ec) { - if (_stack) - { - EINA_LIST_FOREACH(_stack, l, _ec) - { - if (_ec == ec) break; - if ((_ec->iconic) || (!_ec->visible)) continue; + if (_ec == ec) break; + if ((_ec->iconic) || (!_ec->visible) || (_ec->argb)) continue; + + EINA_RECTANGLE_SET(&r, _ec->x, _ec->y, _ec->w, _ec->h); + eina_tiler_rect_del(tiler, &r); - emission = "e,action,restack,show"; - } + if (eina_tiler_empty(tiler)) + { + vis = EINA_FALSE; + break; } - else - emission = "e,action,restack,show"; } - else + eina_tiler_free(tiler); + + return vis; +} + +static const char* +_e_mod_effect_restack_effect_check(E_Client *ec) +{ + const char* emission = NULL; + Eina_Bool v1, v2; + + if (!ec->visible) return NULL; + if (ec->new_client) return NULL; + + v1 = _e_mod_effect_visibility_check(ec, _stack_old); + v2 = _e_mod_effect_visibility_check(ec, _stack_new); + + if (v1 != v2) { - _ec = evas_object_data_get(o, "E_Client"); - if ((_ec) && (_ec->layer == ec->layer)) - { - if (_stack) - { - EINA_LIST_FOREACH(_stack, l, _ec) - { - if (_ec->layer > ec->layer) continue; - if ((_ec->iconic) || (!_ec->visible)) continue; - if (_ec != ec) break; - - emission = "e,action,restack,hide"; - } - } - else - emission = "e,action,restack,hide"; - } + if (v2) emission = "e,action,restack,show"; + else emission = "e,action,restack,hide"; } return emission; @@ -95,7 +103,8 @@ _e_mod_effect_cb_client_remove(void *data, int type, void *event) E_Event_Client *ev = event; ec = ev->ec; - _stack = eina_list_remove(_stack, ec); + _stack_old = eina_list_remove(_stack_saved, ec); + _stack_new = eina_list_remove(_stack_new, ec); return ECORE_CALLBACK_PASS_ON; } @@ -108,11 +117,10 @@ _e_mod_effect_cb_client_restack(void *data, int type, void *event) const char* emission = NULL; ec = ev->ec; - + _e_mod_effect_stack_update(); if ((emission = _e_mod_effect_restack_effect_check(ec))) e_comp_object_signal_emit(ec->frame, emission, "e"); - _e_mod_effect_stack_update(); return ECORE_CALLBACK_PASS_ON; } -- 2.7.4 From 31e26898b32777c3eb818aca336cbdb6a5722f8c Mon Sep 17 00:00:00 2001 From: MinJeong Kim Date: Fri, 9 Jan 2015 10:31:21 +0900 Subject: [PATCH 7/8] Fix wrong list name Change-Id: Ia6c1f7030473369b83f12354dc1a9b4a9e30d059 --- src/e_mod_effect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/e_mod_effect.c b/src/e_mod_effect.c index f3b7abe..fa2190e 100644 --- a/src/e_mod_effect.c +++ b/src/e_mod_effect.c @@ -103,7 +103,7 @@ _e_mod_effect_cb_client_remove(void *data, int type, void *event) E_Event_Client *ev = event; ec = ev->ec; - _stack_old = eina_list_remove(_stack_saved, ec); + _stack_old = eina_list_remove(_stack_old, ec); _stack_new = eina_list_remove(_stack_new, ec); return ECORE_CALLBACK_PASS_ON; -- 2.7.4 From e16b49dda263dba1eca19a1c03ac6d7b5bd970df Mon Sep 17 00:00:00 2001 From: MinJeong Kim Date: Wed, 25 Feb 2015 16:25:22 +0900 Subject: [PATCH 8/8] Added keyboard effect Change-Id: Ic439ca113298eef35047a656c6d7f88ca9578fec Signed-off-by: MinJeong Kim --- data/effect.edc | 5 ++ data/group/keyboard.edc | 174 ++++++++++++++++++++++++++++++++++++++++++++++++ src/e_mod_effect.c | 13 +++- 3 files changed, 189 insertions(+), 3 deletions(-) create mode 100644 data/group/keyboard.edc diff --git a/data/effect.edc b/data/effect.edc index 9640e49..81ed67b 100644 --- a/data/effect.edc +++ b/data/effect.edc @@ -12,5 +12,10 @@ collections { /* group "e/comp/effects/fade" */ /*-----------------------------------------------------*/ #include "group/fade.edc" + + /*-----------------------------------------------------*/ + /* group "e/comp/effects/keyboard" */ + /*-----------------------------------------------------*/ + #include "group/keyboard.edc" } diff --git a/data/group/keyboard.edc b/data/group/keyboard.edc new file mode 100644 index 0000000..1442cf6 --- /dev/null +++ b/data/group/keyboard.edc @@ -0,0 +1,174 @@ +group { name: "e/comp/effects/keyboard"; + script { + public message(Msg_Type:type, id, ...) { + if ((type == MSG_INT_SET) && (id == 0)) { + /*set state */ + new st; + st = getarg(2); + if (st == 0) + { + set_state(PART:"clipper", "default", 0.0); + set_state(PART:"shower", "default", 0.0); + } + else if (st == 1) + { + set_state(PART:"clipper", "visible", 0.0); + set_state(PART:"shower", "visible", 0.0); + } + else if (st == 2) + { + set_state(PART:"clipper", "restack_hidden", 0.0); + set_state(PART:"shower", "restack_hidden", 0.0); + } + else if (st == 3) + { + set_state(PART:"clipper", "restack_visible", 0.0); + set_state(PART:"shower", "restack_visible", 0.0); + } + else if (st == 4) + { + set_state(PART:"clipper", "restack_done", 0.0); + set_state(PART:"shower", "restack_done", 0.0); + } + } else if ((type == MSG_INT_SET) && (id == 1)) + { + } + } + } + parts { + part { name: "clipper"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + color: 255 255 255 255; + rel1.relative: -1.0 -1.0; + rel1.offset: -9999 -9999; + rel2.relative: 2.0 2.0; + rel2.offset: 9999 9999; + visible: 1; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + description { state: "hide" 0.0; + inherit: "default" 0.0; + } + description { state: "restack_visible" 0.0; + inherit: "visible" 0.0; + } + description { state: "restack_hidden" 0.0; + inherit: "default" 0.0; + } + description { state: "restack_done" 0.0; + inherit: "visible" 0.0; + } + } + part { name: "shower"; + type: SPACER; + mouse_events: 0; + description { state: "default" 0.0; + rel1.relative: 0 1; + rel2.relative: 1 2; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + rel1.relative: 0 0; + rel1.offset: 0 0; + rel2.relative: 1 1; + } + description { state: "hide" 0.0; + inherit: "default" 0.0; + } + description { state: "restack_visible" 0.0; + inherit: "visible" 0.0; + } + description { state: "restack_hidden" 0.0; + inherit: "default" 0.0; + } + description { state: "restack_done" 0.0; + inherit: "visible" 0.0; + } + } + 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"; + } + description { state: "visible" 0.0; + rel1.to: "shower"; + rel2.to: "shower"; + } + description { state: "hide" 0.0; + rel1.to: "shower"; + rel2.to: "shower"; + } + } + } + programs { + program { name: "show1"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "default"; + action: STATE_SET "visible" 0.0; + transition: ACCELERATE COMP_EFFECT_DURATION_FAST; + target: "shower"; + target: "clipper"; + target: "e.swallow.content"; + after: "done"; + } + program { name: "hide1"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "visible"; + action: STATE_SET "hide" 0.0; + transition: ACCELERATE COMP_EFFECT_DURATION_FAST; + target: "shower"; + target: "clipper"; + after: "hide2"; + } + program { name: "hide2"; + action: STATE_SET "default" 0.0; + target: "shower"; + target: "clipper"; + after: "done"; + } + program { name: "restack,hide"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "restack_visible"; + action: STATE_SET "hide" 0.0; + transition: ACCELERATE COMP_EFFECT_DURATION_FAST; + target: "shower"; + target: "clipper"; + after: "done"; + } + program { name: "restack,show"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "restack_hidden"; + action: STATE_SET "visible" 0.0; + transition: ACCELERATE COMP_EFFECT_DURATION_FAST; + target: "shower"; + target: "clipper"; + target: "e.swallow.content"; + after: "done"; + } + program { name: "restack,finish"; + signal: "e,action,go"; + source: "e"; + filter: "shower" "restack_done"; + action: STATE_SET "visible" 0.0; + target: "shower"; + target: "clipper"; + target: "e.swallow.content"; + after: "done"; + } + program { name: "done"; + action: SIGNAL_EMIT "e,action,done" "e"; + } + } +} diff --git a/src/e_mod_effect.c b/src/e_mod_effect.c index fa2190e..483bb7b 100644 --- a/src/e_mod_effect.c +++ b/src/e_mod_effect.c @@ -13,12 +13,19 @@ _e_mod_effect_object_setup(E_Client *ec) E_Comp_Config *config; config = e_comp_config_get(); - if ((config) && (config->effect_style)) + if (ec->vkbd.vkbd) { - e_comp_object_effect_set(ec->frame , config->effect_style); + e_comp_object_effect_set(ec->frame, "keyboard"); } else - e_comp_object_effect_set(ec->frame, "no-effect"); + { + if ((config) && (config->effect_style)) + { + e_comp_object_effect_set(ec->frame , config->effect_style); + } + else + e_comp_object_effect_set(ec->frame, "no-effect"); + } } static void -- 2.7.4