From 638af3e64fb8a1968f3710934da260ce74dd3dd5 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 17 Jun 2015 10:51:10 +0900 Subject: [PATCH 02/10] add initial code Change-Id: Ic4d1513780e19de915f158ad969d5e82fc0b3f22 --- COPYING | 25 +++++ Makefile.am | 8 ++ autogen.sh | 16 +++ configure.ac | 55 ++++++++++ packaging/e-mod-tizen-eom.spec | 61 +++++++++++ protocol/eom-client-protocol.h | 233 +++++++++++++++++++++++++++++++++++++++++ protocol/eom-protocol.c | 38 +++++++ protocol/eom-server-protocol.h | 194 ++++++++++++++++++++++++++++++++++ protocol/eom.xml | 102 ++++++++++++++++++ src/Makefile.am | 28 +++++ src/e_mod_main.c | 165 +++++++++++++++++++++++++++++ src/e_mod_main.h | 19 ++++ 12 files changed, 944 insertions(+) create mode 100644 COPYING create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 packaging/e-mod-tizen-eom.spec create mode 100644 protocol/eom-client-protocol.h create mode 100644 protocol/eom-protocol.c create mode 100644 protocol/eom-server-protocol.h create mode 100644 protocol/eom.xml create mode 100644 src/Makefile.am create mode 100755 src/e_mod_main.c create mode 100755 src/e_mod_main.h 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. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..a30d363 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,8 @@ +#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 + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..1ac867a --- /dev/null +++ b/autogen.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +#rm -rf autom4te.cache +#rm -f aclocal.m4 ltmain.sh + +#echo "Running autoreconf..." ; autoreconf -v --install || exit 1 +#echo "Running configure..." ; ./configure --enable-maintainer-mode + +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..39a2c1b --- /dev/null +++ b/configure.ac @@ -0,0 +1,55 @@ +dnl Process this file with autoconf to produce a configure script. + +# get rid of that stupid cache mechanism +rm -f config.cache + +AC_INIT(e-mod-tizen-eom, 0.1, sc1.lim@samsung.com) +AC_PREREQ(2.52) +AC_CONFIG_SRCDIR(configure.ac) +AC_CANONICAL_BUILD +AC_CANONICAL_HOST +AC_ISC_POSIX + +AM_INIT_AUTOMAKE(1.8) +AM_CONFIG_HEADER(config.h) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +AC_PROG_CC +AM_PROG_CC_STDC +AM_PROG_CC_C_O +AC_HEADER_STDC +AC_C_CONST +AC_C___ATTRIBUTE__ + +define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl +define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl +AC_PROG_LIBTOOL + +#AM_GNU_GETTEXT([external]) +#AM_GNU_GETTEXT_VERSION(0.14) + +AC_PATH_PROG([wayland_scanner], [wayland-scanner]) +if test x$wayland_scanner = x; then + AC_MSG_ERROR([wayland-scanner is needed to compile]) +fi + +PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner) +PKG_CHECK_MODULES(WAYLAND, [wayland-server]) +PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment]) + +AC_SUBST(ENLIGHTENMENT_CFLAGS) +AC_SUBST(ENLIGHTENMENT_LIBS) + +AC_CHECK_LIB(dl, dlopen, dlopen_libs=-ldl) +AC_SUBST(dlopen_libs) + +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_CONFIG_FILES([Makefile + src/Makefile]) +AC_OUTPUT diff --git a/packaging/e-mod-tizen-eom.spec b/packaging/e-mod-tizen-eom.spec new file mode 100644 index 0000000..a290b5d --- /dev/null +++ b/packaging/e-mod-tizen-eom.spec @@ -0,0 +1,61 @@ +%bcond_with x +%bcond_with wayland + +Name: e-mod-tizen-eom +Version: 0.1.1 +Release: 1 +Summary: The Enlightenment eom Module for Tizen +URL: http://www.enlightenment.org +Group: Graphics & UI Framework/Other +Source0: %{name}-%{version}.tar.gz +License: BSD-2-Clause +BuildRequires: pkgconfig(enlightenment) +BuildRequires: gettext +%if %{with x} +%endif +%if %{with wayland} +BuildRequires: pkgconfig(wayland-server) +%endif +BuildRequires: pkgconfig(dlog) +%if "%{?profile}" == "common" +%else +BuildRequires: e-tizen-data +%endif +%description +This package is a the Enlightenment eom Module for Tizen. + +%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 +%if %{with wayland} +%configure --prefix=/usr +%else +%configure --prefix=/usr +%endif + +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}%{_libdir}/enlightenment/modules/%{name} -name *.la | xargs rm + +%files +%defattr(-,root,root,-) +%{_libdir}/enlightenment/modules/e-mod-tizen-eom +/usr/share/license/%{name} diff --git a/protocol/eom-client-protocol.h b/protocol/eom-client-protocol.h new file mode 100644 index 0000000..404fe56 --- /dev/null +++ b/protocol/eom-client-protocol.h @@ -0,0 +1,233 @@ +#ifndef WL_EOM_CLIENT_PROTOCOL_H +#define WL_EOM_CLIENT_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "wayland-client.h" + +struct wl_client; +struct wl_resource; + +struct wl_eom; + +extern const struct wl_interface wl_eom_interface; + +#ifndef WL_EOM_ERROR_ENUM +#define WL_EOM_ERROR_ENUM +enum wl_eom_error { + WL_EOM_ERROR_NONE = 0, + WL_EOM_ERROR_NO_OUTPUT = 1, + WL_EOM_ERROR_NO_ATTRIBUTE = 2, + WL_EOM_ERROR_OUTPUT_OCCUPIED = 3, +}; +#endif /* WL_EOM_ERROR_ENUM */ + +#ifndef WL_EOM_TYPE_ENUM +#define WL_EOM_TYPE_ENUM +/** + * wl_eom_type - connector type of the external output + * @WL_EOM_TYPE_NONE: none + * @WL_EOM_TYPE_VGA: VGA output connector type + * @WL_EOM_TYPE_DIVI: VGA output connector type + * @WL_EOM_TYPE_DIVD: VGA output connector type + * @WL_EOM_TYPE_DIVA: VGA output connector type + * @WL_EOM_TYPE_COMPOSITE: VGA output connector type + * @WL_EOM_TYPE_SVIDEO: VGA output connector type + * @WL_EOM_TYPE_LVDS: VGA output connector type + * @WL_EOM_TYPE_COMPONENT: VGA output connector type + * @WL_EOM_TYPE_9PINDIN: VGA output connector type + * @WL_EOM_TYPE_DISPLAYPORT: VGA output connector type + * @WL_EOM_TYPE_HDMIA: VGA output connector type + * @WL_EOM_TYPE_HDMIB: VGA output connector type + * @WL_EOM_TYPE_TV: VGA output connector type + * @WL_EOM_TYPE_EDP: VGA output connector type + * @WL_EOM_TYPE_VIRTUAL: VGA output connector type + * @WL_EOM_TYPE_DSI: VGA output connector type + * + * ***** TODO ****** + */ +enum wl_eom_type { + WL_EOM_TYPE_NONE = 0, + WL_EOM_TYPE_VGA = 1, + WL_EOM_TYPE_DIVI = 2, + WL_EOM_TYPE_DIVD = 3, + WL_EOM_TYPE_DIVA = 4, + WL_EOM_TYPE_COMPOSITE = 5, + WL_EOM_TYPE_SVIDEO = 6, + WL_EOM_TYPE_LVDS = 7, + WL_EOM_TYPE_COMPONENT = 8, + WL_EOM_TYPE_9PINDIN = 9, + WL_EOM_TYPE_DISPLAYPORT = 10, + WL_EOM_TYPE_HDMIA = 11, + WL_EOM_TYPE_HDMIB = 12, + WL_EOM_TYPE_TV = 13, + WL_EOM_TYPE_EDP = 14, + WL_EOM_TYPE_VIRTUAL = 15, + WL_EOM_TYPE_DSI = 16, +}; +#endif /* WL_EOM_TYPE_ENUM */ + +#ifndef WL_EOM_STATUS_ENUM +#define WL_EOM_STATUS_ENUM +/** + * wl_eom_status - connection status of the external output + * @WL_EOM_STATUS_NONE: none + * @WL_EOM_STATUS_CONNECTION: output connected + * @WL_EOM_STATUS_DISCONNECTION: output disconnected + * + * ***** TODO ****** + */ +enum wl_eom_status { + WL_EOM_STATUS_NONE = 0, + WL_EOM_STATUS_CONNECTION = 1, + WL_EOM_STATUS_DISCONNECTION = 2, +}; +#endif /* WL_EOM_STATUS_ENUM */ + +#ifndef WL_EOM_MODE_ENUM +#define WL_EOM_MODE_ENUM +/** + * wl_eom_mode - mode of the external output + * @WL_EOM_MODE_NONE: none + * @WL_EOM_MODE_MIRROR: mirror mode + * @WL_EOM_MODE_PRESENTATION: presentation mode + * + * ***** TODO ****** + */ +enum wl_eom_mode { + WL_EOM_MODE_NONE = 0, + WL_EOM_MODE_MIRROR = 1, + WL_EOM_MODE_PRESENTATION = 2, +}; +#endif /* WL_EOM_MODE_ENUM */ + +#ifndef WL_EOM_ATTRIBUTE_ENUM +#define WL_EOM_ATTRIBUTE_ENUM +/** + * wl_eom_attribute - attribute of the external output + * @WL_EOM_ATTRIBUTE_NONE: none + * @WL_EOM_ATTRIBUTE_NORMAL: nomal attribute + * @WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARED: exclusive shared attribute + * @WL_EOM_ATTRIBUTE_EXCLUSIVE: exclusive attribute + * + * ***** TODO ****** + */ +enum wl_eom_attribute { + WL_EOM_ATTRIBUTE_NONE = 0, + WL_EOM_ATTRIBUTE_NORMAL = 1, + WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARED = 2, + WL_EOM_ATTRIBUTE_EXCLUSIVE = 3, +}; +#endif /* WL_EOM_ATTRIBUTE_ENUM */ + +#ifndef WL_EOM_ATTRIBUTE_STATE_ENUM +#define WL_EOM_ATTRIBUTE_STATE_ENUM +/** + * wl_eom_attribute_state - state of the external output attribute + * @WL_EOM_ATTRIBUTE_STATE_NONE: none + * @WL_EOM_ATTRIBUTE_STATE_ACTIVE: attribute is active on the output + * @WL_EOM_ATTRIBUTE_STATE_INACTIVE: attribute is inactive on the output + * @WL_EOM_ATTRIBUTE_STATE_LOST: the connection of output is lost + * + * ***** TODO ****** + */ +enum wl_eom_attribute_state { + WL_EOM_ATTRIBUTE_STATE_NONE = 0, + WL_EOM_ATTRIBUTE_STATE_ACTIVE = 1, + WL_EOM_ATTRIBUTE_STATE_INACTIVE = 2, + WL_EOM_ATTRIBUTE_STATE_LOST = 3, +}; +#endif /* WL_EOM_ATTRIBUTE_STATE_ENUM */ + +/** + * wl_eom - an interface to get the information of the external outputs + * @output_type: (none) + * @output_mode: (none) + * @output_attribute: (none) + * + * ***** TODO ****** + */ +struct wl_eom_listener { + /** + * output_type - (none) + * @output: (none) + * @type: (none) + * @status: (none) + * @error: (none) + */ + void (*output_type)(void *data, + struct wl_eom *wl_eom, + struct wl_output *output, + uint32_t type, + uint32_t status, + uint32_t error); + /** + * output_mode - (none) + * @output: (none) + * @mode: (none) + * @error: (none) + */ + void (*output_mode)(void *data, + struct wl_eom *wl_eom, + struct wl_output *output, + uint32_t mode, + uint32_t error); + /** + * output_attribute - (none) + * @output: (none) + * @attribute: (none) + * @attribute_state: (none) + * @error: (none) + */ + void (*output_attribute)(void *data, + struct wl_eom *wl_eom, + struct wl_output *output, + uint32_t attribute, + uint32_t attribute_state, + uint32_t error); +}; + +static inline int +wl_eom_add_listener(struct wl_eom *wl_eom, + const struct wl_eom_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) wl_eom, + (void (**)(void)) listener, data); +} + +#define WL_EOM_SET_ATTRIBUTE 0 + +static inline void +wl_eom_set_user_data(struct wl_eom *wl_eom, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) wl_eom, user_data); +} + +static inline void * +wl_eom_get_user_data(struct wl_eom *wl_eom) +{ + return wl_proxy_get_user_data((struct wl_proxy *) wl_eom); +} + +static inline void +wl_eom_destroy(struct wl_eom *wl_eom) +{ + wl_proxy_destroy((struct wl_proxy *) wl_eom); +} + +static inline void +wl_eom_set_attribute(struct wl_eom *wl_eom, struct wl_output *output, uint32_t attribute) +{ + wl_proxy_marshal((struct wl_proxy *) wl_eom, + WL_EOM_SET_ATTRIBUTE, output, attribute); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/protocol/eom-protocol.c b/protocol/eom-protocol.c new file mode 100644 index 0000000..8eafa37 --- /dev/null +++ b/protocol/eom-protocol.c @@ -0,0 +1,38 @@ +#include +#include +#include "wayland-util.h" + +extern const struct wl_interface wl_output_interface; + +static const struct wl_interface *types[] = { + &wl_output_interface, + NULL, + &wl_output_interface, + NULL, + NULL, + NULL, + &wl_output_interface, + NULL, + NULL, + &wl_output_interface, + NULL, + NULL, + NULL, +}; + +static const struct wl_message wl_eom_requests[] = { + { "set_attribute", "ou", types + 0 }, +}; + +static const struct wl_message wl_eom_events[] = { + { "output_type", "ouuu", types + 2 }, + { "output_mode", "ouu", types + 6 }, + { "output_attribute", "ouuu", types + 9 }, +}; + +WL_EXPORT const struct wl_interface wl_eom_interface = { + "wl_eom", 1, + 1, wl_eom_requests, + 3, wl_eom_events, +}; + diff --git a/protocol/eom-server-protocol.h b/protocol/eom-server-protocol.h new file mode 100644 index 0000000..07becce --- /dev/null +++ b/protocol/eom-server-protocol.h @@ -0,0 +1,194 @@ +#ifndef WL_EOM_SERVER_PROTOCOL_H +#define WL_EOM_SERVER_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "wayland-server.h" + +struct wl_client; +struct wl_resource; + +struct wl_eom; + +extern const struct wl_interface wl_eom_interface; + +#ifndef WL_EOM_ERROR_ENUM +#define WL_EOM_ERROR_ENUM +enum wl_eom_error { + WL_EOM_ERROR_NONE = 0, + WL_EOM_ERROR_NO_OUTPUT = 1, + WL_EOM_ERROR_NO_ATTRIBUTE = 2, + WL_EOM_ERROR_OUTPUT_OCCUPIED = 3, +}; +#endif /* WL_EOM_ERROR_ENUM */ + +#ifndef WL_EOM_TYPE_ENUM +#define WL_EOM_TYPE_ENUM +/** + * wl_eom_type - connector type of the external output + * @WL_EOM_TYPE_NONE: none + * @WL_EOM_TYPE_VGA: VGA output connector type + * @WL_EOM_TYPE_DIVI: VGA output connector type + * @WL_EOM_TYPE_DIVD: VGA output connector type + * @WL_EOM_TYPE_DIVA: VGA output connector type + * @WL_EOM_TYPE_COMPOSITE: VGA output connector type + * @WL_EOM_TYPE_SVIDEO: VGA output connector type + * @WL_EOM_TYPE_LVDS: VGA output connector type + * @WL_EOM_TYPE_COMPONENT: VGA output connector type + * @WL_EOM_TYPE_9PINDIN: VGA output connector type + * @WL_EOM_TYPE_DISPLAYPORT: VGA output connector type + * @WL_EOM_TYPE_HDMIA: VGA output connector type + * @WL_EOM_TYPE_HDMIB: VGA output connector type + * @WL_EOM_TYPE_TV: VGA output connector type + * @WL_EOM_TYPE_EDP: VGA output connector type + * @WL_EOM_TYPE_VIRTUAL: VGA output connector type + * @WL_EOM_TYPE_DSI: VGA output connector type + * + * ***** TODO ****** + */ +enum wl_eom_type { + WL_EOM_TYPE_NONE = 0, + WL_EOM_TYPE_VGA = 1, + WL_EOM_TYPE_DIVI = 2, + WL_EOM_TYPE_DIVD = 3, + WL_EOM_TYPE_DIVA = 4, + WL_EOM_TYPE_COMPOSITE = 5, + WL_EOM_TYPE_SVIDEO = 6, + WL_EOM_TYPE_LVDS = 7, + WL_EOM_TYPE_COMPONENT = 8, + WL_EOM_TYPE_9PINDIN = 9, + WL_EOM_TYPE_DISPLAYPORT = 10, + WL_EOM_TYPE_HDMIA = 11, + WL_EOM_TYPE_HDMIB = 12, + WL_EOM_TYPE_TV = 13, + WL_EOM_TYPE_EDP = 14, + WL_EOM_TYPE_VIRTUAL = 15, + WL_EOM_TYPE_DSI = 16, +}; +#endif /* WL_EOM_TYPE_ENUM */ + +#ifndef WL_EOM_STATUS_ENUM +#define WL_EOM_STATUS_ENUM +/** + * wl_eom_status - connection status of the external output + * @WL_EOM_STATUS_NONE: none + * @WL_EOM_STATUS_CONNECTION: output connected + * @WL_EOM_STATUS_DISCONNECTION: output disconnected + * + * ***** TODO ****** + */ +enum wl_eom_status { + WL_EOM_STATUS_NONE = 0, + WL_EOM_STATUS_CONNECTION = 1, + WL_EOM_STATUS_DISCONNECTION = 2, +}; +#endif /* WL_EOM_STATUS_ENUM */ + +#ifndef WL_EOM_MODE_ENUM +#define WL_EOM_MODE_ENUM +/** + * wl_eom_mode - mode of the external output + * @WL_EOM_MODE_NONE: none + * @WL_EOM_MODE_MIRROR: mirror mode + * @WL_EOM_MODE_PRESENTATION: presentation mode + * + * ***** TODO ****** + */ +enum wl_eom_mode { + WL_EOM_MODE_NONE = 0, + WL_EOM_MODE_MIRROR = 1, + WL_EOM_MODE_PRESENTATION = 2, +}; +#endif /* WL_EOM_MODE_ENUM */ + +#ifndef WL_EOM_ATTRIBUTE_ENUM +#define WL_EOM_ATTRIBUTE_ENUM +/** + * wl_eom_attribute - attribute of the external output + * @WL_EOM_ATTRIBUTE_NONE: none + * @WL_EOM_ATTRIBUTE_NORMAL: nomal attribute + * @WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARED: exclusive shared attribute + * @WL_EOM_ATTRIBUTE_EXCLUSIVE: exclusive attribute + * + * ***** TODO ****** + */ +enum wl_eom_attribute { + WL_EOM_ATTRIBUTE_NONE = 0, + WL_EOM_ATTRIBUTE_NORMAL = 1, + WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARED = 2, + WL_EOM_ATTRIBUTE_EXCLUSIVE = 3, +}; +#endif /* WL_EOM_ATTRIBUTE_ENUM */ + +#ifndef WL_EOM_ATTRIBUTE_STATE_ENUM +#define WL_EOM_ATTRIBUTE_STATE_ENUM +/** + * wl_eom_attribute_state - state of the external output attribute + * @WL_EOM_ATTRIBUTE_STATE_NONE: none + * @WL_EOM_ATTRIBUTE_STATE_ACTIVE: attribute is active on the output + * @WL_EOM_ATTRIBUTE_STATE_INACTIVE: attribute is inactive on the output + * @WL_EOM_ATTRIBUTE_STATE_LOST: the connection of output is lost + * + * ***** TODO ****** + */ +enum wl_eom_attribute_state { + WL_EOM_ATTRIBUTE_STATE_NONE = 0, + WL_EOM_ATTRIBUTE_STATE_ACTIVE = 1, + WL_EOM_ATTRIBUTE_STATE_INACTIVE = 2, + WL_EOM_ATTRIBUTE_STATE_LOST = 3, +}; +#endif /* WL_EOM_ATTRIBUTE_STATE_ENUM */ + +/** + * wl_eom - an interface to get the information of the external outputs + * @set_attribute: (none) + * + * ***** TODO ****** + */ +struct wl_eom_interface { + /** + * set_attribute - (none) + * @output: (none) + * @attribute: (none) + */ + void (*set_attribute)(struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *output, + uint32_t attribute); +}; + +#define WL_EOM_OUTPUT_TYPE 0 +#define WL_EOM_OUTPUT_MODE 1 +#define WL_EOM_OUTPUT_ATTRIBUTE 2 + +#define WL_EOM_OUTPUT_TYPE_SINCE_VERSION 1 +#define WL_EOM_OUTPUT_MODE_SINCE_VERSION 1 +#define WL_EOM_OUTPUT_ATTRIBUTE_SINCE_VERSION 1 + +static inline void +wl_eom_send_output_type(struct wl_resource *resource_, struct wl_resource *output, uint32_t type, uint32_t status, uint32_t error) +{ + wl_resource_post_event(resource_, WL_EOM_OUTPUT_TYPE, output, type, status, error); +} + +static inline void +wl_eom_send_output_mode(struct wl_resource *resource_, struct wl_resource *output, uint32_t mode, uint32_t error) +{ + wl_resource_post_event(resource_, WL_EOM_OUTPUT_MODE, output, mode, error); +} + +static inline void +wl_eom_send_output_attribute(struct wl_resource *resource_, struct wl_resource *output, uint32_t attribute, uint32_t attribute_state, uint32_t error) +{ + wl_resource_post_event(resource_, WL_EOM_OUTPUT_ATTRIBUTE, output, attribute, attribute_state, error); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/protocol/eom.xml b/protocol/eom.xml new file mode 100644 index 0000000..ed162a9 --- /dev/null +++ b/protocol/eom.xml @@ -0,0 +1,102 @@ + + + + ***** TODO ****** + + + + + + + + + + + + ***** TODO ****** + + + + + + + + + + + + + + + + + + + + + + + ***** TODO ****** + + + + + + + + + ***** TODO ****** + + + + + + + + + ***** TODO ****** + + + + + + + + + + ***** TODO ****** + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..cf6fbec --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,28 @@ +MAINTAINERCLEANFILES = Makefile.in +MODULE = e-mod-tizen-eom + +# data files for the module +filesdir = $(libdir)/enlightenment/modules/$(MODULE) + +pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la +module_la_SOURCES = e_mod_main.c +module_la_LIBADD = +module_la_CFLAGS = @WAYLAND_CFLAGS@ @ENLIGHTENMENT_CFLAGS@ -DHAVE_WAYLAND_ONLY +module_la_LDFLAGS = -module -avoid-version @WAYLAND_LIBS@ @ENLIGHTENMENT_LIBS@ +module_la_DEPENDENCIES = $(top_builddir)/config.h + +BUILT_SOURCES = eom-protocol.c \ + eom-client-protocol.h \ + eom-server-protocol.h + +CLEANFILES = $(BUILT_SOURCES) + +%-protocol.c : $(top_srcdir)/protocol/%.xml + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@ + +%-server-protocol.h : $(top_srcdir)/protocol/%.xml + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header < $< > $@ + +%-client-protocol.h : $(top_srcdir)/protocol/%.xml + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@ diff --git a/src/e_mod_main.c b/src/e_mod_main.c new file mode 100755 index 0000000..dcf653f --- /dev/null +++ b/src/e_mod_main.c @@ -0,0 +1,165 @@ +#define E_COMP_WL +#include "e.h" +#include "e_mod_main.h" +#include "eom-server-protocol.h" + +typedef struct _E_Eom E_Eom, *E_EomPtr; + +struct _E_Eom +{ + E_Comp_Data *cdata; + struct wl_global *global; + Eina_List *handlers; +}; + +E_EomPtr g_eom = NULL; + +EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "EOM Module" }; + +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; + + EOM_DBG("e_client: %p is died\n", ec); + + 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) +{ + (void) client; + (void) resource; + (void) output; + (void) attribute; + + EOM_DBG("attribute:%d\n", attribute); +} + +static const struct wl_eom_interface _e_eom_wl_implementation = { + _e_eom_wl_request_set_attribute_cb +}; + +/* wl_eom global object destroy function */ +static void +_e_eom_wl_resource_destory_cb(struct wl_resource *resource) +{ + wl_resource_destroy(resource); +} + +/* wl_eom global object bind function */ +static void +_e_eom_wl_bind_cb(struct wl_client *client, void *data, uint32_t version, uint32_t id) +{ + E_EomPtr eom = data; + struct wl_resource *resource; + + 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); + wl_client_post_no_memory(client); + return; + } + + wl_resource_set_implementation(resource, &_e_eom_wl_implementation, eom, _e_eom_wl_resource_destory_cb); + + EOM_DBG("create wl_eom global resource.\n"); +} + +static void +_e_eom_deinit() +{ + Ecore_Event_Handler *h = NULL; + + if (!g_eom) return; + + /* remove event handlers */ + if (g_eom->handlers) + { + EINA_LIST_FREE(g_eom->handlers, h) + ecore_event_handler_del(h); + } + + if (g_eom->global) wl_global_destroy(g_eom->global); + + E_FREE(g_eom); + g_eom = NULL; +} + +static Eina_Bool +_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; + } + + cdata = e_comp->wl_comp_data; + if (!cdata) + { + EOM_ERR("error. e_comp->wl_comp_data is null.\n"); + goto err; + } + + 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; + } + + /* add event hanlders */ + E_LIST_HANDLER_APPEND(g_eom->handlers, E_EVENT_CLIENT_REMOVE, _e_eom_e_client_remove_cb, g_eom); + + return EINA_TRUE; + +err: + _e_eom_deinit(); + + return EINA_FALSE; +} + +EAPI void * +e_modapi_init(E_Module *m) +{ + return (_e_eom_init() ? m : NULL); +} + +EAPI int +e_modapi_shutdown(E_Module *m EINA_UNUSED) +{ + _e_eom_deinit(); + + 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 100755 index 0000000..14fb89f --- /dev/null +++ b/src/e_mod_main.h @@ -0,0 +1,19 @@ +#ifndef E_MOD_MAIN_H +#define E_MOD_MAIN_H + +#define CHECK_ERR(val) if (WL_KEYROUTER_ERROR_NONE != val) return; +#define CHECK_ERR_VAL(val) if (WL_KEYROUTER_ERROR_NONE != val) return val; +#define CHECK_NULL(val) if (!val) return; +#define CHECK_NULL_VAL(val) if (!val) return val; + +#define EOM_ERR(msg, ARG...) ERR("[eom module][%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG) +#define EOM_WARN(msg, ARG...) WARN("[eom module][%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG) +#define EOM_DBG(msg, ARG...) DBG("[eom module][%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG) + +/* 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 52b281185536d916f25ccf30026e19560d100b72 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Sat, 20 Jun 2015 13:49:49 +0900 Subject: [PATCH 03/10] add ECORE_DRM event handler - add ECORE_DRM_EVENT_OUTPUT and ECRE_DRM_EVENT_ACTIVATE - remove error at type and mode Change-Id: If20f898eb0e62f7719f0faaadadf8be15299e912 --- protocol/eom-client-protocol.h | 8 +-- protocol/eom-protocol.c | 8 ++- protocol/eom-server-protocol.h | 8 +-- protocol/eom.xml | 2 - src/e_mod_main.c | 108 +++++++++++++++++++++++++++++++++++++++-- 5 files changed, 112 insertions(+), 22 deletions(-) diff --git a/protocol/eom-client-protocol.h b/protocol/eom-client-protocol.h index 404fe56..9f91c45 100644 --- a/protocol/eom-client-protocol.h +++ b/protocol/eom-client-protocol.h @@ -157,25 +157,21 @@ struct wl_eom_listener { * @output: (none) * @type: (none) * @status: (none) - * @error: (none) */ void (*output_type)(void *data, struct wl_eom *wl_eom, struct wl_output *output, uint32_t type, - uint32_t status, - uint32_t error); + uint32_t status); /** * output_mode - (none) * @output: (none) * @mode: (none) - * @error: (none) */ void (*output_mode)(void *data, struct wl_eom *wl_eom, struct wl_output *output, - uint32_t mode, - uint32_t error); + uint32_t mode); /** * output_attribute - (none) * @output: (none) diff --git a/protocol/eom-protocol.c b/protocol/eom-protocol.c index 8eafa37..fc7ccc7 100644 --- a/protocol/eom-protocol.c +++ b/protocol/eom-protocol.c @@ -10,10 +10,8 @@ static const struct wl_interface *types[] = { &wl_output_interface, NULL, NULL, - NULL, &wl_output_interface, NULL, - NULL, &wl_output_interface, NULL, NULL, @@ -25,9 +23,9 @@ static const struct wl_message wl_eom_requests[] = { }; static const struct wl_message wl_eom_events[] = { - { "output_type", "ouuu", types + 2 }, - { "output_mode", "ouu", types + 6 }, - { "output_attribute", "ouuu", types + 9 }, + { "output_type", "ouu", types + 2 }, + { "output_mode", "ou", types + 5 }, + { "output_attribute", "ouuu", types + 7 }, }; WL_EXPORT const struct wl_interface wl_eom_interface = { diff --git a/protocol/eom-server-protocol.h b/protocol/eom-server-protocol.h index 07becce..18801cb 100644 --- a/protocol/eom-server-protocol.h +++ b/protocol/eom-server-protocol.h @@ -170,15 +170,15 @@ struct wl_eom_interface { #define WL_EOM_OUTPUT_ATTRIBUTE_SINCE_VERSION 1 static inline void -wl_eom_send_output_type(struct wl_resource *resource_, struct wl_resource *output, uint32_t type, uint32_t status, uint32_t error) +wl_eom_send_output_type(struct wl_resource *resource_, struct wl_resource *output, uint32_t type, uint32_t status) { - wl_resource_post_event(resource_, WL_EOM_OUTPUT_TYPE, output, type, status, error); + wl_resource_post_event(resource_, WL_EOM_OUTPUT_TYPE, output, type, status); } static inline void -wl_eom_send_output_mode(struct wl_resource *resource_, struct wl_resource *output, uint32_t mode, uint32_t error) +wl_eom_send_output_mode(struct wl_resource *resource_, struct wl_resource *output, uint32_t mode) { - wl_resource_post_event(resource_, WL_EOM_OUTPUT_MODE, output, mode, error); + wl_resource_post_event(resource_, WL_EOM_OUTPUT_MODE, output, mode); } static inline void diff --git a/protocol/eom.xml b/protocol/eom.xml index ed162a9..94d5ce6 100644 --- a/protocol/eom.xml +++ b/protocol/eom.xml @@ -81,13 +81,11 @@ - - diff --git a/src/e_mod_main.c b/src/e_mod_main.c index dcf653f..30c4a98 100755 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -2,6 +2,7 @@ #include "e.h" #include "e_mod_main.h" #include "eom-server-protocol.h" +#include "Ecore_Drm.h" typedef struct _E_Eom E_Eom, *E_EomPtr; @@ -9,6 +10,7 @@ struct _E_Eom { E_Comp_Data *cdata; struct wl_global *global; + struct wl_resource *resource; Eina_List *handlers; }; @@ -16,6 +18,21 @@ E_EomPtr g_eom = NULL; EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "EOM Module" }; +static E_Comp_Wl_Output * +_e_eom_e_comp_wl_output_get(Eina_List *outputs, const char *id) +{ + Eina_List *l; + E_Comp_Wl_Output *output; + + EINA_LIST_FOREACH(outputs, l, 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) { @@ -32,6 +49,83 @@ _e_eom_e_client_remove_cb(void *data, int type, void *event) } +static Eina_Bool +_e_eom_ecore_drm_output_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + Ecore_Drm_Event_Output *e; + E_EomPtr eom = data; + E_Comp_Data *cdata; + E_Comp_Wl_Output *output; + Eina_List *l2; + struct wl_resource *output_resource; + enum wl_eom_type eom_type = WL_EOM_TYPE_NONE; + char buff[PATH_MAX]; + + if (!(e = event)) goto end; + + 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); + + if (!(cdata = e_comp->wl_comp_data)) goto end; + + snprintf(buff, sizeof(buff), "%d", e->id); + + /* get the e_comp_wl_output */ + output = _e_eom_e_comp_wl_output_get(cdata->outputs, buff); + if (!output) + { + EOM_ERR("no e_comp_wl_outputs.\n"); + goto end; + } + + /* 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); + else + 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; +} + +static Eina_Bool +_e_eom_ecore_drm_activate_cb(void *data, int type EINA_UNUSED, void *event) +{ + Ecore_Drm_Event_Activate *e = NULL; + E_EomPtr eom = NULL; + + if ((!event) || (!data)) goto end; + e = event; + data = eom; + + if (e->active) + { + /* TODO: something do */ + } + else + { + /* TODO: something do */ + } + +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, @@ -39,12 +133,12 @@ _e_eom_wl_request_set_attribute_cb(struct wl_client *client, struct wl_resource *output, uint32_t attribute) { - (void) client; - (void) resource; - (void) output; - (void) attribute; + (void) client; + (void) attribute; - EOM_DBG("attribute:%d\n", attribute); + EOM_DBG("attribute:%d\n", attribute); + + 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 = { @@ -75,6 +169,8 @@ _e_eom_wl_bind_cb(struct wl_client *client, void *data, uint32_t version, uint32 wl_resource_set_implementation(resource, &_e_eom_wl_implementation, eom, _e_eom_wl_resource_destory_cb); + eom->resource = resource; + EOM_DBG("create wl_eom global resource.\n"); } @@ -132,6 +228,8 @@ _e_eom_init() } /* 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); return EINA_TRUE; -- 2.7.4 From 7528682c900fdddf8f5be4f089f1294e549acfd9 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 29 Jun 2015 17:35:52 +0900 Subject: [PATCH 04/10] add eom-protocol.c to Makefile.am Change-Id: I5dc59e158859fc562f2abb80d33b0f7f3caac0d1 --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index cf6fbec..ee78075 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,7 +6,7 @@ filesdir = $(libdir)/enlightenment/modules/$(MODULE) pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH) pkg_LTLIBRARIES = module.la -module_la_SOURCES = e_mod_main.c +module_la_SOURCES = e_mod_main.c eom-protocol.c module_la_LIBADD = module_la_CFLAGS = @WAYLAND_CFLAGS@ @ENLIGHTENMENT_CFLAGS@ -DHAVE_WAYLAND_ONLY module_la_LDFLAGS = -module -avoid-version @WAYLAND_LIBS@ @ENLIGHTENMENT_LIBS@ -- 2.7.4 From 76ae3e74c5b6c60fa55acd690da6ea4a06efe499 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 1 Jul 2015 14:06:54 +0900 Subject: [PATCH 05/10] remove destry resource it occurs crash.. Change-Id: I63f3fa99f0942306c1a1614225d23687adb2b985 --- src/e_mod_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 30c4a98..c68a217 100755 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -149,7 +149,9 @@ static const struct wl_eom_interface _e_eom_wl_implementation = { static void _e_eom_wl_resource_destory_cb(struct wl_resource *resource) { - wl_resource_destroy(resource); + +/* TODO : destroy resources if exist */ + } /* wl_eom global object bind function */ -- 2.7.4 From db411842075d0878553760f4a0782abbde574ba7 Mon Sep 17 00:00:00 2001 From: Gwanglim Lee Date: Tue, 4 Aug 2015 14:40:14 +0900 Subject: [PATCH 06/10] remove noisy log message. Change-Id: I2e54acef8a39ba67acd7d526ea859638c6c8b6e1 --- src/e_mod_main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index c68a217..c5cc230 100755 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -43,8 +43,6 @@ _e_eom_e_client_remove_cb(void *data, int type, void *event) (void) event; (void) data; - EOM_DBG("e_client: %p is died\n", ec); - return ECORE_CALLBACK_PASS_ON; } -- 2.7.4 From bd5efcd5d86ca07c259c264e0da34d5743fd694c Mon Sep 17 00:00:00 2001 From: Gwanglim Lee Date: Tue, 4 Aug 2015 16:34:44 +0900 Subject: [PATCH 07/10] 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 From e6052cc5ad3baded0fa331a52fa2eb9fd5a982a6 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 28 Oct 2015 19:40:49 +0900 Subject: [PATCH 08/10] add dummy x11 module for avoiding build break Change-Id: Ieb750c5164278967f1d37137e83ef6c7ca75a0fd --- configure.ac | 21 +++++++++++++++++++++ packaging/e-mod-tizen-eom.spec | 3 ++- src/Makefile.am | 8 ++++++++ src/e_mod_main_x11.c | 26 ++++++++++++++++++++++++++ src/e_mod_main_x11.h | 11 +++++++++++ 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/e_mod_main_x11.c create mode 100644 src/e_mod_main_x11.h diff --git a/configure.ac b/configure.ac index 39a2c1b..cec8ae1 100644 --- a/configure.ac +++ b/configure.ac @@ -37,6 +37,27 @@ PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner) PKG_CHECK_MODULES(WAYLAND, [wayland-server]) PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment]) +dnl ======================================================================== +# checks for wayland only argument +dnl ======================================================================== +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]) +AM_CONDITIONAL(WAYLAND_ONLY, test x$have_wayland_only = xyes) +if test "x${have_wayland_only}" != "xno"; then + AC_DEFINE_UNQUOTED([HAVE_WAYLAND_ONLY],[1],[enable wayland-only version of enlightenment]) +fi + +dnl ======================================================================== +# checks for wayland only argument +dnl ======================================================================== +if test "x${have_wayland_only}" = "xyes"; then + PKG_CHECK_MODULES(WAYLAND, [wayland-server]) +fi + AC_SUBST(ENLIGHTENMENT_CFLAGS) AC_SUBST(ENLIGHTENMENT_LIBS) diff --git a/packaging/e-mod-tizen-eom.spec b/packaging/e-mod-tizen-eom.spec index a290b5d..52e9762 100644 --- a/packaging/e-mod-tizen-eom.spec +++ b/packaging/e-mod-tizen-eom.spec @@ -12,6 +12,7 @@ License: BSD-2-Clause BuildRequires: pkgconfig(enlightenment) BuildRequires: gettext %if %{with x} +BuildRequires: pkgconfig(x11) %endif %if %{with wayland} BuildRequires: pkgconfig(wayland-server) @@ -35,7 +36,7 @@ export LDFLAGS+=" -Wl,--hash-style=both -Wl,--as-needed -Wl,--rpath=/usr/lib" %autogen %if %{with wayland} -%configure --prefix=/usr +%configure --prefix=/usr --enable-wayland-only %else %configure --prefix=/usr %endif diff --git a/src/Makefile.am b/src/Makefile.am index ee78075..7ae647e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,6 +6,8 @@ filesdir = $(libdir)/enlightenment/modules/$(MODULE) pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH) pkg_LTLIBRARIES = module.la + +if WAYLAND_ONLY module_la_SOURCES = e_mod_main.c eom-protocol.c module_la_LIBADD = module_la_CFLAGS = @WAYLAND_CFLAGS@ @ENLIGHTENMENT_CFLAGS@ -DHAVE_WAYLAND_ONLY @@ -26,3 +28,9 @@ CLEANFILES = $(BUILT_SOURCES) %-client-protocol.h : $(top_srcdir)/protocol/%.xml $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@ +else +module_la_SOURCES = e_mod_main_x11.c +module_la_LIBADD = +module_la_CFLAGS = @ENLIGHTENMENT_CFLAGS@ +module_la_LDFLAGS = -module -avoid-version @ENLIGHTENMENT_LIBS@ +endif diff --git a/src/e_mod_main_x11.c b/src/e_mod_main_x11.c new file mode 100644 index 0000000..964e025 --- /dev/null +++ b/src/e_mod_main_x11.c @@ -0,0 +1,26 @@ +#include "e.h" +#include "e_mod_main.h" + +EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "EOM Module of Window Manager" }; + +EAPI void * +e_modapi_init(E_Module *m) +{ + + return m; +} + +EAPI int +e_modapi_shutdown(E_Module *m EINA_UNUSED) +{ + + 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_x11.h b/src/e_mod_main_x11.h new file mode 100644 index 0000000..b848208 --- /dev/null +++ b/src/e_mod_main_x11.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 5a524be00d52f60e0b34601db51ebe3ef3e8a729 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Tue, 12 Jan 2016 22:36:50 +0900 Subject: [PATCH 09/10] Modification for enlightenment version upgrade 0.20.0 Change-Id: Ie6e4d551b3c8aa981232dc7c71a71aad0f86f3b8 --- src/Makefile.am | 2 +- src/e_mod_main.c | 24 +++++++----------------- src/e_mod_main.h | 8 ++++---- src/e_mod_main_x11.c | 8 ++++---- src/e_mod_main_x11.h | 8 ++++---- 5 files changed, 20 insertions(+), 30 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 7ae647e..dfde2d5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,7 +10,7 @@ pkg_LTLIBRARIES = module.la if WAYLAND_ONLY module_la_SOURCES = e_mod_main.c eom-protocol.c module_la_LIBADD = -module_la_CFLAGS = @WAYLAND_CFLAGS@ @ENLIGHTENMENT_CFLAGS@ -DHAVE_WAYLAND_ONLY +module_la_CFLAGS = @WAYLAND_CFLAGS@ @ENLIGHTENMENT_CFLAGS@ -DHAVE_WAYLAND_ONLY -DHAVE_WAYLAND module_la_LDFLAGS = -module -avoid-version @WAYLAND_LIBS@ @ENLIGHTENMENT_LIBS@ module_la_DEPENDENCIES = $(top_builddir)/config.h diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 215d9ae..6c2101c 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -8,7 +8,6 @@ typedef struct _E_Eom E_Eom, *E_EomPtr; struct _E_Eom { - E_Comp_Data *cdata; struct wl_global *global; struct wl_resource *resource; Eina_List *handlers; @@ -16,7 +15,7 @@ struct _E_Eom E_EomPtr g_eom = NULL; -EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "EOM Module" }; +E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "EOM Module" }; static E_Comp_Wl_Output * _e_eom_e_comp_wl_output_get(Eina_List *outputs, const char *id) @@ -38,7 +37,6 @@ _e_eom_ecore_drm_output_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *e { Ecore_Drm_Event_Output *e; E_EomPtr eom = data; - E_Comp_Data *cdata; E_Comp_Wl_Output *output; Eina_List *l2; struct wl_resource *output_resource; @@ -52,12 +50,10 @@ _e_eom_ecore_drm_output_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *e 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); - if (!(cdata = e_comp->wl_comp_data)) goto end; - snprintf(buff, sizeof(buff), "%d", e->id); /* get the e_comp_wl_output */ - output = _e_eom_e_comp_wl_output_get(cdata->outputs, buff); + output = _e_eom_e_comp_wl_output_get(e_comp_wl->outputs, buff); if (!output) { EOM_ERR("no e_comp_wl_outputs.\n"); @@ -188,18 +184,12 @@ _e_eom_deinit() static Eina_Bool _e_eom_init() { - E_Comp_Data *cdata = NULL; - - EINA_SAFETY_ON_NULL_GOTO(e_comp, err); - - cdata = e_comp->wl_comp_data; - EINA_SAFETY_ON_NULL_GOTO(cdata, err); + EINA_SAFETY_ON_NULL_GOTO(e_comp_wl, 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, + g_eom->global = wl_global_create(e_comp_wl->wl.disp, &wl_eom_interface, 1, g_eom, @@ -216,20 +206,20 @@ err: return EINA_FALSE; } -EAPI void * +E_API void * e_modapi_init(E_Module *m) { return (_e_eom_init() ? m : NULL); } -EAPI int +E_API int e_modapi_shutdown(E_Module *m EINA_UNUSED) { _e_eom_deinit(); return 1; } -EAPI int +E_API int e_modapi_save(E_Module *m EINA_UNUSED) { /* Save something to be kept */ diff --git a/src/e_mod_main.h b/src/e_mod_main.h index 14fb89f..94675fc 100644 --- a/src/e_mod_main.h +++ b/src/e_mod_main.h @@ -11,9 +11,9 @@ #define EOM_DBG(msg, ARG...) DBG("[eom module][%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG) /* 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); +E_API extern E_Module_Api e_modapi; +E_API void *e_modapi_init(E_Module *m); +E_API int e_modapi_shutdown(E_Module *m); +E_API int e_modapi_save(E_Module *m); #endif diff --git a/src/e_mod_main_x11.c b/src/e_mod_main_x11.c index 964e025..93e4e04 100644 --- a/src/e_mod_main_x11.c +++ b/src/e_mod_main_x11.c @@ -1,23 +1,23 @@ #include "e.h" #include "e_mod_main.h" -EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "EOM Module of Window Manager" }; +E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "EOM Module of Window Manager" }; -EAPI void * +E_API void * e_modapi_init(E_Module *m) { return m; } -EAPI int +E_API int e_modapi_shutdown(E_Module *m EINA_UNUSED) { return 1; } -EAPI int +E_API int e_modapi_save(E_Module *m EINA_UNUSED) { /* Save something to be kept */ diff --git a/src/e_mod_main_x11.h b/src/e_mod_main_x11.h index b848208..cc3a882 100644 --- a/src/e_mod_main_x11.h +++ b/src/e_mod_main_x11.h @@ -2,10 +2,10 @@ #define E_MOD_MAIN_H /*** E Module ***/ -EAPI extern E_Module_Api e_modapi; +E_API 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); +E_API void *e_modapi_init(E_Module *m); +E_API int e_modapi_shutdown(E_Module *m); +E_API int e_modapi_save(E_Module *m); #endif -- 2.7.4 From 629ff6846eb60a271b53e65ded7a4adf5d075e23 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 17 Feb 2016 16:42:55 +0900 Subject: [PATCH 10/10] fix _e_eom_e_comp_wl_output_get error Change-Id: Ica89b3e0ba2066a93b68079060c42ed06ebc868d Signed-off-by: Junkyeong Kim --- src/e_mod_main.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 6c2101c..fc73de3 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -25,8 +25,20 @@ _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; + char *temp_id = NULL; + temp_id = strchr(output->id, '/'); + if (temp_id == NULL) + { + if (!strcmp(output->id, id)) + return output; + } + else + { + int loc = temp_id - output->id; + + if (!strncmp(output->id, id, loc)) + return output; + } } return NULL; @@ -47,16 +59,16 @@ _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); + 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 name:%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->name, e->plug); - snprintf(buff, sizeof(buff), "%d", e->id); + snprintf(buff, sizeof(buff), "%s", e->name); /* get the e_comp_wl_output */ output = _e_eom_e_comp_wl_output_get(e_comp_wl->outputs, buff); if (!output) { - EOM_ERR("no e_comp_wl_outputs.\n"); + EOM_ERR("no e_comp_wl_outputs. (%s)\n", buff); goto end; } @@ -90,9 +102,13 @@ _e_eom_ecore_drm_activate_cb(void *data, int type EINA_UNUSED, void *event) Ecore_Drm_Event_Activate *e = NULL; E_EomPtr eom = NULL; + EOM_DBG("_e_eom_ecore_drm_activate_cb called\n"); + if ((!event) || (!data)) goto end; e = event; - data = eom; + eom = data; + + EOM_DBG("e->active:%d\n", e->active); if (e->active) { -- 2.7.4