[NUI] Support RequestLayout() while main loop is in idle state
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 28 Jan 2022 09:35:09 +0000 (18:35 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 8 Feb 2022 04:41:28 +0000 (13:41 +0900)
Previously, RequestLayout() was not supported if it was called while
main loop was in idle state.

Now, RequestLayout() calls Awake() to awake main loop again and Layout
can be re-calculated correctly.

src/Tizen.NUI/src/public/Layouting/LayoutItem.cs

index 3b074c5..6efc654 100755 (executable)
@@ -348,7 +348,15 @@ namespace Tizen.NUI
         public void RequestLayout()
         {
             flags = flags | LayoutFlags.ForceLayout;
-            if (parent != null)
+            if (parent == null)
+            {
+                // If RequestLayout() is called while main loop is in idle state,
+                // then Awake() is required to awake main loop again and
+                // Layout can be re-calculated correctly.
+                // For performance, Awake() is called only by the root layout.
+                ProcessorController.Instance.Awake();
+            }
+            else
             {
                 LayoutGroup layoutGroup = parent as LayoutGroup;
                 if (layoutGroup != null && !layoutGroup.LayoutRequested)