: 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) {
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;
}
}
}
+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)) {
return 0;
}
+int RemoteSurfaceWatcher::SetBlock(bool enable) {
+ impl_->block_update_ = enable;
+ impl_->UpdateFocusedSurface();
+ return 0;
+}
+
} // namespace screen_connector
Impl(RemoteSurfaceWatcher* parent, RemoteSurface::Type type,
std::shared_ptr<EvasObject> viewer_win,
bool focused_only);
+ void UpdateFocusedSurface();
private:
friend class RemoteSurfaceWatcher;
std::unique_ptr<AulHandle> aul_handle_;
RemoteSurfaceWatcher* parent_;
bool focused_only_;
+ bool block_update_;
+ std::string focused_inst_id_;
};
} // namespace screen_connector