# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-if HAVE_UTEST
-SUBDIRS = include src ut
-else
SUBDIRS = include src
-endif
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = eom-server.pc
-
# Enable quiet compiles on automake 1.11.
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-# check for wayland pareser
-AC_PATH_PROG([wayland_scanner], [wayland-scanner])
-if test x$wayland_scanner = x; then
- AC_MSG_ERROR([wayland-scanner is needed to compile])
-fi
-
-AC_ARG_WITH(utest, AS_HELP_STRING([--with-utest=yes/no], [whether build/run unit tests or not]),
- [ utest="$withval" ],
- [ utest="no" ])
-
-AM_CONDITIONAL(HAVE_UTEST, test "x$utest" = "xyes")
-
# Checks for pkg-config packages
-PKG_CHECK_MODULES(GLIB, glib-2.0 gobject-2.0)
PKG_CHECK_MODULES(ELEMENTARY, elementary)
-LIBEOM_CFLAGS="$DBUS_CFLAGS $GLIB_CFLAGS $ELEMENTARY_CFLAGS "
-LIBEOM_LIBS="$DBUS_LIBS $GLIB_LIBS $ELEMENTARY_LIBS "
-LIBEOM_SERVER_CFLAGS="$DBUS_CFLAGS $GLIB_CFLAGS "
-LIBEOM_SERVER_LIBS="$DBUS_LIBS $GLIB_LIBS "
-
-PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner)
-PKG_CHECK_MODULES(WAYLAND_CLIENT, wayland-client)
-PKG_CHECK_MODULES(XDG_SHELL_CLIENT, xdg-shell-unstable-v6-client)
-LIBEOM_CFLAGS="$LIBEOM_CFLAGS $WAYLAND_CLIENT_CFLAGS $XDG_SHELL_CLIENT_CFLAGS"
-LIBEOM_LIBS="$LIBEOM_LIBS $WAYLAND_CLIENT_LIBS $XDG_SHELL_CLIENT_LIBS"
-
-PKG_CHECK_MODULES(ECORE_WAYLAND, ecore-wl2)
-LIBEOM_CFLAGS="$LIBEOM_CFLAGS $ECORE_WAYLAND_CFLAGS"
-LIBEOM_LIBS="$LIBEOM_LIBS $ECORE_WAYLAND_LIBS"
-
-LIBEOM_CFLAGS="$LIBEOM_CFLAGS -DEFL_BETA_API_SUPPORT "
-
-# WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
-# AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],,
-# [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
+LIBEOM_CFLAGS="$GLIB_CFLAGS $ELEMENTARY_CFLAGS "
+LIBEOM_LIBS="$GLIB_LIBS $ELEMENTARY_LIBS "
+LIBEOM_SERVER_CFLAGS="$GLIB_CFLAGS "
+LIBEOM_SERVER_LIBS="$GLIB_LIBS "
PKG_CHECK_MODULES(CAPI, [capi-base-common >= 0.1.1], [CAPI_VER="yes"], [CAPI_VER="no"])
if test "x$CAPI_VER" = "xyes"; then
LIBEOM_SERVER_LIBS="$LIBEOM_SERVER_LIBS $CAPI_LIBS"
fi
-AC_CHECK_LIB(dlog, __dlog_print, [have_dlog="yes"], [have_dlog="no"])
-if test "x$have_dlog" = "xyes"; then
- PKG_CHECK_MODULES(DLOG, dlog)
- AC_DEFINE([HAVE_DLOG], 1, "Have dlog support")
- LIBEOM_CFLAGS="$LIBEOM_CFLAGS $DLOG_CFLAGS"
- LIBEOM_LIBS="$LIBEOM_LIBS $DLOG_LIBS"
-fi
-
AC_SUBST([LIBEOM_CFLAGS])
AC_SUBST([LIBEOM_LIBS])
AC_SUBST([LIBEOM_SERVER_CFLAGS])
AC_HEADER_STDC
AC_OUTPUT([Makefile
- eom-server.pc
src/Makefile
include/Makefile
- include/eom.pc
- ut/Makefile])
+ include/eom.pc])
echo "CFLAGS : $CFLAGS"
echo "LDFLAGS : $LDFLAGS"
+++ /dev/null
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: eom-server
-Description: The External Output Manager Server Library
-Version: @PACKAGE_VERSION@
-Requires.private: dbus-1 gio-unix-2.0
-Requires: capi-base-common xdg-shell-unstable-v6-server
-Cflags: -I${includedir}/eom
-Libs: -L${libdir} -leom-server-protocol -lxdg-shell-unstable-v6-server
libeomincludedir = $(includedir)/eom
libeominclude_HEADERS = \
- eom.h \
- eom_internal.h \
- eom-connect.h
+ eom.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = eom.pc
+++ /dev/null
-/**************************************************************************
- *
- * eom (external output manager)
- *
- * Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact:
- * SooChan Lim <sc1.lim@samsung.com>
- * Boram Park <boram1288.park@samsung.com>
- * Changyeon Lee <cyeon.lee@samsung.com>
- * JunKyeong Kim <jk0430.kim@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-
-#ifndef __EOM_CONNECT_H__
-#define __EOM_CONNECT_H__
-
-/**
- * @ingroup
- * @addtogroup CAPI_UI_EOM_MODULE
- * @{
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <eom.h>
-
-/**
- * @file eom-connect.h
- */
-
-/**
- * @deprecated Deprecated since 8.0.
- * @brief Set mode to external output.
- * @param[in] output : The pointer of external output instance
- * @param[in] output_id : eom output id
- * @return #EOM_ERROR_NONE if this function succeeds.
- * otherwise error status value.
- * @retval #EOM_ERROR_NONE Successful
- * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #EOM_ERROR_SEND_MESSAGE_FAILE Message sending failure
- * @retval #EOM_ERROR_OPERATE_MESSAGE_FAILE Message operation failure
- * see #eom_output_mode_e
- */
-int eom_output_set_mode(eom_output_id output_id, eom_output_mode_e mode) TIZEN_DEPRECATED_API;
-
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
-* @}
-*/
-
-#endif /* __EOM_CONNECT_H__ */
+++ /dev/null
-/**************************************************************************
- *
- * eom (external output manager)
- *
- * Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact:
- * SooChan Lim <sc1.lim@samsung.com>
- * Boram Park <boram1288.park@samsung.com>
- * Changyeon Lee <cyeon.lee@samsung.com>
- * JunKyeong Kim <jk0430.kim@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-
-#ifndef __EOM_INTERNAL_H__
-#define __EOM_INTERNAL_H__
-
-/**
- * @brief Enumeration of eom notify type
- * @since_tizen 2.4
- */
-typedef enum {
- EOM_OUTPUT_NOTIFY_NONE, /**< None notify */
- EOM_OUTPUT_NOTIFY_ADD, /**< Output add notify */
- EOM_OUTPUT_NOTIFY_REMOVE, /**< Output remove notify */
- EOM_OUTPUT_NOTIFY_MODE_CHANGED, /**< Mode change notify */
- EOM_OUTPUT_NOTIFY_ATTRIBUTE_CHANGED, /**< Attribute change notify */
- EOM_OUTPUT_NOTIFY_MAX,
-} eom_output_notify_type_e;
-
-#endif /* __EOM_INTERNAL_H__ */
Source0: %{name}-%{version}.tar.gz
Source1001: %name.manifest
-BuildRequires: pkgconfig(wayland-client)
-BuildRequires: pkgconfig(ecore-wl2)
-BuildRequires: pkgconfig(xdg-shell-unstable-v6-client)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(capi-base-common)
BuildRequires: pkgconfig(elementary)
-%if %{with utest}
-BuildRequires: gtest-devel
-%endif
-
%description
This package provides the runtime library to manage External Output
%description devel
External Output Manager Library development package
-%package -n libeom-server
-Summary: EOM Server Library
-Group: Development/Libraries
-
-%description -n libeom-server
-External Output Manager Server Library
-
-%package -n libeom-server-devel
-Summary: EOM Server Library development package
-Group: Development/Libraries
-Requires: libeom-server = %{version}
-BuildRequires: pkgconfig(xdg-shell-unstable-v6-server)
-
-%description -n libeom-server-devel
-External Output Manager Server Library development package
-
%global TZ_SYS_RO_SHARE %{?TZ_SYS_RO_SHARE:%TZ_SYS_RO_SHARE}%{!?TZ_SYS_RO_SHARE:/usr/share}
%prep
export LDFLAGS="$LDFLAGS -Wl,--hash-style=both -Wl,--as-needed"
UTEST="no"
-%if %{with utest}
-UTEST="yes"
-%endif
-
-%reconfigure --disable-dlog --disable-static --with-utest=${UTEST}
+%reconfigure --disable-dlog --disable-static
make %{?_smp_mflags}
-%if %{with utest}
-make -C ut check
-%endif
-
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/usr/include
-cp src/eom-server-protocol.h %{buildroot}/usr/include
%make_install
%remove_docs
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
-%post -n libeom-server -p /sbin/ldconfig
-%postun -n libeom-server -p /sbin/ldconfig
-
%files
%manifest %{name}.manifest
%defattr(-,root,root,-)
%license COPYING
%{_libdir}/libeom.so.*
-%if %{with utest}
-%{_bindir}/ut
-%endif
%files devel
%manifest %{name}.manifest
%{_includedir}/eom/*.h
%{_libdir}/libeom.so
%{_libdir}/pkgconfig/eom.pc
-
-%files -n libeom-server
-%manifest %{name}.manifest
-%defattr(-,root,root,-)
-%license COPYING
-%{_includedir}/eom-server-protocol.h
-%{_includedir}/eom/eom.h
-%{_libdir}/libeom-server-protocol.so.*
-
-%files -n libeom-server-devel
-%manifest %{name}.manifest
-%dir %{_includedir}/eom/
-%{_includedir}/eom-server-protocol.h
-%{_includedir}/eom/eom.h
-%{_libdir}/libeom-server-protocol.so
-%{_libdir}/pkgconfig/eom-server.pc
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="wl_eom">
-
- <copyright>
- Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that\n the above copyright notice appear in
- all copies and that both that copyright notice and this permission
- notice appear in supporting documentation, and that the name of
- the copyright holders not be used in advertising or publicity
- pertaining to distribution of the software without specific,
- written prior permission. The copyright holders make no
- representations about the suitability of this software for any
- purpose. It is provided "as is" without express or implied
- warranty.
-
- THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
- THIS SOFTWARE.
- </copyright>
-
- <interface name="wl_eom" version="2">
- <description summary="an interface for external outputs">
- An interface to get information of external outputs and to use external outputs.
- </description>
-
- <enum name="error">
- <entry name="none" value="0" summary="no error"/>
- <entry name="no_output" value="1" summary="Given output is invalid."/>
- <entry name="no_attribute" value="2" summary="Given attribute is invalid."/>
- <entry name="output_occupied" value="3" summary="The key has been grabbed already."/>
- </enum>
-
- <enum name="type">
- <description summary="connector type">
- Define several connectors type of the external outputs
- </description>
- <entry name="none" value="0" summary="none"/>
- <entry name="vga" value="1" summary="VGA output connector type"/>
- <entry name="dvii" value="2" summary="DVI-I output connector type"/>
- <entry name="dvid" value="3" summary="DVI-D output connector type"/>
- <entry name="dvia" value="4" summary="DVI-A output connector type"/>
- <entry name="composite" value="5" summary="Composite output connector type"/>
- <entry name="svideo" value="6" summary="S-Video output connector type"/>
- <entry name="lvds" value="7" summary="LVDS output connector type"/>
- <entry name="component" value="8" summary="Component output connector type"/>
- <entry name="9pindin" value="9" summary="9 pin DIN output connector type"/>
- <entry name="displayport" value="10" summary="DisplayPort output connector type"/>
- <entry name="hdmia" value="11" summary="HDMI type A output connector type"/>
- <entry name="hdmib" value="12" summary="HDMI type B output connector type"/>
- <entry name="tv" value="13" summary="TV output connector type"/>
- <entry name="edp" value="14" summary="eDP output connector type"/>
- <entry name="virtual" value="15" summary="Virtual output connector type"/>
- <entry name="dsi" value="16" summary="DSI output connector type"/>
- </enum>
-
- <enum name="status">
- <description summary="connection status of the external output">
- The status of external output is connected or not.
- </description>
- <entry name="none" value="0" summary="none"/>
- <entry name="connection" value="1" summary="output connected"/>
- <entry name="disconnection" value="2" summary="output disconnected"/>
- </enum>
-
- <enum name="mode">
- <description summary="mode of the external output">
- There are two modes for external output.
- Mirror mode is showing main display screen to external output.
- Presentation mode is showing app's specific buffer contents to external output.
- </description>
- <entry name="none" value="0" summary="none"/>
- <entry name="mirror" value="1" summary="mirror mode"/>
- <entry name="presentation" value="2" summary="presentation mode"/>
- </enum>
-
- <enum name="attribute">
- <description summary="attribute of the external output">
- Application can use external output by attribute.
-
- If application succeed to set attribute and set external output window,
- the external output's mode will be changed to Presentation mode.
-
- Attribute has priority.
- If attribute is set to normal, it can be changed by normal, exclusive_share, exclusive.
- If attribute is set to exclusive_share, it can be changed by exclusive_share, exclusive.
- If attribute is set to exclusive, it cannot be changed by other application.
- If application which set attribute is quit or set to none,
- the mode will be changed to Mirror if connected.
- </description>
- <entry name="none" value="0" summary="none"/>
- <entry name="normal" value="1" summary="nomal attribute"/>
- <entry name="exclusive_share" value="2" summary="exclusive share attribute"/>
- <entry name="exclusive" value="3" summary="exclusive attribute"/>
- </enum>
-
- <enum name="attribute_state">
- <description summary="state of the external output attribute">
- It means the state of attribute.
- The applicatoin which set attribute successful can get state.
-
- Active means the external window is set to external output succefully.
- So application can use that window.
- Inactive means cannot use external output, because of dissconnecting or some other reasons.
- But if connected again, the application can use external output.
- Lost means the application is lost it's right to external output by other application's attribute set.
- </description>
- <entry name="none" value="0" summary="none"/>
- <entry name="active" value="1" summary="attribute is active on the output"/>
- <entry name="inactive" value="2" summary="attribute is inactive on the output"/>
- <entry name="lost" value="3" summary="the connection of output is lost"/>
- </enum>
-
- <request name="set_attribute">
- <description summary="api to set attribute to specific external output">
- Application can have right to external output by set_attribute.
- </description>
- <arg name="output_id" type="uint"/>
- <arg name="attribute" type="uint"/>
- </request>
-
- <request name="set_shell_window">
- <description summary="">
- Use shell_surface to external output.
- </description>
- <arg name="output_id" type="uint"/>
- <arg name="surface" type="object" interface="zxdg_surface_v6" allow-null="false"/>
- </request>
-
- <request name="get_output_info">
- <description summary="get information of external output">
- Request to server to send information of specific external output to client by output id.
- </description>
- <arg name="output_id" type="uint"/>
- </request>
-
- <event name="output_count">
- <description summary="external output count">
- Get the number of external output devices that are supported by this device.
- </description>
- <arg name="count" type="uint"/>
- </event>
-
- <event name="output_info">
- <description summary="">
- Send information of specific external output to client.
-
- Output_id is numbering of external outputs. It is fixed when booting time.
- The type, mode attribute, attribute_state is mentioned above.
- The w and h is the resolution of external output.
- The w_mm and h_mm is the physical size of external output. The unit is mm.
- </description>
- <arg name="output_id" type="uint"/>
- <arg name="type" type="uint"/>
- <arg name="mode" type="uint"/>
- <arg name="w" type="uint"/>
- <arg name="h" type="uint"/>
- <arg name="w_mm" type="uint"/>
- <arg name="h_mm" type="uint"/>
- <arg name="connection" type="uint"/>
- <arg name="skip" type="uint"/>
- <arg name="attribute" type="uint"/>
- <arg name="attribute_state" type="uint"/>
- <arg name="error" type="uint"/>
- </event>
-
- <event name="output_type">
- <description summary="output type and connection info">
- Send information of output type and connection.
- </description>
- <arg name="output_id" type="uint"/>
- <arg name="type" type="uint"/>
- <arg name="status" type="uint"/>
- </event>
-
- <event name="output_mode">
- <description summary="output mode info">
- Send information of output mode.
- </description>
- <arg name="output_id" type="uint"/>
- <arg name="mode" type="uint"/>
- </event>
-
- <event name="output_attribute">
- <description summary="output attribute info">
- Send information of output attribute and attribute state.
- </description>
- <arg name="output_id" type="uint"/>
- <arg name="attribute" type="uint"/>
- <arg name="attribute_state" type="uint"/>
- <arg name="error" type="uint"/>
- </event>
-
- <event name="output_set_window">
- <description summary="reslut of set_window">
- Send the result of set_window to client.
- </description>
- <arg name="output_id" type="uint"/>
- <arg name="error" type="uint"/>
- </event>
-
- <event name="output_add">
- <description summary="output add info">
- Send information of output add.
- </description>
- <arg name="output_id" type="uint"/>
- </event>
-
- <event name="output_remove">
- <description summary="output remove info">
- Send information of output remove.
- </description>
- <arg name="output_id" type="uint"/>
- </event>
-
- <request name="destroy" type="destructor" since="2">
- </request>
- </interface>
-
-</protocol>
${CFLAGS} \
@LIBEOM_CFLAGS@ \
-I$(top_srcdir)/include \
- -I$(top_srcdir)/src \
- -I$(top_srcdir)/protocol
-
-libeom_la_SOURCES = \
- eom.c \
- eom-wayland.c \
- eom-protocol.c
-
-libeom_protocol_la_SOURCES = \
- eom-client-protocol.h \
- eom-protocol.c
-
-%-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 < $< > $@
-
-libeom_server_protocol_la_LTLIBRARIES = libeom-server-protocol.la
-libeom_server_protocol_ladir = $(libdir)
-libeom_server_protocol_la_LIBADD = @LIBEOM_SERVER_LIBS@
-libeom_server_protocol_la_LDFLAGS = ${LDFLAGS}
-libeom_server_protocol_la_CFLAGS = \
- ${CFLAGS} \
- @LIBEOM_SERVER_CFLAGS@ \
-I$(top_srcdir)/src
-libeom_server_protocol_la_SOURCES = \
- eom-protocol.c \
- eom-client-protocol.h \
- eom-server-protocol.h
-
-BUILT_SOURCES = \
- $(libeom_server_protocol_la_SOURCES) \
- $(libeom_protocol_la_SOURCES)
-
-
+libeom_la_SOURCES = \
+ eom.c
+++ /dev/null
-/**************************************************************************
- *
- * eom (external output manager)
- *
- * Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact:
- * SooChan Lim <sc1.lim@samsung.com>
- * Boram Park <boram1288.park@samsung.com>
- * Changyeon Lee <cyeon.lee@samsung.com>
- * JunKyeong Kim <jk0430.kim@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-
-#ifndef __EOM_LOG_H__
-#define __EOM_LOG_H__
-
-#include <config.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
-
-#undef HAVE_DLOG
-
-extern bool eom_debug_on;
-
-#ifndef HAVE_CAPI_0_1_1
-static inline void set_last_result(int i) {; }
-#endif
-
-#ifdef HAVE_DLOG
-#define LOG_TAG "EOM"
-#include <dlog.h>
-#define INFO(fmt, arg...) {if (eom_debug_on) SECURE_SLOGI(fmt, ##arg)}
-#define WARN(fmt, arg...) {if (eom_debug_on) SECURE_SLOGW(fmt, ##arg)}
-#define ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
-#define ERRNO(fmt, arg...) SECURE_SLOGE("(err=%s(%d)) "fmt,\
- strerror(errno), errno, ##arg)
-#define FATAL(fmt, arg...) SECURE_SLOGF(fmt, ##arg)
-#else /* HAVE_DLOG */
-#include <stdlib.h>
-#define INFO(fmt, arg...) \
- {\
- if (eom_debug_on)\
- fprintf(stdout, "[%s:%d] "fmt"\n",\
- __func__, __LINE__, ##arg);\
- }
-#define WARN(fmt, arg...) \
- {\
- if (eom_debug_on)\
- fprintf(stderr, "[%s:%d] "fmt"\n",\
- __func__, __LINE__, ##arg);\
- }
-#define ERR(fmt, arg...) \
- fprintf(stderr, "[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
-#define ERRNO(fmt, arg...) \
- fprintf(stderr, "[%s:%d](err=%s(%d)) "fmt"\n",\
- __func__, __LINE__, strerror(errno), errno, ##arg)
-#define FATAL(fmt, arg...) \
- fprintf(stderr, "[%s:%d] "fmt"\n",\
- __func__, __LINE__, ##arg)
-#endif /* HAVE_DLOG */
-
-#define WARN_IF_FAIL(cond) if (!(cond)) ERR("'%s' failed", #cond);
-#define RET_IF_FAIL(cond) {if (!(cond)) { ERR("'%s' failed", #cond); return; } }
-#define RETV_IF_FAIL(cond, val) {if (!(cond)) { ERR("'%s' failed", #cond); return val; } }
-#define RETV_IF_ERRNO(cond, val, errno) {if (!(cond)) { ERRNO("'%s' failed", #cond); return val; } }
-#define GOTO_IF_FAIL(cond, dst) {if (!(cond)) { ERR("'%s' failed", #cond); goto dst; } }
-#define GOTO_IF_ERRNO(cond, dst, errno) {if (!(cond)) { ERRNO("'%s' failed", #cond); goto dst; } }
-#define NEVER_GET_HERE() ERR("** NEVER GET HERE **\n")
-
-#endif /* __EOM_LOG_H__ */
+++ /dev/null
-/**************************************************************************
- *
- * eom (external output manager)
- *
- * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact:
- * SooChan Lim <sc1.lim@samsung.com>
- * Boram Park <boram1288.park@samsung.com>
- * Changyeon Lee <cyeon.lee@samsung.com>
- * JunKyeong Kim <jk0430.kim@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-
-#include <config.h>
-#include "eom.h"
-#include "eom_internal.h"
-#include "eom-log.h"
-#include "eom-wayland.h"
-#include "eom-private.h"
-#include "eom-client-protocol.h"
-#include "xdg-shell-unstable-v6-client-protocol.h"
-#include <Ecore_Wl2.h>
-
-typedef struct _EomWaylandClientInfo {
- /* wl */
- struct wl_display *display;
- struct wl_registry *registry;
- Ecore_Wl2_Display *wl2_display;
-
- struct wl_eom *eom;
-
- /* eom wayland output list */
- struct wl_list eom_wl_output_list;
- int num_outputs;
-
- notify_func func;
-} EomWaylandClientInfo;
-
-typedef struct _EomWaylandOutput {
- eom_output_id id;
- struct wl_output *output;
-
- /* current output data */
- int32_t x;
- int32_t y;
- int32_t physical_width;
- int32_t physical_height;
- enum wl_output_subpixel subpixel;
- const char *make;
- const char *model;
- enum wl_output_transform transform;
-
- uint32_t flags;
- int32_t width;
- int32_t height;
- int32_t refresh;
-
- int32_t factor;
-
- /* current eom data */
- enum wl_eom_type eom_type;
- enum wl_eom_status eom_status;
- enum wl_eom_mode eom_mode;
- enum wl_eom_attribute eom_attribute;
- enum wl_eom_attribute_state eom_attribute_state;
- enum wl_eom_error error;
-
- /* client info */
- EomWaylandClientInfo *client_info;
-
- struct wl_list link;
-} EomWaylandOutput;
-
-static EomWaylandClientInfo wl_client_info;
-static int eom_wayland_init;
-/*LCOV_EXCL_START*/
-static eom_output_type_e
-_convert_to_eom_output_type(enum wl_eom_type eom_type)
-{
- eom_output_type_e output_type = EOM_OUTPUT_TYPE_UNKNOWN;
-
- switch (eom_type) {
- case WL_EOM_TYPE_NONE:
- output_type = EOM_OUTPUT_TYPE_UNKNOWN;
- break;
- case WL_EOM_TYPE_VGA:
- output_type = EOM_OUTPUT_TYPE_VGA;
- break;
- case WL_EOM_TYPE_DVII:
- output_type = EOM_OUTPUT_TYPE_DVII;
- break;
- case WL_EOM_TYPE_DVID:
- output_type = EOM_OUTPUT_TYPE_DVID;
- break;
- case WL_EOM_TYPE_DVIA:
- output_type = EOM_OUTPUT_TYPE_DVIA;
- break;
- case WL_EOM_TYPE_COMPOSITE:
- output_type = EOM_OUTPUT_TYPE_COMPOSITE;
- break;
- case WL_EOM_TYPE_SVIDEO:
- output_type = EOM_OUTPUT_TYPE_SVIDEO;
- break;
- case WL_EOM_TYPE_LVDS:
- output_type = EOM_OUTPUT_TYPE_LVDS;
- break;
- case WL_EOM_TYPE_COMPONENT:
- output_type = EOM_OUTPUT_TYPE_COMPONENT;
- break;
- case WL_EOM_TYPE_9PINDIN:
- output_type = EOM_OUTPUT_TYPE_9PINDIN;
- break;
- case WL_EOM_TYPE_DISPLAYPORT:
- output_type = EOM_OUTPUT_TYPE_DISPLAYPORT;
- break;
- case WL_EOM_TYPE_HDMIA:
- output_type = EOM_OUTPUT_TYPE_HDMIA;
- break;
- case WL_EOM_TYPE_HDMIB:
- output_type = EOM_OUTPUT_TYPE_HDMIB;
- break;
- case WL_EOM_TYPE_TV:
- output_type = EOM_OUTPUT_TYPE_TV;
- break;
- case WL_EOM_TYPE_EDP:
- output_type = EOM_OUTPUT_TYPE_EDP;
- break;
- case WL_EOM_TYPE_VIRTUAL:
- output_type = EOM_OUTPUT_TYPE_VIRTUAL;
- break;
- case WL_EOM_TYPE_DSI:
- output_type = EOM_OUTPUT_TYPE_DSI;
- break;
- default:
- ERR("no type.");
- break;
- }
-
- return output_type;
-}
-
-static eom_output_mode_e
-_convert_to_eom_output_mode(enum wl_eom_mode eom_mode)
-{
- eom_output_mode_e output_mode = EOM_OUTPUT_MODE_NONE;
-
- switch (eom_mode) {
- case WL_EOM_MODE_NONE:
- output_mode = EOM_OUTPUT_MODE_NONE;
- break;
- case WL_EOM_MODE_MIRROR:
- output_mode = EOM_OUTPUT_MODE_MIRROR;
- break;
- case WL_EOM_MODE_PRESENTATION:
- output_mode = EOM_OUTPUT_MODE_PRESENTATION;
- break;
- default:
- ERR("no mode.");
- break;
- }
-
- return output_mode;
-}
-
-static eom_output_attribute_e
-_convert_to_eom_output_attribute(enum wl_eom_attribute eom_attribute)
-{
- eom_output_attribute_e output_attribute = EOM_OUTPUT_ATTRIBUTE_NONE;
-
- switch (eom_attribute) {
- case WL_EOM_ATTRIBUTE_NONE:
- output_attribute = EOM_OUTPUT_ATTRIBUTE_NONE;
- break;
- case WL_EOM_ATTRIBUTE_NORMAL:
- output_attribute = EOM_OUTPUT_ATTRIBUTE_NORMAL;
- break;
- case WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARE:
- output_attribute = EOM_OUTPUT_ATTRIBUTE_EXCLUSIVE_SHARE;
- break;
- case WL_EOM_ATTRIBUTE_EXCLUSIVE:
- output_attribute = EOM_OUTPUT_ATTRIBUTE_EXCLUSIVE;
- break;
- default:
- ERR("no attribute.");
- break;
- }
-
- return output_attribute;
-}
-
-static eom_output_attribute_state_e
-_convert_to_eom_output_attribute_state(
- enum wl_eom_attribute_state eom_attribute_state)
-{
- eom_output_attribute_state_e output_attribute_state =
- EOM_OUTPUT_ATTRIBUTE_STATE_NONE;
-
- switch (eom_attribute_state) {
- case WL_EOM_ATTRIBUTE_STATE_NONE:
- output_attribute_state = EOM_OUTPUT_ATTRIBUTE_STATE_NONE;
- break;
- case WL_EOM_ATTRIBUTE_STATE_ACTIVE:
- output_attribute_state = EOM_OUTPUT_ATTRIBUTE_STATE_ACTIVE;
- break;
- case WL_EOM_ATTRIBUTE_STATE_INACTIVE:
- output_attribute_state = EOM_OUTPUT_ATTRIBUTE_STATE_INACTIVE;
- break;
- case WL_EOM_ATTRIBUTE_STATE_LOST:
- output_attribute_state = EOM_OUTPUT_ATTRIBUTE_STATE_LOST;
- break;
- default:
- ERR("no attribute state.");
- break;
- }
-
- return output_attribute_state;
-}
-
-static enum wl_eom_attribute
-_convert_to_wl_eom_attribute(eom_output_attribute_e attr)
-{
- enum wl_eom_attribute eom_attribute = WL_EOM_ATTRIBUTE_NONE;
-
- switch (attr) {
- case EOM_OUTPUT_ATTRIBUTE_NONE:
- eom_attribute = WL_EOM_ATTRIBUTE_NONE;
- break;
- case EOM_OUTPUT_ATTRIBUTE_NORMAL:
- eom_attribute = WL_EOM_ATTRIBUTE_NORMAL;
- break;
- case EOM_OUTPUT_ATTRIBUTE_EXCLUSIVE_SHARE:
- eom_attribute = WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARE;
- break;
- case EOM_OUTPUT_ATTRIBUTE_EXCLUSIVE:
- eom_attribute = WL_EOM_ATTRIBUTE_EXCLUSIVE;
- break;
- default:
- ERR("no wl attribute.");
- break;
- }
-
- return eom_attribute;
-}
-
-static void
-_eom_wayland_client_call_notify(EomWaylandOutput *eom_wl_output,
- eom_output_notify_type_e type)
-{
- GArray *array = NULL;
- GValue v = G_VALUE_INIT;
- int current_pid = getpid();
-
- array = g_array_new(FALSE, FALSE, sizeof(GValue));
-
- /* 0: notify_type */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, type);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 1:output_id */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->id);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 2:output_type */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v,
- _convert_to_eom_output_type(eom_wl_output->eom_type));
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 3:output_mode */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v,
- _convert_to_eom_output_mode(eom_wl_output->eom_mode));
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 4:w */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->width);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 5:h */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->height);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 6:w_mm */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->physical_width);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 7:h_mm */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->physical_height);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 8:pid */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, current_pid);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 9:attri */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v,
- _convert_to_eom_output_attribute(eom_wl_output->eom_attribute));
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 10:state */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v,
- _convert_to_eom_output_attribute_state(
- eom_wl_output->eom_attribute_state));
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- if (eom_wl_output->client_info && eom_wl_output->client_info->func)
- eom_wl_output->client_info->func(NULL, array);
-
- if (array)
- g_array_free(array, FALSE);
-}
-
-static EomWaylandOutput *
-_eom_wayland_client_find_output_from_wl_output(
- struct wl_list *eom_wl_output_list, int output_id)
-{
- EomWaylandOutput *eom_wl_output = NULL;
- EomWaylandOutput *tmp = NULL;
- EomWaylandOutput *ret = NULL;
-
- if (!wl_list_empty(eom_wl_output_list)) {
- wl_list_for_each_safe(eom_wl_output, tmp, eom_wl_output_list, link) {
- if (eom_wl_output->id == output_id) {
- ret = eom_wl_output;
- break;
- }
- }
- }
-
- return ret;
-}
-
-static EomWaylandOutput *
-_eom_wayland_client_find_output_from_eom_output(
- struct wl_list *eom_wl_output_list, eom_output_id id)
-{
- EomWaylandOutput *eom_wl_output = NULL;
- EomWaylandOutput *tmp = NULL;
- EomWaylandOutput *ret = NULL;
-
- if (!wl_list_empty(eom_wl_output_list)) {
- wl_list_for_each_safe(eom_wl_output, tmp, eom_wl_output_list, link) {
- if (eom_wl_output->id == id) {
- ret = eom_wl_output;
- break;
- }
- }
- }
-
- return ret;
-}
-/*LCOV_EXCL_STOP*/
-#if 0
-static void
-_eom_wl_output_handle_geometry(void *data,
- struct wl_output *wl_output,
- int32_t x,
- int32_t y,
- int32_t physical_width,
- int32_t physical_height,
- int32_t subpixel,
- const char *make,
- const char *model,
- int32_t transform)
-{
- EomWaylandOutput *eom_wl_output = (EomWaylandOutput *) data;
-
- INFO("wl_output:%p x:%d y:%d phy(w:%d h:%d) p:%d m:%s model:%s t:%d\n",
- wl_output, x, y, physical_width, physical_height,
- subpixel, make, model, transform);
-
- /* save vaules if it is different before */
- if (eom_wl_output->x != x)
- eom_wl_output->x = x;
- if (eom_wl_output->y != y)
- eom_wl_output->y = y;
- if (eom_wl_output->physical_height)
- eom_wl_output->physical_height = physical_height;
- if (eom_wl_output->physical_width)
- eom_wl_output->physical_width = physical_width;
- if (eom_wl_output->subpixel)
- eom_wl_output->subpixel = subpixel;
- if (eom_wl_output->transform)
- eom_wl_output->transform = transform;
-
-}
-
-static void
-_eom_wl_output_handle_mode(void *data,
- struct wl_output *wl_output,
- uint32_t flags,
- int32_t width,
- int32_t height,
- int32_t refresh)
-{
- EomWaylandOutput *eom_wl_output = (EomWaylandOutput *) data;
-
- INFO("wl_output:%p flags:%d width:%d height:%d refresh:%d\n",
- wl_output, flags, width, height, refresh);
-
- /* save vaules if it is different before */
- if (eom_wl_output->flags != flags)
- eom_wl_output->flags = flags;
- if (eom_wl_output->width != width)
- eom_wl_output->width = width;
- if (eom_wl_output->height != height)
- eom_wl_output->height = height;
- if (eom_wl_output->refresh != refresh)
- eom_wl_output->refresh = refresh;
-}
-
-static void
-_eom_wl_output_handle_done(void *data,
- struct wl_output *wl_output)
-{
- INFO("wl_output:%p\n", wl_output);
-}
-
-static void
-_eom_wl_output_handle_scale(void *data,
- struct wl_output *wl_output,
- int32_t factor)
-{
- EomWaylandOutput *eom_wl_output = (EomWaylandOutput *) data;
-
- INFO("wl_output:%p factor:%d\n", wl_output, factor);
-
- /* save vaules if it is different before */
- if (eom_wl_output->factor != factor)
- eom_wl_output->factor = factor;
-}
-
-static const struct wl_output_listener eom_wl_output_listener = {
- _eom_wl_output_handle_geometry,
- _eom_wl_output_handle_mode,
- _eom_wl_output_handle_done,
- _eom_wl_output_handle_scale,
-};
-#endif
-/*LCOV_EXCL_START*/
-static void
-_eom_wl_eom_output_count(void *data,
- struct wl_eom *wl_eom,
- uint32_t count)
-{
- EomWaylandClientInfo *eom_client_info = (EomWaylandClientInfo *)data;
- /*EomWaylandOutput *eom_wl_output = NULL;*/
-
- INFO("COUNT - %d", count);
-
- if (count == 0) {
- INFO("not support external output");
- return;
- }
-
- eom_client_info->num_outputs = count;
-}
-
-static void
-_eom_wl_eom_output_info(void *data,
- struct wl_eom *wl_eom,
- uint32_t output_id,
- uint32_t type,
- uint32_t mode,
- uint32_t w,
- uint32_t h,
- uint32_t w_mm,
- uint32_t h_mm,
- uint32_t connection,
- uint32_t skip,
- uint32_t attribute,
- uint32_t attribute_state,
- uint32_t error)
-{
- EomWaylandClientInfo *eom_client_info = (EomWaylandClientInfo *) data;
- EomWaylandOutput *eom_wl_output = NULL;
-
- INFO("INFO - id : %d, type : %d, mode : %d, w : %d, h : %d, w_mm : %d, h_mm : %d, conn : %d\n",
- output_id, type, mode, w, h, w_mm, h_mm, connection);
-
- eom_wl_output = _eom_wayland_client_find_output_from_wl_output(
- &eom_client_info->eom_wl_output_list, output_id);
- if (eom_wl_output) {
- eom_wl_output->width = w;
- eom_wl_output->height = h;
- eom_wl_output->physical_width = w_mm;
- eom_wl_output->physical_height = h_mm;
-
- /* save the output type */
- if (eom_wl_output->eom_type != type)
- eom_wl_output->eom_type = type;
-
- /* check the connection status and call the notify */
- if (eom_wl_output->eom_status != connection) {
- eom_wl_output->eom_status = connection;
-
- INFO("INFO send connection: %d", connection);
-
- if (connection == WL_EOM_STATUS_CONNECTION)
- _eom_wayland_client_call_notify(eom_wl_output, EOM_OUTPUT_NOTIFY_ADD);
- else if (connection == WL_EOM_STATUS_DISCONNECTION)
- _eom_wayland_client_call_notify(eom_wl_output, EOM_OUTPUT_NOTIFY_REMOVE);
- }
-
- /* check the eom mode and call the notify */
- if (eom_wl_output->eom_mode != mode) {
- eom_wl_output->eom_mode = mode;
-
- INFO("INFO send mode:%d", mode);
-
- _eom_wayland_client_call_notify(eom_wl_output, EOM_OUTPUT_NOTIFY_MODE_CHANGED);
- }
-
- if (skip)
- return;
-
- /* check the eom attribute and call the notify */
- if ((eom_wl_output->eom_attribute != attribute) ||
- (eom_wl_output->eom_attribute_state != attribute_state)) {
- eom_wl_output->eom_attribute = attribute;
- eom_wl_output->eom_attribute_state = attribute_state;
-
- INFO("INFO NEW send attribute:%d", attribute);
- INFO("INFO NEW send attribute state:%d", attribute_state);
-
- _eom_wayland_client_call_notify(eom_wl_output, EOM_OUTPUT_NOTIFY_ATTRIBUTE_CHANGED);
- }
-
- eom_wl_output->error = error;
- } else {
- /* make external output info */
- eom_wl_output = calloc(1, sizeof(EomWaylandOutput));
- if (!eom_wl_output) {
- ERR("Fail to allocate the eom_output.\n");
- return;
- }
-
- eom_wl_output->id = output_id;
- eom_wl_output->eom_type = type;
- eom_wl_output->eom_mode = mode;
- eom_wl_output->width = w;
- eom_wl_output->height = h;
- eom_wl_output->physical_width = w_mm;
- eom_wl_output->physical_height = h_mm;
- eom_wl_output->eom_status = connection;
- eom_wl_output->client_info = &wl_client_info;
- eom_wl_output->error = WL_EOM_ERROR_NONE;
-
- wl_list_insert(&eom_client_info->eom_wl_output_list, &eom_wl_output->link);
- }
-}
-
-static void
-_eom_wl_eom_output_type(void *data,
- struct wl_eom *wl_eom,
- uint32_t output_id,
- uint32_t type,
- uint32_t status)
-{
- EomWaylandClientInfo *eom_client_info = (EomWaylandClientInfo *)data;
- EomWaylandOutput *eom_wl_output = NULL;
-
- INFO("TYPE - id : %d, type : %d, status : %d\n", output_id, type, status);
-
- eom_wl_output = _eom_wayland_client_find_output_from_wl_output(
- &eom_client_info->eom_wl_output_list, output_id);
- RET_IF_FAIL(eom_wl_output != NULL);
-
- /* save the output type */
- if (eom_wl_output->eom_type != type)
- eom_wl_output->eom_type = type;
-
- /* check the connection status and call the notify */
- if (eom_wl_output->eom_status != status) {
- eom_wl_output->eom_status = status;
-
- if (status == WL_EOM_STATUS_CONNECTION)
- _eom_wayland_client_call_notify(eom_wl_output, EOM_OUTPUT_NOTIFY_ADD);
- else if (status == WL_EOM_STATUS_DISCONNECTION)
- _eom_wayland_client_call_notify(eom_wl_output, EOM_OUTPUT_NOTIFY_REMOVE);
- }
-}
-
-static void
-_eom_wl_eom_output_mode(void *data,
- struct wl_eom *wl_eom,
- uint32_t output_id,
- uint32_t mode)
-{
- EomWaylandClientInfo *eom_client_info = (EomWaylandClientInfo *)data;
- EomWaylandOutput *eom_wl_output = NULL;
-
- INFO("MODE - id : %d, mode : %d\n", output_id, mode);
-
- eom_wl_output = _eom_wayland_client_find_output_from_wl_output(
- &eom_client_info->eom_wl_output_list, output_id);
- RET_IF_FAIL(eom_wl_output != NULL);
-
- /* check the eom mode and call the notify */
- if (eom_wl_output->eom_mode != mode) {
- eom_wl_output->eom_mode = mode;
-
- _eom_wayland_client_call_notify(eom_wl_output, EOM_OUTPUT_NOTIFY_MODE_CHANGED);
- }
-}
-
-static void
-_eom_wl_eom_output_attribute(void *data,
- struct wl_eom *wl_eom,
- uint32_t output_id,
- uint32_t attribute,
- uint32_t attribute_state,
- uint32_t error)
-{
- EomWaylandClientInfo *eom_client_info = (EomWaylandClientInfo *)data;
- EomWaylandOutput *eom_wl_output = NULL;
-
- INFO("ATTRIBUTE - id : %d, attribute : %d, state : %d\n", output_id, attribute, attribute_state);
-
- eom_wl_output = _eom_wayland_client_find_output_from_wl_output(
- &eom_client_info->eom_wl_output_list, output_id);
- RET_IF_FAIL(eom_wl_output != NULL);
-
- /* check the eom attribute and call the notify */
- if ((eom_wl_output->eom_attribute != attribute) ||
- (eom_wl_output->eom_attribute_state != attribute_state)) {
- eom_wl_output->eom_attribute = attribute;
- eom_wl_output->eom_attribute_state = attribute_state;
-
- _eom_wayland_client_call_notify(eom_wl_output, EOM_OUTPUT_NOTIFY_ATTRIBUTE_CHANGED);
- }
-
- eom_wl_output->error = error;
-}
-
-static void
-_eom_wl_eom_output_set_window(void *data,
- struct wl_eom *wl_eom,
- uint32_t output_id,
- uint32_t error)
-{
- EomWaylandClientInfo *eom_client_info = (EomWaylandClientInfo *)data;
- EomWaylandOutput *eom_wl_output = NULL;
-
- INFO("SET_WINODW - id : %d, error : %d\n", output_id, error);
-
- eom_wl_output = _eom_wayland_client_find_output_from_wl_output(
- &eom_client_info->eom_wl_output_list, output_id);
- RET_IF_FAIL(eom_wl_output != NULL);
-
- eom_wl_output->error = error;
-}
-
-static void
-_eom_wl_eom_output_add(void *data,
- struct wl_eom *wl_eom,
- uint32_t output_id)
-{
- EomWaylandClientInfo *eom_client_info = (EomWaylandClientInfo *)data;
- EomWaylandOutput *eom_wl_output = NULL;
-
- INFO("OUTPUT ADD - %d", output_id);
-
- eom_wl_output = _eom_wayland_client_find_output_from_wl_output(
- &eom_client_info->eom_wl_output_list, output_id);
- RET_IF_FAIL(eom_wl_output != NULL);
-
- _eom_wayland_client_call_notify(eom_wl_output, EOM_OUTPUT_NOTIFY_ADD);
-}
-
-static void
-_eom_wl_eom_output_remove(void *data,
- struct wl_eom *wl_eom,
- uint32_t output_id)
-{
- EomWaylandClientInfo *eom_client_info = (EomWaylandClientInfo *)data;
- EomWaylandOutput *eom_wl_output = NULL;
-
- INFO("OUTPUT REMOVE - %d", output_id);
-
- eom_wl_output = _eom_wayland_client_find_output_from_wl_output(
- &eom_client_info->eom_wl_output_list, output_id);
- RET_IF_FAIL(eom_wl_output != NULL);
-
- wl_list_remove(&eom_wl_output->link);
-
- _eom_wayland_client_call_notify(eom_wl_output, EOM_OUTPUT_NOTIFY_REMOVE);
-
- free(eom_wl_output);
- eom_wl_output = NULL;
-}
-/*LCOV_EXCL_STOP*/
-
-static const struct wl_eom_listener eom_wl_eom_listener = {
- _eom_wl_eom_output_count,
- _eom_wl_eom_output_info,
- _eom_wl_eom_output_type,
- _eom_wl_eom_output_mode,
- _eom_wl_eom_output_attribute,
- _eom_wl_eom_output_set_window,
- _eom_wl_eom_output_add,
- _eom_wl_eom_output_remove,
-};
-
-static void
-_eom_wl_registry_handle_global(void *data, struct wl_registry *registry,
- uint32_t name, const char *interface, uint32_t version)
-{
- EomWaylandClientInfo *ci = (EomWaylandClientInfo *)data;
- /*EomWaylandOutput *eom_wl_output = NULL;*/
- struct wl_output *output = NULL;
- struct wl_eom *eom = NULL;
-
- if (strcmp(interface, "wl_output") == 0) {
- output = wl_registry_bind(registry, name,
- &wl_output_interface, 1);
- if (!output)
- ERR("Error. fail to bind %s.\n", interface);/*LCOV_EXCL_LINE*/
- else {
- INFO("bind %s.\n", interface);
-#if 0
- /* create the eom_wl_output */
- eom_wl_output = calloc(1, sizeof(EomWaylandOutput));
- if (!eom_wl_output) {
- ERR("Fail to allocate the eom_output.\n");
- return;
- }
- ci->num_outputs++;
- eom_wl_output->id = ci->num_outputs;
- eom_wl_output->output = output;
- wl_list_insert(&ci->eom_wl_output_list,
- &eom_wl_output->link);
-
- /* add listener */
- wl_output_add_listener(eom_wl_output->output,
- &eom_wl_output_listener, eom_wl_output);
-#endif
- }
- } else if (strcmp(interface, "wl_eom") == 0) {
- eom = wl_registry_bind(registry, name, &wl_eom_interface, 1);
- if (!eom)
- ERR("Error. fail to bind %s.\n", interface);/*LCOV_EXCL_LINE*/
- else {
- INFO("bind %s.\n", interface);/*LCOV_EXCL_LINE*/
-
- ci->eom = eom;
-
- /* add listener */
- wl_eom_add_listener(ci->eom, &eom_wl_eom_listener, ci);
-
- wl_display_dispatch(ci->display);
- wl_display_roundtrip(ci->display);
- }
- } else
- INFO("Not bind %s.\n", interface);
-}
-/*LCOV_EXCL_START*/
-static void
-_eom_wl_registry_handle_global_remove(void *data,
- struct wl_registry *registry, uint32_t name)
-{
-
-}
-/*LCOV_EXCL_STOP*/
-static const struct wl_registry_listener eom_registry_listener = {
- _eom_wl_registry_handle_global,
- _eom_wl_registry_handle_global_remove
-};
-
-static bool
-_eom_wayland_client_initialize()
-{
- int ecore_count = -1;
-
- ecore_count = ecore_wl2_init();
- RETV_IF_FAIL(ecore_count > 0, false);
-
- wl_list_init(&wl_client_info.eom_wl_output_list);
-
- wl_client_info.wl2_display = ecore_wl2_display_connect(NULL);
- GOTO_IF_FAIL(wl_client_info.wl2_display != NULL, fail);
-
- wl_client_info.display = ecore_wl2_display_get(wl_client_info.wl2_display);
- GOTO_IF_FAIL(wl_client_info.display != NULL, fail);
-
- /* get the registry */
- wl_client_info.registry =
- wl_display_get_registry(wl_client_info.display);
- GOTO_IF_FAIL(wl_client_info.registry != NULL, fail);
-
- /* get the global objects */
- wl_registry_add_listener(wl_client_info.registry,
- &eom_registry_listener, &wl_client_info);
- wl_display_dispatch(wl_client_info.display);
- wl_display_roundtrip(wl_client_info.display);
-#if 0
- /* remove type none eom_wl_outputs */
- if (!wl_list_empty(&wl_client_info.eom_wl_output_list)) {
- EomWaylandOutput *eom_wl_output = NULL;
- EomWaylandOutput *tmp = NULL;
-
- wl_list_for_each_safe(eom_wl_output, tmp, &wl_client_info.eom_wl_output_list, link) {
- if (eom_wl_output->eom_type == WL_EOM_TYPE_NONE) {
- WARN("[EOM_CLIENT] eom_type is NONE. remove output:%d\n",
- eom_wl_output->id);
- wl_output_destroy(eom_wl_output->output);
- wl_list_remove(&eom_wl_output->link);
- free(eom_wl_output);
- eom_wl_output = NULL;
- }
- }
- }
-#endif
- if (wl_client_info.num_outputs == 0)
- WARN("[EOM_CLIENT] not support external output at this device.\n");
-
- /* output list */
- if (wl_list_empty(&wl_client_info.eom_wl_output_list))
- WARN("[EOM_CLIENT] no wl output at this device.\n");
-
- INFO("[EOM_CLIENT] wayland client init.");
-
- return true;
-fail:
- if (wl_client_info.registry) {
- wl_registry_destroy(wl_client_info.registry);
- wl_client_info.registry = NULL;
- }
-
- if (wl_client_info.wl2_display) {
- ecore_wl2_display_disconnect(wl_client_info.wl2_display);
- wl_client_info.wl2_display = NULL;
- }
- ecore_wl2_shutdown();
-
- return false;
-}
-
-static void
-_eom_wayland_client_deinitialize()
-{
- EomWaylandOutput *eom_wl_output = NULL;
- EomWaylandOutput *tmp = NULL;
-
- /* remove all eom_wl_outputs */
- if (!wl_list_empty(&wl_client_info.eom_wl_output_list)) {
- wl_list_for_each_safe(eom_wl_output, tmp, &wl_client_info.eom_wl_output_list, link) {
- if (eom_wl_output->output)
- wl_output_destroy(eom_wl_output->output);
- free(eom_wl_output);
- eom_wl_output = NULL;
- }
- }
-
- if (wl_client_info.registry) {
- wl_registry_destroy(wl_client_info.registry);
- wl_client_info.registry = NULL;
- }
- if (wl_client_info.wl2_display) {
- ecore_wl2_display_disconnect(wl_client_info.wl2_display);
- wl_client_info.wl2_display = NULL;
- }
- ecore_wl2_shutdown();
-
- INFO("[EOM_CLIENT] wayland client deinit.");
-}
-
-bool
-eom_wayland_client_init(notify_func func)
-{
- bool ret = false;
-
- if (eom_wayland_init)
- return true;
-
- ret = _eom_wayland_client_initialize();
- GOTO_IF_FAIL(ret != false, fail);
-
- wl_client_info.func = func;
-
- eom_wayland_init = 1;
-
- return ret;
-fail:
- return false;
-}
-
-void
-eom_wayland_client_deinit(GList *cb_info_list)
-{
- if (!eom_wayland_init)
- return;
-
- _eom_wayland_client_deinitialize();
-
- eom_wayland_init = 0;
-
- memset(&wl_client_info, 0x0, sizeof(EomWaylandClientInfo));
-}
-
-GArray *
-eom_wayland_client_get_output_ids(void)
-{
- GArray *array = NULL;
- GValue v = G_VALUE_INIT;
- EomWaylandOutput *eom_wl_output = NULL;
- EomWaylandOutput *tmp = NULL;
-
- if (wl_list_empty(&wl_client_info.eom_wl_output_list)) {
- ERR("error. no outputs.\n");
- return NULL;
- }
-/*LCOV_EXCL_START*/
- array = g_array_new(FALSE, FALSE, sizeof(GValue));
-
- wl_list_for_each_safe(eom_wl_output, tmp, &wl_client_info.eom_wl_output_list, link) {
- if (eom_wl_output) {
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->id);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
- }
- }
-
- /* returned array will be freed by caller */
- return array;
-/*LCOV_EXCL_STOP*/
-}
-/*LCOV_EXCL_START*/
-GArray *
-eom_wayland_client_get_output_info(eom_output_id output_id)
-{
- GArray *array = NULL;
- GValue v = G_VALUE_INIT;
- EomWaylandOutput *eom_wl_output = NULL;
-
- eom_wl_output = _eom_wayland_client_find_output_from_eom_output(
- &wl_client_info.eom_wl_output_list, output_id);
- RETV_IF_FAIL(eom_wl_output != NULL, NULL);
-
- array = g_array_new(FALSE, FALSE, sizeof(GValue));
-
- /* 0:output_id */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->id);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 1:output_type */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->eom_type);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 2:output_mode */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->eom_mode);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 3:w */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->width);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 4:h */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->height);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 5:w_mm */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->physical_width);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 6:h_mm */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->physical_height);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* 7:attribute */
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, eom_wl_output->eom_attribute);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* returned array will be freed by caller */
- return array;
-}
-/*LCOV_EXCL_STOP*/
-/*LCOV_EXCL_START*/
-GArray *
-eom_wayland_client_set_attribute(eom_output_id output_id,
- eom_output_attribute_e attr)
-{
- GArray *array = NULL;
- GValue v = G_VALUE_INIT;
- EomWaylandOutput *eom_wl_output = NULL;
- int ret = 0;
-
- eom_wl_output = _eom_wayland_client_find_output_from_eom_output(
- &wl_client_info.eom_wl_output_list, output_id);
- GOTO_IF_FAIL(eom_wl_output != NULL, fail);
-
- wl_eom_set_attribute(wl_client_info.eom, eom_wl_output->id,
- _convert_to_wl_eom_attribute(attr));
-
- /* TODO:
- * wait for the result of set_attribute.
- * this should be the blocking call.
- */
- wl_display_dispatch(wl_client_info.display);
- wl_display_roundtrip(wl_client_info.display);
-
- if (eom_wl_output->error == WL_EOM_ERROR_NONE)
- ret = 1;
-
- array = g_array_new(FALSE, FALSE, sizeof(GValue));
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, ret);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* returned array will be freed by caller */
- return array;
-fail:
-
- return NULL;
-}
-/*LCOV_EXCL_STOP*/
-/*LCOV_EXCL_START*/
-GArray *
-eom_wayland_client_set_window(eom_output_id output_id, Evas_Object *win)
-{
- GArray *array = NULL;
- GValue v = G_VALUE_INIT;
- Ecore_Wl2_Window *e_wl_win = NULL;
- EomWaylandOutput *eom_wl_output = NULL;
- struct zxdg_surface_v6 *shell_surface = NULL;
- int ret = 0;
-
- evas_object_show(win);
-
- e_wl_win = (Ecore_Wl2_Window *)elm_win_wl_window_get(win);
- GOTO_IF_FAIL(e_wl_win != NULL, fail);
-
- eom_wl_output = _eom_wayland_client_find_output_from_eom_output(
- &wl_client_info.eom_wl_output_list, output_id);
- GOTO_IF_FAIL(eom_wl_output != NULL, fail);
-
-#if 0
- elm_win_aux_hint_add(win, "wm.policy.win.user.geometry", "1");
-#endif
-
- /* set full screen at output */
- shell_surface = ecore_wl2_window_shell_surface_get(e_wl_win);
- if (shell_surface) {
- wl_eom_set_shell_window(wl_client_info.eom, output_id, shell_surface);
- } else {
- ERR("no wl surface.\n");
- goto fail;
- }
-
- /* TODO:
- * wait for the result of set_window.
- * this should be the blocking call.
- */
- wl_display_dispatch(wl_client_info.display);
- wl_display_roundtrip(wl_client_info.display);
-
- if (eom_wl_output->error == WL_EOM_ERROR_NONE)
- ret = 1;
-
- array = g_array_new(FALSE, FALSE, sizeof(GValue));
- g_value_init(&v, G_TYPE_INT);
- g_value_set_int(&v, ret);
- array = g_array_append_val(array, v);
- g_value_unset(&v);
-
- /* returned array will be freed by caller */
- return array;
-fail:
-
- return NULL;
-}
-/*LCOV_EXCL_STOP*/
-
+++ /dev/null
-/**************************************************************************
- *
- * eom (external output manager)
- *
- * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact:
- * SooChan Lim <sc1.lim@samsung.com>
- * Boram Park <boram1288.park@samsung.com>
- * Changyeon Lee <cyeon.lee@samsung.com>
- * JunKyeong Kim <jk0430.kim@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-
-#ifndef __EOM_WAYLAND_H__
-#define __EOM_WAYLAND_H__
-
-#include <stdbool.h>
-#include <glib.h>
-#include <glib-object.h>
-#include "eom.h"
-#include "eom-private.h"
-
-bool eom_wayland_client_init(notify_func func);
-void eom_wayland_client_deinit(GList *cb_info_list);
-
-GArray *eom_wayland_client_get_output_ids(void);
-GArray *eom_wayland_client_get_output_info(eom_output_id output_id);
-GArray *eom_wayland_client_set_attribute(eom_output_id output_id,
- eom_output_attribute_e attry);
-GArray *eom_wayland_client_set_window(eom_output_id output_id,
- Evas_Object *win);
-
-
-#endif /* __EOM_WAYLAND_H__ */
-
*
**************************************************************************/
-#include <config.h>
-
-#include <glib.h>
-#include <string.h>
-#include <errno.h>
-#include <pthread.h>
-
#include "eom.h"
-#include "eom_internal.h"
-#include "eom-log.h"
-#include "eom-wayland.h"
-#include "eom-private.h"
-
-typedef struct {
- eom_output_notify_type_e type; /**< External output type */
- eom_output_id output_id; /**< External output id */
-} eom_output_notify_base_s;
-
-typedef struct {
- eom_output_notify_type_e type; /**< External output type */
- eom_output_id output_id; /**< External output id */
-} eom_output_notify_add_s;
-
-typedef struct {
- eom_output_notify_type_e type; /**< External output type */
- eom_output_id output_id; /**< External output id */
-} eom_output_notify_remove_s;
-
-typedef struct {
- eom_output_notify_type_e type; /**< External output type */
- eom_output_id output_id; /**< External output id */
- eom_output_mode_e old_mode; /**< External output mode */
- eom_output_mode_e new_mode; /**< External output mode */
-} eom_output_notify_mode_change_s;
-
-typedef struct {
- /**< External output type */
- eom_output_notify_type_e type;
- /**< External output id */
- eom_output_id output_id;
- /**< External output attribute */
- eom_output_attribute_e attribute;
- /**< External output attribute state */
- eom_output_attribute_state_e attr_state;
-} eom_output_notify_attribute_change_s;
-
-typedef union {
- /**< Base structure for eom notify */
- eom_output_notify_base_s base;
- /**< #EOM_OUTPUT_NOTIFY_ADD notify */
- eom_output_notify_add_s output_add;
- /**< #EOM_OUTPUT_NOTIFY_REMOVE notify */
- eom_output_notify_remove_s output_remove;
- /**< #EOM_OUTPUT_NOTIFY_MODE_CHANGED notify */
- eom_output_notify_mode_change_s mode_change;
- /**< #EOM_OUTPUT_NOTIFY_ATTRIBUTE_CHANGED notify */
- eom_output_notify_attribute_change_s attr_change;
-} eom_output_notify_s;
-
-typedef struct {
- eom_output_notify_type_e type;
- eom_output_added_cb add_func;
- eom_output_removed_cb remove_func;
- eom_mode_changed_cb mode_change_func;
- eom_attribute_changed_cb attribute_change_func;
- void *user_data;
-} eom_output_notify_cb_info;
-
-bool eom_debug_on;
-static bool eom_mutex_init;
-static pthread_mutex_t eom_lock;
-
-static GList *cb_info_list;
-static GList *output_info_list;
-
-static void _eom_output_process_notify_cb(void *data, GArray *array);
-static eom_output_info *_eom_find_output_info(eom_output_id output_id);
-static eom_output_info *_eom_alloc_output_info(int output_id, int output_type);
-/*LCOV_EXCL_START*/
-static const char*
-TYPE(eom_output_type_e output_type)
-{
- switch (output_type) {
- case EOM_OUTPUT_TYPE_VGA:
- return "VGA";
- case EOM_OUTPUT_TYPE_DVII:
- return "DVII";
- case EOM_OUTPUT_TYPE_DVID:
- return "DVID";
- case EOM_OUTPUT_TYPE_DVIA:
- return "DVIA";
- case EOM_OUTPUT_TYPE_COMPOSITE:
- return "COMPOSITE";
- case EOM_OUTPUT_TYPE_SVIDEO:
- return "SVIDEO";
- case EOM_OUTPUT_TYPE_LVDS:
- return "LVDS";
- case EOM_OUTPUT_TYPE_COMPONENT:
- return "COMPONENT";
- case EOM_OUTPUT_TYPE_9PINDIN:
- return "9PINDIN";
- case EOM_OUTPUT_TYPE_DISPLAYPORT:
- return "DISPLAYPORT";
- case EOM_OUTPUT_TYPE_HDMIA:
- return "HDMIA";
- case EOM_OUTPUT_TYPE_HDMIB:
- return "HDMIB";
- case EOM_OUTPUT_TYPE_TV:
- return "TV";
- case EOM_OUTPUT_TYPE_EDP:
- return "EDP";
- case EOM_OUTPUT_TYPE_VIRTUAL:
- return "VIRTUAL";
- case EOM_OUTPUT_TYPE_DSI:
- return "DSI";
- default:
- return "UNKNOWN";
- }
-}
-/*LCOV_EXCL_STOP*/
-static void
-_eom_get_debug_evn(void)
-{
- char *env = getenv("EOM_DEBUG");
-
- if (env) {
- eom_debug_on = (atoi(env) > 0) ? true : false;/*LCOV_EXCL_LINE*/
-#ifdef HAVE_DLOG
- fprintf(stderr, "eom dlog on\n");/*LCOV_EXCL_LINE*/
-#else
- fprintf(stderr, "eom dlog off\n");/*LCOV_EXCL_LINE*/
+#ifndef API
+#define API __attribute__ ((visibility("default")))
#endif
- INFO("EOM_DEBUG = %s", env);/*LCOV_EXCL_LINE*/
- } else
- eom_debug_on = 0;
-}
-
-static bool
-_eom_mutex_init(void)
-{
- if (eom_mutex_init)
- return true;
-
- if (pthread_mutex_init(&eom_lock, NULL)) {
- fprintf(stderr, "fail: eom mutex init");/*LCOV_EXCL_LINE*/
- return false;/*LCOV_EXCL_LINE*/
- }
-
- eom_mutex_init = true;
-
- return true;
-}
-
-static bool
-_eom_mutex_destory(void)
-{
- if (!eom_mutex_init)
- return true;
-
- if (pthread_mutex_destroy(&eom_lock)) {
- fprintf(stderr, "fail: eom mutex destory");
- return false;
- }
-
- eom_mutex_init = false;
-
- return true;
-}
-
-void
-_eom_mutex_lock(void)
-{
- if (!_eom_mutex_init())
- return;
-
- pthread_mutex_lock(&eom_lock);
-}
-
-void
-_eom_mutex_unlock(void)
-{
- pthread_mutex_unlock(&eom_lock);
-}
-/*LCOV_EXCL_START*/
-static void
-_eom_set_output_info_mode(eom_output_info *output_info,
- int output_mode)
-{
- RET_IF_FAIL(output_info != NULL);
-
- if (output_info->output_mode == output_mode)
- return;
-
- output_info->output_mode = output_mode;
-}
-
-static void
-_eom_set_output_attribute(eom_output_info *output_info,
- eom_output_attribute_e attribute)
-{
- RET_IF_FAIL(output_info != NULL);
-
- output_info->attribute = attribute;
-}
-
-static void
-_eom_set_output_attribute_state(eom_output_info *output_info,
- eom_output_attribute_state_e state)
-{
- RET_IF_FAIL(output_info != NULL);
-
- output_info->state = state;
-}
-
-static void
-_eom_set_output_info_size(eom_output_info *output_info,
- int w, int h)
-{
- RET_IF_FAIL(output_info != NULL);
-
- output_info->width = w;
- output_info->height = h;
-}
-
-static void
-_eom_set_output_info_phy_size(eom_output_info *output_info,
- int w_mm, int h_mm)
-{
- RET_IF_FAIL(output_info != NULL);
-
- output_info->mm_width = w_mm;
- output_info->mm_height = h_mm;
-}
-
-static void
-_eom_reset_output_info(eom_output_info *output_info)
-{
- RET_IF_FAIL(output_info != NULL);
-
- output_info->width = 0;
- output_info->height = 0;
- output_info->mm_width = 0;
- output_info->mm_height = 0;
-}
-
-static eom_output_id *
-_eom_get_eom_output_ids(int *count)
-{
- GArray *ret_array = NULL;
- eom_output_id *output_ids = NULL;
- int i;
-
- if (!count)
- return NULL;
- *count = 0;
-
- ret_array = eom_wayland_client_get_output_ids();
-
- if (!ret_array)
- return NULL;
-
- if (ret_array->len == 0)
- goto done;
-
- output_ids = calloc(ret_array->len, sizeof(eom_output_id));
- if (output_ids == NULL) {
- ERR("alloc fail");
- goto done;
- }
-
- *count = ret_array->len;
- for (i = 0; i < ret_array->len; i++) {
- GValue *v = &g_array_index(ret_array, GValue, i);
-
- output_ids[i] = g_value_get_int(v);
- INFO("output_ids: %d", output_ids[i]);
- }
-
- return output_ids;
-
-done:
- g_array_free(ret_array, FALSE);
- return NULL;
-}
-
-static void
-_eom_update_output_info_list()
-{
- GArray *ret_array = NULL;
- eom_output_id *output_ids = NULL;
- int i, count;
- output_ids = _eom_get_eom_output_ids(&count);
- RET_IF_FAIL(output_ids != NULL);
-
- /* TODO: redesign the life-cycle of output_infos */
- for (i = 0; i < count; i++) {
- /* add output_info to output_info_list */
- eom_output_info *output_info;
- eom_output_id output_id = output_ids[i];
-
- output_info = _eom_find_output_info(output_id);
- if (output_info)
- continue;
-
- ret_array = eom_wayland_client_get_output_info(output_id);
- if (ret_array) {
- /*
- * 0:output_id, 1:output_type, 2:output_mode,
- * 3:w, 4:h, 5:w_mm, 6:h_mm, 7:attribute
- */
- output_info = _eom_alloc_output_info(
- g_value_get_int(&g_array_index(
- ret_array, GValue, 0)),
- g_value_get_int(&g_array_index(
- ret_array, GValue, 1)));
- if (output_info) {
- output_info_list = g_list_append(
- output_info_list, output_info);
- _eom_set_output_info_mode(output_info,
- g_value_get_int(&g_array_index(
- ret_array, GValue, 2)));
- _eom_set_output_info_size(output_info,
- g_value_get_int(&g_array_index(
- ret_array, GValue, 3)),
- g_value_get_int(&g_array_index(
- ret_array, GValue, 4)));
- _eom_set_output_info_phy_size(output_info,
- g_value_get_int(&g_array_index(
- ret_array, GValue, 5)),
- g_value_get_int(&g_array_index(
- ret_array, GValue, 6)));
- _eom_set_output_attribute(output_info,
- g_value_get_int(&g_array_index(
- ret_array, GValue, 7)));
- INFO("GetOutputInfo: %s(%d)",
- TYPE(output_info->type),
- output_info->id);
- }
-
- g_array_free(ret_array, FALSE);
- ret_array = NULL;
- } else
- ERR("fail: get id(%d)'s information", output_id);
- }
-
- free(output_ids);
-}
-
-static void
-_eom_output_call_notify_cb(eom_output_notify_s *notify)
-{
- GList *l;
-
- for (l = cb_info_list; l; l = g_list_next(l)) {
- eom_output_notify_cb_info *cb_info =
- (eom_output_notify_cb_info *)l->data;
-
- if (!cb_info || cb_info->type != notify->base.type)
- continue;
-
- if (notify->base.type == EOM_OUTPUT_NOTIFY_ADD) {
- if (cb_info->add_func == NULL)
- continue;
-
- INFO("cb_info: type(%d) output_id(%d)",
- notify->base.type, notify->base.output_id);
-
- cb_info->add_func(notify->base.output_id,
- cb_info->user_data);
- } else if (notify->base.type == EOM_OUTPUT_NOTIFY_REMOVE) {
- if (cb_info->remove_func == NULL)
- continue;
-
- INFO("cb_info: type(%d) output_id(%d)",
- notify->base.type, notify->base.output_id);
-
- cb_info->remove_func(notify->base.output_id,
- cb_info->user_data);
- } else if (notify->base.type ==
- EOM_OUTPUT_NOTIFY_MODE_CHANGED) {
- if (cb_info->mode_change_func == NULL)
- continue;
-
- INFO("cb_info: type(%d) output_id(%d)",
- notify->base.type, notify->base.output_id);
-
- cb_info->mode_change_func(notify->base.output_id,
- cb_info->user_data);
- } else if (notify->base.type ==
- EOM_OUTPUT_NOTIFY_ATTRIBUTE_CHANGED) {
- if (cb_info->attribute_change_func == NULL)
- continue;
-
- INFO("cb_info: type(%d) output_id(%d)",
- notify->base.type, notify->base.output_id);
-
- cb_info->attribute_change_func(notify->base.output_id,
- cb_info->user_data);
- } else {
- INFO("cb_info: type(%d) output_id(%d)",
- notify->base.type, notify->base.output_id);
- continue;
- }
- }
-}
-
-static void
-_eom_output_process_notify_cb(void *data, GArray *array)
-{
- eom_output_notify_s notify;
- eom_output_info *output_info;
- int notify_type, output_id, output_type, output_mode;
- int w, h, w_mm, h_mm, pid, attr, state;
- GValue *v;
-
- RET_IF_FAIL(array != NULL);
- RET_IF_FAIL(array->len == 11);
-
-/* 11 args 0: notify_type 1:output_id, 2:output_type, 3:output_mode,
- * 4:w, 5:h, 6:w_mm, 7:h_mm, 8:pid, 9:attr, 10:state
- */
- v = &g_array_index(array, GValue, 0);
- notify_type = g_value_get_int(v);
- v = &g_array_index(array, GValue, 1);
- output_id = g_value_get_int(v);
- v = &g_array_index(array, GValue, 2);
- output_type = g_value_get_int(v);
- v = &g_array_index(array, GValue, 3);
- output_mode = g_value_get_int(v);
- v = &g_array_index(array, GValue, 4);
- w = g_value_get_int(v);
- v = &g_array_index(array, GValue, 5);
- h = g_value_get_int(v);
- v = &g_array_index(array, GValue, 6);
- w_mm = g_value_get_int(v);
- v = &g_array_index(array, GValue, 7);
- h_mm = g_value_get_int(v);
- v = &g_array_index(array, GValue, 8);
- pid = g_value_get_int(v);
- v = &g_array_index(array, GValue, 9);
- attr = g_value_get_int(v);
- v = &g_array_index(array, GValue, 10);
- state = g_value_get_int(v);
-
- INFO("notify: %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
- notify_type, output_id, output_type, output_mode,
- w, h, w_mm, h_mm, pid, attr, state);
-
- memset(¬ify, 0, sizeof(eom_output_notify_s));
- notify.base.type = notify_type;
- notify.base.output_id = output_id;
-
- _eom_mutex_lock();
-
- output_info = _eom_find_output_info(output_id);
- if (output_info == NULL) {
- if (notify_type == EOM_OUTPUT_NOTIFY_ADD) {
- _eom_update_output_info_list();
- output_info = _eom_find_output_info(output_id);
- }
-
- GOTO_IF_FAIL(output_info != NULL, exit);
- }
-
- switch (notify_type) {
- case EOM_OUTPUT_NOTIFY_ADD:
- {
- INFO("'%s(%d)' added", TYPE(output_type), output_id);
-
- _eom_set_output_info_mode(output_info, output_mode);
- _eom_set_output_info_size(output_info, w, h);
- _eom_set_output_info_phy_size(output_info, w_mm, h_mm);
-
- _eom_mutex_unlock();
- _eom_output_call_notify_cb(¬ify);
- _eom_mutex_lock();
- }
- break;
-
- case EOM_OUTPUT_NOTIFY_REMOVE:
- {
- INFO("'%s(%d)' removed", TYPE(output_type), output_id);
-
- _eom_reset_output_info(output_info);
-
- _eom_mutex_unlock();
- _eom_output_call_notify_cb(¬ify);
- _eom_mutex_lock();
- }
- break;
-
- case EOM_OUTPUT_NOTIFY_MODE_CHANGED:
- {
- eom_output_mode_e old_mode;
-
- old_mode = output_info->output_mode;
- output_info->output_mode = output_mode;
-
- INFO("'%s(%d)' mode changed(%d=>%d)",
- TYPE(output_type), output_id,
- old_mode, output_info->output_mode);
-
- notify.mode_change.old_mode = old_mode;
- notify.mode_change.new_mode = output_info->output_mode;
-
- _eom_mutex_unlock();
- _eom_output_call_notify_cb(¬ify);
- _eom_mutex_lock();
- }
- break;
-
- case EOM_OUTPUT_NOTIFY_ATTRIBUTE_CHANGED:
- {
- int current_pid = getpid();
-
- if (current_pid == pid) {
- INFO("'%s(%d)'pid(%d)",
- TYPE(output_type), output_id, pid);
- _eom_set_output_attribute(output_info, attr);
- _eom_set_output_attribute_state(output_info, state);
- notify.attr_change.output_id = output_id;
- notify.attr_change.attribute = attr;
- notify.attr_change.attr_state = state;
-
- _eom_mutex_unlock();
- _eom_output_call_notify_cb(¬ify);
- _eom_mutex_lock();
-
- if (state == EOM_OUTPUT_ATTRIBUTE_STATE_LOST)
- _eom_set_output_attribute_state(output_info,
- EOM_OUTPUT_ATTRIBUTE_STATE_NONE);
- }
- }
- break;
-
- default:
- INFO("'unknown(%d)' notified", notify.base.type);
-
- _eom_mutex_unlock();
- _eom_output_call_notify_cb(¬ify);
- _eom_mutex_lock();
- break;
- }
-
-exit:
- _eom_mutex_unlock();
-}
-
-static eom_output_info*
-_eom_find_output_info(eom_output_id output_id)
-{
- GList *l;
-
- for (l = output_info_list; l; l = g_list_next(l)) {
- eom_output_info *output_info = (eom_output_info *)l->data;
-
- if (output_info && (output_id == output_info->id))
- return output_info;
- }
-
- return NULL;
-}
-
-static void
-_eom_free_output_info(eom_output_info **output_info)
-{
- if (output_info && *output_info) {
- free(*output_info);
- *output_info = NULL;
- }
-}
-
-static eom_output_info*
-_eom_alloc_output_info(int output_id, int output_type)
-{
- eom_output_info *output_info = NULL;
-
- output_info = calloc(1, sizeof(eom_output_info));
- GOTO_IF_FAIL(output_info != NULL, fail);
-
- output_info->id = output_id;
- output_info->type = output_type;
- output_info->output_mode = EOM_OUTPUT_MODE_NONE;
- output_info->attribute = EOM_OUTPUT_ATTRIBUTE_NONE;
- output_info->state = EOM_OUTPUT_ATTRIBUTE_STATE_NONE;
- output_info->width = 0;
- output_info->height = 0;
- output_info->mm_width = 0;
- output_info->mm_height = 0;
-
- INFO("alloc '%s(%d)''s info", TYPE(output_type), output_id);
-
- return output_info;
-
-fail:
- ERR("fail: alloc '%s(%d)''s info", TYPE(output_type), output_id);
-
- return NULL;
-}
-/*LCOV_EXCL_STOP*/
API int
eom_init(void)
{
- bool ret;
-
- _eom_get_debug_evn();
-
- _eom_mutex_lock();
- ret = eom_wayland_client_init(_eom_output_process_notify_cb);
- _eom_mutex_unlock();
-
- INFO("eom init %s", (ret) ? "success" : "failed");
-
- return (ret) ? EOM_ERROR_NONE : EOM_ERROR_CONNECTION_FAILURE;
+ return EOM_ERROR_NONE;
}
API void
eom_deinit(void)
{
- GList *l = NULL;
-
- _eom_mutex_lock();
- eom_wayland_client_deinit(cb_info_list);
-
- for (l = cb_info_list; l; l = cb_info_list) {
- eom_output_notify_cb_info *cb_info = (eom_output_notify_cb_info *)l->data;
-
- cb_info_list = g_list_remove(cb_info_list, cb_info);
- free(cb_info);
- }
- cb_info_list = NULL;
-
- /* TODO: redesign the life-cycle of output_infos */
- /* destory output_info. */
- for (l = output_info_list; l; l = output_info_list) {
-/*LCOV_EXCL_START*/
- eom_output_info *output_info = (eom_output_info *)l->data;
-
- output_info_list = g_list_remove(output_info_list, output_info);
-
- _eom_free_output_info(&output_info);
-/*LCOV_EXCL_STOP*/
- }
- output_info_list = NULL;
-
- _eom_mutex_unlock();
-
- _eom_mutex_destory();
-
- INFO("eom deinit");
}
-API eom_output_id*
+API eom_output_id *
eom_get_eom_output_ids(int *count)
{
- eom_output_id *output_ids = NULL;
-
- if (!count) {
- set_last_result(EOM_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- _eom_mutex_lock();
-
- output_ids = _eom_get_eom_output_ids(count);
- _eom_update_output_info_list();
-
- _eom_mutex_unlock();
-
- set_last_result(EOM_ERROR_NONE);
-
- return output_ids;
+ return NULL;
}
API int
eom_set_output_added_cb(eom_output_added_cb callback, void *user_data)
{
- eom_output_notify_cb_info *cb_info;
- GList *l;
-
- RETV_IF_FAIL(callback != NULL, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- for (l = cb_info_list; l; l = g_list_next(l)) {
- eom_output_notify_cb_info *cb_info =
- (eom_output_notify_cb_info *)l->data;
-
- if (cb_info && (cb_info->add_func != NULL) &&
- (cb_info->add_func == callback)) {
- _eom_mutex_unlock();
- return EOM_ERROR_NONE;
- }
- }
-
- cb_info = calloc(1, sizeof(eom_output_notify_cb_info));
- GOTO_IF_FAIL(cb_info != NULL, fail);
-
- cb_info->type = EOM_OUTPUT_NOTIFY_ADD;
- cb_info->add_func = callback;
- cb_info->user_data = user_data;
-
- cb_info_list = g_list_append(cb_info_list, cb_info);
-
- _eom_mutex_unlock();
-
return EOM_ERROR_NONE;
-/*LCOV_EXCL_START*/
-fail:
- _eom_mutex_unlock();
-
- return EOM_ERROR_OUT_OF_MEMORY;
-/*LCOV_EXCL_STOP*/
}
API int
eom_unset_output_added_cb(eom_output_added_cb callback)
{
- GList *l;
-
- RETV_IF_FAIL(callback != NULL, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- for (l = cb_info_list; l; l = g_list_next(l)) {
- eom_output_notify_cb_info *cb_info =
- (eom_output_notify_cb_info *)l->data;
-
- if (!cb_info || (cb_info->add_func == NULL) ||
- (cb_info->add_func != callback))
- continue;
-
- cb_info_list = g_list_remove(cb_info_list, cb_info);
- free(cb_info);
-
- _eom_mutex_unlock();
-
- return EOM_ERROR_NONE;
- }
-
- _eom_mutex_unlock();
-
- return EOM_ERROR_INVALID_PARAMETER;
+ return EOM_ERROR_NONE;
}
API int
eom_set_output_removed_cb(eom_output_removed_cb callback, void *user_data)
{
- eom_output_notify_cb_info *cb_info;
- GList *l;
-
- RETV_IF_FAIL(callback != NULL, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- for (l = cb_info_list; l; l = g_list_next(l)) {
- eom_output_notify_cb_info *cb_info =
- (eom_output_notify_cb_info *)l->data;
-
- if (cb_info && (cb_info->remove_func != NULL) &&
- (cb_info->remove_func == callback)) {
- _eom_mutex_unlock();
- return EOM_ERROR_NONE;
- }
- }
-
- cb_info = calloc(1, sizeof(eom_output_notify_cb_info));
- GOTO_IF_FAIL(cb_info != NULL, fail);
-
- cb_info->type = EOM_OUTPUT_NOTIFY_REMOVE;
- cb_info->remove_func = callback;
- cb_info->user_data = user_data;
-
- cb_info_list = g_list_append(cb_info_list, cb_info);
-
- _eom_mutex_unlock();
-
return EOM_ERROR_NONE;
-/*LCOV_EXCL_START*/
-fail:
- _eom_mutex_unlock();
-
- return EOM_ERROR_OUT_OF_MEMORY;
-/*LCOV_EXCL_STOP*/
}
API int
eom_unset_output_removed_cb(eom_output_removed_cb callback)
{
- GList *l;
-
- RETV_IF_FAIL(callback != NULL, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- for (l = cb_info_list; l; l = g_list_next(l)) {
- eom_output_notify_cb_info *cb_info =
- (eom_output_notify_cb_info *)l->data;
-
- if (!cb_info || (cb_info->remove_func == NULL) ||
- (cb_info->remove_func != callback))
- continue;
-
- cb_info_list = g_list_remove(cb_info_list, cb_info);
- free(cb_info);
-
- _eom_mutex_unlock();
-
- return EOM_ERROR_NONE;
- }
-
- _eom_mutex_unlock();
-
- return EOM_ERROR_INVALID_PARAMETER;
+ return EOM_ERROR_NONE;
}
API int
eom_set_mode_changed_cb(eom_mode_changed_cb callback, void *user_data)
{
- eom_output_notify_cb_info *cb_info;
- GList *l;
-
- RETV_IF_FAIL(callback != NULL, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- for (l = cb_info_list; l; l = g_list_next(l)) {
- eom_output_notify_cb_info *cb_info =
- (eom_output_notify_cb_info *)l->data;
-
- if (cb_info && (cb_info->mode_change_func != NULL) &&
- (cb_info->mode_change_func == callback)) {
- _eom_mutex_unlock();
- return EOM_ERROR_NONE;
- }
- }
-
- cb_info = calloc(1, sizeof(eom_output_notify_cb_info));
- GOTO_IF_FAIL(cb_info != NULL, fail);
-
- cb_info->type = EOM_OUTPUT_NOTIFY_MODE_CHANGED;
- cb_info->mode_change_func = callback;
- cb_info->user_data = user_data;
-
- cb_info_list = g_list_append(cb_info_list, cb_info);
-
- _eom_mutex_unlock();
-
return EOM_ERROR_NONE;
-/*LCOV_EXCL_START*/
-fail:
- _eom_mutex_unlock();
-
- return EOM_ERROR_OUT_OF_MEMORY;
-/*LCOV_EXCL_STOP*/
}
API int
eom_unset_mode_changed_cb(eom_mode_changed_cb callback)
{
- GList *l;
-
- RETV_IF_FAIL(callback != NULL, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- for (l = cb_info_list; l; l = g_list_next(l)) {
- eom_output_notify_cb_info *cb_info =
- (eom_output_notify_cb_info *)l->data;
-
- if (!cb_info || (cb_info->mode_change_func == NULL) ||
- (cb_info->mode_change_func != callback))
- continue;
-
- cb_info_list = g_list_remove(cb_info_list, cb_info);
- free(cb_info);
-
- _eom_mutex_unlock();
-
- return EOM_ERROR_NONE;
- }
-
- _eom_mutex_unlock();
-
- return EOM_ERROR_INVALID_PARAMETER;
+ return EOM_ERROR_NONE;
}
API int
eom_set_attribute_changed_cb(eom_attribute_changed_cb callback, void *user_data)
{
- eom_output_notify_cb_info *cb_info;
- GList *l;
-
- RETV_IF_FAIL(callback != NULL, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- for (l = cb_info_list; l; l = g_list_next(l)) {
- eom_output_notify_cb_info *cb_info =
- (eom_output_notify_cb_info *)l->data;
-
- if (cb_info && (cb_info->attribute_change_func != NULL) &&
- (cb_info->attribute_change_func == callback)) {
- _eom_mutex_unlock();
- return EOM_ERROR_NONE;
- }
- }
-
- cb_info = calloc(1, sizeof(eom_output_notify_cb_info));
- GOTO_IF_FAIL(cb_info != NULL, fail);
-
- cb_info->type = EOM_OUTPUT_NOTIFY_ATTRIBUTE_CHANGED;
- cb_info->attribute_change_func = callback;
- cb_info->user_data = user_data;
-
- cb_info_list = g_list_append(cb_info_list, cb_info);
-
- _eom_mutex_unlock();
-
return EOM_ERROR_NONE;
-/*LCOV_EXCL_START*/
-fail:
- _eom_mutex_unlock();
-
- return EOM_ERROR_OUT_OF_MEMORY;
-/*LCOV_EXCL_STOP*/
}
API int
eom_unset_attribute_changed_cb(eom_attribute_changed_cb callback)
{
- GList *l;
-
- RETV_IF_FAIL(callback != NULL, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- for (l = cb_info_list; l; l = g_list_next(l)) {
- eom_output_notify_cb_info *cb_info =
- (eom_output_notify_cb_info *)l->data;
-
- if (!cb_info || (cb_info->attribute_change_func == NULL) ||
- (cb_info->attribute_change_func != callback))
- continue;
-
- cb_info_list = g_list_remove(cb_info_list, cb_info);
- free(cb_info);
-
- _eom_mutex_unlock();
-
- return EOM_ERROR_NONE;
- }
-
- _eom_mutex_unlock();
-
- return EOM_ERROR_INVALID_PARAMETER;
+ return EOM_ERROR_NONE;
}
API int
-eom_set_output_attribute(eom_output_id output_id,
- eom_output_attribute_e attr)
+eom_set_output_attribute(eom_output_id output_id, eom_output_attribute_e attr)
{
- eom_output_info *output_info = NULL;
- bool ret = false;
- GArray *ret_array;
-
- RETV_IF_FAIL(output_id != 0, EOM_ERROR_INVALID_PARAMETER);
- RETV_IF_FAIL(attr > EOM_OUTPUT_ATTRIBUTE_NONE,
- EOM_ERROR_INVALID_PARAMETER);
- RETV_IF_FAIL(attr < EOM_OUTPUT_ATTRIBUTE_MAX,
- EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- output_info = _eom_find_output_info(output_id);
- if (!output_info) {
- set_last_result(EOM_ERROR_NO_SUCH_DEVICE);
- _eom_mutex_unlock();
- return EOM_ERROR_NO_SUCH_DEVICE;
- }
-/*LCOV_EXCL_START*/
- INFO("output_id: %d, attr: %d\n", output_id, attr);
-
- _eom_mutex_unlock();
- ret_array = eom_wayland_client_set_attribute(output_id, attr);
- _eom_mutex_lock();
-
- if (!ret_array) {
- _eom_mutex_unlock();
- return EOM_ERROR_MESSAGE_SENDING_FAILURE;
- }
-
- ret = g_value_get_int(&g_array_index(ret_array, GValue, 0));
-
- g_array_free(ret_array, FALSE);
-
- INFO("SetOutputAttribute: %s", (ret) ? "success" : "failed");
-
- if (ret)
- _eom_set_output_attribute(output_info, attr);
-
- _eom_mutex_unlock();
-
- return (ret) ? EOM_ERROR_NONE : EOM_ERROR_MESSAGE_OPERATION_FAILURE;
-/*LCOV_EXCL_STOP*/
+ return EOM_ERROR_NONE;
}
-
API int
-eom_get_output_type(eom_output_id output_id,
- eom_output_type_e *type)
+eom_get_output_type(eom_output_id output_id, eom_output_type_e *type)
{
- eom_output_info *output_info = NULL;
-
- RETV_IF_FAIL(output_id != 0, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- output_info = _eom_find_output_info(output_id);
- if (!output_info) {
- *type = EOM_OUTPUT_TYPE_UNKNOWN;
- _eom_mutex_unlock();
- set_last_result(EOM_ERROR_NO_SUCH_DEVICE);
- return EOM_ERROR_NO_SUCH_DEVICE;
- }
-/*LCOV_EXCL_START*/
- *type = output_info->type;
-
- _eom_mutex_unlock();
-
- set_last_result(EOM_ERROR_NONE);
return EOM_ERROR_NONE;
-/*LCOV_EXCL_STOP*/
}
API int
-eom_get_output_mode(eom_output_id output_id,
- eom_output_mode_e *mode)
+eom_get_output_mode(eom_output_id output_id, eom_output_mode_e *mode)
{
- eom_output_info *output_info = NULL;
-
- RETV_IF_FAIL(output_id != 0, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- output_info = _eom_find_output_info(output_id);
- if (!output_info) {
- *mode = EOM_OUTPUT_MODE_NONE;
- _eom_mutex_unlock();
- set_last_result(EOM_ERROR_NO_SUCH_DEVICE);
- return EOM_ERROR_NO_SUCH_DEVICE;
- }
-/*LCOV_EXCL_START*/
- *mode = output_info->output_mode;
-
- _eom_mutex_unlock();
-
- set_last_result(EOM_ERROR_NONE);
return EOM_ERROR_NONE;
-/*LCOV_EXCL_STOP*/
}
API int
-eom_get_output_attribute(eom_output_id output_id,
- eom_output_attribute_e *attribute)
+eom_get_output_attribute(eom_output_id output_id, eom_output_attribute_e *attribute)
{
- eom_output_info *output_info = NULL;
-
- RETV_IF_FAIL(output_id != 0, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- output_info = _eom_find_output_info(output_id);
- if (!output_info) {
- *attribute = EOM_OUTPUT_ATTRIBUTE_NONE;
- _eom_mutex_unlock();
- set_last_result(EOM_ERROR_NO_SUCH_DEVICE);
- return EOM_ERROR_NO_SUCH_DEVICE;
- }
-/*LCOV_EXCL_START*/
- *attribute = output_info->attribute;
-
- _eom_mutex_unlock();
-
- set_last_result(EOM_ERROR_NONE);
return EOM_ERROR_NONE;
-/*LCOV_EXCL_STOP*/
}
API int
-eom_get_output_attribute_state(eom_output_id output_id,
- eom_output_attribute_state_e *state)
+eom_get_output_attribute_state(eom_output_id output_id, eom_output_attribute_state_e *state)
{
- eom_output_info *output_info = NULL;
-
- RETV_IF_FAIL(output_id != 0, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- output_info = _eom_find_output_info(output_id);
- if (!output_info) {
- *state = EOM_OUTPUT_ATTRIBUTE_STATE_NONE;
- _eom_mutex_unlock();
- set_last_result(EOM_ERROR_NO_SUCH_DEVICE);
- return EOM_ERROR_NO_SUCH_DEVICE;
- }
-/*LCOV_EXCL_START*/
- *state = output_info->state;
-
- _eom_mutex_unlock();
-
- set_last_result(EOM_ERROR_NONE);
return EOM_ERROR_NONE;
-/*LCOV_EXCL_STOP*/
}
API int
eom_get_output_resolution(eom_output_id output_id, int *width, int *height)
{
- eom_output_info *output_info = NULL;
-
- RETV_IF_FAIL(output_id != 0, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- output_info = _eom_find_output_info(output_id);
- if (!output_info) {
- if (width)
- *width = 0;
- if (height)
- *height = 0;
-
- set_last_result(EOM_ERROR_NO_SUCH_DEVICE);
- _eom_mutex_unlock();
- return EOM_ERROR_NO_SUCH_DEVICE;
- }
-/*LCOV_EXCL_START*/
- if (width)
- *width = output_info->width;
- if (height)
- *height = output_info->height;
-
- _eom_mutex_unlock();
-
return EOM_ERROR_NONE;
-/*LCOV_EXCL_STOP*/
}
API int
-eom_get_output_physical_size(eom_output_id output_id,
- int *phy_width, int *phy_height)
+eom_get_output_physical_size(eom_output_id output_id, int *phy_width, int *phy_height)
{
- eom_output_info *output_info = NULL;
-
- RETV_IF_FAIL(output_id != 0, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- output_info = _eom_find_output_info(output_id);
- if (!output_info) {
- if (phy_width)
- *phy_width = 0;
- if (phy_height)
- *phy_height = 0;
-
- _eom_mutex_unlock();
- set_last_result(EOM_ERROR_NO_SUCH_DEVICE);
- return EOM_ERROR_NO_SUCH_DEVICE;
- }
-/*LCOV_EXCL_START*/
- if (phy_width)
- *phy_width = output_info->mm_width;
- if (phy_height)
- *phy_height = output_info->mm_height;
-
- _eom_mutex_unlock();
-
return EOM_ERROR_NONE;
-/*LCOV_EXCL_STOP*/
}
API int
eom_set_output_window(eom_output_id output_id, Evas_Object *win)
{
- eom_output_info *output_info = NULL;
- bool ret = false;
- GArray *ret_array;
-
- RETV_IF_FAIL(output_id != 0, EOM_ERROR_INVALID_PARAMETER);
- RETV_IF_FAIL(win != NULL, EOM_ERROR_INVALID_PARAMETER);
-
- _eom_mutex_lock();
-
- output_info = _eom_find_output_info(output_id);
- if (!output_info) {
- set_last_result(EOM_ERROR_NO_SUCH_DEVICE);
- _eom_mutex_unlock();
- return EOM_ERROR_NO_SUCH_DEVICE;
- }
-/*LCOV_EXCL_START*/
- INFO("output_id: %d, evas_win: %p\n", output_id, win);
-
- _eom_mutex_unlock();
- ret_array = eom_wayland_client_set_window(output_id, win);
- _eom_mutex_lock();
-
- if (!ret_array) {
- _eom_mutex_unlock();
- return EOM_ERROR_MESSAGE_SENDING_FAILURE;
- }
-
- ret = g_value_get_int(&g_array_index(ret_array, GValue, 0));
- g_array_free(ret_array, FALSE);
- if (ret == 0) {
- ERR("SetWindow: failed\n");
- _eom_mutex_unlock();
- return EOM_ERROR_MESSAGE_OPERATION_FAILURE;
- }
-
- INFO("SetWindow: success\n");
-
- _eom_mutex_unlock();
-
return EOM_ERROR_NONE;
-/*LCOV_EXCL_STOP*/
}
+++ /dev/null
-bin_PROGRAMS = ut
-
-ut_SOURCES = \
- main_tests.cpp \
- ut_eom.cpp \
- stubs/eom_wayland.cpp
-
-ut_CXXFLAGS = \
- ${CXXFLAGS} \
- @LIBEOM_CFLAGS@ \
- -I./stubs \
- -I../src \
- -I../src/dbus \
- -I../src/wayland \
- -I../include \
- -fpermissive
-
-ut_LDFLAGS = \
- ${LDFLAGS} \
- @LIBEOM_LIBS@ \
- -lgtest \
- -pthread
-
-check:
- ./ut
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact:
- * Konstantin Drabeniuk <k.drabeniuk@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-
-#include "gtest/gtest.h"
-
-int main(int argc, char **argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact:
- * Konstantin Drabeniuk <k.drabeniuk@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-
-#include "eom-wayland.h"
-#include <string.h>
-
-int EOM_WAYLEND_ERROR;
-int EOM_WAYLEND_RET_ERROR;
-int EOM_WAYLAND_CLIENT_INIT_ERROR;
-
-GValue value[10];
-
-bool eom_wayland_client_init(notify_func func)
-{
- if (EOM_WAYLAND_CLIENT_INIT_ERROR) {
- return false;
- }
-
- return true;
-}
-
-void eom_wayland_client_deinit(GList *cb_info_list)
-{
-}
-
-GArray *eom_wayland_client_get_output_ids(void)
-{
- if (EOM_WAYLEND_ERROR) {
- return NULL;
- }
-
- memset(value, 0, 10 * sizeof(GValue));
- GArray *ret_array = g_array_new(false, false, sizeof(GValue));
- g_value_init(&value[0], G_TYPE_INT);
- g_value_init(&value[1], G_TYPE_INT);
- if (EOM_WAYLEND_RET_ERROR) {
- g_value_set_int(&value[0], 0);
- ret_array->len = 0;
- } else {
- g_value_set_int(&value[0], 1);
- g_value_set_int(&value[1], 2);
- ret_array->len = 2;
- }
- ret_array->data = (gchar *)&value;
- return ret_array;
-}
-
-GArray *eom_wayland_client_get_output_info(eom_output_id output_id)
-{
- memset(value, 0, 10 * sizeof(GValue));
- GArray *ret_array = g_array_new(false, false, sizeof(GValue));
- g_value_init(&value[0], G_TYPE_INT);
- g_value_init(&value[1], G_TYPE_INT);
- g_value_init(&value[2], G_TYPE_INT);
- g_value_init(&value[3], G_TYPE_INT);
- g_value_init(&value[4], G_TYPE_INT);
- g_value_init(&value[5], G_TYPE_INT);
- g_value_init(&value[6], G_TYPE_INT);
- g_value_init(&value[7], G_TYPE_INT);
- g_value_set_int(&value[0], 1);
- g_value_set_int(&value[1], 2);
- g_value_set_int(&value[2], 3);
- g_value_set_int(&value[3], 4);
- g_value_set_int(&value[4], 5);
- g_value_set_int(&value[5], 6);
- g_value_set_int(&value[6], 7);
- g_value_set_int(&value[7], 8);
- ret_array->data = (gchar *)&value;
- ret_array->len = 8;
- return ret_array;
-}
-
-GArray *eom_wayland_client_set_attribute(eom_output_id output_id,
- eom_output_attribute_e attry)
-{
- if (EOM_WAYLEND_ERROR) {
- return NULL;
- }
-
- memset(value, 0, 10 * sizeof(GValue));
- GArray *ret_array = g_array_new(false, false, sizeof(GValue));
- g_value_init(&value[0], G_TYPE_INT);
- g_value_init(&value[1], G_TYPE_INT);
- if (EOM_WAYLEND_RET_ERROR) {
- g_value_set_int(&value[0], 0);
- } else {
- g_value_set_int(&value[0], 1);
- }
- ret_array->data = (gchar *)&value;
- return ret_array;
-}
-
-GArray *eom_wayland_client_set_window(eom_output_id output_id,
- Evas_Object *win)
-{
- if (EOM_WAYLEND_ERROR) {
- return NULL;
- }
-
- memset(value, 0, 10 * sizeof(GValue));
- GArray *ret_array = g_array_new(false, false, sizeof(GValue));
- g_value_init(&value[0], G_TYPE_INT);
- g_value_init(&value[1], G_TYPE_INT);
- if (EOM_WAYLEND_RET_ERROR) {
- g_value_set_int(&value[0], 0);
- } else {
- g_value_set_int(&value[0], 1);
- }
- ret_array->data = (gchar *)&value;
- return ret_array;
-}
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact:
- * Konstantin Drabeniuk <k.drabeniuk@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-
-#ifndef _PTHREAD_STUBS_H
-#define _PTHREAD_STUBS_H
-
-#include <pthread.h>
-#include <stdio.h>
-
-static int PTHREAD_MUTEX_INIT_ERROR;
-
-static int ut_pthread_mutex_lock(pthread_mutex_t * __mutex)
-{
-
-}
-
-static int ut_pthread_mutex_unlock(pthread_mutex_t * __mutex)
-{
-
-}
-
-static int ut_pthread_mutex_init(pthread_mutex_t * __mutex,
- const pthread_mutexattr_t * __mutexattr)
-{
- if (PTHREAD_MUTEX_INIT_ERROR) {
- return PTHREAD_MUTEX_INIT_ERROR;
- }
-
- return 0;
-}
-
-#endif /* _PTHREAD_STUBS_H */
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact:
- * Konstantin Drabeniuk <k.drabeniuk@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-
-#ifndef _STDLIB_STUBS_H
-#define _STDLIB_STUBS_H
-
-#include <cstdlib>
-
-int CALLOC_ERROR;
-int CALLOC_RETURN_BUFFER;
-int FREE_CALLED;
-void *FREE_PTR;
-void *FREE_TESTED_PTR;
-int free_called_for_tested_ptr = 0;
-int free_call_count = 0;
-
-static void *ut_calloc(size_t nmemb, size_t size)
-{
- if (CALLOC_ERROR) {
- return NULL;
- }
-
- return calloc(nmemb, size);
-}
-
-static void ut_free(void *ptr)
-{
- if (FREE_TESTED_PTR == ptr) {
- free_called_for_tested_ptr = 1;
- }
- FREE_PTR = ptr;
- FREE_CALLED = 1;
- free(ptr);
- free_call_count++;
-}
-
-#endif /* _STDLIB_STUBS_H */
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact:
- * Konstantin Drabeniuk <k.drabeniuk@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-#include "gtest/gtest.h"
-
-#include "pthread_stubs.h"
-#include "stdlib_stubs.h"
-
-extern int EOM_WAYLEND_ERROR;
-extern int EOM_WAYLEND_RET_ERROR;
-extern int EOM_WAYLAND_CLIENT_INIT_ERROR;
-
-#define pthread_mutex_lock ut_pthread_mutex_lock
-#define calloc ut_calloc
-#define free ut_free
-#define pthread_mutex_init ut_pthread_mutex_init
-#define pthread_mutex_unlock ut_pthread_mutex_unlock
-
-#include "eom.c"
-
-/* HELPER FUNCTIONS */
-
-void ut_eom_cb(eom_output_id output_id, void *user_data) {}
-
-void ut_eom_cb1(eom_output_id output_id, void *user_data) {}
-
-static void _init_test()
-{
- EOM_WAYLEND_ERROR = 0;
- EOM_WAYLEND_RET_ERROR = 0;
- EOM_WAYLAND_CLIENT_INIT_ERROR = 0;
- PTHREAD_MUTEX_INIT_ERROR = 0;
- CALLOC_ERROR = 0;
- CALLOC_RETURN_BUFFER = 0;
- FREE_CALLED = 0;
- FREE_PTR = NULL;
- FREE_TESTED_PTR = NULL;
- free_called_for_tested_ptr = 0;
- free_call_count = 0;
- output_info_list = NULL;
- cb_info_list = NULL;
-
- set_last_result(EOM_ERROR_NONE);
-}
-
-/* eom_set_output_window() */
-
-TEST(eom_set_output_window, work_flow_success_5)
-{
- eom_output_id output_id = 1;
- eom_error_e error = EOM_ERROR_MESSAGE_OPERATION_FAILURE;
- eom_error_e expected_error = EOM_ERROR_NONE;
- Evas_Object *win = (Evas_Object *)25;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
-
- error = eom_set_output_window(output_id, win);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_window, work_flow_success_4)
-{
- eom_output_id output_id = 1;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_MESSAGE_OPERATION_FAILURE;
- Evas_Object *win = (Evas_Object *)25;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
- EOM_WAYLEND_RET_ERROR = 1;
-
- error = eom_set_output_window(output_id, win);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_window, work_flow_success_3)
-{
- eom_output_id output_id = 1;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_MESSAGE_SENDING_FAILURE;
- Evas_Object *win = (Evas_Object *)25;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
- EOM_WAYLEND_ERROR = 1;
-
- error = eom_set_output_window(output_id, win);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_window, work_flow_success_2)
-{
- eom_output_id output_id = 1;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_NO_SUCH_DEVICE;
- Evas_Object *win = (Evas_Object *)25;
-
- _init_test();
-
- error = eom_set_output_window(output_id, win);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_window, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- Evas_Object *win = (Evas_Object *)25;
-
- _init_test();
-
- error = eom_set_output_window(0, win);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_window, null_ptr_fail_1)
-{
- eom_output_id output_id = 1;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_set_output_window(output_id, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_get_output_physical_size() */
-
-TEST(eom_get_output_physical_size, work_flow_success_3)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NO_SUCH_DEVICE;
- eom_error_e expected_error = EOM_ERROR_NONE;
- int phy_width = 0;
- int phy_height = 0;
- int expected_phy_width = 1024;
- int expected_phy_height = 768;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- output_info.mm_width = expected_phy_width;
- output_info.mm_height = expected_phy_height;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
-
- error = eom_get_output_physical_size(output_id, &phy_width, &phy_height);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
- ASSERT_EQ(phy_width, expected_phy_width);
- ASSERT_EQ(phy_height, expected_phy_height);
-}
-
-TEST(eom_get_output_physical_size, work_flow_success_2)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_NO_SUCH_DEVICE;
-
- _init_test();
-
- error = eom_get_output_physical_size(output_id, NULL, NULL);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
-}
-
-TEST(eom_get_output_physical_size, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_get_output_physical_size(0, NULL, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_get_output_resolution() */
-
-TEST(eom_get_output_resolution, work_flow_success_3)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NO_SUCH_DEVICE;
- eom_error_e expected_error = EOM_ERROR_NONE;
- int width = 0;
- int height = 0;
- int expected_width = 1024;
- int expected_height = 768;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- output_info.width = expected_width;
- output_info.height = expected_height;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
-
- error = eom_get_output_resolution(output_id, &width, &height);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
- ASSERT_EQ(width, expected_width);
- ASSERT_EQ(height, expected_height);
-}
-
-TEST(eom_get_output_resolution, work_flow_success_2)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_NO_SUCH_DEVICE;
-
- _init_test();
-
- error = eom_get_output_resolution(output_id, NULL, NULL);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
-}
-
-TEST(eom_get_output_resolution, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_get_output_resolution(0, NULL, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_get_output_attribute_state() */
-
-TEST(eom_get_output_attribute_state, work_flow_success_3)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NO_SUCH_DEVICE;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_attribute_state_e state = EOM_OUTPUT_ATTRIBUTE_STATE_NONE;
- eom_output_attribute_state_e expected_state = EOM_OUTPUT_ATTRIBUTE_STATE_ACTIVE;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- output_info.state = expected_state;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
-
- error = eom_get_output_attribute_state(output_id, &state);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
- ASSERT_EQ(state, expected_state);
-}
-
-TEST(eom_get_output_attribute_state, work_flow_success_2)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_NO_SUCH_DEVICE;
- eom_output_attribute_state_e state;
-
- _init_test();
-
- error = eom_get_output_attribute_state(output_id, &state);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
-}
-
-TEST(eom_get_output_attribute_state, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_attribute_state_e state;
-
- _init_test();
-
- error = eom_get_output_attribute_state(0, &state);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_get_output_attribute() */
-
-TEST(eom_get_output_attribute, work_flow_success_3)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NO_SUCH_DEVICE;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_attribute_e attribute = EOM_OUTPUT_ATTRIBUTE_NONE;
- eom_output_attribute_e expected_attribute = EOM_OUTPUT_ATTRIBUTE_NORMAL;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- output_info.attribute = expected_attribute;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
-
- error = eom_get_output_attribute(output_id, &attribute);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
- ASSERT_EQ(attribute, expected_attribute);
-}
-
-TEST(eom_get_output_attribute, work_flow_success_2)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_NO_SUCH_DEVICE;
- eom_output_attribute_e attribute;
-
- _init_test();
-
- error = eom_get_output_attribute(output_id, &attribute);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
-}
-
-TEST(eom_get_output_attribute, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_attribute_e attribute;
-
- _init_test();
-
- error = eom_get_output_attribute(0, &attribute);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_get_output_mode() */
-
-TEST(eom_get_output_mode, work_flow_success_3)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NO_SUCH_DEVICE;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_mode_e mode = EOM_OUTPUT_MODE_NONE;
- eom_output_mode_e expected_mode = EOM_OUTPUT_MODE_MIRROR;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- output_info.output_mode = expected_mode;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
-
- error = eom_get_output_mode(output_id, &mode);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
- ASSERT_EQ(mode, expected_mode);
-}
-
-TEST(eom_get_output_mode, work_flow_success_2)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_NO_SUCH_DEVICE;
- eom_output_mode_e mode;
-
- _init_test();
-
- error = eom_get_output_mode(output_id, &mode);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
-}
-
-TEST(eom_get_output_mode, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_mode_e mode;
-
- _init_test();
-
- error = eom_get_output_mode(0, &mode);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_get_output_type() */
-
-TEST(eom_get_output_type, work_flow_success_3)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NO_SUCH_DEVICE;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_type_e type = EOM_OUTPUT_TYPE_UNKNOWN;
- eom_output_type_e expected_type = EOM_OUTPUT_TYPE_VGA;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- output_info.type = expected_type;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
-
- error = eom_get_output_type(output_id, &type);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
- ASSERT_EQ(type, expected_type);
-}
-
-TEST(eom_get_output_type1, work_flow_success_2)
-{
- eom_output_id output_id = 1;
- int last_result = EOM_ERROR_NONE;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_NO_SUCH_DEVICE;
- eom_output_type_e type;
-
- _init_test();
-
- error = eom_get_output_type(output_id, &type);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
-}
-
-TEST(eom_get_output_type2, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_type_e type;
-
- _init_test();
-
- error = eom_get_output_type(0, &type);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_set_output_attribute() */
-
-TEST(eom_set_output_attribute, work_flow_success_7)
-{
- eom_output_id output_id = 9849;
- eom_error_e error = EOM_ERROR_MESSAGE_OPERATION_FAILURE;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_attribute_e attr = EOM_OUTPUT_ATTRIBUTE_NORMAL;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
-
- error = eom_set_output_attribute(output_id, attr);
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(output_info.attribute, attr);
-}
-
-TEST(eom_set_output_attribute, work_flow_success_6)
-{
- eom_output_id output_id = 9849;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_MESSAGE_OPERATION_FAILURE;
- eom_output_attribute_e attr = EOM_OUTPUT_ATTRIBUTE_NORMAL;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
- EOM_WAYLEND_RET_ERROR = 1;
-
- error = eom_set_output_attribute(output_id, attr);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_attribute, work_flow_success_5)
-{
- eom_output_id output_id = 9849;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_MESSAGE_SENDING_FAILURE;
- eom_output_attribute_e attr = EOM_OUTPUT_ATTRIBUTE_NORMAL;
- eom_output_info output_info;
- GList list;
-
- _init_test();
-
- output_info.id = output_id;
- list.data = &output_info;
- list.next = list.prev = NULL;
- output_info_list = &list;
- EOM_WAYLEND_ERROR = 1;
-
- error = eom_set_output_attribute(output_id, attr);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_attribute, work_flow_success_4)
-{
- eom_output_id output_id = 1;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_NO_SUCH_DEVICE;
- eom_output_attribute_e attr = EOM_OUTPUT_ATTRIBUTE_NORMAL;
- int last_result = EOM_ERROR_NONE;
-
- _init_test();
-
- error = eom_set_output_attribute(output_id, attr);
-
- last_result = get_last_result();
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(last_result, expected_error);
-}
-
-TEST(eom_set_output_attribute, work_flow_success_3)
-{
- eom_output_id output_id = 1;
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_attribute_e attr = EOM_OUTPUT_ATTRIBUTE_MAX;
-
- _init_test();
-
- error = eom_set_output_attribute(output_id, attr);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_attribute, work_flow_success_2)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_attribute_e attr = EOM_OUTPUT_ATTRIBUTE_NONE;
-
- _init_test();
-
- error = eom_set_output_attribute(1, attr);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_attribute, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_attribute_e attr;
-
- _init_test();
-
- error = eom_set_output_attribute(0, attr);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_unset_attribute_changed_cb() */
-
-TEST(eom_unset_attribute_changed_cb, work_flow_success_3)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_notify_cb_info cb_info1;
- eom_output_notify_cb_info *cb_info2;
-
- _init_test();
-
- cb_info1.attribute_change_func = ut_eom_cb1;
- cb_info2 = calloc(1, sizeof(eom_output_notify_cb_info));
- cb_info2->attribute_change_func = ut_eom_cb;
- cb_info_list = g_list_append(cb_info_list, &cb_info1);
- cb_info_list = g_list_append(cb_info_list, cb_info2);
- FREE_TESTED_PTR = cb_info2;
-
- error = eom_unset_attribute_changed_cb(ut_eom_cb);
-
- cb_info_list = g_list_remove(cb_info_list, &cb_info1);
- cb_info_list = g_list_remove(cb_info_list, cb_info2);
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(free_called_for_tested_ptr, 1);
-}
-
-TEST(eom_unset_attribute_changed_cb, work_flow_success_2)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_notify_cb_info cb_info1;
- eom_output_notify_cb_info cb_info2;
-
- _init_test();
-
- cb_info1.attribute_change_func = ut_eom_cb1;
- cb_info2.attribute_change_func = ut_eom_cb1;
- cb_info_list = g_list_append(cb_info_list, &cb_info1);
- cb_info_list = g_list_append(cb_info_list, &cb_info2);
-
- error = eom_unset_attribute_changed_cb(ut_eom_cb);
-
- cb_info_list = g_list_remove(cb_info_list, &cb_info1);
- cb_info_list = g_list_remove(cb_info_list, &cb_info2);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_unset_attribute_changed_cb, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_unset_attribute_changed_cb(ut_eom_cb);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_unset_attribute_changed_cb, null_ptr_fail_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_unset_attribute_changed_cb(NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_set_attribute_changed_cb() */
-
-TEST(eom_set_attribute_changed_cb, work_flow_success_4)
-{
- eom_error_e error = EOM_ERROR_OUT_OF_MEMORY;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_notify_type_e expected_type = EOM_OUTPUT_NOTIFY_ATTRIBUTE_CHANGED;
- int user_data = 324;
- eom_output_notify_cb_info *cb_info;
- eom_output_notify_cb_info info;
- GList *l;
-
- _init_test();
-
- error = eom_set_attribute_changed_cb(ut_eom_cb, &user_data);
-
- ASSERT_EQ(error, expected_error);
- ASSERT_TRUE(cb_info_list != NULL);
- for (l = cb_info_list; l != NULL; l = g_list_next(l)) {
- cb_info = (eom_output_notify_cb_info *)l->data;
- if (cb_info)
- break;
- }
- cb_info_list = g_list_remove_all(cb_info_list, cb_info);
- ASSERT_TRUE(cb_info != NULL);
- info = *cb_info;
- free(cb_info);
- ASSERT_TRUE(info.attribute_change_func == ut_eom_cb);
- ASSERT_TRUE(info.user_data == &user_data);
- ASSERT_EQ(info.type, expected_type);
-}
-
-TEST(eom_set_attribute_changed_cb, work_flow_success_3)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_OUT_OF_MEMORY;
-
- _init_test();
-
- CALLOC_ERROR = 1;
-
- error = eom_set_attribute_changed_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_attribute_changed_cb, work_flow_success_2)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- GList list1;
- eom_output_notify_cb_info cb_info1;
- GList list;
- eom_output_notify_cb_info cb_info;
-
- _init_test();
-
- cb_info1.attribute_change_func = ut_eom_cb1;
- list1.data = &cb_info1;
- cb_info_list = &list1;
- list1.next = list1.prev = NULL;
-
- cb_info.attribute_change_func = ut_eom_cb;
- list.data = &cb_info;
- list.next = list.prev = NULL;
- list1.next = &list;
- list.prev = &list1;
-
- error = eom_set_attribute_changed_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_attribute_changed_cb, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- GList list;
- eom_output_notify_cb_info cb_info;
-
- _init_test();
-
- cb_info.attribute_change_func = ut_eom_cb;
- list.data = &cb_info;
- cb_info_list = &list;
- list.next = list.prev = NULL;
-
- error = eom_set_attribute_changed_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_attribute_changed_cb, null_ptr_fail_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_set_attribute_changed_cb(NULL, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_unset_mode_changed_cb() */
-
-TEST(eom_unset_mode_changed_cb, work_flow_success_3)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_notify_cb_info cb_info1;
- eom_output_notify_cb_info *cb_info2;
-
- _init_test();
-
- cb_info1.mode_change_func = ut_eom_cb1;
- cb_info2 = calloc(1, sizeof(eom_output_notify_cb_info));
- cb_info2->mode_change_func = ut_eom_cb;
- cb_info_list = g_list_append(cb_info_list, &cb_info1);
- cb_info_list = g_list_append(cb_info_list, cb_info2);
- FREE_TESTED_PTR = cb_info2;
-
- error = eom_unset_mode_changed_cb(ut_eom_cb);
-
- cb_info_list = g_list_remove(cb_info_list, &cb_info1);
- cb_info_list = g_list_remove(cb_info_list, cb_info2);
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(free_called_for_tested_ptr, 1);
-}
-
-TEST(eom_unset_mode_changed_cb, work_flow_success_2)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_notify_cb_info cb_info1;
- eom_output_notify_cb_info cb_info2;
-
- _init_test();
-
- cb_info1.mode_change_func = ut_eom_cb1;
- cb_info2.mode_change_func = ut_eom_cb1;
- cb_info_list = g_list_append(cb_info_list, &cb_info1);
- cb_info_list = g_list_append(cb_info_list, &cb_info2);
-
- error = eom_unset_mode_changed_cb(ut_eom_cb);
-
- cb_info_list = g_list_remove(cb_info_list, &cb_info1);
- cb_info_list = g_list_remove(cb_info_list, &cb_info2);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_unset_mode_changed_cb, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_unset_mode_changed_cb(ut_eom_cb);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_unset_mode_changed_cb, null_ptr_fail_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_unset_mode_changed_cb(NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_set_mode_changed_cb() */
-
-TEST(eom_set_mode_changed_cb, work_flow_success_4)
-{
- eom_error_e error = EOM_ERROR_OUT_OF_MEMORY;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_notify_type_e expected_type = EOM_OUTPUT_NOTIFY_MODE_CHANGED;
- int user_data = 324;
- eom_output_notify_cb_info *cb_info;
- eom_output_notify_cb_info info;
- GList *l;
-
- _init_test();
-
- error = eom_set_mode_changed_cb(ut_eom_cb, &user_data);
-
- ASSERT_EQ(error, expected_error);
- ASSERT_TRUE(cb_info_list != NULL);
- for (l = cb_info_list; l; l = g_list_next(l)) {
- cb_info = (eom_output_notify_cb_info *)l->data;
- if (cb_info)
- break;
- }
- cb_info_list = g_list_remove_all(cb_info_list, cb_info);
- ASSERT_TRUE(cb_info != NULL);
- info = *cb_info;
- free(cb_info);
- ASSERT_TRUE(info.mode_change_func == ut_eom_cb);
- ASSERT_TRUE(info.user_data == &user_data);
- ASSERT_EQ(info.type, expected_type);
-}
-
-TEST(eom_set_mode_changed_cb, work_flow_success_3)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_OUT_OF_MEMORY;
-
- _init_test();
-
- cb_info_list = NULL;
- CALLOC_ERROR = 1;
-
- error = eom_set_mode_changed_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_mode_changed_cb, work_flow_success_2)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- GList list1;
- eom_output_notify_cb_info cb_info1;
- GList list;
- eom_output_notify_cb_info cb_info;
-
- _init_test();
-
- cb_info1.mode_change_func = ut_eom_cb1;
- list1.data = &cb_info1;
- cb_info_list = &list1;
- list1.next = list1.prev = NULL;
-
- cb_info.mode_change_func = ut_eom_cb;
- list.data = &cb_info;
- list.next = list.prev = NULL;
- list1.next = &list;
- list.prev = &list1;
-
- error = eom_set_mode_changed_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_mode_changed_cb, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- GList list;
- eom_output_notify_cb_info cb_info;
-
- _init_test();
-
- cb_info.mode_change_func = ut_eom_cb;
- list.data = &cb_info;
- cb_info_list = &list;
- list.next = list.prev = NULL;
-
- error = eom_set_mode_changed_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_mode_changed_cb, null_ptr_fail_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_set_mode_changed_cb(NULL, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_unset_output_removed_cb() */
-
-TEST(eom_unset_output_removed_cb, work_flow_success_3)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_notify_cb_info cb_info1;
- eom_output_notify_cb_info *cb_info2;
-
- _init_test();
-
- cb_info1.remove_func = ut_eom_cb1;
- cb_info2 = calloc(1, sizeof(eom_output_notify_cb_info));
- cb_info2->remove_func = ut_eom_cb;
- cb_info_list = g_list_append(cb_info_list, &cb_info1);
- cb_info_list = g_list_append(cb_info_list, cb_info2);
- FREE_TESTED_PTR = cb_info2;
-
- error = eom_unset_output_removed_cb(ut_eom_cb);
-
- cb_info_list = g_list_remove(cb_info_list, &cb_info1);
- cb_info_list = g_list_remove(cb_info_list, cb_info2);
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(free_called_for_tested_ptr, 1);
-}
-
-TEST(eom_unset_output_removed_cb, work_flow_success_2)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_notify_cb_info cb_info1;
- eom_output_notify_cb_info cb_info2;
-
- _init_test();
-
- cb_info1.remove_func = ut_eom_cb1;
- cb_info2.remove_func = ut_eom_cb1;
- cb_info_list = g_list_append(cb_info_list, &cb_info1);
- cb_info_list = g_list_append(cb_info_list, &cb_info2);
-
- error = eom_unset_output_removed_cb(ut_eom_cb);
-
- cb_info_list = g_list_remove(cb_info_list, &cb_info1);
- cb_info_list = g_list_remove(cb_info_list, &cb_info2);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_unset_output_removed_cb, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_unset_output_removed_cb(ut_eom_cb);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_unset_output_removed_cb, null_ptr_fail_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_unset_output_removed_cb(NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_set_output_removed_cb() */
-
-TEST(eom_set_output_removed_cb, work_flow_success_4)
-{
- eom_error_e error = EOM_ERROR_OUT_OF_MEMORY;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_notify_type_e expected_type = EOM_OUTPUT_NOTIFY_REMOVE;
- int user_data = 324;
- eom_output_notify_cb_info *cb_info;
- eom_output_notify_cb_info info;
- GList *l;
-
- _init_test();
-
- error = eom_set_output_removed_cb(ut_eom_cb, &user_data);
-
- ASSERT_EQ(error, expected_error);
- ASSERT_TRUE(cb_info_list != NULL);
- for (l = cb_info_list; l; l = g_list_next(l)) {
- cb_info = (eom_output_notify_cb_info *)l->data;
- if (cb_info)
- break;
- }
- cb_info_list = g_list_remove_all(cb_info_list, cb_info);
- ASSERT_TRUE(cb_info != NULL);
- info = *cb_info;
- free(cb_info);
- ASSERT_TRUE(info.remove_func == ut_eom_cb);
- ASSERT_TRUE(info.user_data == &user_data);
- ASSERT_EQ(info.type, expected_type);
-}
-
-TEST(eom_set_output_removed_cb, work_flow_success_3)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_OUT_OF_MEMORY;
-
- _init_test();
-
- CALLOC_ERROR = 1;
-
- error = eom_set_output_removed_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_removed_cb, work_flow_success_2)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- GList list1;
- eom_output_notify_cb_info cb_info1;
- GList list;
- eom_output_notify_cb_info cb_info;
-
- _init_test();
-
- cb_info1.remove_func = ut_eom_cb1;
- list1.data = &cb_info1;
- cb_info_list = &list1;
- list1.next = list1.prev = NULL;
-
- cb_info.remove_func = ut_eom_cb;
- list.data = &cb_info;
- list.next = list.prev = NULL;
- list1.next = &list;
- list.prev = &list1;
-
- error = eom_set_output_removed_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_removed_cb, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- GList list;
- eom_output_notify_cb_info cb_info;
-
- _init_test();
-
- cb_info.remove_func = ut_eom_cb;
- list.data = &cb_info;
- cb_info_list = &list;
- list.next = list.prev = NULL;
-
- error = eom_set_output_removed_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_removed_cb, null_ptr_fail_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_set_output_removed_cb(NULL, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_unset_output_added_cb() */
-
-TEST(eom_unset_output_added_cb, work_flow_success_3)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_notify_cb_info cb_info1;
- eom_output_notify_cb_info *cb_info2;
-
- _init_test();
-
- cb_info1.add_func = ut_eom_cb1;
- cb_info2 = calloc(1, sizeof(eom_output_notify_cb_info));
- cb_info2->add_func = ut_eom_cb;
- cb_info_list = g_list_append(cb_info_list, &cb_info1);
- cb_info_list = g_list_append(cb_info_list, cb_info2);
- FREE_TESTED_PTR = cb_info2;
-
- error = eom_unset_output_added_cb(ut_eom_cb);
-
- cb_info_list = g_list_remove(cb_info_list, &cb_info1);
- cb_info_list = g_list_remove(cb_info_list, cb_info2);
-
- ASSERT_EQ(error, expected_error);
- ASSERT_EQ(free_called_for_tested_ptr, 1);
-}
-
-TEST(eom_unset_output_added_cb, work_flow_success_2)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_notify_cb_info cb_info1;
- eom_output_notify_cb_info cb_info2;
-
- _init_test();
-
- cb_info1.add_func = ut_eom_cb1;
- cb_info2.add_func = ut_eom_cb1;
- cb_info_list = g_list_append(cb_info_list, &cb_info1);
- cb_info_list = g_list_append(cb_info_list, &cb_info2);
-
- error = eom_unset_output_added_cb(ut_eom_cb);
-
- cb_info_list = g_list_remove(cb_info_list, &cb_info1);
- cb_info_list = g_list_remove(cb_info_list, &cb_info2);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_unset_output_added_cb, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_unset_output_added_cb(ut_eom_cb);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_unset_output_added_cb, null_ptr_fail_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_unset_output_added_cb(NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_set_output_added_cb() */
-
-TEST(eom_set_output_added_cb, work_flow_success_4)
-{
- eom_error_e error = EOM_ERROR_OUT_OF_MEMORY;
- eom_error_e expected_error = EOM_ERROR_NONE;
- eom_output_notify_type_e expected_type = EOM_OUTPUT_NOTIFY_ADD;
- int user_data = 324;
- eom_output_notify_cb_info *cb_info;
- eom_output_notify_cb_info info;
- GList *l;
-
- _init_test();
-
- error = eom_set_output_added_cb(ut_eom_cb, &user_data);
-
- ASSERT_EQ(error, expected_error);
- ASSERT_TRUE(cb_info_list != NULL);
- for (l = cb_info_list; l; l = g_list_next(l)) {
- cb_info = (eom_output_notify_cb_info *)l->data;
- if (cb_info)
- break;
- }
- cb_info_list = g_list_remove_all(cb_info_list, cb_info);
- ASSERT_TRUE(cb_info != NULL);
- info = *cb_info;
- free(cb_info);
- ASSERT_TRUE(info.add_func == ut_eom_cb);
- ASSERT_TRUE(info.user_data == &user_data);
- ASSERT_EQ(info.type, expected_type);
-}
-
-TEST(eom_set_output_added_cb, work_flow_success_3)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_OUT_OF_MEMORY;
-
- _init_test();
-
- CALLOC_ERROR = 1;
-
- error = eom_set_output_added_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_added_cb, work_flow_success_2)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- GList list1;
- eom_output_notify_cb_info cb_info1;
- GList list;
- eom_output_notify_cb_info cb_info;
-
- _init_test();
-
- cb_info1.add_func = ut_eom_cb1;
- list1.data = &cb_info1;
- cb_info_list = &list1;
- list1.next = list1.prev = NULL;
-
- cb_info.add_func = ut_eom_cb;
- list.data = &cb_info;
- list.next = list.prev = NULL;
- list1.next = &list;
- list.prev = &list1;
-
- error = eom_set_output_added_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_added_cb, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
- GList list;
- eom_output_notify_cb_info cb_info;
-
- _init_test();
-
- cb_info.add_func = ut_eom_cb;
- list.data = &cb_info;
- cb_info_list = &list;
- list.next = list.prev = NULL;
-
- error = eom_set_output_added_cb(ut_eom_cb, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_set_output_added_cb, null_ptr_fail_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_INVALID_PARAMETER;
-
- _init_test();
-
- error = eom_set_output_added_cb(NULL, NULL);
-
- ASSERT_EQ(error, expected_error);
-}
-
-/* eom_get_eom_output_ids() */
-
-TEST(eom_get_eom_output_ids, work_flow_success_5)
-{
- int count = 0;
- int expected_error = EOM_ERROR_NONE;
- eom_output_id *not_expected = NULL;
- eom_output_id *actual;
- int last_result = EOM_ERROR_NONE;
-
- _init_test();
-
- actual = eom_get_eom_output_ids(&count);
-
- last_result = get_last_result();
-
- ASSERT_TRUE(actual != not_expected);
- free(actual);
- ASSERT_EQ(last_result, expected_error);
- ASSERT_TRUE(output_info_list != NULL);
- while (output_info_list) {
- eom_output_info *output_info = (eom_output_info *)output_info_list->data;
- output_info_list = g_list_remove(output_info_list, output_info);
- free(output_info);
-
- }
-}
-
-TEST(eom_get_eom_output_ids, work_flow_success_4)
-{
- int count = 0;
- int expected_error = EOM_ERROR_OUT_OF_MEMORY;
- eom_output_id *expected = NULL;
- eom_output_id *actual;
- int last_result = EOM_ERROR_NONE;
-
- _init_test();
-
- CALLOC_ERROR = 1;
-
- actual = eom_get_eom_output_ids(&count);
-
- last_result = get_last_result();
-
- ASSERT_EQ(actual, expected);
- ASSERT_EQ(last_result, expected_error);
-}
-
-TEST(eom_get_eom_output_ids, work_flow_success_3)
-{
- int count = 0;
- int expected_error = EOM_ERROR_NONE;
- eom_output_id *expected = NULL;
- eom_output_id *actual;
- int last_result = EOM_ERROR_NONE;
-
- _init_test();
-
- EOM_WAYLEND_RET_ERROR = 1;
-
- actual = eom_get_eom_output_ids(&count);
-
- last_result = get_last_result();
-
- ASSERT_EQ(actual, expected);
- ASSERT_EQ(last_result, expected_error);
-}
-
-TEST(eom_get_eom_output_ids, work_flow_success_2)
-{
- int count = 0;
- int expected_error = EOM_ERROR_NONE;
- eom_output_id *expected = NULL;
- eom_output_id *actual;
- int last_result = EOM_ERROR_NONE;
-
- _init_test();
-
- EOM_WAYLEND_ERROR = 1;
-
- actual = eom_get_eom_output_ids(&count);
-
- last_result = get_last_result();
-
- ASSERT_EQ(actual, expected);
- ASSERT_EQ(last_result, expected_error);
-}
-
-TEST(eom_get_eom_output_ids, work_flow_success_1)
-{
- eom_output_id *expected = NULL;
- int expected_error = EOM_ERROR_INVALID_PARAMETER;
- eom_output_id *actual;
- int last_result = EOM_ERROR_NONE;
-
- _init_test();
-
- actual = eom_get_eom_output_ids(NULL);
-
- last_result = get_last_result();
-
- ASSERT_EQ(actual, expected);
- ASSERT_EQ(last_result, expected_error);
-}
-
-/* eom_deinit() */
-
-TEST(eom_deinit, work_flow_success_2)
-{
- GList *expected_list = NULL;
- GList list;
-
- _init_test();
-
- list.next = list.prev = list.data = NULL;
- output_info_list = &list;
-
- eom_output_info *data1 = calloc(1, sizeof(eom_output_info));
- data1->width = 1;
- eom_output_info *data2 = calloc(1, sizeof(eom_output_info));
- data2->width = 2;
- eom_output_info *data3 = calloc(1, sizeof(eom_output_info));
- data3->width = 3;
- output_info_list = g_list_append(output_info_list, data1);
- output_info_list = g_list_append(output_info_list, data2);
- output_info_list = g_list_append(output_info_list, data3);
-
- eom_deinit();
-
- ASSERT_GE(free_call_count, 3);
- ASSERT_TRUE(output_info_list == expected_list);
-}
-
-TEST(eom_deinit, work_flow_success_1)
-{
- GList *expected_list = NULL;
-
- GList list;
-
- _init_test();
-
- list.next = list.prev = list.data = NULL;
- output_info_list = &list;
-
- eom_output_info *data = calloc(1, sizeof(eom_output_info));
- output_info_list = g_list_append(output_info_list, data);
-
- eom_deinit();
-
- ASSERT_TRUE(output_info_list == expected_list);
- ASSERT_TRUE(FREE_PTR == data);
-}
-
-/* eom_init() */
-
-TEST(eom_init, work_flow_success_2)
-{
- eom_error_e error = EOM_ERROR_INVALID_PARAMETER;
- eom_error_e expected_error = EOM_ERROR_NONE;
-
- _init_test();
-
- error = eom_init();
-
- ASSERT_EQ(error, expected_error);
-}
-
-TEST(eom_init, work_flow_success_1)
-{
- eom_error_e error = EOM_ERROR_NONE;
- eom_error_e expected_error = EOM_ERROR_CONNECTION_FAILURE;
-
- _init_test();
-
- EOM_WAYLAND_CLIENT_INIT_ERROR = 1;
-
- error = eom_init();
-
- ASSERT_EQ(error, expected_error);
-}