Add logic to pending window pause request 81/318681/2
authorChanggyu Choi <changyu.choi@samsung.com>
Wed, 22 Jan 2025 05:43:25 +0000 (14:43 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Wed, 22 Jan 2025 06:43:54 +0000 (15:43 +0900)
The pause request may be delivered before the main window of the app is created.
This patch pends the request in such a case and then performs the request when a window is created.

Change-Id: I8614f9cbbc2800e4cd1dc27d627dbe790002e393
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
tizen-cpp/app-core-ui-cpp/app_core_ui_base.cc

index f4855c36bca4e69cc819692fdecdec2d3dd864d1..e322301b3ddd5bf7770a2950ad8e68e2558c0319 100644 (file)
@@ -140,6 +140,7 @@ class AppCoreUiBase::Impl : public AppCoreRotation::IEventListener {
   std::string appid_;
   AppState state_ = AS_NONE;
   WinStatus w_status_ = WS_NONE;
+  WinStatus w_pending_status_ = WS_NONE;
   std::shared_ptr<EcoreHandler> handler_;
   std::unique_ptr<WaylandHandler> wl_handler_;
   IAppCoreUi* core_ui_delegator_ = nullptr;
@@ -224,6 +225,12 @@ void AppCoreUiBase::Impl::RaiseWin() {
     return;
 
   unsigned int win_id = parent_->GetMainWindow();
+  if (win_id == 0) {
+    _W("Not found main window. pending raise win");
+    w_pending_status_ = WS_RESUME;
+    return;
+  }
+
   _I("Raise window: %u", win_id);
   handler_->RaiseWin(win_id);
 }
@@ -232,6 +239,13 @@ void AppCoreUiBase::Impl::PauseWin() {
   if (!(hint_ & HINT_WINDOW_STACK_CONTROL))
     return;
 
+
+  if (winnode_list_.empty()) {
+    _W("Not found window. pending pause win");
+    w_pending_status_ = WS_PAUSE;
+    return;
+  }
+
   _D("Pause window");
   for (auto& i : winnode_list_) {
     _D("Pause window: %u", i->win_);
@@ -870,8 +884,16 @@ void AppCoreUiBase::OnShow(int type, void* event) {
   unsigned int surf = static_cast<unsigned int>(ev->data[0]);
   _D("[EVENT_TEST][EVENT] GET SHOW EVENT!!!. WIN: %u, %u", win, surf);
 
-  if (!impl_->FindWin(win))
+  if (!impl_->FindWin(win)) {
     impl_->AddWin(win, surf);
+    if (impl_->winnode_list_.size() == 1 &&
+        impl_->w_pending_status_ == Impl::WS_PAUSE) {
+      _W("Process a pending pause window request");
+      impl_->PauseWin();
+    }
+
+    impl_->w_pending_status_ = Impl::WS_NONE;
+  }
   else
     impl_->UpdateWin(win, surf, Impl::VT_NONE);