From 33d5dd4db11853dd088ad31aa665cea733d8319c Mon Sep 17 00:00:00 2001 From: Daehyeon Jung Date: Mon, 27 Apr 2020 12:38:45 +0900 Subject: [PATCH 01/16] Release version 1.6.15 Changes: - Release tbm surface on block state Change-Id: If868292014a6e756ba33e9aa6a9a371e85d5dba5 Signed-off-by: Daehyeon Jung --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index 61636de..88a9ff5 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.6.14 +Version: 1.6.15 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 5210e0ebf3713c17c3c1953b489026120c0d42ba Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Tue, 28 Apr 2020 15:41:04 +0900 Subject: [PATCH 02/16] Add a flag for removed instance Change-Id: Ic0aeac0f8ff18b2af8bfcbc92f2a3b7fe8343ddb Signed-off-by: Junghoon Park --- screen_connector_remote_surface/remote_surface.cc | 10 ++++++++++ .../remote_surface_implementation.h | 1 + 2 files changed, 11 insertions(+) diff --git a/screen_connector_remote_surface/remote_surface.cc b/screen_connector_remote_surface/remote_surface.cc index 113b57f..0fc70ea 100644 --- a/screen_connector_remote_surface/remote_surface.cc +++ b/screen_connector_remote_surface/remote_surface.cc @@ -92,6 +92,9 @@ void RemoteSurface::Impl::OnAppAdded(const std::string &appId, const std::string& instId, const int pid, const unsigned int surfaceId) { + if (disposed_) + return; + if (inst_id_ != instId) return; @@ -107,17 +110,24 @@ void RemoteSurface::Impl::OnAppRemoved(const std::string& appId, const std::string& instId, const int pid, const unsigned int surfaceId) { + if (disposed_) + return; + if (inst_id_ != instId) return; LOGW("removed %s", instId.c_str()); parent_->OnBufferRemoved(appId, instId, pid); + disposed_ = true; } void RemoteSurface::Impl::OnAppUpdated(const std::string &appId, const std::string& instId, const int pid, const unsigned int surfaceId) { + if (disposed_) + return; + if (inst_id_ != instId) return; diff --git a/screen_connector_remote_surface/remote_surface_implementation.h b/screen_connector_remote_surface/remote_surface_implementation.h index af56724..dcc870f 100644 --- a/screen_connector_remote_surface/remote_surface_implementation.h +++ b/screen_connector_remote_surface/remote_surface_implementation.h @@ -84,6 +84,7 @@ class RemoteSurface::Impl : AulHandle::IEventListener, ITRS::IEventListener { RemoteSurface* parent_; bool mock_; std::unique_ptr queuing_visibility_; + bool disposed_ = false; }; } // namespace screen_connector -- 2.7.4 From edd87a50d5695358e1338c47529a489f049f2658 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Tue, 28 Apr 2020 19:15:20 +0900 Subject: [PATCH 03/16] Release version 1.6.16 Changes: - Add a flag for removed instance Change-Id: Ib7adac5eb7449c75e88ae02cda4dc356dc682dde Signed-off-by: Junghoon Park --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index 88a9ff5..68e7ced 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.6.15 +Version: 1.6.16 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 2c839e7806f3e6f2c3d1bd239b0209bddd9b7f50 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 29 Apr 2020 09:38:44 +0900 Subject: [PATCH 04/16] Add Reset Function If the raw image is remote surface type, the launcher service calls the unredirect method when the reset function is called. Change-Id: I9ebe7eef50b820873538528420cd97aae90f46b6 Signed-off-by: Hwankyu Jhun --- .../include/screen_connector_launcher_service.h | 4 ++++ screen_connector_launcher_service/launcher_service.cc | 13 +++++++++++++ screen_connector_launcher_service/launcher_service.h | 1 + .../launcher_service_implementation.h | 1 + screen_connector_launcher_service/stub.cc | 12 ++++++++++++ .../tizen_remote_surface_internal.cc | 4 ++++ .../tizen_remote_surface_internal.h | 1 + 7 files changed, 36 insertions(+) diff --git a/screen_connector_launcher_service/include/screen_connector_launcher_service.h b/screen_connector_launcher_service/include/screen_connector_launcher_service.h index 22029a6..828a73f 100644 --- a/screen_connector_launcher_service/include/screen_connector_launcher_service.h +++ b/screen_connector_launcher_service/include/screen_connector_launcher_service.h @@ -118,6 +118,10 @@ int screen_connector_launcher_service_launch_done( screen_connector_launcher_service_h handle, uint32_t serial); +int screen_connector_launcher_service_reset( + screen_connector_launcher_service_h handle, + uint32_t serial); + int screen_connector_launcher_service_image_get_direction( screen_connector_launcher_service_image_h handle, screen_connector_launcher_service_direction_e* direction); diff --git a/screen_connector_launcher_service/launcher_service.cc b/screen_connector_launcher_service/launcher_service.cc index d486ca3..ced3de5 100644 --- a/screen_connector_launcher_service/launcher_service.cc +++ b/screen_connector_launcher_service/launcher_service.cc @@ -68,6 +68,15 @@ int LauncherService::Impl::LaunchDone(uint32_t serial) { return ret; } +int LauncherService::Impl::Reset(uint32_t serial) { + if (raw_image_->GetImageType() == ImageType::RemoteSurfaceTBM || + raw_image_->GetImageType() == ImageType::RemoteSurfaceImageFile) { + _W("Unredirect()"); + trs_->Unredirect(); + } + return 0; +} + void LauncherService::Impl::OnRawBufferUpdated( std::shared_ptr wl_buffer, uint32_t time, @@ -202,4 +211,8 @@ int LauncherService::LaunchDone(uint32_t serial) { return impl_->LaunchDone(serial); } +int LauncherService::Reset(uint32_t serial) { + return impl_->Reset(serial); +} + } // namespace screen_connector diff --git a/screen_connector_launcher_service/launcher_service.h b/screen_connector_launcher_service/launcher_service.h index 3ef2c3a..d7344ea 100644 --- a/screen_connector_launcher_service/launcher_service.h +++ b/screen_connector_launcher_service/launcher_service.h @@ -55,6 +55,7 @@ class EXPORT LauncherService { int Launching(uint32_t serial); int LaunchCancel(uint32_t serial); int LaunchDone(uint32_t serial); + int Reset(uint32_t serial); private: class Impl; diff --git a/screen_connector_launcher_service/launcher_service_implementation.h b/screen_connector_launcher_service/launcher_service_implementation.h index 0afd237..8d18eea 100644 --- a/screen_connector_launcher_service/launcher_service_implementation.h +++ b/screen_connector_launcher_service/launcher_service_implementation.h @@ -82,6 +82,7 @@ class LauncherService::Impl : TizenRemoteSurface::IEventListener, int Launching(uint32_t serial); int LaunchCancel(uint32_t serial); int LaunchDone(uint32_t serial); + int Reset(uint32_t serial); private: friend class LauncherService; diff --git a/screen_connector_launcher_service/stub.cc b/screen_connector_launcher_service/stub.cc index c95d496..507a8f1 100644 --- a/screen_connector_launcher_service/stub.cc +++ b/screen_connector_launcher_service/stub.cc @@ -222,6 +222,18 @@ extern "C" EXPORT int screen_connector_launcher_service_launch_done( return ls->LaunchDone(serial); } +extern "C" EXPORT int screen_connector_launcher_service_reset( + screen_connector_launcher_service_h handle, + uint32_t serial) { + if (handle == nullptr) { + _E("Invalid parameter"); + return -EINVAL; + } + + auto ls = static_cast(handle); + return ls->Reset(serial); +} + extern "C" EXPORT int screen_connector_launcher_service_image_get_direction( screen_connector_launcher_service_image_h handle, screen_connector_launcher_service_direction_e* direction) { diff --git a/screen_connector_launcher_service/tizen_remote_surface_internal.cc b/screen_connector_launcher_service/tizen_remote_surface_internal.cc index 5a6d15e..a13a4c8 100644 --- a/screen_connector_launcher_service/tizen_remote_surface_internal.cc +++ b/screen_connector_launcher_service/tizen_remote_surface_internal.cc @@ -82,6 +82,10 @@ void TizenRemoteSurface::Redirect() { tizen_remote_surface_redirect(GetRaw()); } +void TizenRemoteSurface::Unredirect() { + tizen_remote_surface_unredirect(GetRaw()); +} + void TizenRemoteSurface::BufferUpdatedCB(void* data, struct tizen_remote_surface* trs, struct wl_buffer* buffer, diff --git a/screen_connector_launcher_service/tizen_remote_surface_internal.h b/screen_connector_launcher_service/tizen_remote_surface_internal.h index 2448ecc..95527cd 100644 --- a/screen_connector_launcher_service/tizen_remote_surface_internal.h +++ b/screen_connector_launcher_service/tizen_remote_surface_internal.h @@ -70,6 +70,7 @@ class TizenRemoteSurface : public Handle { const std::string& GetSharedWidgetInfo() const; uint32_t GetSerial() const; void Redirect(); + void Unredirect(); private: static void BufferUpdatedCB(void* data, -- 2.7.4 From 88fb03c830915f9e9448a05ca4993f1f5859462c Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 29 Apr 2020 17:53:20 +0900 Subject: [PATCH 05/16] Release version 1.6.17 Changes: - Add Reset Function Change-Id: I38555533453271b692bbaf6343a662b090a7ab17 Signed-off-by: Hwankyu Jhun --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index 68e7ced..147f423 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.6.16 +Version: 1.6.17 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 40b967b9ef1b46f2fc08a60d83793bfc3d63884d Mon Sep 17 00:00:00 2001 From: hyunho Date: Thu, 7 May 2020 16:04:36 +0900 Subject: [PATCH 06/16] Fix timer handle leak issue Change-Id: Ifa68988421e6eb55185819c8317543bb8e0072e5 Signed-off-by: hyunho --- screen_connector_remote_surface_evas/remote_surface_evas.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/screen_connector_remote_surface_evas/remote_surface_evas.cc b/screen_connector_remote_surface_evas/remote_surface_evas.cc index 07d21f9..121e677 100644 --- a/screen_connector_remote_surface_evas/remote_surface_evas.cc +++ b/screen_connector_remote_surface_evas/remote_surface_evas.cc @@ -542,6 +542,11 @@ void RemoteSurfaceEvas::ClearNoRenderTimer() { void RemoteSurfaceEvas::NoRenderPush(int timeout) { LOGI("No render push start"); + if(impl_->no_render_timer_) { + LOGW("no render push is already started skip this one"); + return; + } + elm_win_norender_push(impl_->viewer_win_->GetRaw()); impl_->no_render_timer_ = g_timeout_add(timeout, [](gpointer user_data)->gboolean { -- 2.7.4 From fc357fd099ac12a2727878a2aefeac1b7a02f5e3 Mon Sep 17 00:00:00 2001 From: hyunho Date: Fri, 8 May 2020 15:39:48 +0900 Subject: [PATCH 07/16] Do not update buffer after app dead Change-Id: Id7aab3c5e0eca6ff5b113cec92a44364a413c299 Signed-off-by: hyunho --- screen_connector_remote_surface/remote_surface.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/screen_connector_remote_surface/remote_surface.cc b/screen_connector_remote_surface/remote_surface.cc index 0fc70ea..a1f668b 100644 --- a/screen_connector_remote_surface/remote_surface.cc +++ b/screen_connector_remote_surface/remote_surface.cc @@ -233,7 +233,7 @@ void RemoteSurface::Impl::OnRawBufferChanged(int type, std::shared_ptr tbm, int fd, uint32_t size, uint32_t time) { - if (bind_surface_.get() != nullptr || block_) + if (bind_surface_.get() != nullptr || block_ || disposed_) return; LOGD("resource_id : %s", parent_->GetInstId().c_str()); -- 2.7.4 From 9a1fdb03723d747fecc46c83939d33bc67882248 Mon Sep 17 00:00:00 2001 From: hyunho Date: Fri, 8 May 2020 16:29:36 +0900 Subject: [PATCH 08/16] Release version 1.6.18 Changes: - Fix timer handle leak issue - Do not update buffer after app dead Change-Id: I817bf68b24cf9946bf270e42e0e965b4b51dba14 Signed-off-by: hyunho --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index 147f423..53876dc 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.6.17 +Version: 1.6.18 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 77be05c511b83995ac33ec63a3e6121b75b72457 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Wed, 29 Apr 2020 12:40:56 +0900 Subject: [PATCH 09/16] Add mockup packages to improve testability Change-Id: I4a0f6bf23cac38cd7c13de15d10b9464ef43aca9 Signed-off-by: Junghoon Park --- CMakeLists.txt | 2 + packaging/libscreen_connector.spec | 34 +++++++ .../CMakeLists.txt | 22 ++++ .../evas_event_interface.h | 42 ++++++++ .../evas_object.h | 35 +++++++ .../remote_surface_evas.h | 79 +++++++++++++++ .../remote_surface_watcher.h | 54 ++++++++++ ...screen_connector_remote_surface_evas_mock.pc.in | 11 ++ .../watcher_event_interface.h | 41 ++++++++ .../CMakeLists.txt | 18 ++++ .../buffer_event_interface.h | 41 ++++++++ screen_connector_remote_surface_mock/common.h | 25 +++++ screen_connector_remote_surface_mock/handle.h | 73 ++++++++++++++ .../remote_surface.h | 111 +++++++++++++++++++++ .../screen_connector_remote_surface_mock.pc.in | 10 ++ .../trs_interface.h | 67 +++++++++++++ 16 files changed, 665 insertions(+) create mode 100644 screen_connector_remote_surface_evas_mock/CMakeLists.txt create mode 100644 screen_connector_remote_surface_evas_mock/evas_event_interface.h create mode 100644 screen_connector_remote_surface_evas_mock/evas_object.h create mode 100644 screen_connector_remote_surface_evas_mock/remote_surface_evas.h create mode 100644 screen_connector_remote_surface_evas_mock/remote_surface_watcher.h create mode 100644 screen_connector_remote_surface_evas_mock/screen_connector_remote_surface_evas_mock.pc.in create mode 100644 screen_connector_remote_surface_evas_mock/watcher_event_interface.h create mode 100644 screen_connector_remote_surface_mock/CMakeLists.txt create mode 100644 screen_connector_remote_surface_mock/buffer_event_interface.h create mode 100644 screen_connector_remote_surface_mock/common.h create mode 100644 screen_connector_remote_surface_mock/handle.h create mode 100644 screen_connector_remote_surface_mock/remote_surface.h create mode 100644 screen_connector_remote_surface_mock/screen_connector_remote_surface_mock.pc.in create mode 100644 screen_connector_remote_surface_mock/trs_interface.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 219e233..b2292a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,9 @@ 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_mock) ADD_SUBDIRECTORY(screen_connector_remote_surface_evas) +ADD_SUBDIRECTORY(screen_connector_remote_surface_evas_mock) ADD_SUBDIRECTORY(screen_connector_watcher) ADD_SUBDIRECTORY(screen_connector_watcher_evas) ADD_SUBDIRECTORY(unittest) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index 53876dc..f3a6d5e 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -192,6 +192,23 @@ Header & package files to support development of the widget viewer applications. %attr(0644,root,root) %{_libdir}/%{name}_remote_surface.so ################################################# +# libscreen_connector_remote_surface_mock +################################################# +%package -n %{name}_remote_surface_mock +Summary: Mockup header for developing the screen connector remote surface +Group: Applications/Core Applications +License: Apache-2.0 + +%description -n %{name}_remote_surface_mock +Provider APIs to develop unittests. + +%license LICENSE + +%files -n %{name}_remote_surface_mock +%{_includedir}/screen_connector_remote_surface_mock/*.h +%{_libdir}/pkgconfig/screen_connector_remote_surface_mock.pc + +################################################# # libscreen_connector_remote_surface_evas ################################################# %package -n %{name}_remote_surface_evas @@ -224,6 +241,23 @@ Header & package files to support development of the widget viewer applications. %{_libdir}/pkgconfig/screen_connector_remote_surface_evas.pc %attr(0644,root,root) %{_libdir}/%{name}_remote_surface_evas.so +################################################# +# libscreen_connector_remote_surface_evas_mock +################################################# +%package -n %{name}_remote_surface_evas_mock +Summary: Mockup header for developing the screen connector remote surface evas +Group: Applications/Core Applications +Requires: %{name}_remote_surface_mock +License: Apache-2.0 + +%description -n %{name}_remote_surface_evas_mock +Provider APIs to develop unittests. + +%license LICENSE + +%files -n %{name}_remote_surface_evas_mock +%{_includedir}/screen_connector_remote_surface_evas_mock/*.h +%{_libdir}/pkgconfig/screen_connector_remote_surface_evas_mock.pc ################################################# # gtest-screen-connector diff --git a/screen_connector_remote_surface_evas_mock/CMakeLists.txt b/screen_connector_remote_surface_evas_mock/CMakeLists.txt new file mode 100644 index 0000000..b203229 --- /dev/null +++ b/screen_connector_remote_surface_evas_mock/CMakeLists.txt @@ -0,0 +1,22 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(screen_connector_remote_surface_evas_mock 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 1) +SET(VERSION "${VERSION_MAJOR}.0.0") + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") +SET(CMAKE_CXX_FLAGS_RELEASE "-O2") + +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc") + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION include/${PROJECT_NAME} FILES_MATCHING + PATTERN "*_internal.h" + PATTERN "*_implementation.h" EXCLUDE + PATTERN "*.h") diff --git a/screen_connector_remote_surface_evas_mock/evas_event_interface.h b/screen_connector_remote_surface_evas_mock/evas_event_interface.h new file mode 100644 index 0000000..3328f94 --- /dev/null +++ b/screen_connector_remote_surface_evas_mock/evas_event_interface.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020 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_REMOTE_SURFACE_EVAS_EVAS_EVENT_INTERFACE_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_EVAS_EVENT_INTERFACE_H_ + +#include + +#include + +namespace screen_connector { + +class IEvasEvent { + public: + virtual void OnEvasAdded(const std::string& appId, const std::string& instId, + int pid, + const EvasObject& image) = 0; + virtual void OnEvasRemoved(const std::string& appId, + const std::string& instId, + int pid, + const EvasObject& image) = 0; + virtual void OnEvasChanged(const std::string& appId, + const std::string& instId, int pid, + const EvasObject& image) = 0; +}; + +} // namespace screen_connector + +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_EVAS_EVENT_INTERFACE_H_ diff --git a/screen_connector_remote_surface_evas_mock/evas_object.h b/screen_connector_remote_surface_evas_mock/evas_object.h new file mode 100644 index 0000000..62572d8 --- /dev/null +++ b/screen_connector_remote_surface_evas_mock/evas_object.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2020 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_REMOTE_SURFACE_EVAS_EVAS_OBJECT_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_EVAS_OBJECT_H_ + +#include + +#include + +namespace screen_connector { + +class EvasObject : public Handle { + public: + EvasObject(Evas_Object* raw, bool owner) + : Handle(raw, owner) {} + virtual ~EvasObject() {} +}; + +} // namespace screen_connector + +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_EVAS_OBJECT_H_ diff --git a/screen_connector_remote_surface_evas_mock/remote_surface_evas.h b/screen_connector_remote_surface_evas_mock/remote_surface_evas.h new file mode 100644 index 0000000..47acf3c --- /dev/null +++ b/screen_connector_remote_surface_evas_mock/remote_surface_evas.h @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2020 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_REMOTE_SURFACE_EVAS_REMOTE_SURFACE_EVAS_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_REMOTE_SURFACE_EVAS_H_ + +#include +#include +#include + +#include +#include +#include + + +namespace screen_connector { + +class RemoteSurfaceEvas : public RemoteSurface, public IEvasEvent { + public: + enum Visibility { + UNOBSCURED, + PARTIALLY_OBSCURED, + FULLY_OBSCURED, + UNKNOWN + }; + + RemoteSurfaceEvas(const std::string& id, RemoteSurface::Type type, + std::shared_ptr viewerWin, bool mock = false) + : RemoteSurface(id, type, nullptr, mock) {} + RemoteSurfaceEvas(int rid, const std::string& id, RemoteSurface::Type type, + std::shared_ptr viewerWin, bool mock = false) + : RemoteSurface(rid, id, type, nullptr, mock) {} + + virtual void Bind(const EvasObject& win) {} + virtual bool IsVisibleArea() const { return false; } + virtual void SendMouseUp() {} + virtual Visibility GetVisibility() const { return UNOBSCURED; } + virtual void NotifyWindowVisibilityEvent(int type, void* event) {} + + public: + void Unbind() override {} + + virtual void SetAutoVisibility(bool enable) {} + + void SetChangedEventFilter(RemoteSurface::ChangedEventFilter filter) override {} + + void OnBufferAdded(const std::string& appId, const std::string& instId, + int pid) override {} + void OnBufferRemoved(const std::string& appId, const std::string& instId, + int pid) override {} + void OnBufferChanged(int type, std::shared_ptr tbm, int fd, + uint32_t size, uint32_t time) override {} + void OnBind() override {} + void OnEvasAdded(const std::string& appId, const std::string& instId, + int pid, const EvasObject& image) override {} + void OnEvasRemoved(const std::string& appId, const std::string& instId, + int pid, const EvasObject& image) override {} + void OnEvasChanged(const std::string& appId, const std::string& instId, + int pid, const EvasObject& image) override {} + virtual void ClearNoRenderTimer() {} + virtual void NoRenderPush(int timeout) {} +}; + +} // namespace screen_connector + +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_REMOTE_SURFACE_EVAS_H_ diff --git a/screen_connector_remote_surface_evas_mock/remote_surface_watcher.h b/screen_connector_remote_surface_evas_mock/remote_surface_watcher.h new file mode 100644 index 0000000..0fce2d7 --- /dev/null +++ b/screen_connector_remote_surface_evas_mock/remote_surface_watcher.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 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_REMOTE_SURFACE_EVAS_REMOTE_SURFACE_WATCHER_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_REMOTE_SURFACE_WATCHER_H_ + +#include +#include +#include +#include + +#include +#include +#include + +namespace screen_connector { +class RemoteSurfaceWatcher : public IWatcherEvent { + public: + RemoteSurfaceWatcher(RemoteSurface::Type type, + std::shared_ptr viewerWin) {} + RemoteSurfaceWatcher(RemoteSurface::Type type, + std::shared_ptr viewerWin, + bool watchFocusedOnly, bool mock = false) {} + + public: + virtual void SetChangedEventFilter(RemoteSurface::ChangedEventFilter filter) {} + virtual int SetRemoteRender() { return 0; } + virtual int SetBlock(bool enable) { return 0; } + void OnWatcherAdded(const std::string& appId, const std::string& instId, + const int pid) override {} + void OnWatcherChanged(const std::string& appId, const std::string& instId, + const int pid, const EvasObject& image) override {} + void OnWatcherRemoved(const std::string& appId, const std::string& instId, + const int pid) override {} + void OnWatcherFocusChanged(const std::string& appId, + const std::string& instId, const int pid) override {} +}; + +} // namespace screen_connector + +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_REMOTE_SURFACE_WATCHER_H_ diff --git a/screen_connector_remote_surface_evas_mock/screen_connector_remote_surface_evas_mock.pc.in b/screen_connector_remote_surface_evas_mock/screen_connector_remote_surface_evas_mock.pc.in new file mode 100644 index 0000000..ec32898 --- /dev/null +++ b/screen_connector_remote_surface_evas_mock/screen_connector_remote_surface_evas_mock.pc.in @@ -0,0 +1,11 @@ +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ + +Name: screen_connector_remote_surface_evas_mock +Description: Support development of unittest +Version: @VERSION@ +Requires: screen_connector_remote_surface_mock +Cflags: -I${includedir} +cppflags: -I${includedir} diff --git a/screen_connector_remote_surface_evas_mock/watcher_event_interface.h b/screen_connector_remote_surface_evas_mock/watcher_event_interface.h new file mode 100644 index 0000000..91f8812 --- /dev/null +++ b/screen_connector_remote_surface_evas_mock/watcher_event_interface.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020 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_REMOTE_SURFACE_EVAS_WATCHER_EVENT_INTERFACE_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_WATCHER_EVENT_INTERFACE_H_ + +#include + +#include + +namespace screen_connector { + +class IWatcherEvent { + public: + virtual void OnWatcherAdded(const std::string& appId, + const std::string& instId, int pid) = 0; + virtual void OnWatcherRemoved(const std::string& appId, + const std::string& instId, int pid) = 0; + virtual void OnWatcherChanged(const std::string& appId, + const std::string& instId, int pid, + const EvasObject& image) = 0; + virtual void OnWatcherFocusChanged(const std::string& appId, + const std::string& instId, int pid) = 0; +}; + +} // namespace screen_connector + +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_WATCHER_EVENT_INTERFACE_H_ diff --git a/screen_connector_remote_surface_mock/CMakeLists.txt b/screen_connector_remote_surface_mock/CMakeLists.txt new file mode 100644 index 0000000..32da7d9 --- /dev/null +++ b/screen_connector_remote_surface_mock/CMakeLists.txt @@ -0,0 +1,18 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(screen_connector_remote_surface_mock 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 1) +SET(VERSION "${VERSION_MAJOR}.0.0") + +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc") + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION include/${PROJECT_NAME} FILES_MATCHING + PATTERN "*_internal.h" + PATTERN "*_implementation.h" EXCLUDE + PATTERN "*.h") diff --git a/screen_connector_remote_surface_mock/buffer_event_interface.h b/screen_connector_remote_surface_mock/buffer_event_interface.h new file mode 100644 index 0000000..c709250 --- /dev/null +++ b/screen_connector_remote_surface_mock/buffer_event_interface.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020 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_REMOTE_SURFACE_BUFFER_EVENT_INTERFACE_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_BUFFER_EVENT_INTERFACE_H_ + +#include +#include + +#include +#include + +namespace screen_connector { + +class IBufferEvent { + public: + virtual void OnBufferAdded(const std::string& appId, + const std::string& instId, int pid) = 0; + virtual void OnBufferRemoved(const std::string& appId, + const std::string& instId, int pid) = 0; + virtual void OnBufferChanged(int type, std::shared_ptr tbm, int fd, + uint32_t size, uint32_t time) = 0; + virtual void OnBind() = 0; +}; + +} // namespace screen_connector + +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_BUFFER_EVENT_INTERFACE_H_ diff --git a/screen_connector_remote_surface_mock/common.h b/screen_connector_remote_surface_mock/common.h new file mode 100644 index 0000000..a906730 --- /dev/null +++ b/screen_connector_remote_surface_mock/common.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020 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_REMOTE_SURFACE_COMMON_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_COMMON_H_ + +#ifdef EXPORT_API +#undef EXPORT_API +#endif +#define EXPORT_API __attribute__((visibility("default"))) + +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_COMMON_H_ diff --git a/screen_connector_remote_surface_mock/handle.h b/screen_connector_remote_surface_mock/handle.h new file mode 100644 index 0000000..8fac6db --- /dev/null +++ b/screen_connector_remote_surface_mock/handle.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2020 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_REMOTE_SURFACE_HANDLE_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_HANDLE_H_ + +#include +#include +#include +#include +#include + +#include + +namespace screen_connector { + +template +class Handle { + public: + Handle(T raw, bool owner) : raw_(raw), owner_(owner) { } + virtual ~Handle() { } + + T GetRaw() const { return raw_; } + bool IsOwner() { return owner_; } + void SetIsOwner(bool owner) { + owner_ = owner; + } + + private: + T raw_; + bool owner_; +}; + +class WlBuffer : public Handle { + public: + WlBuffer(struct wl_buffer* raw, struct tizen_remote_surface* trs, bool owner) + : Handle(raw, owner) {} + + virtual ~WlBuffer() {} +}; + +class WlSurface : public Handle { + public: + WlSurface(struct wl_surface* raw, bool owner) : + Handle(raw, owner) { } + + virtual ~WlSurface() { } +}; + +class TbmSurface : public Handle { + public: + TbmSurface(tbm_surface_h raw, bool owner) : + Handle(raw, owner) { } + + virtual ~TbmSurface() {} +}; + +} // namespace screen_connector + +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_HANDLE_H_ diff --git a/screen_connector_remote_surface_mock/remote_surface.h b/screen_connector_remote_surface_mock/remote_surface.h new file mode 100644 index 0000000..86ad8a5 --- /dev/null +++ b/screen_connector_remote_surface_mock/remote_surface.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2020 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_REMOTE_SURFACE_REMOTE_SURFACE_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_REMOTE_SURFACE_H_ + +#include +#include + +#include +#include +#include + +namespace screen_connector { + +class RemoteSurface : public IBufferEvent { + public: + enum Type { + WIDGET = 0x1, + WATCH = 0x2, + UI = 0x4, + ALL = WIDGET | WATCH | UI + }; + + enum ChangedEventFilter { + FILTER_NONE, + FILTER_TBM, + FILTER_IMAGE_FILE, + FILTER_ALL + }; + + enum InputType { + MOUSE_UP_DOWN, + MOUSE_MOVE_X, + MOUSE_MOVE_Y, + MOUSE_MOVE_X_Y, + MOUSE_WHEEL, + TOUCH_UP_DOWN, + TOUCH_MOVE_X, + TOUCH_MOVE_Y, + TOUCH_MOVE_X_Y, + TOUCH_CANCEL, + KEY + }; + + RemoteSurface(const std::string& id, Type type, + std::shared_ptr wl_surface, bool mock = false) {} + RemoteSurface(int rid, const std::string& id, Type type, + std::shared_ptr wl_surface, bool mock = false) {} + virtual ~RemoteSurface() {} + + const std::string& GetAppId() const { + static std::string sAppid; + return sAppid; + } + + const std::string& GetInstId() const { + static std::string sInstId; + return sInstId; + } + + virtual int GetPid() const { return 0; } + virtual int GetRid() const { return 0; } + virtual Type GetType() const { return WIDGET; } + virtual bool IsFrozen() const { return false; } + virtual ITRS* GetRaw() { return nullptr; } + virtual ChangedEventFilter GetChangedEventFilter() const { return FILTER_NONE; } + virtual void SendVisibility(bool visible) {} + virtual void SendTouchCancel() {} + virtual void SendMouseUp(int x, int y, unsigned int timestamp) {} + virtual void Bind(std::shared_ptr surface) {} + virtual void Freeze(bool visible) {} + virtual void Thaw() {} + virtual void SetChangedEventFilter(ChangedEventFilter filter) {}; + virtual bool IsDisabledInput(InputType type) const { return false; } + virtual bool IsRemoteRender() const { return false; } + virtual void ClearRemoteRender() {} + virtual int SetRemoteRender() { return 0; } + virtual void SetBlock(bool is_block) {} + virtual void Unbind() {} + virtual bool IsBound() const { return false; } + void OnBufferAdded(const std::string& appId, + const std::string& instId, int pid) override {} + void OnBufferRemoved(const std::string& appId, + const std::string& instId, int pid) override {} + void OnBufferChanged(int type, std::shared_ptr tbm, int fd, + uint32_t size, uint32_t time) override {} + void OnBind() override {} + + static void SetDelayedResumingTime(uint32_t ms) {} + static void InitManager() {} + static void FiniManager() {} + +}; + +} // namespace screen_connector + +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_REMOTE_SURFACE_H_ diff --git a/screen_connector_remote_surface_mock/screen_connector_remote_surface_mock.pc.in b/screen_connector_remote_surface_mock/screen_connector_remote_surface_mock.pc.in new file mode 100644 index 0000000..18945fd --- /dev/null +++ b/screen_connector_remote_surface_mock/screen_connector_remote_surface_mock.pc.in @@ -0,0 +1,10 @@ +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ + +Name: screen_connector_remote_surface_mock +Description: Support development of the screen connector remote surface library +Version: @VERSION@ +Cflags: -I${includedir} +cppflags: -I${includedir} diff --git a/screen_connector_remote_surface_mock/trs_interface.h b/screen_connector_remote_surface_mock/trs_interface.h new file mode 100644 index 0000000..3a3a9c9 --- /dev/null +++ b/screen_connector_remote_surface_mock/trs_interface.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2020 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_REMOTE_SURFACE_TRS_INTERFACE_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_TRS_INTERFACE_H_ + +#include + +#include +#include + +#include + +namespace screen_connector { + +class ITRS { + public: + class IEventListener { + public: + virtual void OnRawBufferMissing() = 0; + virtual void OnRawBufferChanged(int type, std::shared_ptr tbm, + int fd, uint32_t size, uint32_t time) = 0; + virtual void OnInputFilterChanged(uint32_t event_filter) = 0; + }; + + virtual ~ITRS() = default; + virtual struct tizen_remote_surface* GetHandle() const = 0; + virtual void TransferVisibility(bool visible) = 0; + virtual void TransferTouchCancel() = 0; + virtual void TransferMouseUp(int x, int y, unsigned int timestamp) = 0; + virtual void SetRemoteRender(bool set) = 0; + virtual void SetChangedBufferEventFilter(int filter) = 0; + virtual void AddListener(IEventListener* listener) = 0; + virtual void Redirect() = 0; + virtual void TransferTouchEvent(uint32_t event_type, int32_t device, + int32_t button, int32_t x, int32_t y, + wl_fixed_t radius_x, wl_fixed_t radius_y, + wl_fixed_t pressure, wl_fixed_t angle, + uint32_t clas, uint32_t subclas, + const char *identifier, uint32_t time) = 0; + virtual void TransferMouseEvent(uint32_t event_type, int32_t device, + int32_t button, int32_t x, int32_t y, + wl_fixed_t radius_x, wl_fixed_t radius_y, + wl_fixed_t pressure, wl_fixed_t angle, + uint32_t clas, uint32_t subclas, + const char *identifier, uint32_t time) = 0; + virtual void TransferMouseWheel(uint32_t direction, int32_t z, uint32_t clas, + uint32_t subclas, const char *identifier, + uint32_t time) = 0; +}; + +} // namespace screen_connector + +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_TRS_INTERFACE_H_ -- 2.7.4 From 9ba83d839d3049d711d42b2102a840c8e7cd6ed3 Mon Sep 17 00:00:00 2001 From: hyunho Date: Wed, 27 May 2020 11:15:06 +0900 Subject: [PATCH 10/16] Release version 1.6.19 Changes: - Add mockup packages to improve testability Change-Id: I15551cd1ff6bd5e506db3941660ee0d99da73baa Signed-off-by: hyunho --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index f3a6d5e..bbfda14 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.6.18 +Version: 1.6.19 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 4775e9633ac75e638289f47a70cfa04e329d5543 Mon Sep 17 00:00:00 2001 From: hyunho Date: Fri, 5 Jun 2020 14:07:45 +0900 Subject: [PATCH 11/16] Remove image event handling logic from RemoteSurfaceEvas Change-Id: Ibb48123aa6ec420cfe18e7d5ed55ea2ec86eb6d5 Signed-off-by: hyunho --- screen_connector_remote_surface/handle.h | 1 - screen_connector_remote_surface/remote_surface.cc | 18 - screen_connector_remote_surface/remote_surface.h | 15 - .../screen_connector_remote_surface.pc.in | 1 + screen_connector_remote_surface/trs_interface.h | 15 + screen_connector_remote_surface/trs_internal.h | 20 +- screen_connector_remote_surface_evas/image.cc | 4 +- .../{image_internal.h => image.h} | 29 +- .../image_event_listener.cc | 375 +++++++++++++++++++++ .../image_event_listener.h | 57 ++++ .../image_mock_internal.h | 4 +- .../remote_surface_evas.cc | 357 +------------------- .../remote_surface_evas_implementation.h | 19 +- screen_connector_remote_surface_evas/util.cc | 20 ++ screen_connector_remote_surface_evas/util.h | 1 + 15 files changed, 504 insertions(+), 432 deletions(-) rename screen_connector_remote_surface_evas/{image_internal.h => image.h} (62%) create mode 100644 screen_connector_remote_surface_evas/image_event_listener.cc create mode 100644 screen_connector_remote_surface_evas/image_event_listener.h diff --git a/screen_connector_remote_surface/handle.h b/screen_connector_remote_surface/handle.h index f129713..c0f70fb 100644 --- a/screen_connector_remote_surface/handle.h +++ b/screen_connector_remote_surface/handle.h @@ -17,7 +17,6 @@ #ifndef SCREEN_CONNECTOR_REMOTE_SURFACE_HANDLE_H_ #define SCREEN_CONNECTOR_REMOTE_SURFACE_HANDLE_H_ -#include #include #include #include diff --git a/screen_connector_remote_surface/remote_surface.cc b/screen_connector_remote_surface/remote_surface.cc index a1f668b..7b166a1 100644 --- a/screen_connector_remote_surface/remote_surface.cc +++ b/screen_connector_remote_surface/remote_surface.cc @@ -40,20 +40,6 @@ std::map RemoteSurface::Impl::buffer_event_table_ = { TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM |TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE} }; -std::map RemoteSurface::Impl::input_type_table_ = { - {MOUSE_UP_DOWN, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_UP_DOWN}, - {MOUSE_MOVE_X, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_X}, - {MOUSE_MOVE_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_Y}, - {MOUSE_MOVE_X_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_X_Y}, - {MOUSE_WHEEL, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_WHEEL_ALL}, - {TOUCH_UP_DOWN, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_UP_DOWN}, - {TOUCH_MOVE_X, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_X}, - {TOUCH_MOVE_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_Y}, - {TOUCH_MOVE_X_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_X_Y}, - {TOUCH_CANCEL, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_CANCEL_ALL}, - {KEY, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_KEY_ALL} -}; - void RemoteSurface::InitManager() { (void)RemoteSurfaceManager::GetInst(); } @@ -304,10 +290,6 @@ void RemoteSurface::SetBlock(bool is_block) { impl_->block_ = is_block; } -bool RemoteSurface::IsDisabledInput(InputType type) const { - return ((impl_->input_event_filter_ & impl_->input_type_table_[type]) > 0); -} - void RemoteSurface::OnBufferAdded(const std::string& appId, const std::string& instId, int pid) { } diff --git a/screen_connector_remote_surface/remote_surface.h b/screen_connector_remote_surface/remote_surface.h index 1851352..17e8b2c 100644 --- a/screen_connector_remote_surface/remote_surface.h +++ b/screen_connector_remote_surface/remote_surface.h @@ -42,20 +42,6 @@ class EXPORT_API RemoteSurface : public IBufferEvent { FILTER_ALL }; - enum InputType { - MOUSE_UP_DOWN, - MOUSE_MOVE_X, - MOUSE_MOVE_Y, - MOUSE_MOVE_X_Y, - MOUSE_WHEEL, - TOUCH_UP_DOWN, - TOUCH_MOVE_X, - TOUCH_MOVE_Y, - TOUCH_MOVE_X_Y, - TOUCH_CANCEL, - KEY - }; - RemoteSurface(const std::string& id, Type type, std::shared_ptr wl_surface, bool mock = false); RemoteSurface(int rid, const std::string& id, Type type, @@ -79,7 +65,6 @@ class EXPORT_API RemoteSurface : public IBufferEvent { void Freeze(bool visible); void Thaw(); virtual void SetChangedEventFilter(ChangedEventFilter filter); - bool IsDisabledInput(InputType type) const; bool IsRemoteRender() const; void ClearRemoteRender(); int SetRemoteRender(); diff --git a/screen_connector_remote_surface/screen_connector_remote_surface.pc.in b/screen_connector_remote_surface/screen_connector_remote_surface.pc.in index 1f8c65b..fc14b05 100644 --- a/screen_connector_remote_surface/screen_connector_remote_surface.pc.in +++ b/screen_connector_remote_surface/screen_connector_remote_surface.pc.in @@ -6,6 +6,7 @@ includedir=@INCLUDEDIR@ Name: screen_connector_remote_surface Description: Support development of the screen connector remote surface library Version: @VERSION@ +Requires: ecore-wl2 Libs: -L${libdir} -lscreen_connector_remote_surface Cflags: -I${includedir} cppflags: -I${includedir} diff --git a/screen_connector_remote_surface/trs_interface.h b/screen_connector_remote_surface/trs_interface.h index 12696de..9b8d250 100644 --- a/screen_connector_remote_surface/trs_interface.h +++ b/screen_connector_remote_surface/trs_interface.h @@ -36,6 +36,20 @@ class EXPORT_API ITRS { virtual void OnInputFilterChanged(uint32_t event_filter) = 0; }; + enum InputType { + MOUSE_UP_DOWN, + MOUSE_MOVE_X, + MOUSE_MOVE_Y, + MOUSE_MOVE_X_Y, + MOUSE_WHEEL, + TOUCH_UP_DOWN, + TOUCH_MOVE_X, + TOUCH_MOVE_Y, + TOUCH_MOVE_X_Y, + TOUCH_CANCEL, + KEY + }; + virtual ~ITRS() = default; virtual struct tizen_remote_surface* GetHandle() const = 0; virtual void TransferVisibility(bool visible) = 0; @@ -45,6 +59,7 @@ class EXPORT_API ITRS { virtual void SetChangedBufferEventFilter(int filter) = 0; virtual void AddListener(IEventListener* listener) = 0; virtual void Redirect() = 0; + virtual uint32_t GetRawInputType(InputType type) = 0; virtual void TransferTouchEvent(uint32_t event_type, int32_t device, int32_t button, int32_t x, int32_t y, wl_fixed_t radius_x, wl_fixed_t radius_y, diff --git a/screen_connector_remote_surface/trs_internal.h b/screen_connector_remote_surface/trs_internal.h index 593a3de..ff2ad4b 100644 --- a/screen_connector_remote_surface/trs_internal.h +++ b/screen_connector_remote_surface/trs_internal.h @@ -18,7 +18,7 @@ #define SCREEN_CONNECTOR_REMOTE_SURFACE_TRS_INTERNAL_H_ #include - +#include #include #include "screen_connector_remote_surface/handle.h" @@ -127,7 +127,25 @@ class TRS : public Handle, public ITRS { subclas, identifier, time); } + uint32_t GetRawInputType(InputType type) override { + return input_type_table_[type]; + } + private: + std::map input_type_table_ = { + {MOUSE_UP_DOWN, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_UP_DOWN}, + {MOUSE_MOVE_X, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_X}, + {MOUSE_MOVE_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_Y}, + {MOUSE_MOVE_X_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_X_Y}, + {MOUSE_WHEEL, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_WHEEL_ALL}, + {TOUCH_UP_DOWN, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_UP_DOWN}, + {TOUCH_MOVE_X, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_X}, + {TOUCH_MOVE_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_Y}, + {TOUCH_MOVE_X_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_X_Y}, + {TOUCH_CANCEL, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_CANCEL_ALL}, + {KEY, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_KEY_ALL} + }; + static void BufferUpdatedCB(void* data, struct tizen_remote_surface* trs, struct wl_buffer* buffer, uint32_t time) { } diff --git a/screen_connector_remote_surface_evas/image.cc b/screen_connector_remote_surface_evas/image.cc index 28642b2..2c2aeec 100644 --- a/screen_connector_remote_surface_evas/image.cc +++ b/screen_connector_remote_surface_evas/image.cc @@ -16,7 +16,7 @@ #include -#include "screen_connector_remote_surface_evas/image_internal.h" +#include "screen_connector_remote_surface_evas/image.h" #ifdef LOG_TAG #undef LOG_TAG @@ -27,7 +27,7 @@ namespace screen_connector { -Image::Image(Evas_Object* raw, IEventListener* listener, +Image::Image(Evas_Object* raw, ImageEventListener* listener, const std::string& instId, int pid, void* tag) : EvasObject(raw, true), listener_(listener) { evas_object_image_alpha_set(GetRaw(), 1); diff --git a/screen_connector_remote_surface_evas/image_internal.h b/screen_connector_remote_surface_evas/image.h similarity index 62% rename from screen_connector_remote_surface_evas/image_internal.h rename to screen_connector_remote_surface_evas/image.h index 4b9f658..49ba39f 100644 --- a/screen_connector_remote_surface_evas/image_internal.h +++ b/screen_connector_remote_surface_evas/image.h @@ -14,35 +14,20 @@ * limitations under the License. */ -#ifndef SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_INTERNAL_H_ -#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_INTERNAL_H_ +#ifndef SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_H_ #include #include #include "screen_connector_remote_surface_evas/evas_object.h" +#include "screen_connector_remote_surface_evas/image_event_listener.h" namespace screen_connector { -class Image : public EvasObject { +class EXPORT_API Image : public EvasObject { public: - class IEventListener { - public: - virtual void OnMouseIn(const EvasObject& obj, void* eventInfo) = 0; - virtual void OnMouseOut(const EvasObject& obj, void* eventInfo) = 0; - virtual void OnMouseDown(const EvasObject& obj, void* eventInfo) = 0; - virtual void OnMouseUp(const EvasObject& obj, void* eventInfo) = 0; - virtual void OnTouchMultiDown(const EvasObject& obj, void* eventInfo) = 0; - virtual void OnTouchMultiUp(const EvasObject& obj, void* eventInfo) = 0; - virtual void OnMouseMove(const EvasObject& obj, void* eventInfo) = 0; - virtual void OnMouseWheel(const EvasObject& obj, void* eventInfo) = 0; - virtual void OnMove(const EvasObject& obj, void* eventInfo) = 0; - virtual void OnShow(const EvasObject& obj, void* eventInfo) = 0; - virtual void OnHide(const EvasObject& obj, void* eventInfo) = 0; - virtual void OnResize(const EvasObject& obj, void* eventInfo) = 0; - }; - - Image(Evas_Object* raw, IEventListener* listener, const std::string& instId, + Image(Evas_Object* raw, ImageEventListener* listener, const std::string& instId, int pid, void* tag); virtual ~Image(); @@ -70,10 +55,10 @@ class Image : public EvasObject { static void MoveCB(void* data, Evas* e, Evas_Object* obj, void* eventInfo); private: - IEventListener* listener_; + ImageEventListener* listener_; std::shared_ptr prev_buf_; }; } // namespace screen_connector -#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_INTERNAL_H_ +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_H_ diff --git a/screen_connector_remote_surface_evas/image_event_listener.cc b/screen_connector_remote_surface_evas/image_event_listener.cc new file mode 100644 index 0000000..9f66c67 --- /dev/null +++ b/screen_connector_remote_surface_evas/image_event_listener.cc @@ -0,0 +1,375 @@ +/* + * Copyright (c) 2020 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 + +#include "screen_connector_remote_surface_evas/image_event_listener.h" + +#ifdef LOG_TAG +#undef LOG_TAG +#endif + +#define LOG_TAG "SC_REMOTE_SURFACE" +#define SC_TOOLKIT_HANDLE_TAG "SC_TOOLKIT_HANDLE_TAG" + +namespace screen_connector { + +ImageEventListener::ImageEventListener(RemoteSurface* parent) + : parent_(parent), is_flick_enabled_(parent->GetType() == RemoteSurface::Type::WATCH) { +} + +void ImageEventListener::OnMouseIn(const EvasObject& obj, + void* eventInfo) { + Evas_Event_Mouse_In* ev = + static_cast(eventInfo); + const char* desc = evas_device_description_get(ev->dev); + int x; + int y; + int w; + int h; + + evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); + if (desc == NULL) + desc = ""; + + LOGD("mouse in: %d %d", ev->canvas.x - x, ev->canvas.y - y); + parent_->GetRaw()->TransferMouseEvent( + TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_IN, + 0, + 0, + ev->canvas.x - x, + ev->canvas.y - y, + 0, + 0, + 0, + 0, + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + +void ImageEventListener::OnMouseOut(const EvasObject& obj, + void* eventInfo) { + Evas_Event_Mouse_Out* ev = + static_cast(eventInfo); + const char* desc = evas_device_description_get(ev->dev); + int x; + int y; + int w; + int h; + + evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); + if (desc == NULL) + desc = ""; + + LOGD("mouse out: %d %d", ev->canvas.x - x, ev->canvas.y - y); + parent_->GetRaw()->TransferMouseEvent( + TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_OUT, + 0, + 0, + ev->canvas.x - x, + ev->canvas.y - y, + 0, + 0, + 0, + 0, + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + +void ImageEventListener::OnMouseDown(const EvasObject& obj, + void* eventInfo) { + Evas_Event_Mouse_Down* ev = + static_cast(eventInfo); + const char* desc = evas_device_description_get(ev->dev); + int x; + int y; + int w; + int h; + + if (IsDisabledInput(ITRS::MOUSE_UP_DOWN)) { + LOGD("mouse down disabled"); + return; + } + + evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); + + LOGD("mouse down: %d %d", ev->canvas.x - x, ev->canvas.y - y); + flick_ = false; + + if (is_flick_enabled_) + prev_y_ = ev->canvas.y - y; + + if (desc == NULL) + desc = ""; + + parent_->GetRaw()->TransferMouseEvent( + TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_DOWN, + 0, + ev->button, + ev->canvas.x - x, + ev->canvas.y - y, + wl_fixed_from_double(ev->radius_x), + wl_fixed_from_double(ev->radius_y), + wl_fixed_from_double(ev->pressure), + wl_fixed_from_double(ev->angle), + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + +void ImageEventListener::OnMouseUp(const EvasObject& obj, + void* eventInfo) { + Evas_Event_Mouse_Up* ev = + static_cast(eventInfo); + const char *desc = evas_device_description_get(ev->dev); + int x; + int y; + int w; + int h; + + if (IsDisabledInput(ITRS::MOUSE_UP_DOWN)) { + LOGD("mouse up disabled"); + return; + } + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) { + LOGD("Event canceled"); + parent_->GetRaw()->TransferTouchCancel(); + } + + evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); + LOGD("mouse up: %d %d", ev->canvas.x - x, ev->canvas.y - y); + + if (desc == NULL) + desc = ""; + + parent_->GetRaw()->TransferMouseEvent( + TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE, + 0, + 0, + ev->canvas.x - x, + ev->canvas.y - y, + wl_fixed_from_double(ev->radius_x), + wl_fixed_from_double(ev->radius_y), + wl_fixed_from_double(ev->pressure), + wl_fixed_from_double(ev->angle), + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); + + parent_->GetRaw()->TransferMouseEvent( + TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_UP, + 0, + ev->button, + ev->canvas.x - x, + ev->canvas.y - y, + wl_fixed_from_double(ev->radius_x), + wl_fixed_from_double(ev->radius_y), + wl_fixed_from_double(ev->pressure), + wl_fixed_from_double(ev->angle), + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + +void ImageEventListener::OnTouchMultiDown(const EvasObject& obj, + void* eventInfo) { + Evas_Event_Multi_Down* ev = + static_cast(eventInfo); + const char *desc = evas_device_description_get(ev->dev); + int x; + int y; + int w; + int h; + + if (IsDisabledInput(ITRS::TOUCH_UP_DOWN)) { + LOGD("touch-multi-down disabled"); + return; + } + + evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); + LOGD("multi down: %d %d", ev->canvas.x - x, ev->canvas.y - y); + + if (desc == NULL) + desc = ""; + + parent_->GetRaw()->TransferTouchEvent( + TIZEN_REMOTE_SURFACE_EVENT_TYPE_TOUCH_DOWN, + ev->device, + 1, + ev->canvas.x - x, + ev->canvas.y - y, + wl_fixed_from_double(ev->radius_x), + wl_fixed_from_double(ev->radius_y), + wl_fixed_from_double(ev->pressure), + wl_fixed_from_double(ev->angle), + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + +void ImageEventListener::OnTouchMultiUp(const EvasObject& obj, + void* eventInfo) { + Evas_Event_Multi_Up* ev = + static_cast(eventInfo); + const char *desc = evas_device_description_get(ev->dev); + int x; + int y; + int w; + int h; + + if (IsDisabledInput(ITRS::TOUCH_UP_DOWN)) { + LOGD("touch-multi-up disabled"); + return; + } + + evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); + LOGD("multi up: %d %d", ev->canvas.x - x, ev->canvas.y - y); + + if (desc == NULL) + desc = ""; + + parent_->GetRaw()->TransferTouchEvent( + TIZEN_REMOTE_SURFACE_EVENT_TYPE_TOUCH_UP, + ev->device, + 1, + ev->canvas.x - x, + ev->canvas.y - y, + wl_fixed_from_double(ev->radius_x), + wl_fixed_from_double(ev->radius_y), + wl_fixed_from_double(ev->pressure), + wl_fixed_from_double(ev->angle), + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + +void ImageEventListener::OnMouseMove(const EvasObject& obj, + void* eventInfo) { + Evas_Event_Mouse_Move* ev = + static_cast(eventInfo); + const char *desc = evas_device_description_get(ev->dev); + int x; + int y; + int w; + int h; + + if (IsDisabledInput(ITRS::MOUSE_MOVE_X_Y)) { + LOGD("mouse-move disabled"); + return; + } + + evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); + LOGD("mouse move: %d %d", ev->cur.canvas.x - x, ev->cur.canvas.y - y); + + if (desc == NULL) + desc = ""; + + if (is_flick_enabled_) { + if (flick_) { + LOGD("flick event"); + return; + } + + int deltaY = ev->cur.canvas.y - y - prev_y_; + if (deltaY < 0) + deltaY *= -1; + + if (deltaY > 10) { + flick_ = true; + return; + } + + prev_y_ = ev->cur.canvas.y - y; + } + + parent_->GetRaw()->TransferMouseEvent( + TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE, + 0, + 0, + ev->cur.canvas.x - x, + ev->cur.canvas.y - y, + wl_fixed_from_double(ev->radius_x), + wl_fixed_from_double(ev->radius_y), + wl_fixed_from_double(ev->pressure), + wl_fixed_from_double(ev->angle), + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + +void ImageEventListener::OnMouseWheel(const EvasObject& obj, + void* eventInfo) { + Evas_Event_Mouse_Wheel* ev = + static_cast(eventInfo); + const char *desc = evas_device_description_get(ev->dev); + + if (IsDisabledInput(ITRS::MOUSE_WHEEL)) { + LOGD("mouse-wheel disabled"); + return; + } + + LOGD("mouse wheel"); + if (desc == NULL) + desc = ""; + + parent_->GetRaw()->TransferMouseWheel( + ev->direction, + ev->z, + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + +void ImageEventListener::OnShow(const EvasObject& obj, void* eventInfo) { + LOGD("show"); +} + +void ImageEventListener::OnHide(const EvasObject& obj, void* eventInfo) { + LOGD("hide"); +} + +void ImageEventListener::OnResize(const EvasObject& obj, void* eventInfo) { + LOGD("resize"); +} + +void ImageEventListener::OnMove(const EvasObject& obj, void *eventInfo) { +} + +void ImageEventListener::SetInputEventFilter(uint32_t filter) { + input_event_filter_ = filter; +} + +bool ImageEventListener::IsDisabledInput(ITRS::InputType type) { + return ((input_event_filter_ & parent_->GetRaw()->GetRawInputType(type)) > 0); +} + +bool ImageEventListener::IsFlickEnabled(bool enable) { + return is_flick_enabled_; +} + +} \ No newline at end of file diff --git a/screen_connector_remote_surface_evas/image_event_listener.h b/screen_connector_remote_surface_evas/image_event_listener.h new file mode 100644 index 0000000..e394513 --- /dev/null +++ b/screen_connector_remote_surface_evas/image_event_listener.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2020 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_REMOTE_SURFACE_EVAS_IMAGE_EVENT_LISTENER_H_ +#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_EVENT_LISTENER_H_ + +#include +#include + +#include "screen_connector_remote_surface_evas/evas_object.h" +#include "screen_connector_remote_surface/remote_surface.h" +#include "screen_connector_remote_surface/trs_interface.h" + +namespace screen_connector { + +class EXPORT_API ImageEventListener { + public: + ImageEventListener(RemoteSurface* parent); + virtual void OnMouseIn(const EvasObject& obj, void* eventInfo); + virtual void OnMouseOut(const EvasObject& obj, void* eventInfo); + virtual void OnMouseDown(const EvasObject& obj, void* eventInfo); + virtual void OnMouseUp(const EvasObject& obj, void* eventInfo); + virtual void OnTouchMultiDown(const EvasObject& obj, void* eventInfo); + virtual void OnTouchMultiUp(const EvasObject& obj, void* eventInfo); + virtual void OnMouseMove(const EvasObject& obj, void* eventInfo); + virtual void OnMouseWheel(const EvasObject& obj, void* eventInfo); + virtual void OnMove(const EvasObject& obj, void* eventInfo); + virtual void OnShow(const EvasObject& obj, void* eventInfo); + virtual void OnHide(const EvasObject& obj, void* eventInfo); + virtual void OnResize(const EvasObject& obj, void* eventInfo); + void SetInputEventFilter(uint32_t filter); + bool IsDisabledInput(ITRS::InputType type); + bool IsFlickEnabled(bool enable); + + private: + RemoteSurface* parent_ = nullptr; + bool is_flick_enabled_ = false; + uint32_t input_event_filter_ = 0; + bool flick_ = false; + int prev_y_ = 0; +}; +} + +#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_EVENT_LISTENER_H_ \ No newline at end of file diff --git a/screen_connector_remote_surface_evas/image_mock_internal.h b/screen_connector_remote_surface_evas/image_mock_internal.h index 7de3ef3..23aa32e 100644 --- a/screen_connector_remote_surface_evas/image_mock_internal.h +++ b/screen_connector_remote_surface_evas/image_mock_internal.h @@ -20,14 +20,14 @@ #include #include -#include "screen_connector_remote_surface_evas/image_internal.h" +#include "screen_connector_remote_surface_evas/image.h" namespace screen_connector { namespace test { class ImageMock : public Image { public: - ImageMock(Evas_Object* raw, IEventListener* listener, + ImageMock(Evas_Object* raw, ImageEventListener* listener, const std::string& instId, int pid, void* tag) : Image(raw, listener, instId, pid, tag) {} virtual ~ImageMock() {} diff --git a/screen_connector_remote_surface_evas/remote_surface_evas.cc b/screen_connector_remote_surface_evas/remote_surface_evas.cc index 121e677..b72710b 100644 --- a/screen_connector_remote_surface_evas/remote_surface_evas.cc +++ b/screen_connector_remote_surface_evas/remote_surface_evas.cc @@ -60,362 +60,11 @@ RemoteSurfaceEvas& RemoteSurfaceEvas::operator=( RemoteSurfaceEvas::Impl::Impl(RemoteSurfaceEvas* parent, std::shared_ptr viewerWin, bool mock) - : viewer_win_(viewerWin), parent_(parent), mock_(mock), - win_ctx_(mock ? nullptr : new WindowContext()) { + : ImageEventListener((RemoteSurface*)parent), + viewer_win_(viewerWin), parent_(parent), mock_(mock), + win_ctx_(mock ? nullptr : new WindowContext()) { } -void RemoteSurfaceEvas::Impl::OnMouseIn(const EvasObject& obj, - void* eventInfo) { - Evas_Event_Mouse_In* ev = - static_cast(eventInfo); - const char* desc = evas_device_description_get(ev->dev); - int x; - int y; - int w; - int h; - - evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); - if (desc == NULL) - desc = ""; - - LOGD("mouse in: %d %d", ev->canvas.x - x, ev->canvas.y - y); - parent_->GetRaw()->TransferMouseEvent( - TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_IN, - 0, - 0, - ev->canvas.x - x, - ev->canvas.y - y, - 0, - 0, - 0, - 0, - evas_device_class_get(ev->dev), - evas_device_subclass_get(ev->dev), - desc, - ev->timestamp); -} - -void RemoteSurfaceEvas::Impl::OnMouseOut(const EvasObject& obj, - void* eventInfo) { - Evas_Event_Mouse_Out* ev = - static_cast(eventInfo); - const char* desc = evas_device_description_get(ev->dev); - int x; - int y; - int w; - int h; - - evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); - if (desc == NULL) - desc = ""; - - LOGD("mouse out: %d %d", ev->canvas.x - x, ev->canvas.y - y); - parent_->GetRaw()->TransferMouseEvent( - TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_OUT, - 0, - 0, - ev->canvas.x - x, - ev->canvas.y - y, - 0, - 0, - 0, - 0, - evas_device_class_get(ev->dev), - evas_device_subclass_get(ev->dev), - desc, - ev->timestamp); -} - -void RemoteSurfaceEvas::Impl::OnMouseDown(const EvasObject& obj, - void* eventInfo) { - Evas_Event_Mouse_Down* ev = - static_cast(eventInfo); - const char* desc = evas_device_description_get(ev->dev); - int x; - int y; - int w; - int h; - - if (parent_->IsDisabledInput(RemoteSurface::MOUSE_UP_DOWN)) { - LOGD("mouse down disabled"); - return; - } - - evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); - - LOGD("mouse down: %d %d", ev->canvas.x - x, ev->canvas.y - y); - flick_ = false; - - if (parent_->GetType() == RemoteSurface::WATCH) - prev_y_ = ev->canvas.y - y; - - if (desc == NULL) - desc = ""; - - parent_->GetRaw()->TransferMouseEvent( - TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_DOWN, - 0, - ev->button, - ev->canvas.x - x, - ev->canvas.y - y, - wl_fixed_from_double(ev->radius_x), - wl_fixed_from_double(ev->radius_y), - wl_fixed_from_double(ev->pressure), - wl_fixed_from_double(ev->angle), - evas_device_class_get(ev->dev), - evas_device_subclass_get(ev->dev), - desc, - ev->timestamp); -} - -void RemoteSurfaceEvas::Impl::OnMouseUp(const EvasObject& obj, - void* eventInfo) { - Evas_Event_Mouse_Up* ev = - static_cast(eventInfo); - const char *desc = evas_device_description_get(ev->dev); - int x; - int y; - int w; - int h; - - if (parent_->IsDisabledInput(RemoteSurface::MOUSE_UP_DOWN)) { - LOGD("mouse up disabled"); - return; - } - - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) { - LOGD("Event canceled"); - parent_->SendTouchCancel(); - } - - evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); - LOGD("mouse up: %d %d", ev->canvas.x - x, ev->canvas.y - y); - - if (desc == NULL) - desc = ""; - - parent_->GetRaw()->TransferMouseEvent( - TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE, - 0, - 0, - ev->canvas.x - x, - ev->canvas.y - y, - wl_fixed_from_double(ev->radius_x), - wl_fixed_from_double(ev->radius_y), - wl_fixed_from_double(ev->pressure), - wl_fixed_from_double(ev->angle), - evas_device_class_get(ev->dev), - evas_device_subclass_get(ev->dev), - desc, - ev->timestamp); - - parent_->GetRaw()->TransferMouseEvent( - TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_UP, - 0, - ev->button, - ev->canvas.x - x, - ev->canvas.y - y, - wl_fixed_from_double(ev->radius_x), - wl_fixed_from_double(ev->radius_y), - wl_fixed_from_double(ev->pressure), - wl_fixed_from_double(ev->angle), - evas_device_class_get(ev->dev), - evas_device_subclass_get(ev->dev), - desc, - ev->timestamp); -} - -void RemoteSurfaceEvas::Impl::OnTouchMultiDown(const EvasObject& obj, - void* eventInfo) { - Evas_Event_Multi_Down* ev = - static_cast(eventInfo); - const char *desc = evas_device_description_get(ev->dev); - int x; - int y; - int w; - int h; - - if (parent_->IsDisabledInput(RemoteSurface::TOUCH_UP_DOWN)) { - LOGD("touch-multi-down disabled"); - return; - } - - evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); - LOGD("multi down: %d %d", ev->canvas.x - x, ev->canvas.y - y); - - if (desc == NULL) - desc = ""; - - parent_->GetRaw()->TransferTouchEvent( - TIZEN_REMOTE_SURFACE_EVENT_TYPE_TOUCH_DOWN, - ev->device, - 1, - ev->canvas.x - x, - ev->canvas.y - y, - wl_fixed_from_double(ev->radius_x), - wl_fixed_from_double(ev->radius_y), - wl_fixed_from_double(ev->pressure), - wl_fixed_from_double(ev->angle), - evas_device_class_get(ev->dev), - evas_device_subclass_get(ev->dev), - desc, - ev->timestamp); -} - -void RemoteSurfaceEvas::Impl::OnTouchMultiUp(const EvasObject& obj, - void* eventInfo) { - Evas_Event_Multi_Up* ev = - static_cast(eventInfo); - const char *desc = evas_device_description_get(ev->dev); - int x; - int y; - int w; - int h; - - if (parent_->IsDisabledInput(RemoteSurface::TOUCH_UP_DOWN)) { - LOGD("touch-multi-up disabled"); - return; - } - - evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); - LOGD("multi up: %d %d", ev->canvas.x - x, ev->canvas.y - y); - - if (desc == NULL) - desc = ""; - - parent_->GetRaw()->TransferTouchEvent( - TIZEN_REMOTE_SURFACE_EVENT_TYPE_TOUCH_UP, - ev->device, - 1, - ev->canvas.x - x, - ev->canvas.y - y, - wl_fixed_from_double(ev->radius_x), - wl_fixed_from_double(ev->radius_y), - wl_fixed_from_double(ev->pressure), - wl_fixed_from_double(ev->angle), - evas_device_class_get(ev->dev), - evas_device_subclass_get(ev->dev), - desc, - ev->timestamp); -} - -void RemoteSurfaceEvas::Impl::OnMouseMove(const EvasObject& obj, - void* eventInfo) { - Evas_Event_Mouse_Move* ev = - static_cast(eventInfo); - const char *desc = evas_device_description_get(ev->dev); - int x; - int y; - int w; - int h; - - if (parent_->IsDisabledInput(RemoteSurface::MOUSE_MOVE_X_Y)) { - LOGD("mouse-move disabled"); - return; - } - - evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h); - LOGD("mouse move: %d %d", ev->cur.canvas.x - x, ev->cur.canvas.y - y); - - if (desc == NULL) - desc = ""; - - if (parent_->GetType() == RemoteSurface::WATCH) { - if (flick_) { - LOGD("flick event"); - return; - } - - int deltaY = ev->cur.canvas.y - y - prev_y_; - if (deltaY < 0) - deltaY *= -1; - - if (deltaY > 10) { - flick_ = true; - return; - } - - prev_y_ = ev->cur.canvas.y - y; - } - - parent_->GetRaw()->TransferMouseEvent( - TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE, - 0, - 0, - ev->cur.canvas.x - x, - ev->cur.canvas.y - y, - wl_fixed_from_double(ev->radius_x), - wl_fixed_from_double(ev->radius_y), - wl_fixed_from_double(ev->pressure), - wl_fixed_from_double(ev->angle), - evas_device_class_get(ev->dev), - evas_device_subclass_get(ev->dev), - desc, - ev->timestamp); -} - -void RemoteSurfaceEvas::Impl::OnMouseWheel(const EvasObject& obj, - void* eventInfo) { - Evas_Event_Mouse_Wheel* ev = - static_cast(eventInfo); - const char *desc = evas_device_description_get(ev->dev); - - if (parent_->IsDisabledInput(RemoteSurface::MOUSE_WHEEL)) { - LOGD("mouse-wheel disabled"); - return; - } - - LOGD("mouse wheel"); - if (desc == NULL) - desc = ""; - - parent_->GetRaw()->TransferMouseWheel( - ev->direction, - ev->z, - evas_device_class_get(ev->dev), - evas_device_subclass_get(ev->dev), - desc, - ev->timestamp); -} - -void RemoteSurfaceEvas::Impl::OnShow(const EvasObject& obj, void* eventInfo) { - LOGD("show"); - OnMove(obj, eventInfo); -} - -void RemoteSurfaceEvas::Impl::OnHide(const EvasObject& obj, void* eventInfo) { - LOGD("hide"); -} - -void RemoteSurfaceEvas::Impl::OnResize(const EvasObject& obj, void* eventInfo) { - LOGD("resize"); - OnMove(obj, eventInfo); -} - -void RemoteSurfaceEvas::Impl::OnMove(const EvasObject& obj, void *eventInfo) { - if (!is_init_) { - is_init_ = true; - return; - } - - if (!auto_visibility_) - return; - - Ecore_Wl2_Window *window = NULL; - Ecore_Evas *ee; - ee = ecore_evas_ecore_evas_get( - evas_object_evas_get(viewer_win_->GetRaw())); - window = ecore_evas_wayland2_window_get(ee); - - unsigned int win_id = ecore_wl2_window_id_get(window); - if (parent_->IsVisibleArea() && !parent_->impl_->win_ctx_->IsFullyObscured(win_id)) { - parent_->SendVisibility(true); - visibility_ = RemoteSurfaceEvas::UNOBSCURED; - } else { - parent_->SendVisibility(false); - visibility_ = RemoteSurfaceEvas::FULLY_OBSCURED; - } -} bool RemoteSurfaceEvas::IsVisibleArea() const { int x, y, w, h; diff --git a/screen_connector_remote_surface_evas/remote_surface_evas_implementation.h b/screen_connector_remote_surface_evas/remote_surface_evas_implementation.h index 7280aee..096fcac 100644 --- a/screen_connector_remote_surface_evas/remote_surface_evas_implementation.h +++ b/screen_connector_remote_surface_evas/remote_surface_evas_implementation.h @@ -24,26 +24,13 @@ #include "screen_connector_remote_surface_evas/evas_event_interface.h" #include "screen_connector_remote_surface/remote_surface.h" #include "screen_connector_remote_surface_evas/remote_surface_evas.h" -#include "screen_connector_remote_surface_evas/image_internal.h" +#include "screen_connector_remote_surface_evas/image.h" #include "screen_connector_remote_surface/window_context.h" namespace screen_connector { -class RemoteSurfaceEvas::Impl : public Image::IEventListener { +class RemoteSurfaceEvas::Impl : public ImageEventListener { public: - void OnMouseIn(const EvasObject& obj, void* eventInfo) override; - void OnMouseOut(const EvasObject& obj, void* eventInfo) override; - void OnMouseDown(const EvasObject& obj, void* eventInfo) override; - void OnMouseUp(const EvasObject& obj, void* eventInfo) override; - void OnTouchMultiDown(const EvasObject& obj, void* eventInfo) override; - void OnTouchMultiUp(const EvasObject& obj, void* eventInfo) override; - void OnMouseMove(const EvasObject& obj, void* eventInfo) override; - void OnMouseWheel(const EvasObject& obj, void* eventInfo) override; - void OnMove(const EvasObject& obj, void* eventInfo) override; - void OnShow(const EvasObject& obj, void* eventInfo) override; - void OnHide(const EvasObject& obj, void* eventInfo) override; - void OnResize(const EvasObject& obj, void* eventInfo) override; - virtual ~Impl() = default; private: @@ -60,8 +47,6 @@ class RemoteSurfaceEvas::Impl : public Image::IEventListener { RemoteSurfaceEvas::Visibility visibility_ = RemoteSurfaceEvas::UNKNOWN; std::map winVisibility_map_; int bind_win_id_ = 0; - bool flick_ = false; - int prev_y_ = 0; RemoteSurfaceEvas* parent_; bool auto_visibility_ = true; int no_render_timer_ = 0; diff --git a/screen_connector_remote_surface_evas/util.cc b/screen_connector_remote_surface_evas/util.cc index 957d3bd..ba3b2c1 100644 --- a/screen_connector_remote_surface_evas/util.cc +++ b/screen_connector_remote_surface_evas/util.cc @@ -15,6 +15,7 @@ */ #include +#include #include "screen_connector_remote_surface_evas/util.h" @@ -50,5 +51,24 @@ namespace util { return std::shared_ptr(new WlSurface(surface, false)); } + std::shared_ptr GetWlSurface(Evas_Object* win) { + struct wl_surface* surface; + Ecore_Wl2_Window* wl_win; + Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win)); + + wl_win = ecore_evas_wayland2_window_get(ee); + if (!wl_win) { + LOGE("failed to get wl_win"); + return nullptr; + } + + surface = ecore_wl2_window_surface_get(wl_win); + if (!surface) { + LOGE("failed to get surface"); + return nullptr; + } + return std::shared_ptr(new WlSurface(surface, false)); + } + } // namespace util } // namespace watchface_complication diff --git a/screen_connector_remote_surface_evas/util.h b/screen_connector_remote_surface_evas/util.h index d88445f..86940ad 100644 --- a/screen_connector_remote_surface_evas/util.h +++ b/screen_connector_remote_surface_evas/util.h @@ -26,6 +26,7 @@ namespace screen_connector { namespace util { EXPORT_API std::shared_ptr GetWlSurface(const EvasObject& win, bool mock = false); + EXPORT_API std::shared_ptr GetWlSurface(Evas_Object* win); } // namespace util } // namespace screen_connector -- 2.7.4 From 8ed8e79eb92e02d32c79428aea965800acc34def Mon Sep 17 00:00:00 2001 From: hyunho Date: Mon, 15 Jun 2020 16:27:21 +0900 Subject: [PATCH 12/16] Release version 1.6.20 Changes: - Remove image event handling logic from RemoteSurfaceEvas Change-Id: I325c658046694480831e2d508e4085ebcb814388 Signed-off-by: hyunho --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index bbfda14..99780c2 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.6.19 +Version: 1.6.20 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From da4e52e0b11e79b8cd9edef072d20fe9733ad883 Mon Sep 17 00:00:00 2001 From: hyunho Date: Fri, 26 Jun 2020 11:01:22 +0900 Subject: [PATCH 13/16] Handling key down/up events Change-Id: I02ff28d7e4f8e261b83ef837ebe4ae99c6dbee41 Signed-off-by: hyunho --- .../ecore_event_handler_internal.h | 2 +- screen_connector_remote_surface/trs_interface.h | 3 + screen_connector_remote_surface/trs_internal.h | 7 +++ .../trs_mock_internal.h | 5 ++ .../image_event_listener.cc | 69 +++++++++++++++++++++- .../image_event_listener.h | 11 ++++ .../trs_interface.h | 3 + 7 files changed, 98 insertions(+), 2 deletions(-) diff --git a/screen_connector_remote_surface/ecore_event_handler_internal.h b/screen_connector_remote_surface/ecore_event_handler_internal.h index dff7a03..2dfc715 100644 --- a/screen_connector_remote_surface/ecore_event_handler_internal.h +++ b/screen_connector_remote_surface/ecore_event_handler_internal.h @@ -47,7 +47,7 @@ class EcoreEventHandler { EcoreEventCB, listener_); visibility_change_ = ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE, - EcoreEventCB, listener_); + EcoreEventCB, listener_); pre_visibility_change_ = ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE, EcoreEventCB, listener_); diff --git a/screen_connector_remote_surface/trs_interface.h b/screen_connector_remote_surface/trs_interface.h index 9b8d250..242a3c8 100644 --- a/screen_connector_remote_surface/trs_interface.h +++ b/screen_connector_remote_surface/trs_interface.h @@ -72,6 +72,9 @@ class EXPORT_API ITRS { wl_fixed_t pressure, wl_fixed_t angle, uint32_t clas, uint32_t subclas, const char *identifier, uint32_t time) = 0; + virtual void TransferKeyEvent(uint32_t event_type, int32_t keycode, + uint32_t clas, uint32_t subclas, + const char *identifier, uint32_t time) = 0; virtual void TransferMouseWheel(uint32_t direction, int32_t z, uint32_t clas, uint32_t subclas, const char *identifier, uint32_t time) = 0; diff --git a/screen_connector_remote_surface/trs_internal.h b/screen_connector_remote_surface/trs_internal.h index ff2ad4b..c9689e5 100644 --- a/screen_connector_remote_surface/trs_internal.h +++ b/screen_connector_remote_surface/trs_internal.h @@ -105,6 +105,13 @@ class TRS : public Handle, public ITRS { identifier, time); } + void TransferKeyEvent(uint32_t event_type, int32_t keycode, + uint32_t clas, uint32_t subclas, + const char *identifier, uint32_t time) override { + tizen_remote_surface_transfer_key_event(GetRaw(), event_type, keycode, clas, + subclas, identifier, time); + } + void TransferMouseEvent(uint32_t event_type, int32_t device, int32_t button, int32_t x, int32_t y, wl_fixed_t radius_x, wl_fixed_t radius_y, diff --git a/screen_connector_remote_surface/trs_mock_internal.h b/screen_connector_remote_surface/trs_mock_internal.h index e08d765..000afb5 100644 --- a/screen_connector_remote_surface/trs_mock_internal.h +++ b/screen_connector_remote_surface/trs_mock_internal.h @@ -87,6 +87,11 @@ class TRSMock : public TRS { const char *identifier, uint32_t time) override { } + void TransferKeyEvent(uint32_t event_type, int32_t keycode, + uint32_t clas, uint32_t subclas, + const char *identifier, uint32_t time) override { + } + void TransferMouseWheel(uint32_t direction, int32_t z, uint32_t clas, uint32_t subclas, const char *identifier, uint32_t time) override { diff --git a/screen_connector_remote_surface_evas/image_event_listener.cc b/screen_connector_remote_surface_evas/image_event_listener.cc index 9f66c67..ee10c22 100644 --- a/screen_connector_remote_surface_evas/image_event_listener.cc +++ b/screen_connector_remote_surface_evas/image_event_listener.cc @@ -28,7 +28,74 @@ namespace screen_connector { ImageEventListener::ImageEventListener(RemoteSurface* parent) - : parent_(parent), is_flick_enabled_(parent->GetType() == RemoteSurface::Type::WATCH) { + : parent_(parent), + is_flick_enabled_(parent->GetType() == RemoteSurface::Type::WATCH) { + if (is_flick_enabled_) { + key_down_ = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, + KeyDownCb, this); + key_up_ = ecore_event_handler_add(ECORE_EVENT_KEY_UP, + KeyUpCb, this); + } +} + +ImageEventListener::~ImageEventListener() { + if (key_down_) + ecore_event_handler_del(key_down_); + if (key_up_) + ecore_event_handler_del(key_up_); +} + +Eina_Bool ImageEventListener::KeyUpCb(void* data, int type, void* event) { + ImageEventListener* listener = static_cast(data); + Ecore_Event_Key* keyEvent = static_cast(event); + listener->OnUpKey(keyEvent); + return ECORE_CALLBACK_RENEW; +} + +Eina_Bool ImageEventListener::KeyDownCb(void* data, int type, void* event) { + ImageEventListener* listener = static_cast(data); + Ecore_Event_Key* keyEvent = static_cast(event); + listener->OnDownKey(keyEvent); + return ECORE_CALLBACK_RENEW; +} + +void ImageEventListener::OnDownKey(void* eventInfo) { + if (eventInfo == nullptr) { + LOGE("Null eventinfo"); + return; + } + + Ecore_Event_Key* info = static_cast(eventInfo); + LOGI("Down key (%d)", info->keycode); + + const char* desc = ecore_device_description_get(info->dev); + if (desc == nullptr) + desc = ""; + parent_->GetRaw()->TransferKeyEvent(TIZEN_REMOTE_SURFACE_EVENT_TYPE_KEY_DOWN, + info->keycode, + ecore_device_class_get(info->dev), + ecore_device_subclass_get(info->dev), + desc, + info->timestamp); +} + +void ImageEventListener::OnUpKey(void* eventInfo) { + if (eventInfo == nullptr) { + LOGE("Null eventinfo"); + return; + } + Ecore_Event_Key* info = static_cast(eventInfo); + LOGI("Up key (%d)", info->keycode); + + const char* desc = ecore_device_description_get(info->dev); + if (desc == nullptr) + desc = ""; + parent_->GetRaw()->TransferKeyEvent(TIZEN_REMOTE_SURFACE_EVENT_TYPE_KEY_UP, + info->keycode, + ecore_device_class_get(info->dev), + ecore_device_subclass_get(info->dev), + desc, + info->timestamp); } void ImageEventListener::OnMouseIn(const EvasObject& obj, diff --git a/screen_connector_remote_surface_evas/image_event_listener.h b/screen_connector_remote_surface_evas/image_event_listener.h index e394513..9840bc4 100644 --- a/screen_connector_remote_surface_evas/image_event_listener.h +++ b/screen_connector_remote_surface_evas/image_event_listener.h @@ -20,6 +20,8 @@ #include #include +#include + #include "screen_connector_remote_surface_evas/evas_object.h" #include "screen_connector_remote_surface/remote_surface.h" #include "screen_connector_remote_surface/trs_interface.h" @@ -29,6 +31,7 @@ namespace screen_connector { class EXPORT_API ImageEventListener { public: ImageEventListener(RemoteSurface* parent); + virtual ~ImageEventListener(); virtual void OnMouseIn(const EvasObject& obj, void* eventInfo); virtual void OnMouseOut(const EvasObject& obj, void* eventInfo); virtual void OnMouseDown(const EvasObject& obj, void* eventInfo); @@ -41,16 +44,24 @@ class EXPORT_API ImageEventListener { virtual void OnShow(const EvasObject& obj, void* eventInfo); virtual void OnHide(const EvasObject& obj, void* eventInfo); virtual void OnResize(const EvasObject& obj, void* eventInfo); + virtual void OnDownKey(void* eventInfo); + virtual void OnUpKey(void* eventInfo); void SetInputEventFilter(uint32_t filter); bool IsDisabledInput(ITRS::InputType type); bool IsFlickEnabled(bool enable); private: + static Eina_Bool KeyUpCb(void* data, int type, void* event); + static Eina_Bool KeyDownCb(void* data, int type, void* event); + + private: RemoteSurface* parent_ = nullptr; bool is_flick_enabled_ = false; uint32_t input_event_filter_ = 0; bool flick_ = false; int prev_y_ = 0; + Ecore_Event_Handler* key_down_ = nullptr; + Ecore_Event_Handler* key_up_ = nullptr; }; } diff --git a/screen_connector_remote_surface_mock/trs_interface.h b/screen_connector_remote_surface_mock/trs_interface.h index 3a3a9c9..ba9218f 100644 --- a/screen_connector_remote_surface_mock/trs_interface.h +++ b/screen_connector_remote_surface_mock/trs_interface.h @@ -57,6 +57,9 @@ class ITRS { wl_fixed_t pressure, wl_fixed_t angle, uint32_t clas, uint32_t subclas, const char *identifier, uint32_t time) = 0; + virtual void TransferKeyEvent(uint32_t event_type, int32_t keycode, + uint32_t clas, uint32_t subclas, + const char *identifier, uint32_t time) = 0; virtual void TransferMouseWheel(uint32_t direction, int32_t z, uint32_t clas, uint32_t subclas, const char *identifier, uint32_t time) = 0; -- 2.7.4 From c78443a2a887b523a7f29026a52e155ec485c26c Mon Sep 17 00:00:00 2001 From: hyunho Date: Mon, 29 Jun 2020 18:24:49 +0900 Subject: [PATCH 14/16] Handling image move event Change-Id: If341282fb303f209d2ec8e5e377654748cf63a6e Signed-off-by: hyunho --- .../remote_surface_evas.cc | 38 ++++++++++++++++++++++ .../remote_surface_evas_implementation.h | 5 ++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/screen_connector_remote_surface_evas/remote_surface_evas.cc b/screen_connector_remote_surface_evas/remote_surface_evas.cc index b72710b..32e1880 100644 --- a/screen_connector_remote_surface_evas/remote_surface_evas.cc +++ b/screen_connector_remote_surface_evas/remote_surface_evas.cc @@ -65,6 +65,44 @@ RemoteSurfaceEvas::Impl::Impl(RemoteSurfaceEvas* parent, win_ctx_(mock ? nullptr : new WindowContext()) { } +void RemoteSurfaceEvas::Impl::OnMove(const EvasObject& obj, void* eventInfo) { + if (!is_init_) { + is_init_ = true; + return; + } + + if (!auto_visibility_) + return; + + Ecore_Wl2_Window *window = NULL; + Ecore_Evas *ee; + ee = ecore_evas_ecore_evas_get( + evas_object_evas_get(viewer_win_->GetRaw())); + window = ecore_evas_wayland2_window_get(ee); + + unsigned int win_id = ecore_wl2_window_id_get(window); + if (parent_->IsVisibleArea() && !parent_->impl_->win_ctx_->IsFullyObscured(win_id)) { + parent_->SendVisibility(true); + visibility_ = RemoteSurfaceEvas::UNOBSCURED; + } else { + parent_->SendVisibility(false); + visibility_ = RemoteSurfaceEvas::FULLY_OBSCURED; + } +} + +void RemoteSurfaceEvas::Impl::OnShow(const EvasObject& obj, void* eventInfo) { + LOGD("show"); + OnMove(obj, eventInfo); +} + +void RemoteSurfaceEvas::Impl::OnHide(const EvasObject& obj, void* eventInfo) { + LOGD("hide"); +} + +void RemoteSurfaceEvas::Impl::OnResize(const EvasObject& obj, void* eventInfo) { + LOGD("resize"); + OnMove(obj, eventInfo); +} bool RemoteSurfaceEvas::IsVisibleArea() const { int x, y, w, h; diff --git a/screen_connector_remote_surface_evas/remote_surface_evas_implementation.h b/screen_connector_remote_surface_evas/remote_surface_evas_implementation.h index 096fcac..064f715 100644 --- a/screen_connector_remote_surface_evas/remote_surface_evas_implementation.h +++ b/screen_connector_remote_surface_evas/remote_surface_evas_implementation.h @@ -36,7 +36,10 @@ class RemoteSurfaceEvas::Impl : public ImageEventListener { private: Impl(RemoteSurfaceEvas* parent, std::shared_ptr viewerWin, bool mock); - + void OnMove(const EvasObject& obj, void* eventInfo) override; + void OnShow(const EvasObject& obj, void* eventInfo) override; + void OnHide(const EvasObject& obj, void* eventInfo) override; + void OnResize(const EvasObject& obj, void* eventInfo) override; private: friend class RemoteSurfaceEvas; -- 2.7.4 From b76b9024037ef9c0c85dfc8c464adee19ee3d6cd Mon Sep 17 00:00:00 2001 From: hyunho Date: Tue, 30 Jun 2020 12:47:11 +0900 Subject: [PATCH 15/16] Release version 1.6.30 Changes: - Handling key down/up events - Handling image move event Change-Id: I1e3fe72c010d0dba7d2b42a2f2027ed7e4af4ed8 Signed-off-by: hyunho --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index 99780c2..4a8be84 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.6.20 +Version: 1.6.30 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 0345cd2377d3591c297e399f2b13fdc30d674f7a Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 20 Jul 2020 14:31:19 +0900 Subject: [PATCH 16/16] Check RawImage ptr Change-Id: Icbc2a0788bcecf7044f007544694e037b5bd1efc Signed-off-by: Hwankyu Jhun --- screen_connector_launcher_service/launcher_service.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/screen_connector_launcher_service/launcher_service.cc b/screen_connector_launcher_service/launcher_service.cc index ced3de5..87f5378 100644 --- a/screen_connector_launcher_service/launcher_service.cc +++ b/screen_connector_launcher_service/launcher_service.cc @@ -69,6 +69,9 @@ int LauncherService::Impl::LaunchDone(uint32_t serial) { } int LauncherService::Impl::Reset(uint32_t serial) { + if (raw_image_.get() == nullptr) + return 0; + if (raw_image_->GetImageType() == ImageType::RemoteSurfaceTBM || raw_image_->GetImageType() == ImageType::RemoteSurfaceImageFile) { _W("Unredirect()"); -- 2.7.4