Add SetBlock to RemoteSurfaceWatcher
authorhyunho <hhstark.kang@samsung.com>
Thu, 26 Mar 2020 07:58:23 +0000 (16:58 +0900)
committerhyunho <hhstark.kang@samsung.com>
Tue, 31 Mar 2020 03:50:22 +0000 (12:50 +0900)
Change-Id: Ie4487d83b4c7b82f81f4b359ef4ec1383d76febb
Signed-off-by: hyunho <hhstark.kang@samsung.com>
screen_connector_remote_surface_evas/remote_surface_watcher.cc
screen_connector_remote_surface_evas/remote_surface_watcher.h
screen_connector_remote_surface_evas/remote_surface_watcher_implementation.h

index e14785ee3d0a7d44eeda2b7370087a6b0da345b5..9639582b5076fba0acd5cc62e1021407a64ea5e6 100644 (file)
@@ -39,7 +39,7 @@ RemoteSurfaceWatcher::Impl::Impl(RemoteSurfaceWatcher* parent,
     : viewer_win_(viewer_win),
       aul_handle_(new AulHandle(this, (aul_screen_type_e)type)),
       parent_(parent),
-      focused_only_(focused_only) {
+      focused_only_(focused_only), block_update_(false) {
   if (focused_only_) {
     int ret = aul_screen_connector_trigger_focused_force();
     if (ret < 0) {
@@ -78,23 +78,20 @@ void RemoteSurfaceWatcher::Impl::OnAppUpdated(const std::string &app_id,
                                               const unsigned int surface_id) {
 }
 
-void RemoteSurfaceWatcher::Impl::OnAppFocused(const std::string& app_id,
-                                              const std::string& inst_id,
-                                              const int pid,
-                                              const unsigned int surface_id) {
-  parent_->OnWatcherFocusChanged(app_id, inst_id, pid);
+void RemoteSurfaceWatcher::Impl::UpdateFocusedSurface() {
   if (focused_only_) {
     for (auto& i : surfaces_) {
-      if (i->GetInstId() == inst_id) {
-        i->SetBlock(false);
-        i->ForceToUpdateWatcher();
+      if (i->GetInstId() == focused_inst_id_) {
+        i->SetBlock(block_update_);
+        if (!block_update_)
+          i->ForceToUpdateWatcher();
       } else {
         i->SetBlock(true);
       }
     }
   } else {
     for (auto& i : surfaces_) {
-      if (i->GetInstId() == inst_id) {
+      if (i->GetInstId() == focused_inst_id_) {
         i->ForceToUpdateWatcher();
         break;
       }
@@ -102,6 +99,15 @@ void RemoteSurfaceWatcher::Impl::OnAppFocused(const std::string& app_id,
   }
 }
 
+void RemoteSurfaceWatcher::Impl::OnAppFocused(const std::string& app_id,
+                                              const std::string& inst_id,
+                                              const int pid,
+                                              const unsigned int surface_id) {
+  parent_->OnWatcherFocusChanged(app_id, inst_id, pid);
+  focused_inst_id_ = inst_id;
+  UpdateFocusedSurface();
+}
+
 RemoteSurfaceWatcher::RemoteSurfaceWatcher(RemoteSurface::Type type,
     std::shared_ptr<EvasObject> viewer_win)
     : impl_(new Impl(this, type, viewer_win, false)) {
@@ -151,4 +157,10 @@ int RemoteSurfaceWatcher::SetRemoteRender() {
   return 0;
 }
 
+int RemoteSurfaceWatcher::SetBlock(bool enable) {
+  impl_->block_update_ = enable;
+  impl_->UpdateFocusedSurface();
+  return 0;
+}
+
 }  // namespace screen_connector
index ec982904994cc1cc419f95156c55277279ab2013..037c7341c3632cafa1dd9ce44bbebb572c410c10 100644 (file)
@@ -41,6 +41,7 @@ class EXPORT_API RemoteSurfaceWatcher : public IWatcherEvent {
  public:
   void SetChangedEventFilter(RemoteSurface::ChangedEventFilter filter);
   int SetRemoteRender();
+  int SetBlock(bool enable);
   void OnWatcherAdded(const std::string& appId, const std::string& instId,
                       const int pid) override;
   void OnWatcherChanged(const std::string& appId, const std::string& instId,
index e8c3cc5246141dedebdfc8025fdbda0bd5479500..24ac69c9211e98db1e7bd46f87e9442ce9987b75 100644 (file)
@@ -47,6 +47,7 @@ class RemoteSurfaceWatcher::Impl : AulHandle::IEventListener {
   Impl(RemoteSurfaceWatcher* parent, RemoteSurface::Type type,
       std::shared_ptr<EvasObject> viewer_win,
       bool focused_only);
+  void UpdateFocusedSurface();
 
  private:
   friend class RemoteSurfaceWatcher;
@@ -56,6 +57,8 @@ class RemoteSurfaceWatcher::Impl : AulHandle::IEventListener {
   std::unique_ptr<AulHandle> aul_handle_;
   RemoteSurfaceWatcher* parent_;
   bool focused_only_;
+  bool block_update_;
+  std::string focused_inst_id_;
 };
 
 }  // namespace screen_connector