CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+ADD_SUBDIRECTORY(screen_connector_launcher_service)
+ADD_SUBDIRECTORY(screen_connector_launcher_service_evas)
+ADD_SUBDIRECTORY(screen_connector_shared_widget_launch)
ADD_SUBDIRECTORY(screen_connector_provider)
ADD_SUBDIRECTORY(screen_connector_remote_surface)
ADD_SUBDIRECTORY(screen_connector_remote_surface_evas)
ADD_SUBDIRECTORY(screen_connector_watcher_evas)
ADD_SUBDIRECTORY(unittest)
+ADD_DEPENDENCIES(screen_connector_launcher_service_evas screen_connector_launcher_service)
ADD_DEPENDENCIES(screen_connector_remote_surface_evas screen_connector_remote_surface)
ADD_DEPENDENCIES(screen_connector_watcher screen_connector_remote_surface)
ADD_DEPENDENCIES(screen_connector_watcher_evas screen_connector_watcher screen_connector_remote_surface_evas)
Source1003: %{name}_provider.manifest
Source1004: %{name}_remote_surface.manifest
Source1005: %{name}_remote_surface_evas.manifest
+Source1006: %{name}_launcher_service.manifest
+Source1007: %{name}_launcher_service_evas.manifest
+Source1008: %{name}_shared_widget_launch.manifest
BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(wayland-client)
BuildRequires: pkgconfig(ecore-wl2)
BuildRequires: pkgconfig(gmock)
+BuildRequires: pkgconfig(tzsh-launcher-service)
%description
API for creating a new instance of the widget and managing its life-cycle.
cp %{SOURCE1003} .
cp %{SOURCE1004} .
cp %{SOURCE1005} .
+cp %{SOURCE1006} .
+cp %{SOURCE1007} .
+cp %{SOURCE1008} .
%build
%files -n gtest-screen-connector
%{_bindir}/gtest-screen-connector
+#################################################
+# libscreen_connector_launcher_service
+#################################################
+%package -n %{name}_launcher_service
+Summary: Library for developing the screen connector launcher service
+Group: Applications/Core Applications
+License: Apache-2.0
+
+%description -n %{name}_launcher_service
+Launcher Service APIs to develop the screen connector launcher application.
+
+%package -n %{name}_launcher_service-devel
+Summary: Screen connector launcher application development library (dev)
+Group: Development/Libraries
+Requires: %{name}_launcher_service
+
+%description -n %{name}_launcher_service-devel
+Header & package files to support development of the launcher applications.
+
+%post -n %{name}_launcher_service -p /sbin/ldconfig
+
+%postun -n %{name}_launcher_service -p /sbin/ldconfig
+
+%files -n %{name}_launcher_service
+%manifest %{name}_launcher_service.manifest
+%attr(0644,root,root) %{_libdir}/%{name}_launcher_service.so.*
+%license LICENSE
+
+%files -n %{name}_launcher_service-devel
+%{_includedir}/screen_connector_launcher_service/*.h
+%{_libdir}/pkgconfig/screen_connector_launcher_service.pc
+%attr(0644,root,root) %{_libdir}/%{name}_launcher_service.so
+
+#################################################
+# libscreen_connector_launcher_service_evas
+#################################################
+%package -n %{name}_launcher_service_evas
+Summary: Library for developing the screen connector launcher service evas
+Group: Applications/Core Applications
+License: Apache-2.0
+
+%description -n %{name}_launcher_service_evas
+Launcher Service Evas APIs to develop the screen connector launcher application.
+
+%package -n %{name}_launcher_service_evas-devel
+Summary: Screen connector launcher service evas application development library (dev)
+Group: Development/Libraries
+Requires: %{name}_launcher_service_evas
+
+%description -n %{name}_launcher_service_evas-devel
+Header & package files to support development of the launcher service evas applications.
+
+%post -n %{name}_launcher_service_evas -p /sbin/ldconfig
+
+%postun -n %{name}_launcher_service_evas -p /sbin/ldconfig
+
+%files -n %{name}_launcher_service_evas
+%manifest %{name}_launcher_service_evas.manifest
+%attr(0644,root,root) %{_libdir}/%{name}_launcher_service_evas.so.*
+%license LICENSE
+
+%files -n %{name}_launcher_service_evas-devel
+%{_includedir}/screen_connector_launcher_service_evas/*
+%{_libdir}/pkgconfig/screen_connector_launcher_service_evas.pc
+%attr(0644,root,root) %{_libdir}/%{name}_launcher_service_evas.so
+
+#################################################
+# libscreen_connector_shared_widget_launch
+#################################################
+%package -n %{name}_shared_widget_launch
+Summary: Library for developing the screen connector shared launch widget
+Group: Applications/Core Applications
+License: Apache-2.0
+
+%description -n %{name}_shared_widget_launch
+Shared Widget Launch APIs to develop the screen connector launcher application.
+
+%package -n %{name}_shared_widget_launch-devel
+Summary: Screen connector shared widget launch application development library (dev)
+Group: Development/Libraries
+Requires: %{name}_launcher_service_evas
+
+%description -n %{name}_shared_widget_launch-devel
+Header & package files to support development of the shared widget launch applications.
+
+%post -n %{name}_shared_widget_launch -p /sbin/ldconfig
+
+%postun -n %{name}_shared_widget_launch -p /sbin/ldconfig
+
+%files -n %{name}_shared_widget_launch
+%manifest %{name}_shared_widget_launch.manifest
+%attr(0644,root,root) %{_libdir}/%{name}_shared_widget_launch.so.*
+%license LICENSE
+
+%files -n %{name}_shared_widget_launch-devel
+%{_includedir}/screen_connector_shared_widget_launch/*
+%{_libdir}/pkgconfig/screen_connector_shared_widget_launch.pc
+%attr(0644,root,root) %{_libdir}/%{name}_shared_widget_launch.so
# End of a file
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_COMMON_EVAS_OBJECT_H_
+#define SCREEN_CONNECTOR_COMMON_EVAS_OBJECT_H_
+
+#include <Elementary.h>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/handle.h"
+
+namespace screen_connector {
+
+class EXPORT EvasObject : public Handle<Evas_Object*> {
+ public:
+ EvasObject(Evas_Object* raw, bool owner) : Handle<Evas_Object*>(raw, owner) {}
+ virtual ~EvasObject() {
+ if (IsOwner()) {
+ evas_object_del(GetRaw());
+ }
+ }
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_COMMON_EVAS_OBJECT_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_COMMON_EXPORT_H_
+#define SCREEN_CONNECTOR_COMMON_EXPORT_H_
+
+#ifdef EXPORT
+#undef EXPORT
+#endif
+#define EXPORT __attribute__((visibility("default")))
+
+#endif // SCREEN_CONNECTOR_COMMON_EXPORT_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_COMMON_HANDLE_H_
+#define SCREEN_CONNECTOR_COMMON_HANDLE_H_
+
+#include "screen_connector_common/export.h"
+
+namespace screen_connector {
+
+template <typename T>
+class EXPORT Handle {
+ public:
+ explicit Handle(T raw, bool owner) : raw_(raw), owner_(owner) { }
+ virtual ~Handle() { }
+
+ T GetRaw() const {
+ return raw_;
+ }
+
+ bool IsOwner() {
+ return owner_;
+ }
+
+ private:
+ T raw_;
+ bool owner_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_COMMON_HANDLE_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_COMMON_TZSH_H_
+#define SCREEN_CONNECTOR_COMMON_TZSH_H_
+
+#include <stdint.h>
+#include <tzsh_launcher_service.h>
+#include <tzsh_shared_widget_launch.h>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/handle.h"
+
+namespace screen_connector {
+
+class EXPORT Tzsh : public Handle<tzsh_h> {
+ public:
+ explicit Tzsh(tzsh_h raw) : Handle<tzsh_h>(raw, true) { }
+ virtual ~Tzsh() {
+ if (GetRaw() != nullptr) {
+ tzsh_destroy(GetRaw());
+ }
+ }
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_COMMON_TZSH_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_COMMON_TZSH_WINDOW_H_
+#define SCREEN_CONNECTOR_COMMON_TZSH_WINDOW_H_
+
+#include <stdint.h>
+#include <tzsh_launcher_service.h>
+#include <tzsh_shared_widget_launch.h>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/handle.h"
+
+namespace screen_connector {
+
+class EXPORT TzshWindow : public Handle<tzsh_window> {
+ public:
+ explicit TzshWindow(tzsh_window raw) : Handle<tzsh_window>(raw, false) { }
+ virtual ~TzshWindow() { }
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_COMMON_TZSH_WINDOW_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_COMMON_UTIL_H_
+#define SCREEN_CONNECTOR_COMMON_UTIL_H_
+
+#include <memory>
+
+#include "screen_connector_common/evas_object.h"
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/wl2_window.h"
+
+namespace screen_connector {
+namespace util {
+
+EXPORT std::shared_ptr<Wl2Window> GetWl2Window(Evas_Object* win) {
+ Ecore_Wl2_Window* wl2_win =
+ reinterpret_cast<Ecore_Wl2_Window*>(elm_win_wl_window_get(win));
+ return std::shared_ptr<Wl2Window>(new Wl2Window(wl2_win));
+}
+
+} // namespace util
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_COMMON_UTIL_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_COMMON_WL2_WINDOW_H_
+#define SCREEN_CONNECTOR_COMMON_WL2_WINDOW_H_
+
+#include <Ecore_Wl2.h>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/handle.h"
+
+namespace screen_connector {
+
+class EXPORT Wl2Window : public Handle<Ecore_Wl2_Window*> {
+ public:
+ explicit Wl2Window(Ecore_Wl2_Window* raw)
+ : Handle<Ecore_Wl2_Window*>(raw, false) { }
+ virtual ~Wl2Window() { }
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_COMMON_WL2_WINDOW_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_COMMON_WL_BUFFER_H_
+#define SCREEN_CONNECTOR_COMMON_WL_BUFFER_H_
+
+#include <Ecore_Wl2.h>
+#include <stdint.h>
+#include <tbm_surface.h>
+#include <tbm_surface_internal.h>
+#include <tizen-remote-surface-client-protocol.h>
+#include <unistd.h>
+#include <wayland-extension/tizen-extension-client-protocol.h>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/handle.h"
+
+namespace screen_connector {
+
+class EXPORT WlBuffer : public Handle<struct wl_buffer*> {
+ public:
+ WlBuffer(struct wl_buffer* raw, struct tizen_remote_surface* trs)
+ : Handle<struct wl_buffer*>(raw, true), trs_(trs) { }
+
+ virtual ~WlBuffer() {
+ if (GetRaw() != nullptr) {
+ tizen_remote_surface_release(trs_, GetRaw());
+ tbm_surface_h tbm_surface = static_cast<tbm_surface_h>(
+ wl_buffer_get_user_data(GetRaw()));
+ tbm_surface_internal_unref(tbm_surface);
+ wl_buffer_destroy(GetRaw());
+ }
+ }
+
+ private:
+ struct tizen_remote_surface* trs_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_COMMON_WL_BUFFER_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_COMMON_WL_SURFACE_H_
+#define SCREEN_CONNECTOR_COMMON_WL_SURFACE_H_
+
+#include <Ecore_Wl2.h>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/handle.h"
+
+namespace screen_connector {
+
+class EXPORT WlSurface : public Handle<struct wl_surface*> {
+ public:
+ explicit WlSurface(struct wl_surface* raw)
+ : Handle<struct wl_surface*>(raw, false) { }
+
+ virtual ~WlSurface() { }
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_COMMON_WL_SURFACE_H_
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(screen_connector_launcher_service CXX)
+
+SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
+SET(PROJECT_NAME "${PROJECT_NAME}")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(VERSION_MAJOR "${MAJORVER}")
+SET(VERSION "${FULLVER}")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(screen_connector_launcher_service REQUIRED
+ dlog
+ aul
+ wayland-tbm-client
+ wayland-client
+ ecore-wl2
+ tizen-remote-surface-client
+ tzsh-launcher-service
+ glib-2.0
+)
+
+FOREACH(flag ${screen_connector_launcher_service_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++11")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
+ADD_LIBRARY (${PROJECT_NAME} SHARED ${SOURCES})
+
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${screen_connector_launcher_service_LDFLAGS} "-lpthread")
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
+
+INSTALL(TARGETS ${PROJECT_NAME}
+ DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
+ DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
+ DESTINATION include/${PROJECT_NAME}
+ FILES_MATCHING PATTERN "*.h"
+ PATTERN "*_internal.h" EXCLUDE
+ PATTERN "*_implementation.h" EXCLUDE)
--- /dev/null
+Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+ Apache License\r
+ Version 2.0, January 2004\r
+ http://www.apache.org/licenses/\r
+\r
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+ 1. Definitions.\r
+\r
+ "License" shall mean the terms and conditions for use, reproduction,\r
+ and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+ "Licensor" shall mean the copyright owner or entity authorized by\r
+ the copyright owner that is granting the License.\r
+\r
+ "Legal Entity" shall mean the union of the acting entity and all\r
+ other entities that control, are controlled by, or are under common\r
+ control with that entity. For the purposes of this definition,\r
+ "control" means (i) the power, direct or indirect, to cause the\r
+ direction or management of such entity, whether by contract or\r
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+ outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+ "You" (or "Your") shall mean an individual or Legal Entity\r
+ exercising permissions granted by this License.\r
+\r
+ "Source" form shall mean the preferred form for making modifications,\r
+ including but not limited to software source code, documentation\r
+ source, and configuration files.\r
+\r
+ "Object" form shall mean any form resulting from mechanical\r
+ transformation or translation of a Source form, including but\r
+ not limited to compiled object code, generated documentation,\r
+ and conversions to other media types.\r
+\r
+ "Work" shall mean the work of authorship, whether in Source or\r
+ Object form, made available under the License, as indicated by a\r
+ copyright notice that is included in or attached to the work\r
+ (an example is provided in the Appendix below).\r
+\r
+ "Derivative Works" shall mean any work, whether in Source or Object\r
+ form, that is based on (or derived from) the Work and for which the\r
+ editorial revisions, annotations, elaborations, or other modifications\r
+ represent, as a whole, an original work of authorship. For the purposes\r
+ of this License, Derivative Works shall not include works that remain\r
+ separable from, or merely link (or bind by name) to the interfaces of,\r
+ the Work and Derivative Works thereof.\r
+\r
+ "Contribution" shall mean any work of authorship, including\r
+ the original version of the Work and any modifications or additions\r
+ to that Work or Derivative Works thereof, that is intentionally\r
+ submitted to Licensor for inclusion in the Work by the copyright owner\r
+ or by an individual or Legal Entity authorized to submit on behalf of\r
+ the copyright owner. For the purposes of this definition, "submitted"\r
+ means any form of electronic, verbal, or written communication sent\r
+ to the Licensor or its representatives, including but not limited to\r
+ communication on electronic mailing lists, source code control systems,\r
+ and issue tracking systems that are managed by, or on behalf of, the\r
+ Licensor for the purpose of discussing and improving the Work, but\r
+ excluding communication that is conspicuously marked or otherwise\r
+ designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+ "Contributor" shall mean Licensor and any individual or Legal Entity\r
+ on behalf of whom a Contribution has been received by Licensor and\r
+ subsequently incorporated within the Work.\r
+\r
+ 2. Grant of Copyright License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ copyright license to reproduce, prepare Derivative Works of,\r
+ publicly display, publicly perform, sublicense, and distribute the\r
+ Work and such Derivative Works in Source or Object form.\r
+\r
+ 3. Grant of Patent License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ (except as stated in this section) patent license to make, have made,\r
+ use, offer to sell, sell, import, and otherwise transfer the Work,\r
+ where such license applies only to those patent claims licensable\r
+ by such Contributor that are necessarily infringed by their\r
+ Contribution(s) alone or by combination of their Contribution(s)\r
+ with the Work to which such Contribution(s) was submitted. If You\r
+ institute patent litigation against any entity (including a\r
+ cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+ or a Contribution incorporated within the Work constitutes direct\r
+ or contributory patent infringement, then any patent licenses\r
+ granted to You under this License for that Work shall terminate\r
+ as of the date such litigation is filed.\r
+\r
+ 4. Redistribution. You may reproduce and distribute copies of the\r
+ Work or Derivative Works thereof in any medium, with or without\r
+ modifications, and in Source or Object form, provided that You\r
+ meet the following conditions:\r
+\r
+ (a) You must give any other recipients of the Work or\r
+ Derivative Works a copy of this License; and\r
+\r
+ (b) You must cause any modified files to carry prominent notices\r
+ stating that You changed the files; and\r
+\r
+ (c) You must retain, in the Source form of any Derivative Works\r
+ that You distribute, all copyright, patent, trademark, and\r
+ attribution notices from the Source form of the Work,\r
+ excluding those notices that do not pertain to any part of\r
+ the Derivative Works; and\r
+\r
+ (d) If the Work includes a "NOTICE" text file as part of its\r
+ distribution, then any Derivative Works that You distribute must\r
+ include a readable copy of the attribution notices contained\r
+ within such NOTICE file, excluding those notices that do not\r
+ pertain to any part of the Derivative Works, in at least one\r
+ of the following places: within a NOTICE text file distributed\r
+ as part of the Derivative Works; within the Source form or\r
+ documentation, if provided along with the Derivative Works; or,\r
+ within a display generated by the Derivative Works, if and\r
+ wherever such third-party notices normally appear. The contents\r
+ of the NOTICE file are for informational purposes only and\r
+ do not modify the License. You may add Your own attribution\r
+ notices within Derivative Works that You distribute, alongside\r
+ or as an addendum to the NOTICE text from the Work, provided\r
+ that such additional attribution notices cannot be construed\r
+ as modifying the License.\r
+\r
+ You may add Your own copyright statement to Your modifications and\r
+ may provide additional or different license terms and conditions\r
+ for use, reproduction, or distribution of Your modifications, or\r
+ for any such Derivative Works as a whole, provided Your use,\r
+ reproduction, and distribution of the Work otherwise complies with\r
+ the conditions stated in this License.\r
+\r
+ 5. Submission of Contributions. Unless You explicitly state otherwise,\r
+ any Contribution intentionally submitted for inclusion in the Work\r
+ by You to the Licensor shall be under the terms and conditions of\r
+ this License, without any additional terms or conditions.\r
+ Notwithstanding the above, nothing herein shall supersede or modify\r
+ the terms of any separate license agreement you may have executed\r
+ with Licensor regarding such Contributions.\r
+\r
+ 6. Trademarks. This License does not grant permission to use the trade\r
+ names, trademarks, service marks, or product names of the Licensor,\r
+ except as required for reasonable and customary use in describing the\r
+ origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+ 7. Disclaimer of Warranty. Unless required by applicable law or\r
+ agreed to in writing, Licensor provides the Work (and each\r
+ Contributor provides its Contributions) on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+ implied, including, without limitation, any warranties or conditions\r
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+ PARTICULAR PURPOSE. You are solely responsible for determining the\r
+ appropriateness of using or redistributing the Work and assume any\r
+ risks associated with Your exercise of permissions under this License.\r
+\r
+ 8. Limitation of Liability. In no event and under no legal theory,\r
+ whether in tort (including negligence), contract, or otherwise,\r
+ unless required by applicable law (such as deliberate and grossly\r
+ negligent acts) or agreed to in writing, shall any Contributor be\r
+ liable to You for damages, including any direct, indirect, special,\r
+ incidental, or consequential damages of any character arising as a\r
+ result of this License or out of the use or inability to use the\r
+ Work (including but not limited to damages for loss of goodwill,\r
+ work stoppage, computer failure or malfunction, or any and all\r
+ other commercial damages or losses), even if such Contributor\r
+ has been advised of the possibility of such damages.\r
+\r
+ 9. Accepting Warranty or Additional Liability. While redistributing\r
+ the Work or Derivative Works thereof, You may choose to offer,\r
+ and charge a fee for, acceptance of support, warranty, indemnity,\r
+ or other liability obligations and/or rights consistent with this\r
+ License. However, in accepting such obligations, You may act only\r
+ on Your own behalf and on Your sole responsibility, not on behalf\r
+ of any other Contributor, and only if You agree to indemnify,\r
+ defend, and hold each Contributor harmless for any liability\r
+ incurred by, or claims asserted against, such Contributor by reason\r
+ of your accepting any such warranty or additional liability.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ APPENDIX: How to apply the Apache License to your work.\r
+\r
+ To apply the Apache License to your work, attach the following\r
+ boilerplate notice, with the fields enclosed by brackets "[]"\r
+ replaced with your own identifying information. (Don't include\r
+ the brackets!) The text should be enclosed in the appropriate\r
+ comment syntax for the file format. We also recommend that a\r
+ file or class name and description of purpose be included on the\r
+ same "printed page" as the copyright notice for easier\r
+ identification within third-party archives.\r
+\r
+ Copyright [yyyy] [name of copyright owner]\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_DIRECTION_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_DIRECTION_H_
+
+#include <stdint.h>
+#include <tzsh_launcher_service.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/export.h"
+
+namespace screen_connector {
+
+enum class EXPORT Direction {
+ Forward = TZSH_LAUNCHER_SERVICE_DIRECTION_FORWARD,
+ Backward = TZSH_LAUNCHER_SERVICE_DIRECTION_BACKWARD,
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_DIRECTION_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_H_
+
+#include <stdint.h>
+#include <tzsh_launcher_service.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/export.h"
+
+namespace screen_connector {
+
+enum class EXPORT Error {
+ None = TZSH_LAUNCHER_SERVICE_ERROR_NONE,
+ Disqualified = TZSH_LAUNCHER_SERVICE_ERROR_DISQUALIFIED,
+ WrongRequest = TZSH_LAUNCHER_SERVICE_ERROR_WRONG_REQUEST,
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_FILE_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_FILE_H_
+
+#include <stdint.h>
+#include <unistd.h>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/handle.h"
+
+namespace screen_connector {
+
+class EXPORT ImageFile : public Handle<int32_t> {
+ public:
+ ImageFile(int32_t fd, uint32_t size)
+ : Handle<int32_t>(fd, true), size_(size) { }
+
+ virtual ~ImageFile() {
+ if (GetRaw() > 0)
+ close(GetRaw());
+ }
+
+ uint32_t GetSize() const {
+ return size_;
+ }
+
+ private:
+ uint32_t size_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_FILE_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_H_
+
+#include <stdint.h>
+#include <tzsh_launcher_service.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/export.h"
+
+namespace screen_connector {
+
+enum class EXPORT ImageType {
+ RemoteSurfaceTBM,
+ RemoteSurfaceImageFile,
+ SplashScreenImage,
+ SplashScreenEdje,
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "screen_connector_launcher_service/launcher_service.h"
+#include "screen_connector_launcher_service/launcher_service_implementation.h"
+#include "screen_connector_launcher_service/log_internal.h"
+
+namespace screen_connector {
+
+LauncherService::Impl::Impl(LauncherService* parent,
+ std::shared_ptr<Wl2Window> wl2_win,
+ LauncherService::IEventListener* listener)
+ : parent_(parent),
+ wl2_win_(std::move(wl2_win)),
+ listener_(listener),
+ trs_mgr_(new TizenRemoteSurfaceManager()),
+ tzsh_(new Tzsh(tzsh_create(TZSH_TOOLKIT_TYPE_EFL))) {
+ auto win_id = ecore_wl2_window_id_get(wl2_win_->GetRaw());
+ tls_ = std::unique_ptr<TzshLauncherService>(new TzshLauncherService(
+ tzsh_launcher_service_create(tzsh_->GetRaw(),
+ static_cast<tzsh_window>(win_id))));
+ tls_->SetListener(this);
+
+ auto surface = ecore_wl2_window_surface_get(wl2_win_->GetRaw());
+ wl_surface_ = std::shared_ptr<WlSurface>(new WlSurface(surface));
+}
+
+int LauncherService::Impl::Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return tls_->Launch(app_id, inst_id, pid, serial);
+}
+
+int LauncherService::Impl::LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return tls_->LaunchWithSharedWidget(app_id, inst_id, pid, serial);
+}
+
+int LauncherService::Impl::Launching(uint32_t serial) {
+ return tls_->Launching(serial);
+}
+
+int LauncherService::Impl::LaunchCancel(uint32_t serial) {
+ int ret = tls_->LaunchCancel(serial);
+ done_ = true;
+ return ret;
+}
+
+int LauncherService::Impl::LaunchDone(uint32_t serial) {
+ int ret = tls_->LaunchDone(serial);
+ done_ = true;
+ return ret;
+}
+
+void LauncherService::Impl::OnRawBufferUpdated(
+ std::shared_ptr<WlBuffer> wl_buffer,
+ uint32_t time,
+ uint32_t serial) {
+}
+
+void LauncherService::Impl::OnRawBufferMissing(uint32_t serial) {
+}
+
+void LauncherService::Impl::OnRawBufferChanged(uint32_t type,
+ std::shared_ptr<WlBuffer> wl_buffer,
+ int32_t fd,
+ uint32_t size,
+ uint32_t time,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) {
+
+ if (done_) {
+ _W("Skip");
+ return;
+ }
+
+ if (type == TIZEN_REMOTE_SURFACE_BUFFER_TYPE_TBM) {
+ raw_image_ = std::shared_ptr<RawImage>(new RawImage(direction, x, y,
+ shared_widget_info, wl_buffer));
+ listener_->OnPrepareEvent(raw_image_, serial);
+ } else if (type == TIZEN_REMOTE_SURFACE_BUFFER_TYPE_IMAGE_FILE) {
+ raw_image_ = std::shared_ptr<RawImage>(new RawImage(direction, x, y,
+ shared_widget_info,
+ std::shared_ptr<ImageFile>(new ImageFile(fd, size))));
+ listener_->OnPrepareEvent(raw_image_, serial);
+ } else {
+ _W("Unknown type(%u)", type);
+ }
+}
+
+void LauncherService::Impl::OnInputFilterChanged(uint32_t event_filter,
+ uint32_t serial) {
+}
+
+void LauncherService::Impl::OnPrepareEvent(uint32_t target_type,
+ uint32_t target_res_id,
+ const std::string& file_path,
+ const std::string& file_group,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) {
+ if (target_type == TZSH_LAUNCHER_SERVICE_TARGET_TYPE_REMOTE_SURFACE) {
+ done_ = false;
+ listener_->OnResetEvent(serial);
+ raw_image_.reset();
+ trs_.reset(trs_mgr_->CreateTizenRemoteSurface(target_res_id,
+ wl_surface_, direction, x, y, shared_widget_info, serial));
+ trs_->AddListener(this);
+ trs_->Redirect();
+ } else if (target_type == TZSH_LAUNCHER_SERVICE_TARGET_TYPE_IMAGE) {
+ raw_image_ = std::shared_ptr<RawImage>(new RawImage(direction, x, y,
+ shared_widget_info, file_path));
+ listener_->OnPrepareEvent(raw_image_, serial);
+ } else if (target_type == TZSH_LAUNCHER_SERVICE_TARGET_TYPE_EDJE) {
+ raw_image_ = std::shared_ptr<RawImage>(
+ new RawImage(direction, x, y, shared_widget_info,
+ file_path, file_group));
+ listener_->OnPrepareEvent(raw_image_, serial);
+ } else {
+ _W("Unknown target type(%u)", target_type);
+ listener_->OnErrorEvent(Error::WrongRequest, serial);
+ }
+}
+
+void LauncherService::Impl::OnStopEvent(uint32_t serial) {
+ listener_->OnStopEvent(serial);
+ listener_->OnResetEvent(serial);
+ raw_image_.reset();
+ trs_.reset();
+}
+
+void LauncherService::Impl::OnErrorEvent(Error error, uint32_t serial) {
+ if (error == Error::None)
+ return;
+
+ if (error == Error::Disqualified) {
+ _E("Launcher has to clear LauncherService");
+ listener_->OnErrorEvent(error, serial);
+ } else {
+ _W("Wrong request");
+ listener_->OnErrorEvent(error, serial);
+ }
+}
+
+void LauncherService::Impl::OnCleanupEvent(uint32_t serial) {
+ listener_->OnCleanUpEvent(serial);
+}
+
+LauncherService::LauncherService(std::shared_ptr<Wl2Window> wl2_win,
+ IEventListener* listener)
+ : impl_(new Impl(this, std::move(wl2_win), listener)) {
+}
+
+LauncherService::~LauncherService() = default;
+
+int LauncherService::Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return impl_->Launch(app_id, inst_id, pid, serial);
+}
+
+int LauncherService::LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return impl_->LaunchWithSharedWidget(app_id, inst_id, pid, serial);
+}
+
+int LauncherService::Launching(uint32_t serial) {
+ return impl_->Launching(serial);
+}
+
+int LauncherService::LaunchCancel(uint32_t serial) {
+ return impl_->LaunchCancel(serial);
+}
+
+int LauncherService::LaunchDone(uint32_t serial) {
+ return impl_->LaunchDone(serial);
+}
+
+} // namespace screen_connector
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_LAUNCHER_SERVICE_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_LAUNCHER_SERVICE_H_
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/wl2_window.h"
+#include "screen_connector_launcher_service/error.h"
+#include "screen_connector_launcher_service/raw_image.h"
+
+namespace screen_connector {
+
+class EXPORT LauncherService {
+ public:
+ class EXPORT IEventListener {
+ public:
+ virtual void OnPrepareEvent(std::shared_ptr<RawImage> raw_image,
+ uint32_t serial) = 0;
+ virtual void OnStopEvent(uint32_t serial) = 0;
+ virtual void OnErrorEvent(Error error,
+ uint32_t serial) = 0;
+ virtual void OnCleanUpEvent(uint32_t serial) = 0;
+ virtual void OnResetEvent(uint32_t serial) = 0;
+ };
+
+ LauncherService(std::shared_ptr<Wl2Window> wl2_win,
+ IEventListener* listener);
+ virtual ~LauncherService();
+
+ int Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int Launching(uint32_t serial);
+ int LaunchCancel(uint32_t serial);
+ int LaunchDone(uint32_t serial);
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_LAUNCHER_SERVICE_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_LAUNCHER_SERVICE_IMPLEMENTATION_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_LAUNCHER_SERVICE_IMPLEMENTATION_H_
+
+#include <stdint.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_common/tzsh.h"
+#include "screen_connector_common/wl_buffer.h"
+#include "screen_connector_common/wl_surface.h"
+#include "screen_connector_launcher_service/launcher_service.h"
+#include "screen_connector_launcher_service/tizen_remote_surface_internal.h"
+#include "screen_connector_launcher_service/tizen_remote_surface_manager_internal.h"
+#include "screen_connector_launcher_service/tzsh_launcher_service_internal.h"
+
+namespace screen_connector {
+
+class LauncherService::Impl : TizenRemoteSurface::IEventListener,
+ TzshLauncherService::IEventListener {
+ public:
+ // TizenRemoteSurface::IEventListener
+ void OnRawBufferUpdated(std::shared_ptr<WlBuffer> wl_buffer,
+ uint32_t time,
+ uint32_t serial) override;
+ void OnRawBufferMissing(uint32_t serial) override;
+ void OnRawBufferChanged(uint32_t type,
+ std::shared_ptr<WlBuffer> wl_buffer,
+ int32_t fd,
+ uint32_t size,
+ uint32_t time,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) override;
+ void OnInputFilterChanged(uint32_t event_filter,
+ uint32_t serial) override;
+
+ // TzshLauncherService::IEventListener
+ void OnPrepareEvent(uint32_t target_type,
+ uint32_t target_res_id,
+ const std::string& file_path,
+ const std::string& file_group,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) override;
+ void OnStopEvent(uint32_t serial) override;
+ void OnErrorEvent(Error error,
+ uint32_t serial) override;
+ void OnCleanupEvent(uint32_t serial) override;
+
+ virtual ~Impl() = default;
+
+ int Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int Launching(uint32_t serial);
+ int LaunchCancel(uint32_t serial);
+ int LaunchDone(uint32_t serial);
+
+ private:
+ friend class LauncherService;
+
+ Impl(LauncherService* parent,
+ std::shared_ptr<Wl2Window> wl2_win,
+ LauncherService::IEventListener* listener);
+
+ private:
+ LauncherService* parent_;
+ std::shared_ptr<Wl2Window> wl2_win_;
+ LauncherService::IEventListener* listener_;
+ std::unique_ptr<TizenRemoteSurfaceManager> trs_mgr_;
+ std::unique_ptr<Tzsh> tzsh_;
+ std::unique_ptr<TzshLauncherService> tls_;
+ std::shared_ptr<WlSurface> wl_surface_;
+ std::unique_ptr<TizenRemoteSurface> trs_;
+ std::shared_ptr<RawImage> raw_image_;
+ bool done_ = false;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_LAUNCHER_SERVICE_IMPLEMENTATION_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_LOG_INTERNAL_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_LOG_INTERNAL_H_
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "SCLS"
+
+#ifdef _E
+#undef _E
+#endif
+#define _E LOGE
+
+#ifdef _W
+#undef _W
+#endif
+#define _W LOGW
+
+#ifdef _I
+#undef _I
+#endif
+#define _I LOGI
+
+#ifdef _D
+#undef _D
+#endif
+#define _D LOGD
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_LOG_INTERNAL_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "screen_connector_launcher_service/raw_image.h"
+#include "screen_connector_launcher_service/log_internal.h"
+
+namespace screen_connector {
+
+RawImage::RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::shared_ptr<ImageFile> image_file)
+ : image_type_(ImageType::RemoteSurfaceImageFile),
+ direction_(direction),
+ x_(x), y_(y),
+ shared_widget_info_(std::move(shared_widget_info)) {
+ image_file_ = std::move(image_file);
+}
+
+RawImage::RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::shared_ptr<WlBuffer> wl_buffer)
+ : image_type_(ImageType::RemoteSurfaceTBM),
+ direction_(direction),
+ x_(x), y_(y),
+ shared_widget_info_(std::move(shared_widget_info)) {
+ wl_buffer_ = std::move(wl_buffer);
+}
+
+RawImage::RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::string file_path)
+ : image_type_(ImageType::SplashScreenImage),
+ direction_(direction),
+ x_(x), y_(y),
+ shared_widget_info_(std::move(shared_widget_info)) {
+ file_path_ = std::move(file_path);
+}
+
+RawImage::RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::string file_path,
+ std::string file_group)
+ : image_type_(ImageType::SplashScreenEdje),
+ direction_(direction),
+ x_(x), y_(y),
+ shared_widget_info_(std::move(shared_widget_info)) {
+ file_path_ = std::move(file_path);
+ file_group_ = std::move(file_group);
+}
+
+RawImage::~RawImage() = default;
+
+ImageType RawImage::GetImageType() const {
+ return image_type_;
+}
+
+Direction RawImage::GetDirection() const {
+ return direction_;
+}
+
+int32_t RawImage::GetPositionX() const {
+ return x_;
+}
+
+int32_t RawImage::GetPositionY() const {
+ return y_;
+}
+
+std::string RawImage::GetSharedWidgetInfo() const {
+ return shared_widget_info_;
+}
+
+std::shared_ptr<WlBuffer> RawImage::GetWlBuffer() const {
+ return wl_buffer_;
+}
+
+std::shared_ptr<ImageFile> RawImage::GetImageFile() const {
+ return image_file_;
+}
+
+std::string RawImage::GetFilePath() const {
+ return file_path_;
+}
+
+std::string RawImage::GetFileGroup() const {
+ return file_group_;
+}
+
+} // namespace screen_connector
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_RAW_IMAGE_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_RAW_IMAGE_H_
+
+#include <stdint.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_common/wl_buffer.h"
+#include "screen_connector_launcher_service/direction.h"
+#include "screen_connector_launcher_service/image_file.h"
+#include "screen_connector_launcher_service/image_type.h"
+
+namespace screen_connector {
+
+class EXPORT RawImage {
+ public:
+ RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::shared_ptr<ImageFile> image_file);
+ RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::shared_ptr<WlBuffer> wl_buffer);
+ RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::string file_path);
+ RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::string file_path,
+ std::string file_group);
+ virtual ~RawImage();
+
+ Direction GetDirection() const;
+ ImageType GetImageType() const;
+ int32_t GetPositionX() const;
+ int32_t GetPositionY() const;
+ std::string GetSharedWidgetInfo() const;
+ std::shared_ptr<ImageFile> GetImageFile() const;
+ std::shared_ptr<WlBuffer> GetWlBuffer() const;
+ std::string GetFileGroup() const;
+ std::string GetFilePath() const;
+
+ private:
+ ImageType image_type_;
+ Direction direction_;
+ int32_t x_;
+ int32_t y_;
+ std::string shared_widget_info_;
+ std::shared_ptr<WlBuffer> wl_buffer_;
+ std::shared_ptr<ImageFile> image_file_;
+ std::string file_path_;
+ std::string file_group_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_RAW_IMAGE_H_
--- /dev/null
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: screen_connector_launcher_service
+Description: Support development of the Screen Connector Launcher Service library
+Version: @VERSION@
+Requires: tzsh-launcher-service
+Libs: -L${libdir} -lscreen_connector_launcher_service
+Cflags: -I${includedir}
+cppflags: -I${includedir}
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "screen_connector_launcher_service/tizen_remote_surface_internal.h"
+
+namespace screen_connector {
+
+TizenRemoteSurface::TizenRemoteSurface(struct tizen_remote_surface* raw,
+ Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ uint32_t serial)
+ : Handle<struct tizen_remote_surface*>(raw, true),
+ direction_(direction),
+ x_(x), y_(y),
+ shared_widget_info_(std::move(shared_widget_info)),
+ serial_(serial) {
+}
+
+TizenRemoteSurface::~TizenRemoteSurface() {
+ if (GetRaw() != nullptr) {
+ tizen_remote_surface_set_user_data(GetRaw(), NULL);
+ tizen_remote_surface_unredirect(GetRaw());
+ tizen_remote_surface_destroy(GetRaw());
+ }
+}
+
+struct tizen_remote_surface* TizenRemoteSurface::GetHandle() const {
+ return GetRaw();
+ }
+
+void TizenRemoteSurface::AddListener(IEventListener* listener) {
+ static const struct tizen_remote_surface_listener rs_Listener = {
+ BufferUpdatedCB,
+ BufferMissingCB,
+ BufferChangedCB,
+ InputEventFilterCB,
+ };
+
+ listener_ = listener;
+ tizen_remote_surface_add_listener(GetRaw(), &rs_Listener, this);
+}
+
+TizenRemoteSurface::IEventListener* TizenRemoteSurface::GetListener() {
+ return listener_;
+}
+
+Direction TizenRemoteSurface::GetDirection() const {
+ return direction_;
+}
+
+int32_t TizenRemoteSurface::GetPositionX() const {
+ return x_;
+}
+
+int32_t TizenRemoteSurface::GetPositionY() const {
+ return y_;
+}
+
+const std::string& TizenRemoteSurface::GetSharedWidgetInfo() const {
+ return shared_widget_info_;
+}
+
+uint32_t TizenRemoteSurface::GetSerial() const {
+ return serial_;
+}
+
+void TizenRemoteSurface::Redirect() {
+ tizen_remote_surface_redirect(GetRaw());
+}
+
+void TizenRemoteSurface::BufferUpdatedCB(void* data,
+ struct tizen_remote_surface* trs,
+ struct wl_buffer* buffer,
+ uint32_t time) {
+}
+
+void TizenRemoteSurface::BufferMissingCB(void* data,
+ struct tizen_remote_surface* trs) {
+ TizenRemoteSurface* rs = static_cast<TizenRemoteSurface*>(data);
+ IEventListener* l = rs->GetListener();
+ l->OnRawBufferMissing(rs->GetSerial());
+}
+
+void TizenRemoteSurface::BufferChangedCB(void* data,
+ struct tizen_remote_surface* trs,
+ uint32_t type,
+ struct wl_buffer* tbm,
+ int32_t img_fd,
+ uint32_t img_file_size,
+ uint32_t time,
+ struct wl_array* keys) {
+ TizenRemoteSurface* rs = static_cast<TizenRemoteSurface*>(data);
+ IEventListener* l = rs->GetListener();
+ l->OnRawBufferChanged(type, std::make_shared<WlBuffer>(tbm, trs),
+ img_fd, img_file_size, time,
+ rs->GetDirection(),
+ rs->GetPositionX(),
+ rs->GetPositionY(),
+ rs->GetSharedWidgetInfo(),
+ rs->GetSerial());
+}
+
+void TizenRemoteSurface::InputEventFilterCB(void* data,
+ struct tizen_remote_surface* trs,
+ uint32_t event_filter) {
+ TizenRemoteSurface* rs = static_cast<TizenRemoteSurface*>(data);
+ IEventListener* l = rs->GetListener();
+ l->OnInputFilterChanged(event_filter, rs->GetSerial());
+}
+
+} // namespace screen_connector
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_TIZEN_REMOTE_SURFACE_INTERNAL_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_TIZEN_REMOTE_SURFACE_INTERNAL_H_
+
+#include <stdint.h>
+#include <tizen-remote-surface-client-protocol.h>
+#include <unistd.h>
+
+#include <string>
+#include <memory>
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_common/wl_buffer.h"
+#include "screen_connector_launcher_service/direction.h"
+
+namespace screen_connector {
+
+class TizenRemoteSurface : public Handle<struct tizen_remote_surface*> {
+ public:
+ class IEventListener {
+ public:
+ virtual void OnRawBufferUpdated(std::shared_ptr<WlBuffer> wl_buffer,
+ uint32_t time,
+ uint32_t serial) = 0;
+ virtual void OnRawBufferMissing(uint32_t serial) = 0;
+ virtual void OnRawBufferChanged(uint32_t type,
+ std::shared_ptr<WlBuffer> wl_buffer,
+ int32_t fd,
+ uint32_t size,
+ uint32_t time,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) = 0;
+ virtual void OnInputFilterChanged(uint32_t event_filter,
+ uint32_t serial) = 0;
+ };
+
+ TizenRemoteSurface(struct tizen_remote_surface* raw,
+ Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ uint32_t serial);
+ virtual ~TizenRemoteSurface();
+
+ struct tizen_remote_surface* GetHandle() const;
+
+ void AddListener(IEventListener* listener);
+ IEventListener* GetListener();
+
+ Direction GetDirection() const;
+ int32_t GetPositionX() const;
+ int32_t GetPositionY() const;
+ const std::string& GetSharedWidgetInfo() const;
+ uint32_t GetSerial() const;
+ void Redirect();
+
+ private:
+ static void BufferUpdatedCB(void* data,
+ struct tizen_remote_surface* trs,
+ struct wl_buffer* buffer,
+ uint32_t time);
+ static void BufferMissingCB(void* data,
+ struct tizen_remote_surface* trs);
+ static void BufferChangedCB(void* data,
+ struct tizen_remote_surface* trs,
+ uint32_t type,
+ struct wl_buffer* tbm,
+ int32_t img_fd,
+ uint32_t img_file_size,
+ uint32_t time,
+ struct wl_array* keys);
+ static void InputEventFilterCB(void* data,
+ struct tizen_remote_surface* trs,
+ uint32_t event_filter);
+
+ private:
+ Direction direction_;
+ int32_t x_;
+ int32_t y_;
+ std::string shared_widget_info_;
+ uint32_t serial_;
+ IEventListener* listener_ = nullptr;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_TIZEN_REMOTE_SURFACE_INTERNAL_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Ecore_Wl2.h>
+#include <tbm_surface.h>
+#include <tbm_surface_internal.h>
+#include <wayland-client.h>
+#include <wayland-extension/tizen-extension-client-protocol.h>
+
+#include "screen_connector_launcher_service/tizen_remote_surface_manager_internal.h"
+#include "screen_connector_launcher_service/log_internal.h"
+
+namespace screen_connector {
+
+TizenRemoteSurfaceManager::TizenRemoteSurfaceManager() {
+ if (!ecore_wl2_init()) {
+ _E("ecore_wl2_init() is failed");
+ return;
+ }
+
+ Ecore_Wl2_Display* wl2_dpy = ecore_wl2_connected_display_get(NULL);
+ if (wl2_dpy == nullptr)
+ wl2_dpy = ecore_wl2_display_connect(NULL);
+
+ struct wl_display* wl_dpy = ecore_wl2_display_get(wl2_dpy);
+ tbm_client_ = wayland_tbm_client_init(wl_dpy);
+ tbm_ = wayland_tbm_client_get_wl_tbm(tbm_client_);
+
+ struct wl_registry* registry = ecore_wl2_display_registry_get(wl2_dpy);
+ Eina_Iterator* iter = ecore_wl2_display_globals_get(wl2_dpy);
+
+ Ecore_Wl2_Global* global = nullptr;
+ EINA_ITERATOR_FOREACH(iter, global) {
+ if (!strcmp(global->interface, "tizen_remote_surface_manager")) {
+ tzrs_mgr_ = static_cast<struct tizen_remote_surface_manager*>(
+ wl_registry_bind(registry, global->id,
+ &tizen_remote_surface_manager_interface, global->version));
+ if (tzrs_mgr_)
+ break;
+ }
+ }
+ eina_iterator_free(iter);
+}
+
+TizenRemoteSurfaceManager::~TizenRemoteSurfaceManager() {
+ if (tzrs_mgr_) {
+ tizen_remote_surface_manager_destroy(tzrs_mgr_);
+ }
+
+ if (tbm_client_) {
+ wayland_tbm_client_deinit(tbm_client_);
+ }
+
+ ecore_wl2_display_disconnect(ecore_wl2_connected_display_get(NULL));
+ ecore_wl2_shutdown();
+}
+
+TizenRemoteSurface* TizenRemoteSurfaceManager::CreateTizenRemoteSurface(
+ uint32_t res,
+ std::shared_ptr<WlSurface> surface,
+ Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ uint32_t serial) {
+ struct tizen_remote_surface* tzrs =
+ tizen_remote_surface_manager_create_surface_with_wl_surface(tzrs_mgr_,
+ res, tbm_, surface->GetRaw());
+ return new (std::nothrow) TizenRemoteSurface(tzrs, direction, x, y,
+ std::move(shared_widget_info), serial);
+}
+
+} // namespace screen_connector
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_TIZEN_REMOTE_SURFACE_MANAGER_INTERNAL_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_TIZEN_REMOTE_SURFACE_MANAGER_INTERNAL_H_
+
+#include <stdint.h>
+#include <tbm_surface.h>
+#include <tizen-remote-surface-client-protocol.h>
+#include <wayland-extension/tizen-extension-client-protocol.h>
+#include <wayland-tbm-client.h>
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_common/wl_surface.h"
+#include "screen_connector_launcher_service/tizen_remote_surface_internal.h"
+
+namespace screen_connector {
+
+class TizenRemoteSurfaceManager {
+ public:
+ TizenRemoteSurfaceManager();
+ virtual ~TizenRemoteSurfaceManager();
+
+ TizenRemoteSurface* CreateTizenRemoteSurface(uint32_t res,
+ std::shared_ptr<WlSurface> surface,
+ Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ uint32_t serial);
+
+ private:
+ struct tizen_remote_surface_manager* tzrs_mgr_ = nullptr;
+ struct wayland_tbm_client* tbm_client_ = nullptr;
+ struct wl_tbm* tbm_ = nullptr;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_TIZEN_REMOTE_SURFACE_MANAGER_INTERNAL_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_launcher_service/tzsh_launcher_service_internal.h"
+#include "screen_connector_launcher_service/log_internal.h"
+
+namespace screen_connector {
+
+TzshLauncherService::TzshLauncherService(tzsh_launcher_service_h raw)
+ : Handle<tzsh_launcher_service_h>(raw, true) {
+}
+
+TzshLauncherService::~TzshLauncherService() {
+ tzsh_launcher_service_destroy(GetRaw());
+}
+
+tzsh_launcher_service_h TzshLauncherService::GetHandle() const {
+ return GetRaw();
+}
+
+void TzshLauncherService::SetListener(IEventListener* listener) {
+ listener_ = listener;
+
+ int ret = tzsh_launcher_service_prepare_cb_set(GetRaw(), PrepareCB,
+ listener_);
+ if (ret != TZSH_ERROR_NONE)
+ _E("Failed to set prepare callback. error(%d)", ret);
+
+ ret = tzsh_launcher_service_stop_cb_set(GetRaw(), StopCB, listener_);
+ if (ret != TZSH_ERROR_NONE)
+ _E("Failed to set stop callback. error(%d)", ret);
+
+ ret = tzsh_launcher_service_error_cb_set(GetRaw(), ErrorCB, listener_);
+ if (ret != TZSH_ERROR_NONE)
+ _E("Failed to set error callback. error(%d)", ret);
+
+ ret = tzsh_launcher_service_cleanup_cb_set(GetRaw(), CleanupCB, listener_);
+ if (ret != TZSH_ERROR_NONE)
+ _E("Failed to set cleanup callback. error(%d)", ret);
+}
+
+int TzshLauncherService::Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return tzsh_launcher_service_launch(GetRaw(), app_id.c_str(),
+ inst_id.c_str(), pid, serial);
+}
+
+int TzshLauncherService::LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return tzsh_launcher_service_launch_with_shared_widget(GetRaw(),
+ app_id.c_str(), inst_id.c_str(), pid, serial);
+}
+
+int TzshLauncherService::Launching(uint32_t serial) {
+ return tzsh_launcher_service_launching(GetRaw(), serial);
+}
+
+int TzshLauncherService::LaunchCancel(uint32_t serial) {
+ return tzsh_launcher_service_launch_cancel(GetRaw(), serial);
+}
+
+int TzshLauncherService::LaunchDone(uint32_t serial) {
+ return tzsh_launcher_service_launch_done(GetRaw(), serial);
+}
+
+void TzshLauncherService::PrepareCB(void* data,
+ tzsh_launcher_service_h service,
+ tzsh_launcher_service_target_type_e target_type,
+ uint32_t target_res_id,
+ const char* target_path,
+ const char* target_group,
+ tzsh_launcher_service_direction_e direction,
+ int32_t x,
+ int32_t y,
+ const char* target_widget_info,
+ uint32_t serial) {
+ IEventListener* listener = static_cast<IEventListener*>(data);
+ std::string file_path(target_path ? target_path : "");
+ std::string file_group(target_group ? target_group : "");
+ std::string shared_widget_info(target_widget_info ? target_widget_info : "");
+ listener->OnPrepareEvent(static_cast<uint32_t>(target_type),
+ target_res_id, file_path, file_group,
+ static_cast<Direction>(direction), x, y,
+ shared_widget_info, serial);
+}
+
+void TzshLauncherService::StopCB(void* data,
+ tzsh_launcher_service_h service,
+ uint32_t serial) {
+ IEventListener* listener = static_cast<IEventListener*>(data);
+ listener->OnStopEvent(serial);
+}
+
+void TzshLauncherService::ErrorCB(void* data,
+ tzsh_launcher_service_h service,
+ tzsh_launcher_service_error_e error,
+ uint32_t serial) {
+ IEventListener* listener = static_cast<IEventListener*>(data);
+ listener->OnErrorEvent(static_cast<Error>(error), serial);
+}
+
+void TzshLauncherService::CleanupCB(void* data,
+ tzsh_launcher_service_h service,
+ uint32_t serial) {
+ IEventListener* listener = static_cast<IEventListener*>(data);
+ listener->OnCleanupEvent(serial);
+}
+
+} // namespace screen_connector
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_TZSH_LAUNCHER_SERVICE_INTERNAL_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_TZSH_LAUNCHER_SERVICE_INTERNAL_H_
+
+#include <stdint.h>
+#include <tzsh_launcher_service.h>
+#include <unistd.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_launcher_service/direction.h"
+#include "screen_connector_launcher_service/error.h"
+
+namespace screen_connector {
+
+class TzshLauncherService : public Handle<tzsh_launcher_service_h> {
+ public:
+ class IEventListener {
+ public:
+ virtual void OnPrepareEvent(uint32_t target_type,
+ uint32_t target_res_id,
+ const std::string& file_path,
+ const std::string& file_group,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) = 0;
+ virtual void OnStopEvent(uint32_t serial) = 0;
+ virtual void OnErrorEvent(Error error,
+ uint32_t serial) = 0;
+ virtual void OnCleanupEvent(uint32_t serial) = 0;
+ };
+
+ explicit TzshLauncherService(tzsh_launcher_service_h raw);
+ virtual ~TzshLauncherService();
+
+ tzsh_launcher_service_h GetHandle() const;
+ void SetListener(IEventListener* listener);
+
+ int Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int Launching(uint32_t serial);
+ int LaunchCancel(uint32_t serial);
+ int LaunchDone(uint32_t serial);
+
+ private:
+ static void PrepareCB(void* data,
+ tzsh_launcher_service_h service,
+ tzsh_launcher_service_target_type_e target_type,
+ uint32_t target_res_id,
+ const char* target_path,
+ const char* target_group,
+ tzsh_launcher_service_direction_e direction,
+ int32_t x,
+ int32_t y,
+ const char* shared_widget_info,
+ uint32_t serial);
+ static void StopCB(void* data,
+ tzsh_launcher_service_h service,
+ uint32_t serial);
+ static void ErrorCB(void* data,
+ tzsh_launcher_service_h service,
+ tzsh_launcher_service_error_e error,
+ uint32_t serial);
+ static void CleanupCB(void* data,
+ tzsh_launcher_service_h service,
+ uint32_t serial);
+
+ private:
+ IEventListener* listener_ = nullptr;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_TZSH_LAUNCHER_SERVICE_INTERNAL_H_
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+PROJECT(screen_connector_launcher_service_evas CXX)
+
+SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
+SET(PROJECT_NAME "${PROJECT_NAME}")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(VERSION_MAJOR "${MAJORVER}")
+SET(VERSION "${FULLVER}")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(screen_connector_launcher_service_evas REQUIRED
+ dlog
+ aul
+ wayland-tbm-client
+ wayland-client
+ ecore-wl2
+ tizen-remote-surface-client
+ tzsh-launcher-service
+ glib-2.0
+ elementary
+)
+
+FOREACH(flag ${screen_connector_launcher_service_evas_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++11")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
+ADD_LIBRARY (${PROJECT_NAME} SHARED ${SOURCES})
+
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${screen_connector_launcher_service_evas_LDFLAGS} "-lpthread")
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
+
+INSTALL(TARGETS ${PROJECT_NAME}
+ DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
+ DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
+ DESTINATION include/${PROJECT_NAME}
+ FILES_MATCHING PATTERN "*.h"
+ PATTERN "*_internal.h" EXCLUDE
+ PATTERN "*_implementation.h" EXCLUDE)
--- /dev/null
+Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+ Apache License\r
+ Version 2.0, January 2004\r
+ http://www.apache.org/licenses/\r
+\r
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+ 1. Definitions.\r
+\r
+ "License" shall mean the terms and conditions for use, reproduction,\r
+ and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+ "Licensor" shall mean the copyright owner or entity authorized by\r
+ the copyright owner that is granting the License.\r
+\r
+ "Legal Entity" shall mean the union of the acting entity and all\r
+ other entities that control, are controlled by, or are under common\r
+ control with that entity. For the purposes of this definition,\r
+ "control" means (i) the power, direct or indirect, to cause the\r
+ direction or management of such entity, whether by contract or\r
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+ outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+ "You" (or "Your") shall mean an individual or Legal Entity\r
+ exercising permissions granted by this License.\r
+\r
+ "Source" form shall mean the preferred form for making modifications,\r
+ including but not limited to software source code, documentation\r
+ source, and configuration files.\r
+\r
+ "Object" form shall mean any form resulting from mechanical\r
+ transformation or translation of a Source form, including but\r
+ not limited to compiled object code, generated documentation,\r
+ and conversions to other media types.\r
+\r
+ "Work" shall mean the work of authorship, whether in Source or\r
+ Object form, made available under the License, as indicated by a\r
+ copyright notice that is included in or attached to the work\r
+ (an example is provided in the Appendix below).\r
+\r
+ "Derivative Works" shall mean any work, whether in Source or Object\r
+ form, that is based on (or derived from) the Work and for which the\r
+ editorial revisions, annotations, elaborations, or other modifications\r
+ represent, as a whole, an original work of authorship. For the purposes\r
+ of this License, Derivative Works shall not include works that remain\r
+ separable from, or merely link (or bind by name) to the interfaces of,\r
+ the Work and Derivative Works thereof.\r
+\r
+ "Contribution" shall mean any work of authorship, including\r
+ the original version of the Work and any modifications or additions\r
+ to that Work or Derivative Works thereof, that is intentionally\r
+ submitted to Licensor for inclusion in the Work by the copyright owner\r
+ or by an individual or Legal Entity authorized to submit on behalf of\r
+ the copyright owner. For the purposes of this definition, "submitted"\r
+ means any form of electronic, verbal, or written communication sent\r
+ to the Licensor or its representatives, including but not limited to\r
+ communication on electronic mailing lists, source code control systems,\r
+ and issue tracking systems that are managed by, or on behalf of, the\r
+ Licensor for the purpose of discussing and improving the Work, but\r
+ excluding communication that is conspicuously marked or otherwise\r
+ designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+ "Contributor" shall mean Licensor and any individual or Legal Entity\r
+ on behalf of whom a Contribution has been received by Licensor and\r
+ subsequently incorporated within the Work.\r
+\r
+ 2. Grant of Copyright License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ copyright license to reproduce, prepare Derivative Works of,\r
+ publicly display, publicly perform, sublicense, and distribute the\r
+ Work and such Derivative Works in Source or Object form.\r
+\r
+ 3. Grant of Patent License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ (except as stated in this section) patent license to make, have made,\r
+ use, offer to sell, sell, import, and otherwise transfer the Work,\r
+ where such license applies only to those patent claims licensable\r
+ by such Contributor that are necessarily infringed by their\r
+ Contribution(s) alone or by combination of their Contribution(s)\r
+ with the Work to which such Contribution(s) was submitted. If You\r
+ institute patent litigation against any entity (including a\r
+ cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+ or a Contribution incorporated within the Work constitutes direct\r
+ or contributory patent infringement, then any patent licenses\r
+ granted to You under this License for that Work shall terminate\r
+ as of the date such litigation is filed.\r
+\r
+ 4. Redistribution. You may reproduce and distribute copies of the\r
+ Work or Derivative Works thereof in any medium, with or without\r
+ modifications, and in Source or Object form, provided that You\r
+ meet the following conditions:\r
+\r
+ (a) You must give any other recipients of the Work or\r
+ Derivative Works a copy of this License; and\r
+\r
+ (b) You must cause any modified files to carry prominent notices\r
+ stating that You changed the files; and\r
+\r
+ (c) You must retain, in the Source form of any Derivative Works\r
+ that You distribute, all copyright, patent, trademark, and\r
+ attribution notices from the Source form of the Work,\r
+ excluding those notices that do not pertain to any part of\r
+ the Derivative Works; and\r
+\r
+ (d) If the Work includes a "NOTICE" text file as part of its\r
+ distribution, then any Derivative Works that You distribute must\r
+ include a readable copy of the attribution notices contained\r
+ within such NOTICE file, excluding those notices that do not\r
+ pertain to any part of the Derivative Works, in at least one\r
+ of the following places: within a NOTICE text file distributed\r
+ as part of the Derivative Works; within the Source form or\r
+ documentation, if provided along with the Derivative Works; or,\r
+ within a display generated by the Derivative Works, if and\r
+ wherever such third-party notices normally appear. The contents\r
+ of the NOTICE file are for informational purposes only and\r
+ do not modify the License. You may add Your own attribution\r
+ notices within Derivative Works that You distribute, alongside\r
+ or as an addendum to the NOTICE text from the Work, provided\r
+ that such additional attribution notices cannot be construed\r
+ as modifying the License.\r
+\r
+ You may add Your own copyright statement to Your modifications and\r
+ may provide additional or different license terms and conditions\r
+ for use, reproduction, or distribution of Your modifications, or\r
+ for any such Derivative Works as a whole, provided Your use,\r
+ reproduction, and distribution of the Work otherwise complies with\r
+ the conditions stated in this License.\r
+\r
+ 5. Submission of Contributions. Unless You explicitly state otherwise,\r
+ any Contribution intentionally submitted for inclusion in the Work\r
+ by You to the Licensor shall be under the terms and conditions of\r
+ this License, without any additional terms or conditions.\r
+ Notwithstanding the above, nothing herein shall supersede or modify\r
+ the terms of any separate license agreement you may have executed\r
+ with Licensor regarding such Contributions.\r
+\r
+ 6. Trademarks. This License does not grant permission to use the trade\r
+ names, trademarks, service marks, or product names of the Licensor,\r
+ except as required for reasonable and customary use in describing the\r
+ origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+ 7. Disclaimer of Warranty. Unless required by applicable law or\r
+ agreed to in writing, Licensor provides the Work (and each\r
+ Contributor provides its Contributions) on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+ implied, including, without limitation, any warranties or conditions\r
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+ PARTICULAR PURPOSE. You are solely responsible for determining the\r
+ appropriateness of using or redistributing the Work and assume any\r
+ risks associated with Your exercise of permissions under this License.\r
+\r
+ 8. Limitation of Liability. In no event and under no legal theory,\r
+ whether in tort (including negligence), contract, or otherwise,\r
+ unless required by applicable law (such as deliberate and grossly\r
+ negligent acts) or agreed to in writing, shall any Contributor be\r
+ liable to You for damages, including any direct, indirect, special,\r
+ incidental, or consequential damages of any character arising as a\r
+ result of this License or out of the use or inability to use the\r
+ Work (including but not limited to damages for loss of goodwill,\r
+ work stoppage, computer failure or malfunction, or any and all\r
+ other commercial damages or losses), even if such Contributor\r
+ has been advised of the possibility of such damages.\r
+\r
+ 9. Accepting Warranty or Additional Liability. While redistributing\r
+ the Work or Derivative Works thereof, You may choose to offer,\r
+ and charge a fee for, acceptance of support, warranty, indemnity,\r
+ or other liability obligations and/or rights consistent with this\r
+ License. However, in accepting such obligations, You may act only\r
+ on Your own behalf and on Your sole responsibility, not on behalf\r
+ of any other Contributor, and only if You agree to indemnify,\r
+ defend, and hold each Contributor harmless for any liability\r
+ incurred by, or claims asserted against, such Contributor by reason\r
+ of your accepting any such warranty or additional liability.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ APPENDIX: How to apply the Apache License to your work.\r
+\r
+ To apply the Apache License to your work, attach the following\r
+ boilerplate notice, with the fields enclosed by brackets "[]"\r
+ replaced with your own identifying information. (Don't include\r
+ the brackets!) The text should be enclosed in the appropriate\r
+ comment syntax for the file format. We also recommend that a\r
+ file or class name and description of purpose be included on the\r
+ same "printed page" as the copyright notice for easier\r
+ identification within third-party archives.\r
+\r
+ Copyright [yyyy] [name of copyright owner]\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_EVAS_EVENT_INTERFACE_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_EVAS_EVENT_INTERFACE_H_
+
+#include <stdint.h>
+
+#include <string>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/evas_object.h"
+#include "screen_connector_launcher_service/direction.h"
+#include "screen_connector_launcher_service/error.h"
+#include "screen_connector_launcher_service/image_type.h"
+
+namespace screen_connector {
+
+class EXPORT IEvasEvent {
+ public:
+ virtual void OnEvasPrepareEvent(const EvasObject& image,
+ ImageType image_type,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) = 0;
+ virtual void OnEvasStopEvent(uint32_t serial) = 0;
+ virtual void OnEvasErrorEvent(Error error, uint32_t serial) = 0;
+ virtual void OnEvasCleanUpEvent(uint32_t serial) = 0;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_EVAS_EVENT_INTERFACE_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+
+#include "screen_connector_launcher_service_evas/image_internal.h"
+#include "screen_connector_launcher_service_evas/log_internal.h"
+
+namespace screen_connector {
+
+Image::Image(Evas_Object* raw) : EvasObject(raw, true) {
+}
+
+Image::~Image() = default;
+
+void Image::Update(std::shared_ptr<RawImage> raw_image) {
+ raw_image_ = std::move(raw_image);
+ if (GetImageType() == ImageType::RemoteSurfaceTBM) {
+ Update(raw_image_->GetWlBuffer());
+ } else if (GetImageType() == ImageType::RemoteSurfaceImageFile) {
+ Update(raw_image_->GetImageFile());
+ } else if (GetImageType() == ImageType::SplashScreenImage) {
+ Update(raw_image_->GetFilePath());
+ } else if (GetImageType() == ImageType::SplashScreenEdje) {
+ Update(raw_image_->GetFilePath(), raw_image_->GetFileGroup());
+ }
+}
+
+void Image::Reset() {
+ if (raw_image_.get() != nullptr &&
+ raw_image_->GetImageType() == ImageType::RemoteSurfaceTBM) {
+ evas_object_image_native_surface_set(GetRaw(), nullptr);
+ raw_image_.reset();
+ }
+}
+
+void Image::Update(std::shared_ptr<ImageFile> image_file) {
+ void* map = mmap(NULL, image_file->GetSize(), PROT_READ, MAP_SHARED,
+ image_file->GetRaw(), 0);
+
+ evas_object_image_alpha_set(GetRaw(), EINA_TRUE);
+ char format[] = "png";
+ evas_object_image_memfile_set(GetRaw(), map, image_file->GetSize(),
+ format, NULL);
+
+ int width;
+ int height;
+ evas_object_image_size_get(GetRaw(), &width, &height);
+ evas_object_image_fill_set(GetRaw(), 0, 0, width, height);
+ evas_object_resize(GetRaw(), width, height);
+
+ munmap(map, image_file->GetSize());
+}
+
+void Image::Update(std::shared_ptr<WlBuffer> wl_buffer) {
+ tbm_surface_h tbm_surface = static_cast<tbm_surface_h>(
+ wl_buffer_get_user_data(wl_buffer->GetRaw()));
+ int width = tbm_surface_get_width(tbm_surface);
+ int height = tbm_surface_get_height(tbm_surface);
+
+ Evas_Native_Surface ns;
+ memset(&ns, 0, sizeof(Evas_Native_Surface));
+ ns.version = EVAS_NATIVE_SURFACE_VERSION;
+ ns.type = EVAS_NATIVE_SURFACE_TBM;
+ ns.data.tbm.buffer = tbm_surface;
+
+ evas_object_image_alpha_set(GetRaw(), EINA_TRUE);
+ evas_object_image_size_set(GetRaw(), width, height);
+ evas_object_image_native_surface_set(GetRaw(), &ns);
+ evas_object_image_pixels_dirty_set(GetRaw(), EINA_TRUE);
+}
+
+void Image::Update(std::string file_path) {
+ evas_object_move(GetRaw(), 0, 0);
+ evas_object_image_file_set(GetRaw(), file_path.c_str(), NULL);
+
+ Evas_Load_Error err = evas_object_image_load_error_get(GetRaw());
+ if (err != EVAS_LOAD_ERROR_NONE)
+ _E("error(%d)", err);
+}
+
+void Image::Update(std::string file_path, std::string file_group) {
+ evas_object_move(GetRaw(), 0, 0);
+ edje_object_file_set(GetRaw(), file_path.c_str(), file_group.c_str());
+}
+
+void Image::SetSize(int32_t width, int32_t height) {
+ evas_object_image_size_set(GetRaw(), width, height);
+}
+
+ImageType Image::GetImageType() const {
+ return raw_image_->GetImageType();
+}
+
+Direction Image::GetDirection() const {
+ return raw_image_->GetDirection();
+}
+
+int32_t Image::GetPositionX() const {
+ return raw_image_->GetPositionX();
+}
+
+int32_t Image::GetPositionY() const {
+ return raw_image_->GetPositionY();
+}
+
+std::string Image::GetSharedWidgetInfo() const {
+ return raw_image_->GetSharedWidgetInfo();
+}
+
+} // namespace screen_connector
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_INTERNAL_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_INTERNAL_H_
+
+#include <string>
+
+#include "screen_connector_common/evas_object.h"
+#include "screen_connector_launcher_service/direction.h"
+#include "screen_connector_launcher_service/image_type.h"
+#include "screen_connector_launcher_service/raw_image.h"
+
+namespace screen_connector {
+
+class Image : public EvasObject {
+ public:
+ Image(Evas_Object* raw);
+ virtual ~Image();
+
+ public:
+ void Reset();
+ void Update(std::shared_ptr<RawImage> raw_image);
+ void SetSize(int32_t width, int32_t height);
+
+ ImageType GetImageType() const;
+ Direction GetDirection() const;
+ int32_t GetPositionX() const;
+ int32_t GetPositionY() const;
+ std::string GetSharedWidgetInfo() const;
+
+ private:
+ void Update(std::shared_ptr<ImageFile> image_file);
+ void Update(std::shared_ptr<WlBuffer> wl_buffer);
+ void Update(std::string file_path);
+ void Update(std::string file_path, std::string file_group);
+
+ private:
+ std::shared_ptr<RawImage> raw_image_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_INTERNAL_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_INCLUDE_SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_INCLUDE_SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_H_
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include <Elementary.h>
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_ERROR_NONE,
+ SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_ERROR_DISQUALIFIED,
+ SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_ERROR_WRONG_REQUEST,
+} screen_connector_launcher_service_evas_error_e;
+
+typedef enum {
+ SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_DIRECTION_FORWARD,
+ SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_DIRECTION_BACKWARD,
+} screen_connector_launcher_service_evas_direction_e;
+
+typedef enum {
+ SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_TYPE_REMOTE_SURFACE_TBM,
+ SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_TYPE_REMOTE_SURFACE_IMAGE_FILE,
+ SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_TYPE_SPLASH_SCREEN_IMAGE,
+ SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_TYPE_SPLASH_SCREEN_EDJE,
+} screen_connector_launcher_service_evas_image_type_e;
+
+typedef void* screen_connector_launcher_service_evas_h;
+
+typedef void (*screen_connector_launcher_service_evas_prepare_cb)(
+ Evas_Object* image,
+ screen_connector_launcher_service_evas_image_type_e image_type,
+ screen_connector_launcher_service_evas_direction_e direction,
+ int32_t x,
+ int32_t y,
+ const char* shared_widget_info,
+ uint32_t serial,
+ void* user_data);
+
+typedef void (*screen_connector_launcher_service_evas_stop_cb)(
+ uint32_t serial,
+ void* user_data);
+
+typedef void (*screen_connector_launcher_service_evas_error_cb)(
+ screen_connector_launcher_service_evas_error_e error,
+ uint32_t serial,
+ void* user_data);
+
+typedef void (*screen_connector_launcher_service_evas_cleanup_cb)(
+ uint32_t serial,
+ void* user_data);
+
+typedef struct {
+ screen_connector_launcher_service_evas_prepare_cb prepare;
+ screen_connector_launcher_service_evas_stop_cb stop;
+ screen_connector_launcher_service_evas_error_cb error;
+ screen_connector_launcher_service_evas_cleanup_cb cleanup;
+} screen_connector_launcher_service_evas_ops;
+
+int screen_connector_launcher_service_evas_create(
+ Evas_Object* win,
+ screen_connector_launcher_service_evas_h* handle);
+
+int screen_connector_launcher_service_evas_destroy(
+ screen_connector_launcher_service_evas_h handle);
+
+int screen_connector_launcher_service_evas_set_ops(
+ screen_connector_launcher_service_evas_h handle,
+ screen_connector_launcher_service_evas_ops *ops,
+ void* user_data);
+
+int screen_connector_launcher_service_evas_launch(
+ screen_connector_launcher_service_evas_h handle,
+ const char* app_id,
+ const char* inst_id,
+ int pid,
+ uint32_t serial);
+
+int screen_connector_launcher_service_evas_launch_with_shared_widget(
+ screen_connector_launcher_service_evas_h handle,
+ const char* app_id,
+ const char* inst_id,
+ int pid,
+ uint32_t serial);
+
+int screen_connector_launcher_service_evas_launching(
+ screen_connector_launcher_service_evas_h handle,
+ uint32_t serial);
+
+int screen_connector_launcher_service_evas_launch_cancel(
+ screen_connector_launcher_service_evas_h handle,
+ uint32_t serial);
+
+int screen_connector_launcher_service_evas_launch_done(
+ screen_connector_launcher_service_evas_h handle,
+ uint32_t serial);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_INCLUDE_SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "screen_connector_common/util.h"
+#include "screen_connector_launcher_service_evas/launcher_service_evas.h"
+#include "screen_connector_launcher_service_evas/launcher_service_evas_implementation.h"
+#include "screen_connector_launcher_service_evas/log_internal.h"
+
+namespace screen_connector {
+
+LauncherServiceEvas::Impl::Impl(LauncherServiceEvas* parent,
+ std::shared_ptr<EvasObject> win)
+ : parent_(parent), win_(std::move(win)) {
+}
+
+const EvasObject& LauncherServiceEvas::Impl::GetWindow() {
+ return *win_.get();
+}
+
+const Image& LauncherServiceEvas::Impl::GetImage() {
+ return *image_.get();
+}
+
+void LauncherServiceEvas::Impl::Update(std::shared_ptr<RawImage> raw_image) {
+ ImageType type = raw_image->GetImageType();
+ if (type == ImageType::RemoteSurfaceTBM) {
+ if (rs_img_.get() == nullptr) {
+ _D("First added");
+ rs_img_.reset(new Image(CreateEvasObjectImage()));
+ }
+ rs_img_->Update(raw_image);
+ image_ = rs_img_;
+ } else if (type == ImageType::RemoteSurfaceImageFile) {
+ if (rs_img_.get() == nullptr) {
+ _D("First added");
+ rs_img_.reset(new Image(CreateEvasObjectImage()));
+ }
+ rs_img_->Update(raw_image);
+ image_ = rs_img_;
+ } else if (type == ImageType::SplashScreenImage) {
+ if (ss_img_.get() == nullptr) {
+ _D("First added");
+ ss_img_.reset(new Image(CreateEvasObjectImage()));
+ }
+ ss_img_->Update(raw_image);
+ image_ = ss_img_;
+ } else if (type == ImageType::SplashScreenEdje) {
+ if (ss_edje_.get() == nullptr) {
+ _D("First added");
+ ss_edje_.reset(new Image(CreateEdjeObject()));
+ }
+ ss_edje_->Update(raw_image);
+
+ int width;
+ int height;
+ elm_win_screen_size_get(win_->GetRaw(), NULL, NULL, &width, &height);
+ ss_edje_->SetSize(width, height);
+ image_ = ss_edje_;
+ }
+}
+
+void LauncherServiceEvas::Impl::Reset() {
+ if (rs_img_.get() != nullptr) {
+ _D("Reset raw image");
+ rs_img_->Reset();
+ }
+}
+
+Evas_Object* LauncherServiceEvas::Impl::CreateEvasObjectImage() {
+ Evas_Object* raw = evas_object_image_filled_add(
+ evas_object_evas_get(win_->GetRaw()));
+ return raw;
+}
+
+Evas_Object* LauncherServiceEvas::Impl::CreateEdjeObject() {
+ Evas_Object* raw = edje_object_add(evas_object_evas_get(win_->GetRaw()));
+ return raw;
+}
+
+LauncherServiceEvas::LauncherServiceEvas(std::shared_ptr<EvasObject> win)
+ : LauncherService(util::GetWl2Window(win->GetRaw()), this),
+ impl_(new Impl(this, std::move(win))) {
+}
+
+LauncherServiceEvas::~LauncherServiceEvas() = default;
+
+const EvasObject& LauncherServiceEvas::GetWindow() {
+ return impl_->GetWindow();
+}
+
+const EvasObject& LauncherServiceEvas::GetImage() {
+ return impl_->GetImage();
+}
+
+void LauncherServiceEvas::OnEvasPrepareEvent(const EvasObject& image,
+ ImageType image_type,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) {
+}
+
+void LauncherServiceEvas::OnEvasStopEvent(uint32_t serial) {
+}
+
+void LauncherServiceEvas::OnEvasErrorEvent(Error error,
+ uint32_t serial) {
+}
+
+void LauncherServiceEvas::OnEvasCleanUpEvent(uint32_t serial) {
+}
+
+void LauncherServiceEvas::OnPrepareEvent(std::shared_ptr<RawImage> raw_image,
+ uint32_t serial) {
+ impl_->Update(raw_image);
+ const Image& image = impl_->GetImage();
+ OnEvasPrepareEvent(image, image.GetImageType(), image.GetDirection(),
+ image.GetPositionX(), image.GetPositionY(),
+ image.GetSharedWidgetInfo(), serial);
+}
+
+void LauncherServiceEvas::OnStopEvent(uint32_t serial) {
+ OnEvasStopEvent(serial);
+}
+
+void LauncherServiceEvas::OnErrorEvent(Error error, uint32_t serial) {
+ OnEvasErrorEvent(error, serial);
+}
+
+void LauncherServiceEvas::OnCleanUpEvent(uint32_t serial) {
+ OnEvasCleanUpEvent(serial);
+}
+
+void LauncherServiceEvas::OnResetEvent(uint32_t serial) {
+ impl_->Reset();
+}
+
+} // namespace screen_connector
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_LAUNCHER_SERVICE_EVAS_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_LAUNCHER_SERVICE_EVAS_H_
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/evas_object.h"
+#include "screen_connector_common/export.h"
+#include "screen_connector_launcher_service/launcher_service.h"
+#include "screen_connector_launcher_service_evas/evas_event_interface.h"
+
+namespace screen_connector {
+
+class EXPORT LauncherServiceEvas : public LauncherService,
+ public LauncherService::IEventListener,
+ public IEvasEvent {
+ public:
+ LauncherServiceEvas(std::shared_ptr<EvasObject> win);
+ virtual ~LauncherServiceEvas();
+
+ const EvasObject& GetWindow();
+ const EvasObject& GetImage();
+
+ public:
+ void OnEvasPrepareEvent(const EvasObject& image,
+ ImageType type,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) override;
+ void OnEvasStopEvent(uint32_t serial) override;
+ void OnEvasErrorEvent(Error error,
+ uint32_t serial) override;
+ void OnEvasCleanUpEvent(uint32_t serial) override;
+
+ private:
+ void OnPrepareEvent(std::shared_ptr<RawImage> raw_image,
+ uint32_t serial);
+ void OnStopEvent(uint32_t serial);
+ void OnErrorEvent(Error error,
+ uint32_t serial);
+ void OnCleanUpEvent(uint32_t serial);
+ void OnResetEvent(uint32_t serial);
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_LAUNCHER_SERVICE_EVAS_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_LAUNCHER_SERVICE_EVAS_IMPLEMENTATION_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_LAUNCHER_SERVICE_EVAS_IMPLEMENTATION_H_
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_launcher_service_evas/launcher_service_evas.h"
+#include "screen_connector_launcher_service_evas/image_internal.h"
+
+namespace screen_connector {
+
+class LauncherServiceEvas::Impl {
+ public:
+ virtual ~Impl() = default;
+
+ const EvasObject& GetWindow();
+ const Image& GetImage();
+ void Update(std::shared_ptr<RawImage> raw_image);
+ void Reset();
+
+ private:
+ Evas_Object* CreateEvasObjectImage();
+ Evas_Object* CreateEdjeObject();
+
+ private:
+ friend class LauncherServiceEvas;
+ Impl(LauncherServiceEvas* parent, std::shared_ptr<EvasObject> win);
+
+ private:
+ LauncherServiceEvas* parent_;
+ std::shared_ptr<EvasObject> win_;
+ std::shared_ptr<Image> image_;
+ std::shared_ptr<Image> rs_img_;
+ std::shared_ptr<Image> ss_img_;
+ std::shared_ptr<Image> ss_edje_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_LAUNCHER_SERVICE_EVAS_IMPLEMENTATION_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_LOG_INTERNAL_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_LOG_INTERNAL_H_
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "SCLS_EVAS"
+
+#ifdef _E
+#undef _E
+#endif
+#define _E LOGE
+
+#ifdef _W
+#undef _W
+#endif
+#define _W LOGW
+
+#ifdef _I
+#undef _I
+#endif
+#define _I LOGI
+
+#ifdef _D
+#undef _D
+#endif
+#define _D LOGD
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_LOG_INTERNAL_H_
--- /dev/null
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: screen_connector_launcher_service_evas
+Description: Support development of the Screen Connector Launcher Service Evas library
+Version: @VERSION@
+Requires: screen_connector_launcher_service elementary
+Libs: -L${libdir} -lscreen_connector_launcher_service -lscreen_connector_launcher_service_evas
+Cflags: -I${includedir} -I${includedir}/include
+cppflags: -I${includedir} -I${includedir}/include
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_launcher_service_evas/include/screen_connector_launcher_service_evas.h"
+#include "screen_connector_launcher_service_evas/launcher_service_evas.h"
+#include "screen_connector_launcher_service_evas/log_internal.h"
+
+namespace {
+
+static screen_connector_launcher_service_evas_error_e __convert_error(
+ screen_connector::Error error) {
+ if (error == screen_connector::Error::Disqualified) {
+ return SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_ERROR_DISQUALIFIED;
+ } else if (error == screen_connector::Error::WrongRequest) {
+ return SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_ERROR_WRONG_REQUEST;
+ } else {
+ return SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_ERROR_NONE;
+ }
+}
+
+static screen_connector_launcher_service_evas_direction_e __convert_direction(
+ screen_connector::Direction direction) {
+ if (direction == screen_connector::Direction::Forward)
+ return SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_DIRECTION_FORWARD;
+
+ return SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_DIRECTION_BACKWARD;
+}
+
+static screen_connector_launcher_service_evas_image_type_e __convert_image_type(
+ screen_connector::ImageType image_type) {
+ if (image_type == screen_connector::ImageType::RemoteSurfaceTBM) {
+ return SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_TYPE_REMOTE_SURFACE_TBM;
+ } else if (image_type == screen_connector::ImageType::RemoteSurfaceImageFile) {
+ return SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_TYPE_REMOTE_SURFACE_IMAGE_FILE;
+ } else if (image_type == screen_connector::ImageType::SplashScreenImage) {
+ return SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_TYPE_SPLASH_SCREEN_IMAGE;
+ } else {
+ return SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_TYPE_SPLASH_SCREEN_EDJE;
+ }
+}
+
+class LauncherServiceEvasStub : public screen_connector::LauncherServiceEvas {
+ public:
+ LauncherServiceEvasStub(std::shared_ptr<screen_connector::EvasObject> win)
+ : screen_connector::LauncherServiceEvas(std::move(win)) {
+ }
+
+ void SetOps(screen_connector_launcher_service_evas_ops* ops,
+ void* user_data) {
+ ops_ = *ops;
+ user_data_ = user_data;
+ }
+
+ void OnEvasPrepareEvent(const screen_connector::EvasObject& image,
+ screen_connector::ImageType image_type,
+ screen_connector::Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) override {
+ if (ops_.prepare) {
+ ops_.prepare(image.GetRaw(),
+ __convert_image_type(image_type),
+ __convert_direction(direction),
+ x,
+ y,
+ shared_widget_info.c_str(),
+ serial,
+ user_data_);
+ }
+ }
+
+ void OnEvasStopEvent(uint32_t serial) override {
+ if (ops_.stop) {
+ ops_.stop(serial, user_data_);
+ }
+ }
+
+ void OnEvasErrorEvent(screen_connector::Error error,
+ uint32_t serial) override {
+ if (ops_.error) {
+ ops_.error(__convert_error(error), serial, user_data_);
+ }
+ }
+
+ void OnEvasCleanUpEvent(uint32_t serial) override {
+ if (ops_.cleanup) {
+ ops_.cleanup(serial, user_data_);
+ }
+ }
+
+ private:
+ screen_connector_launcher_service_evas_ops ops_;
+ void* user_data_;
+};
+
+} // namespace
+
+extern "C" EXPORT int screen_connector_launcher_service_evas_create(
+ Evas_Object* win,
+ screen_connector_launcher_service_evas_h* handle) {
+ if (win == nullptr || handle == nullptr) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto ls = new (std::nothrow) LauncherServiceEvasStub(
+ std::shared_ptr<screen_connector::EvasObject>(
+ new (std::nothrow) screen_connector::EvasObject(win, false)));
+
+ *handle = static_cast<void*>(ls);
+
+ return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_evas_destroy(
+ screen_connector_launcher_service_evas_h handle) {
+ if (handle == nullptr) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto ls = static_cast<LauncherServiceEvasStub*>(handle);
+ delete ls;
+
+ return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_evas_set_ops(
+ screen_connector_launcher_service_evas_h handle,
+ screen_connector_launcher_service_evas_ops* ops,
+ void* user_data) {
+ if (handle == nullptr || ops == nullptr) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto ls = static_cast<LauncherServiceEvasStub*>(handle);
+ ls->SetOps(ops, user_data);
+
+ return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_evas_launch(
+ screen_connector_launcher_service_evas_h handle,
+ const char* app_id,
+ const char* inst_id,
+ int pid,
+ uint32_t serial) {
+ if (handle == nullptr || app_id == nullptr || pid < -1) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto ls = static_cast<LauncherServiceEvasStub*>(handle);
+ return ls->Launch(app_id, inst_id, pid, serial);
+}
+
+extern "C" EXPORT int
+screen_connector_launcher_service_evas_launch_with_shared_widget (
+ screen_connector_launcher_service_evas_h handle,
+ const char* app_id,
+ const char* inst_id,
+ int pid,
+ uint32_t serial) {
+ if (handle == nullptr || app_id == nullptr || pid < -1) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto ls = static_cast<LauncherServiceEvasStub*>(handle);
+ return ls->LaunchWithSharedWidget(app_id, inst_id, pid, serial);
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_evas_launching(
+ screen_connector_launcher_service_evas_h handle,
+ uint32_t serial) {
+ if (handle == nullptr) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto ls = static_cast<LauncherServiceEvasStub*>(handle);
+ return ls->Launching(serial);
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_evas_launch_cancel(
+ screen_connector_launcher_service_evas_h handle,
+ uint32_t serial) {
+ if (handle == nullptr) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto ls = static_cast<LauncherServiceEvasStub*>(handle);
+ return ls->LaunchCancel(serial);
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_evas_launch_done(
+ screen_connector_launcher_service_evas_h handle,
+ uint32_t serial) {
+ if (handle == nullptr) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto ls = static_cast<LauncherServiceEvasStub*>(handle);
+ return ls->LaunchDone(serial);
+}
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(screen_connector_shared_widget_launch CXX)
+
+SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
+SET(PROJECT_NAME "${PROJECT_NAME}")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(VERSION_MAJOR "${MAJORVER}")
+SET(VERSION "${FULLVER}")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(screen_connector_shared_widget_launch REQUIRED
+ dlog
+ aul
+ wayland-client
+ ecore-wl2
+ tzsh-shared-widget-launch
+ glib-2.0
+)
+
+FOREACH(flag ${screen_connector_shared_widget_launch_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++11")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
+ADD_LIBRARY (${PROJECT_NAME} SHARED ${SOURCES})
+
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${screen_connector_shared_widget_launch_LDFLAGS} "-lpthread")
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
+
+INSTALL(TARGETS ${PROJECT_NAME}
+ DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
+ DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
+ DESTINATION include/${PROJECT_NAME}
+ FILES_MATCHING PATTERN "*.h"
+ PATTERN "*_internal.h" EXCLUDE
+ PATTERN "*_implementation.h" EXCLUDE)
--- /dev/null
+Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+ Apache License\r
+ Version 2.0, January 2004\r
+ http://www.apache.org/licenses/\r
+\r
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+ 1. Definitions.\r
+\r
+ "License" shall mean the terms and conditions for use, reproduction,\r
+ and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+ "Licensor" shall mean the copyright owner or entity authorized by\r
+ the copyright owner that is granting the License.\r
+\r
+ "Legal Entity" shall mean the union of the acting entity and all\r
+ other entities that control, are controlled by, or are under common\r
+ control with that entity. For the purposes of this definition,\r
+ "control" means (i) the power, direct or indirect, to cause the\r
+ direction or management of such entity, whether by contract or\r
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+ outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+ "You" (or "Your") shall mean an individual or Legal Entity\r
+ exercising permissions granted by this License.\r
+\r
+ "Source" form shall mean the preferred form for making modifications,\r
+ including but not limited to software source code, documentation\r
+ source, and configuration files.\r
+\r
+ "Object" form shall mean any form resulting from mechanical\r
+ transformation or translation of a Source form, including but\r
+ not limited to compiled object code, generated documentation,\r
+ and conversions to other media types.\r
+\r
+ "Work" shall mean the work of authorship, whether in Source or\r
+ Object form, made available under the License, as indicated by a\r
+ copyright notice that is included in or attached to the work\r
+ (an example is provided in the Appendix below).\r
+\r
+ "Derivative Works" shall mean any work, whether in Source or Object\r
+ form, that is based on (or derived from) the Work and for which the\r
+ editorial revisions, annotations, elaborations, or other modifications\r
+ represent, as a whole, an original work of authorship. For the purposes\r
+ of this License, Derivative Works shall not include works that remain\r
+ separable from, or merely link (or bind by name) to the interfaces of,\r
+ the Work and Derivative Works thereof.\r
+\r
+ "Contribution" shall mean any work of authorship, including\r
+ the original version of the Work and any modifications or additions\r
+ to that Work or Derivative Works thereof, that is intentionally\r
+ submitted to Licensor for inclusion in the Work by the copyright owner\r
+ or by an individual or Legal Entity authorized to submit on behalf of\r
+ the copyright owner. For the purposes of this definition, "submitted"\r
+ means any form of electronic, verbal, or written communication sent\r
+ to the Licensor or its representatives, including but not limited to\r
+ communication on electronic mailing lists, source code control systems,\r
+ and issue tracking systems that are managed by, or on behalf of, the\r
+ Licensor for the purpose of discussing and improving the Work, but\r
+ excluding communication that is conspicuously marked or otherwise\r
+ designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+ "Contributor" shall mean Licensor and any individual or Legal Entity\r
+ on behalf of whom a Contribution has been received by Licensor and\r
+ subsequently incorporated within the Work.\r
+\r
+ 2. Grant of Copyright License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ copyright license to reproduce, prepare Derivative Works of,\r
+ publicly display, publicly perform, sublicense, and distribute the\r
+ Work and such Derivative Works in Source or Object form.\r
+\r
+ 3. Grant of Patent License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ (except as stated in this section) patent license to make, have made,\r
+ use, offer to sell, sell, import, and otherwise transfer the Work,\r
+ where such license applies only to those patent claims licensable\r
+ by such Contributor that are necessarily infringed by their\r
+ Contribution(s) alone or by combination of their Contribution(s)\r
+ with the Work to which such Contribution(s) was submitted. If You\r
+ institute patent litigation against any entity (including a\r
+ cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+ or a Contribution incorporated within the Work constitutes direct\r
+ or contributory patent infringement, then any patent licenses\r
+ granted to You under this License for that Work shall terminate\r
+ as of the date such litigation is filed.\r
+\r
+ 4. Redistribution. You may reproduce and distribute copies of the\r
+ Work or Derivative Works thereof in any medium, with or without\r
+ modifications, and in Source or Object form, provided that You\r
+ meet the following conditions:\r
+\r
+ (a) You must give any other recipients of the Work or\r
+ Derivative Works a copy of this License; and\r
+\r
+ (b) You must cause any modified files to carry prominent notices\r
+ stating that You changed the files; and\r
+\r
+ (c) You must retain, in the Source form of any Derivative Works\r
+ that You distribute, all copyright, patent, trademark, and\r
+ attribution notices from the Source form of the Work,\r
+ excluding those notices that do not pertain to any part of\r
+ the Derivative Works; and\r
+\r
+ (d) If the Work includes a "NOTICE" text file as part of its\r
+ distribution, then any Derivative Works that You distribute must\r
+ include a readable copy of the attribution notices contained\r
+ within such NOTICE file, excluding those notices that do not\r
+ pertain to any part of the Derivative Works, in at least one\r
+ of the following places: within a NOTICE text file distributed\r
+ as part of the Derivative Works; within the Source form or\r
+ documentation, if provided along with the Derivative Works; or,\r
+ within a display generated by the Derivative Works, if and\r
+ wherever such third-party notices normally appear. The contents\r
+ of the NOTICE file are for informational purposes only and\r
+ do not modify the License. You may add Your own attribution\r
+ notices within Derivative Works that You distribute, alongside\r
+ or as an addendum to the NOTICE text from the Work, provided\r
+ that such additional attribution notices cannot be construed\r
+ as modifying the License.\r
+\r
+ You may add Your own copyright statement to Your modifications and\r
+ may provide additional or different license terms and conditions\r
+ for use, reproduction, or distribution of Your modifications, or\r
+ for any such Derivative Works as a whole, provided Your use,\r
+ reproduction, and distribution of the Work otherwise complies with\r
+ the conditions stated in this License.\r
+\r
+ 5. Submission of Contributions. Unless You explicitly state otherwise,\r
+ any Contribution intentionally submitted for inclusion in the Work\r
+ by You to the Licensor shall be under the terms and conditions of\r
+ this License, without any additional terms or conditions.\r
+ Notwithstanding the above, nothing herein shall supersede or modify\r
+ the terms of any separate license agreement you may have executed\r
+ with Licensor regarding such Contributions.\r
+\r
+ 6. Trademarks. This License does not grant permission to use the trade\r
+ names, trademarks, service marks, or product names of the Licensor,\r
+ except as required for reasonable and customary use in describing the\r
+ origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+ 7. Disclaimer of Warranty. Unless required by applicable law or\r
+ agreed to in writing, Licensor provides the Work (and each\r
+ Contributor provides its Contributions) on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+ implied, including, without limitation, any warranties or conditions\r
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+ PARTICULAR PURPOSE. You are solely responsible for determining the\r
+ appropriateness of using or redistributing the Work and assume any\r
+ risks associated with Your exercise of permissions under this License.\r
+\r
+ 8. Limitation of Liability. In no event and under no legal theory,\r
+ whether in tort (including negligence), contract, or otherwise,\r
+ unless required by applicable law (such as deliberate and grossly\r
+ negligent acts) or agreed to in writing, shall any Contributor be\r
+ liable to You for damages, including any direct, indirect, special,\r
+ incidental, or consequential damages of any character arising as a\r
+ result of this License or out of the use or inability to use the\r
+ Work (including but not limited to damages for loss of goodwill,\r
+ work stoppage, computer failure or malfunction, or any and all\r
+ other commercial damages or losses), even if such Contributor\r
+ has been advised of the possibility of such damages.\r
+\r
+ 9. Accepting Warranty or Additional Liability. While redistributing\r
+ the Work or Derivative Works thereof, You may choose to offer,\r
+ and charge a fee for, acceptance of support, warranty, indemnity,\r
+ or other liability obligations and/or rights consistent with this\r
+ License. However, in accepting such obligations, You may act only\r
+ on Your own behalf and on Your sole responsibility, not on behalf\r
+ of any other Contributor, and only if You agree to indemnify,\r
+ defend, and hold each Contributor harmless for any liability\r
+ incurred by, or claims asserted against, such Contributor by reason\r
+ of your accepting any such warranty or additional liability.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ APPENDIX: How to apply the Apache License to your work.\r
+\r
+ To apply the Apache License to your work, attach the following\r
+ boilerplate notice, with the fields enclosed by brackets "[]"\r
+ replaced with your own identifying information. (Don't include\r
+ the brackets!) The text should be enclosed in the appropriate\r
+ comment syntax for the file format. We also recommend that a\r
+ file or class name and description of purpose be included on the\r
+ same "printed page" as the copyright notice for easier\r
+ identification within third-party archives.\r
+\r
+ Copyright [yyyy] [name of copyright owner]\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_INCLUDE_SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_H_
+#define SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_INCLUDE_SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_H_
+
+#include <stdbool.h>
+
+#include <Ecore_Wl2.h>
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_PREPARE_STATE_WIDGET_SHOW,
+ SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_PREPARE_STATE_WIDGET_HIDE,
+} screen_connector_shared_widget_launch_prepare_state_e;
+
+typedef void* screen_connector_shared_widget_launch_h;
+
+typedef void (*screen_connector_shared_widget_launch_prepare_cb)(
+ screen_connector_shared_widget_launch_prepare_state_e prepare_state,
+ uint32_t serial,
+ void* user_data);
+
+int screen_connector_shared_widget_launch_create(Ecore_Wl2_Window* wl2_win,
+ screen_connector_shared_widget_launch_h* handle);
+
+int screen_connector_shared_widget_launch_destroy(
+ screen_connector_shared_widget_launch_h handle);
+
+int screen_connector_shared_widget_launch_prepare_cb_set(
+ screen_connector_shared_widget_launch_h handle,
+ screen_connector_shared_widget_launch_prepare_cb callback,
+ void* user_data);
+
+int screen_connector_shared_widget_launch_prepare_done(
+ screen_connector_shared_widget_launch_h handle,
+ const char* shared_widget_info,
+ screen_connector_shared_widget_launch_prepare_state_e prepare_state,
+ uint32_t serial);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_INCLUDE_SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_LOG_INTERNAL_H_
+#define SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_LOG_INTERNAL_H_
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "SCSWL"
+
+#ifdef _E
+#undef _E
+#endif
+#define _E LOGE
+
+#ifdef _W
+#undef _W
+#endif
+#define _W LOGW
+
+#ifdef _I
+#undef _I
+#endif
+#define _I LOGI
+
+#ifdef _D
+#undef _D
+#endif
+#define _D LOGD
+
+#endif // SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_LOG_INTERNAL_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_PREPARE_STATE_H_
+#define SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_PREPARE_STATE_H_
+
+#include <tzsh_shared_widget_launch.h>
+
+#include "screen_connector_common/export.h"
+
+namespace screen_connector {
+
+enum class EXPORT PrepareState {
+ WIDGET_SHOW = TZSH_SHARED_WIDGET_LAUNCH_PREPARE_STATE_WIDGET_SHOW,
+ WIDGET_HIDE = TZSH_SHARED_WIDGET_LAUNCH_PREPARE_STATE_WIDGET_HIDE,
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_PREPARE_STATE_H_
--- /dev/null
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: screen_connector_shared_widget_launch
+Description: Support development of the Screen Connector Shared Widget Launch library
+Version: @VERSION@
+Requires: tzsh-shared-widget-launch
+Libs: -L${libdir} -lscreen_connector_shared_widget_launch
+Cflags: -I${includedir} -I${includedir}/include
+cppflags: -I${includedir} -I${includedir}/include
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "screen_connector_shared_widget_launch/shared_widget_launch.h"
+#include "screen_connector_shared_widget_launch/shared_widget_launch_implementation.h"
+
+namespace screen_connector {
+
+SharedWidgetLaunch::Impl::Impl(SharedWidgetLaunch* parent,
+ std::shared_ptr<Wl2Window> wl2_win,
+ SharedWidgetLaunch::IEventListener* listener)
+ : parent_(parent),
+ wl2_win_(std::move(wl2_win)),
+ listener_(listener),
+ tzsh_(new Tzsh(tzsh_create(TZSH_TOOLKIT_TYPE_EFL))) {
+ auto win_id = ecore_wl2_window_id_get(wl2_win_->GetRaw());
+ tzsh_swl_.reset(new TzshSharedWidgetLaunch(
+ tzsh_shared_widget_launch_create(tzsh_->GetRaw(),
+ static_cast<tzsh_window>(win_id))));
+ tzsh_swl_->SetListener(this);
+}
+
+void SharedWidgetLaunch::Impl::PrepareDone(
+ const std::string& shared_widget_info,
+ PrepareState state,
+ uint32_t serial) {
+ tzsh_swl_->PrepareDone(shared_widget_info, state, serial);
+}
+
+void SharedWidgetLaunch::Impl::OnPrepareEvent(PrepareState state,
+ uint32_t serial) {
+ listener_->OnPrepareEvent(state, serial);
+}
+
+SharedWidgetLaunch::SharedWidgetLaunch(std::shared_ptr<Wl2Window> wl2_win,
+ IEventListener* listener)
+ : impl_(new Impl(this, std::move(wl2_win), listener)) {
+}
+
+SharedWidgetLaunch::~SharedWidgetLaunch() = default;
+
+void SharedWidgetLaunch::PrepareDone(const std::string& shared_widget_info,
+ PrepareState state,
+ uint32_t serial) {
+ impl_->PrepareDone(shared_widget_info, state, serial);
+}
+
+} // namespace screen_connector
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_SHARED_WIDGET_LAUNCH_H_
+#define SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_SHARED_WIDGET_LAUNCH_H_
+
+#include <stdint.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/wl2_window.h"
+#include "screen_connector_shared_widget_launch/prepare_state.h"
+
+namespace screen_connector {
+
+class EXPORT SharedWidgetLaunch {
+ public:
+ class EXPORT IEventListener {
+ public:
+ virtual void OnPrepareEvent(PrepareState state, uint32_t serial) = 0;
+ };
+
+ explicit SharedWidgetLaunch(std::shared_ptr<Wl2Window> wl2_win,
+ IEventListener* listener);
+ virtual ~SharedWidgetLaunch();
+
+ void PrepareDone(const std::string& shared_widget_info,
+ PrepareState state,
+ uint32_t serial);
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_SHARED_WIDGET_LAUNCH_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_SHARED_WIDGET_LAUNCH_IMPLEMENTATION_H_
+#define SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_SHARED_WIDGET_LAUNCH_IMPLEMENTATION_H_
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/wl2_window.h"
+#include "screen_connector_common/tzsh.h"
+#include "screen_connector_shared_widget_launch/shared_widget_launch.h"
+#include "screen_connector_shared_widget_launch/tzsh_shared_widget_launch_internal.h"
+
+namespace screen_connector {
+
+class SharedWidgetLaunch::Impl : public TzshSharedWidgetLaunch::IEventListener {
+ public:
+ virtual ~Impl() = default;
+
+ void PrepareDone(const std::string& shared_widget_info,
+ PrepareState state,
+ uint32_t serial);
+
+ void OnPrepareEvent(PrepareState state, uint32_t serial) override;
+
+ private:
+ friend class SharedWidgetLaunch;
+ Impl(SharedWidgetLaunch* parent,
+ std::shared_ptr<Wl2Window> wl2_win,
+ SharedWidgetLaunch::IEventListener* listener);
+
+ private:
+ SharedWidgetLaunch* parent_;
+ std::shared_ptr<Wl2Window> wl2_win_;
+ SharedWidgetLaunch::IEventListener* listener_;
+ std::unique_ptr<Tzsh> tzsh_;
+ std::unique_ptr<TzshSharedWidgetLaunch> tzsh_swl_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_SHARED_WIDGET_LAUNCH_IMPLEMENTATION_H_
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/wl2_window.h"
+#include "screen_connector_shared_widget_launch/include/screen_connector_shared_widget_launch.h"
+#include "screen_connector_shared_widget_launch/log_internal.h"
+#include "screen_connector_shared_widget_launch/shared_widget_launch.h"
+
+namespace {
+
+class SharedWidgetLaunchStub : public screen_connector::SharedWidgetLaunch,
+ public screen_connector::SharedWidgetLaunch::IEventListener {
+ public:
+ explicit SharedWidgetLaunchStub(
+ std::shared_ptr<screen_connector::Wl2Window> wl2_win)
+ : screen_connector::SharedWidgetLaunch(std::move(wl2_win), this) {
+ }
+
+ virtual ~SharedWidgetLaunchStub() = default;
+
+ void SetPrepareCB(screen_connector_shared_widget_launch_prepare_cb cb,
+ void* user_data) {
+ prepare_cb_ = cb;
+ user_data_ = user_data;
+ }
+
+ void OnPrepareEvent(screen_connector::PrepareState state,
+ uint32_t serial) override {
+ if (!prepare_cb_)
+ return;
+
+ screen_connector_shared_widget_launch_prepare_state_e prepare_state =
+ static_cast<screen_connector_shared_widget_launch_prepare_state_e>(state);
+
+ prepare_cb_(prepare_state, serial, user_data_);
+ }
+
+ private:
+ screen_connector_shared_widget_launch_prepare_cb prepare_cb_ = nullptr;
+ void* user_data_ = nullptr;
+};
+
+extern "C" EXPORT int screen_connector_shared_widget_launch_create(
+ Ecore_Wl2_Window* wl2_win,
+ screen_connector_shared_widget_launch_h* handle) {
+ if (wl2_win == nullptr || handle == nullptr) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto swl = new (std::nothrow) SharedWidgetLaunchStub(
+ std::shared_ptr<screen_connector::Wl2Window>(
+ new (std::nothrow) screen_connector::Wl2Window(wl2_win)));
+
+ *handle = static_cast<void*>(swl);
+
+ return 0;
+}
+
+extern "C" EXPORT int screen_connector_shared_widget_launch_destroy(
+ screen_connector_shared_widget_launch_h handle) {
+ if (handle == nullptr) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto swl = static_cast<SharedWidgetLaunchStub*>(handle);
+ delete swl;
+
+ return 0;
+}
+
+extern "C" EXPORT int screen_connector_shared_widget_launch_prepare_cb_set(
+ screen_connector_shared_widget_launch_h handle,
+ screen_connector_shared_widget_launch_prepare_cb callback,
+ void* user_data) {
+ if (handle == nullptr || callback == nullptr) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto swl = static_cast<SharedWidgetLaunchStub*>(handle);
+ swl->SetPrepareCB(callback, user_data);
+
+ return 0;
+}
+
+extern "C" EXPORT int screen_connector_shared_widget_launch_prepare_done(
+ screen_connector_shared_widget_launch_h handle,
+ const char* shared_widget_info,
+ screen_connector_shared_widget_launch_prepare_state_e state,
+ uint32_t serial) {
+ if (handle == nullptr || shared_widget_info == nullptr) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ auto swl = static_cast<SharedWidgetLaunchStub*>(handle);
+ swl->PrepareDone(shared_widget_info,
+ static_cast<screen_connector::PrepareState>(state), serial);
+
+ return 0;
+}
+
+} // namespace
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "screen_connector_shared_widget_launch/tzsh_shared_widget_launch_internal.h"
+#include "screen_connector_shared_widget_launch/log_internal.h"
+
+namespace screen_connector {
+
+TzshSharedWidgetLaunch::TzshSharedWidgetLaunch(tzsh_shared_widget_launch_h raw)
+ : Handle<tzsh_shared_widget_launch_h>(raw, true) {
+}
+
+TzshSharedWidgetLaunch::~TzshSharedWidgetLaunch() {
+ tzsh_shared_widget_launch_destroy(GetRaw());
+}
+
+tzsh_shared_widget_launch_h TzshSharedWidgetLaunch::GetHandle() const {
+ return GetRaw();
+}
+
+void TzshSharedWidgetLaunch::SetListener(
+ TzshSharedWidgetLaunch::IEventListener* listener) {
+ listener_ = listener;
+ tzsh_shared_widget_launch_prepare_cb_set(GetRaw(), PrepareCB, listener_);
+}
+
+int TzshSharedWidgetLaunch::PrepareDone(const std::string& shared_widget_info,
+ PrepareState state,
+ uint32_t serial) {
+ return tzsh_shared_widget_launch_prepare_done(GetRaw(),
+ shared_widget_info.c_str(),
+ static_cast<tzsh_shared_widget_launch_prepare_state_e>(state),
+ serial);
+}
+
+void TzshSharedWidgetLaunch::PrepareCB(void* data,
+ tzsh_shared_widget_launch_h tzsh_swl,
+ tzsh_shared_widget_launch_prepare_state_e state,
+ uint32_t serial) {
+ auto listener = static_cast<IEventListener*>(data);
+ listener->OnPrepareEvent(static_cast<PrepareState>(state), serial);
+}
+
+} // namespace screen_connector
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_TZSH_SHARED_WIDGET_LAUNCH_INTERNAL_H_
+#define SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_TZSH_SHARED_WIDGET_LAUNCH_INTERNAL_H_
+
+#include <stdint.h>
+#include <tzsh_shared_widget_launch.h>
+#include <unistd.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_shared_widget_launch/prepare_state.h"
+
+namespace screen_connector {
+
+class TzshSharedWidgetLaunch : public Handle<tzsh_shared_widget_launch_h> {
+ public:
+ class IEventListener {
+ public:
+ virtual void OnPrepareEvent(PrepareState state, uint32_t serial) = 0;
+ };
+
+ explicit TzshSharedWidgetLaunch(tzsh_shared_widget_launch_h raw);
+ virtual ~TzshSharedWidgetLaunch();
+
+ tzsh_shared_widget_launch_h GetHandle() const;
+ void SetListener(IEventListener* listener);
+
+ int PrepareDone(const std::string& shared_widget_info,
+ PrepareState state,
+ uint32_t serial);
+
+ private:
+ static void PrepareCB(void* data,
+ tzsh_shared_widget_launch_h tzsh_swl,
+ tzsh_shared_widget_launch_prepare_state_e state,
+ uint32_t serial);
+
+ private:
+ IEventListener* listener_ = nullptr;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_SHARED_WIDGET_LAUNCH_TZSH_SHARED_WIDGET_LAUNCH_INTERNAL_H_