/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// CLASS HEADER
-#include "processor-controller.h"
+#include <dali-csharp-binder/common/processor-controller.h>
// EXTERNAL INCLUDES
#include <dali/devel-api/common/stage-devel.h>
ProcessorController::ProcessorController()
: mHandler(nullptr),
mPostHandler(nullptr),
- mKeepRenderingApplied(false)
+ mKeepRenderingApplied(false),
+ mProcessingEvents(false),
+ mProcessEventsIdleRequested(false)
{
{
try
{
// We will ignore Awake events during Process running
mKeepRenderingApplied = true;
+
+ // Mark as we are processing now.
+ mProcessingEvents = true;
+
if(DALI_LIKELY(mHandler != nullptr))
{
mHandler();
}
// Make awake events can be applied after PostProcess done.
mKeepRenderingApplied = false;
+
+ // Clean up processing and events idle request flag.
+ mProcessingEvents = false;
+ mProcessEventsIdleRequested = false;
}
}
void ProcessorController::Awake()
{
- if(DALI_UNLIKELY(!mKeepRenderingApplied))
+ if(!mProcessingEvents && !mKeepRenderingApplied)
{
- if(DALI_LIKELY(Dali::Stage::IsInstalled()))
+ if(DALI_LIKELY(Dali::Stage::IsInstalled())) ///< Avoid worker thread calling.
{
auto stage = Dali::Stage::GetCurrent();
stage.KeepRendering(0.0f);
mKeepRenderingApplied = true;
}
}
+ else if(mProcessingEvents && !mProcessEventsIdleRequested)
+ {
+ if(DALI_LIKELY(Dali::Stage::IsInstalled())) ///< Avoid worker thread calling.
+ {
+ // Request ProcessEvents on idle when we are processing now.
+ Dali::Adaptor::Get().RequestProcessEventsOnIdle();
+ mProcessEventsIdleRequested = true;
+ }
+ }
}
// ProcessorController Bindings
#define CSHARP_PROCESSOR_CONTROLLER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void RemovePostCallback( ProcessorControllerProcessCallback postCallback );
/**
- * @brief Awake update thread so dali-core calls the overriden Process() api.
+ * @brief Layout and awake update thread, or re-run registered processor.
*/
void Awake();
ProcessorControllerProcessCallback mHandler; ///< PreProcessHandler before Relayout
ProcessorControllerProcessCallback mPostHandler; ///< PostProcessHandler after Relayout
- bool mKeepRenderingApplied; ///< True if we call Stage::KeepRendering(0.0f). It need to avoid duplicated keep rendering call
+
+ bool mKeepRenderingApplied : 1; ///< True if we call Stage::KeepRendering(0.0f). It need to avoid duplicated keep rendering call
+ bool mProcessingEvents : 1; ///< True if we are running Process now.
+ bool mProcessEventsIdleRequested : 1; ///< True if we call Adaptor::RequestProcessEventsOnIdle(). It need to avoid duplicated request call.
};
#endif // CSHARP_PROCESSOR_CONTROLLER_H
\ No newline at end of file