provide eom server protocol through eom-server-protocol.so library 64/94864/2
authorRoman Peresipkyn <r.peresipkyn@samsung.com>
Tue, 1 Nov 2016 12:20:26 +0000 (14:20 +0200)
committerRoman Peresypkin <r.peresipkyn@samsung.com>
Tue, 1 Nov 2016 14:23:33 +0000 (07:23 -0700)
libeom generates eom wayland protocol and provide it through eom-server-protocol.so library. It has been done for simplification of building and developing of EOM client and server parts

Change-Id: I3c0721d81eab7f4c62a1799c838bb37675099312
Signed-off-by: Roman Peresipkyn <r.peresipkyn@samsung.com>
configure.ac
include/eom.pc.in
packaging/libeom.spec
protocol/eom-client-protocol.h [deleted file]
protocol/eom-protocol.c [deleted file]
src/Makefile.am
src/eom-wayland.c

index 9f7e30d..42342e7 100755 (executable)
@@ -51,6 +51,12 @@ AC_FUNC_ALLOCA
 # 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" ])
@@ -64,6 +70,8 @@ PKG_CHECK_MODULES(ELEMENTARY, elementary)
 LIBEOM_CFLAGS="$DBUS_CFLAGS $GLIB_CFLAGS $ELEMENTARY_CFLAGS "
 LIBEOM_LIBS="$DBUS_LIBS $GLIB_LIBS $ELEMENTARY_LIBS "
 
+PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner)
+
 
 PKG_CHECK_MODULES(WAYLAND_CLIENT, wayland-client)
 PKG_CHECK_MODULES(XDG_SHELL_CLIENT, xdg-shell-client)
index b795246..1a89a1b 100644 (file)
@@ -9,4 +9,4 @@ Version: @PACKAGE_VERSION@
 Requires.private: dbus-1 gio-unix-2.0
 Requires: capi-base-common
 Cflags: -I${includedir}/eom
-Libs: -L${libdir} -leom
+Libs: -L${libdir} -leom -leom-server-protocol
index f9abebd..af7f836 100644 (file)
@@ -61,6 +61,8 @@ make -C ut check
 rm -rf %{buildroot}
 mkdir -p %{buildroot}/%{TZ_SYS_RO_SHARE}/license
 cp -af COPYING %{buildroot}/%{TZ_SYS_RO_SHARE}/license/%{name}
+mkdir -p %{buildroot}/usr/include
+cp src/eom-server-protocol.h %{buildroot}/usr/include
 %make_install
 
 %remove_docs
@@ -69,7 +71,9 @@ cp -af COPYING %{buildroot}/%{TZ_SYS_RO_SHARE}/license/%{name}
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
 %{TZ_SYS_RO_SHARE}/license/%{name}
+%{_includedir}/eom-server-protocol.h
 %{_libdir}/libeom.so.*
+%{_libdir}/libeom-server-protocol.so.*
 %if %{with utest}
 %{_bindir}/ut
 %endif
@@ -79,5 +83,6 @@ cp -af COPYING %{buildroot}/%{TZ_SYS_RO_SHARE}/license/%{name}
 %dir %{_includedir}/eom/
 %{_includedir}/eom/*.h
 %{_libdir}/libeom.so
+%{_libdir}/libeom-server-protocol.so
 %{_libdir}/pkgconfig/eom.pc
 
diff --git a/protocol/eom-client-protocol.h b/protocol/eom-client-protocol.h
deleted file mode 100644 (file)
index c88784e..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef WL_EOM_CLIENT_PROTOCOL_H
-#define WL_EOM_CLIENT_PROTOCOL_H
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-#include <stddef.h>
-#include "wayland-client.h"
-
-struct wl_client;
-struct wl_resource;
-
-struct wl_eom;
-struct wl_shell_surface;
-struct xdg_surface;
-
-extern const struct wl_interface wl_eom_interface;
-
-#ifndef WL_EOM_ERROR_ENUM
-#define WL_EOM_ERROR_ENUM
-enum wl_eom_error {
-       WL_EOM_ERROR_NONE = 0,
-       WL_EOM_ERROR_NO_OUTPUT = 1,
-       WL_EOM_ERROR_NO_ATTRIBUTE = 2,
-       WL_EOM_ERROR_OUTPUT_OCCUPIED = 3,
-};
-#endif /* WL_EOM_ERROR_ENUM */
-
-#ifndef WL_EOM_TYPE_ENUM
-#define WL_EOM_TYPE_ENUM
-/**
- * wl_eom_type - connector type
- * @WL_EOM_TYPE_NONE: none
- * @WL_EOM_TYPE_VGA: VGA output connector type
- * @WL_EOM_TYPE_DVII: DVI-I output connector type
- * @WL_EOM_TYPE_DVID: DVI-D output connector type
- * @WL_EOM_TYPE_DVIA: DVI-A output connector type
- * @WL_EOM_TYPE_COMPOSITE: Composite output connector type
- * @WL_EOM_TYPE_SVIDEO: S-Video output connector type
- * @WL_EOM_TYPE_LVDS: LVDS output connector type
- * @WL_EOM_TYPE_COMPONENT: Component output connector type
- * @WL_EOM_TYPE_9PINDIN: 9 pin DIN output connector type
- * @WL_EOM_TYPE_DISPLAYPORT: DisplayPort output connector type
- * @WL_EOM_TYPE_HDMIA: HDMI type A output connector type
- * @WL_EOM_TYPE_HDMIB: HDMI type B output connector type
- * @WL_EOM_TYPE_TV: TV output connector type
- * @WL_EOM_TYPE_EDP: eDP output connector type
- * @WL_EOM_TYPE_VIRTUAL: Virtual output connector type
- * @WL_EOM_TYPE_DSI: DSI output connector type
- *
- * Define several connectors type of the external outputs
- */
-enum wl_eom_type {
-       WL_EOM_TYPE_NONE = 0,
-       WL_EOM_TYPE_VGA = 1,
-       WL_EOM_TYPE_DVII = 2,
-       WL_EOM_TYPE_DVID = 3,
-       WL_EOM_TYPE_DVIA = 4,
-       WL_EOM_TYPE_COMPOSITE = 5,
-       WL_EOM_TYPE_SVIDEO = 6,
-       WL_EOM_TYPE_LVDS = 7,
-       WL_EOM_TYPE_COMPONENT = 8,
-       WL_EOM_TYPE_9PINDIN = 9,
-       WL_EOM_TYPE_DISPLAYPORT = 10,
-       WL_EOM_TYPE_HDMIA = 11,
-       WL_EOM_TYPE_HDMIB = 12,
-       WL_EOM_TYPE_TV = 13,
-       WL_EOM_TYPE_EDP = 14,
-       WL_EOM_TYPE_VIRTUAL = 15,
-       WL_EOM_TYPE_DSI = 16,
-};
-#endif /* WL_EOM_TYPE_ENUM */
-
-#ifndef WL_EOM_STATUS_ENUM
-#define WL_EOM_STATUS_ENUM
-/**
- * wl_eom_status - connection status of the external output
- * @WL_EOM_STATUS_NONE: none
- * @WL_EOM_STATUS_CONNECTION: output connected
- * @WL_EOM_STATUS_DISCONNECTION: output disconnected
- *
- * The status of external output is connected or not.
- */
-enum wl_eom_status {
-       WL_EOM_STATUS_NONE = 0,
-       WL_EOM_STATUS_CONNECTION = 1,
-       WL_EOM_STATUS_DISCONNECTION = 2,
-};
-#endif /* WL_EOM_STATUS_ENUM */
-
-#ifndef WL_EOM_MODE_ENUM
-#define WL_EOM_MODE_ENUM
-/**
- * wl_eom_mode - mode of the external output
- * @WL_EOM_MODE_NONE: none
- * @WL_EOM_MODE_MIRROR: mirror mode
- * @WL_EOM_MODE_PRESENTATION: presentation mode
- *
- * 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.
- */
-enum wl_eom_mode {
-       WL_EOM_MODE_NONE = 0,
-       WL_EOM_MODE_MIRROR = 1,
-       WL_EOM_MODE_PRESENTATION = 2,
-};
-#endif /* WL_EOM_MODE_ENUM */
-
-#ifndef WL_EOM_ATTRIBUTE_ENUM
-#define WL_EOM_ATTRIBUTE_ENUM
-/**
- * wl_eom_attribute - attribute of the external output
- * @WL_EOM_ATTRIBUTE_NONE: none
- * @WL_EOM_ATTRIBUTE_NORMAL: nomal attribute
- * @WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARE: exclusive share attribute
- * @WL_EOM_ATTRIBUTE_EXCLUSIVE: exclusive attribute
- *
- * 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.
- */
-enum wl_eom_attribute {
-       WL_EOM_ATTRIBUTE_NONE = 0,
-       WL_EOM_ATTRIBUTE_NORMAL = 1,
-       WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARE = 2,
-       WL_EOM_ATTRIBUTE_EXCLUSIVE = 3,
-};
-#endif /* WL_EOM_ATTRIBUTE_ENUM */
-
-#ifndef WL_EOM_ATTRIBUTE_STATE_ENUM
-#define WL_EOM_ATTRIBUTE_STATE_ENUM
-/**
- * wl_eom_attribute_state - state of the external output attribute
- * @WL_EOM_ATTRIBUTE_STATE_NONE: none
- * @WL_EOM_ATTRIBUTE_STATE_ACTIVE: attribute is active on the output
- * @WL_EOM_ATTRIBUTE_STATE_INACTIVE: attribute is inactive on the output
- * @WL_EOM_ATTRIBUTE_STATE_LOST: the connection of output is lost
- *
- * 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.
- */
-enum wl_eom_attribute_state {
-       WL_EOM_ATTRIBUTE_STATE_NONE = 0,
-       WL_EOM_ATTRIBUTE_STATE_ACTIVE = 1,
-       WL_EOM_ATTRIBUTE_STATE_INACTIVE = 2,
-       WL_EOM_ATTRIBUTE_STATE_LOST = 3,
-};
-#endif /* WL_EOM_ATTRIBUTE_STATE_ENUM */
-
-/**
- * wl_eom - an interface for external outputs
- * @output_count: external output count
- * @output_info: 
- * @output_type: output type and connection info
- * @output_mode: output mode info
- * @output_attribute: output attribute info
- * @output_set_window: reslut of set_window
- *
- * An interface to get information of external outputs and to use
- * external outputs.
- */
-struct wl_eom_listener {
-       /**
-        * output_count - external output count
-        * @count: (none)
-        *
-        * Get the number of external output devices that are supported
-        * by this device.
-        */
-       void (*output_count)(void *data,
-                            struct wl_eom *wl_eom,
-                            uint32_t count);
-       /**
-        * output_info - 
-        * @output_id: (none)
-        * @type: (none)
-        * @mode: (none)
-        * @w: (none)
-        * @h: (none)
-        * @w_mm: (none)
-        * @h_mm: (none)
-        * @connection: (none)
-        * @skip: (none)
-        * @attribute: (none)
-        * @attribute_state: (none)
-        * @error: (none)
-        *
-        * 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.
-        */
-       void (*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);
-       /**
-        * output_type - output type and connection info
-        * @output_id: (none)
-        * @type: (none)
-        * @status: (none)
-        *
-        * Send information of output type and connection.
-        */
-       void (*output_type)(void *data,
-                           struct wl_eom *wl_eom,
-                           uint32_t output_id,
-                           uint32_t type,
-                           uint32_t status);
-       /**
-        * output_mode - output mode info
-        * @output_id: (none)
-        * @mode: (none)
-        *
-        * Send information of output mode.
-        */
-       void (*output_mode)(void *data,
-                           struct wl_eom *wl_eom,
-                           uint32_t output_id,
-                           uint32_t mode);
-       /**
-        * output_attribute - output attribute info
-        * @output_id: (none)
-        * @attribute: (none)
-        * @attribute_state: (none)
-        * @error: (none)
-        *
-        * Send information of output attribute and attribute state.
-        */
-       void (*output_attribute)(void *data,
-                                struct wl_eom *wl_eom,
-                                uint32_t output_id,
-                                uint32_t attribute,
-                                uint32_t attribute_state,
-                                uint32_t error);
-       /**
-        * output_set_window - reslut of set_window
-        * @output_id: (none)
-        * @error: (none)
-        *
-        * Send the result of set_window to client.
-        */
-       void (*output_set_window)(void *data,
-                                 struct wl_eom *wl_eom,
-                                 uint32_t output_id,
-                                 uint32_t error);
-};
-
-static inline int
-wl_eom_add_listener(struct wl_eom *wl_eom,
-                   const struct wl_eom_listener *listener, void *data)
-{
-       return wl_proxy_add_listener((struct wl_proxy *) wl_eom,
-                                    (void (**)(void)) listener, data);
-}
-
-#define WL_EOM_SET_ATTRIBUTE   0
-#define WL_EOM_SET_XDG_WINDOW  1
-#define WL_EOM_SET_SHELL_WINDOW        2
-#define WL_EOM_GET_OUTPUT_INFO 3
-
-#define WL_EOM_SET_ATTRIBUTE_SINCE_VERSION     1
-#define WL_EOM_SET_XDG_WINDOW_SINCE_VERSION    1
-#define WL_EOM_SET_SHELL_WINDOW_SINCE_VERSION  1
-#define WL_EOM_GET_OUTPUT_INFO_SINCE_VERSION   1
-
-static inline void
-wl_eom_set_user_data(struct wl_eom *wl_eom, void *user_data)
-{
-       wl_proxy_set_user_data((struct wl_proxy *) wl_eom, user_data);
-}
-
-static inline void *
-wl_eom_get_user_data(struct wl_eom *wl_eom)
-{
-       return wl_proxy_get_user_data((struct wl_proxy *) wl_eom);
-}
-
-static inline uint32_t
-wl_eom_get_version(struct wl_eom *wl_eom)
-{
-       return wl_proxy_get_version((struct wl_proxy *) wl_eom);
-}
-
-static inline void
-wl_eom_destroy(struct wl_eom *wl_eom)
-{
-       wl_proxy_destroy((struct wl_proxy *) wl_eom);
-}
-
-static inline void
-wl_eom_set_attribute(struct wl_eom *wl_eom, uint32_t output_id, uint32_t attribute)
-{
-       wl_proxy_marshal((struct wl_proxy *) wl_eom,
-                        WL_EOM_SET_ATTRIBUTE, output_id, attribute);
-}
-
-static inline void
-wl_eom_set_xdg_window(struct wl_eom *wl_eom, uint32_t output_id, struct xdg_surface *surface)
-{
-       wl_proxy_marshal((struct wl_proxy *) wl_eom,
-                        WL_EOM_SET_XDG_WINDOW, output_id, surface);
-}
-
-static inline void
-wl_eom_set_shell_window(struct wl_eom *wl_eom, uint32_t output_id, struct wl_shell_surface *surface)
-{
-       wl_proxy_marshal((struct wl_proxy *) wl_eom,
-                        WL_EOM_SET_SHELL_WINDOW, output_id, surface);
-}
-
-static inline void
-wl_eom_get_output_info(struct wl_eom *wl_eom, uint32_t output_id)
-{
-       wl_proxy_marshal((struct wl_proxy *) wl_eom,
-                        WL_EOM_GET_OUTPUT_INFO, output_id);
-}
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif
diff --git a/protocol/eom-protocol.c b/protocol/eom-protocol.c
deleted file mode 100644 (file)
index 3ca9b25..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdint.h>
-#include "wayland-util.h"
-
-extern const struct wl_interface wl_shell_surface_interface;
-extern const struct wl_interface xdg_surface_interface;
-
-static const struct wl_interface *types[] = {
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       &xdg_surface_interface,
-       NULL,
-       &wl_shell_surface_interface,
-};
-
-static const struct wl_message wl_eom_requests[] = {
-       { "set_attribute", "uu", types + 0 },
-       { "set_xdg_window", "uo", types + 12 },
-       { "set_shell_window", "uo", types + 14 },
-       { "get_output_info", "u", types + 0 },
-};
-
-static const struct wl_message wl_eom_events[] = {
-       { "output_count", "u", types + 0 },
-       { "output_info", "uuuuuuuuuuuu", types + 0 },
-       { "output_type", "uuu", types + 0 },
-       { "output_mode", "uu", types + 0 },
-       { "output_attribute", "uuuu", types + 0 },
-       { "output_set_window", "uu", types + 0 },
-};
-
-WL_EXPORT const struct wl_interface wl_eom_interface = {
-       "wl_eom", 1,
-       4, wl_eom_requests,
-       6, wl_eom_events,
-};
-
index c8579b3..2e213b2 100755 (executable)
@@ -38,7 +38,33 @@ libeom_la_CFLAGS = \
 libeom_la_SOURCES = \
        eom.c \
        eom-wayland.c \
-       ../protocol/eom-protocol.c
+       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 < $< > $@
+
+BUILT_SOURCES = eom-protocol.c \
+                eom-client-protocol.h \
+                eom-server-protocol.h
+
+libeom_server_protocol_la_LTLIBRARIES = libeom-server-protocol.la
+libeom_server_protocol_ladir = $(libdir)
+libeom_server_protocol_la_LIBADD = @LIBEOM_LIBS@
+libeom_server_protocol_la_LDFLAGS = ${LDFLAGS}
+libeom_server_protocol_la_CFLAGS = \
+    ${CFLAGS} \
+    @LIBEOM_CFLAGS@ \
+    -I$(top_srcdir)/src
+
+libeom_server_protocol_la_SOURCES = \
+    eom-protocol.c
+
 
 
 
index 8222aec..c298281 100644 (file)
@@ -38,7 +38,7 @@
 #include "eom-log.h"
 #include "eom-wayland.h"
 #include "eom-private.h"
-#include "../protocol/eom-client-protocol.h"
+#include "eom-client-protocol.h"
 #include "xdg-shell-client-protocol.h"
 #include <Ecore_Wayland.h>