From a149cc60667a1a4149cfe4717dd5644b5f545814 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Tue, 14 Apr 2020 20:29:56 +0900 Subject: Add flag for mockup Change-Id: I855b9eb607ae425d650deaa7467b6ab46ed16b73 Signed-off-by: Junghoon Park --- screen_connector_remote_surface/remote_surface.cc | 2 ++ screen_connector_remote_surface_evas/remote_surface_evas.cc | 7 ++++--- .../remote_surface_watcher.cc | 12 ++++++++---- .../remote_surface_watcher.h | 2 +- .../remote_surface_watcher_implementation.h | 3 ++- screen_connector_remote_surface_evas/util.cc | 4 +++- screen_connector_remote_surface_evas/util.h | 3 ++- 7 files changed, 22 insertions(+), 11 deletions(-) diff --git a/screen_connector_remote_surface/remote_surface.cc b/screen_connector_remote_surface/remote_surface.cc index c277b7e..d24ab9c 100644 --- a/screen_connector_remote_surface/remote_surface.cc +++ b/screen_connector_remote_surface/remote_surface.cc @@ -145,6 +145,8 @@ RemoteSurface::RemoteSurface(const std::string& id, Type type, RemoteSurface::RemoteSurface(int rid, const std::string& id, Type type, std::shared_ptr wl_surface, bool mock) : impl_(new Impl(this, rid, id, type, std::move(wl_surface), mock)) { + if (mock) + return; impl_->Redirect(); } diff --git a/screen_connector_remote_surface_evas/remote_surface_evas.cc b/screen_connector_remote_surface_evas/remote_surface_evas.cc index 008ec9a..07d21f9 100644 --- a/screen_connector_remote_surface_evas/remote_surface_evas.cc +++ b/screen_connector_remote_surface_evas/remote_surface_evas.cc @@ -39,7 +39,7 @@ RemoteSurfaceEvas::RemoteSurfaceEvas(const std::string& id, RemoteSurface::Type type, std::shared_ptr viewerWin, bool mock) - : RemoteSurface(id, type, util::GetWlSurface(*viewerWin.get()), mock), + : RemoteSurface(id, type, util::GetWlSurface(*viewerWin.get(), mock), mock), impl_(new Impl(this, viewerWin, mock)) { } @@ -47,7 +47,7 @@ RemoteSurfaceEvas::RemoteSurfaceEvas(int rid, const std::string& id, RemoteSurface::Type type, std::shared_ptr viewerWin, bool mock) - : RemoteSurface(rid, id, type, util::GetWlSurface(*viewerWin.get()), mock), + : RemoteSurface(rid, id, type, util::GetWlSurface(*viewerWin.get(), mock), mock), impl_(new Impl(this, viewerWin, mock)) { } @@ -60,7 +60,8 @@ RemoteSurfaceEvas& RemoteSurfaceEvas::operator=( RemoteSurfaceEvas::Impl::Impl(RemoteSurfaceEvas* parent, std::shared_ptr viewerWin, bool mock) - : viewer_win_(viewerWin), parent_(parent), mock_(mock), win_ctx_(new WindowContext()) { + : viewer_win_(viewerWin), parent_(parent), mock_(mock), + win_ctx_(mock ? nullptr : new WindowContext()) { } void RemoteSurfaceEvas::Impl::OnMouseIn(const EvasObject& obj, diff --git a/screen_connector_remote_surface_evas/remote_surface_watcher.cc b/screen_connector_remote_surface_evas/remote_surface_watcher.cc index 9639582..5ed7355 100644 --- a/screen_connector_remote_surface_evas/remote_surface_watcher.cc +++ b/screen_connector_remote_surface_evas/remote_surface_watcher.cc @@ -35,11 +35,15 @@ namespace screen_connector { RemoteSurfaceWatcher::Impl::Impl(RemoteSurfaceWatcher* parent, RemoteSurface::Type type, std::shared_ptr viewer_win, - bool focused_only) + bool focused_only, bool mock) : viewer_win_(viewer_win), - aul_handle_(new AulHandle(this, (aul_screen_type_e)type)), + aul_handle_(mock ? new test::AulHandleMock(this, + (aul_screen_type_e)type) : new AulHandle(this, + (aul_screen_type_e)type)), parent_(parent), focused_only_(focused_only), block_update_(false) { + if (mock) + return; if (focused_only_) { int ret = aul_screen_connector_trigger_focused_force(); if (ret < 0) { @@ -114,8 +118,8 @@ RemoteSurfaceWatcher::RemoteSurfaceWatcher(RemoteSurface::Type type, } RemoteSurfaceWatcher::RemoteSurfaceWatcher(RemoteSurface::Type type, - std::shared_ptr viewerWin, bool watchFocusedOnly) - : impl_(new Impl(this, type, viewerWin, watchFocusedOnly)) { + std::shared_ptr viewerWin, bool watchFocusedOnly, bool mock) + : impl_(new Impl(this, type, viewerWin, watchFocusedOnly, mock)) { } RemoteSurfaceWatcher::~RemoteSurfaceWatcher() = default; diff --git a/screen_connector_remote_surface_evas/remote_surface_watcher.h b/screen_connector_remote_surface_evas/remote_surface_watcher.h index 037c734..cf494db 100644 --- a/screen_connector_remote_surface_evas/remote_surface_watcher.h +++ b/screen_connector_remote_surface_evas/remote_surface_watcher.h @@ -33,7 +33,7 @@ class EXPORT_API RemoteSurfaceWatcher : public IWatcherEvent { std::shared_ptr viewerWin); RemoteSurfaceWatcher(RemoteSurface::Type type, std::shared_ptr viewerWin, - bool watchFocusedOnly); + bool watchFocusedOnly, bool mock = false); RemoteSurfaceWatcher(RemoteSurfaceWatcher&&) noexcept; RemoteSurfaceWatcher& operator=(RemoteSurfaceWatcher&&) noexcept; virtual ~RemoteSurfaceWatcher(); diff --git a/screen_connector_remote_surface_evas/remote_surface_watcher_implementation.h b/screen_connector_remote_surface_evas/remote_surface_watcher_implementation.h index 24ac69c..f271f5a 100644 --- a/screen_connector_remote_surface_evas/remote_surface_watcher_implementation.h +++ b/screen_connector_remote_surface_evas/remote_surface_watcher_implementation.h @@ -28,6 +28,7 @@ #include "screen_connector_remote_surface_evas/remote_surface_mixed_internal.h" #include "screen_connector_remote_surface_evas/watcher_image_internal.h" #include "screen_connector_remote_surface/aul_handle_internal.h" +#include "screen_connector_remote_surface/aul_handle_mock_internal.h" namespace screen_connector { @@ -46,7 +47,7 @@ class RemoteSurfaceWatcher::Impl : AulHandle::IEventListener { private: Impl(RemoteSurfaceWatcher* parent, RemoteSurface::Type type, std::shared_ptr viewer_win, - bool focused_only); + bool focused_only, bool mock = false); void UpdateFocusedSurface(); private: diff --git a/screen_connector_remote_surface_evas/util.cc b/screen_connector_remote_surface_evas/util.cc index 393f49b..957d3bd 100644 --- a/screen_connector_remote_surface_evas/util.cc +++ b/screen_connector_remote_surface_evas/util.cc @@ -28,7 +28,9 @@ using namespace std; namespace screen_connector { namespace util { - std::shared_ptr GetWlSurface(const EvasObject& win) { + std::shared_ptr GetWlSurface(const EvasObject& win, bool mock) { + if (mock) + return nullptr; struct wl_surface* surface; Ecore_Wl2_Window* wl_win; Ecore_Evas *ee = ecore_evas_ecore_evas_get( diff --git a/screen_connector_remote_surface_evas/util.h b/screen_connector_remote_surface_evas/util.h index 85faac1..d88445f 100644 --- a/screen_connector_remote_surface_evas/util.h +++ b/screen_connector_remote_surface_evas/util.h @@ -24,7 +24,8 @@ namespace screen_connector { namespace util { - EXPORT_API std::shared_ptr GetWlSurface(const EvasObject& win); + EXPORT_API std::shared_ptr GetWlSurface(const EvasObject& win, + bool mock = false); } // namespace util } // namespace screen_connector -- cgit v1.2.3