2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
19 #include <dali/internal/system/windows/callback-manager-win.h>
\r
21 // EXTERNAL INCLUDES
\r
22 #include <Windows.h>
\r
24 // Need to undef the following constants as they are defined in one of the headers in Windows.h but used in DALi (via debug.h)
\r
25 #undef TRANSPARENT // Used in constants.h
\r
26 #undef CopyMemory // Used in dali-vector.h
\r
28 #include <dali/integration-api/debug.h>
\r
30 // INTERNAL INCLUDES
\r
31 #include <dali/internal/window-system/windows/platform-implement-win.h>
\r
39 WinCallbackManager::WinCallbackManager()
\r
44 void WinCallbackManager::Start()
\r
46 DALI_ASSERT_DEBUG(mRunning == false);
\r
50 void WinCallbackManager::Stop()
\r
52 // make sure we're not called twice
\r
53 DALI_ASSERT_DEBUG(mRunning == true);
\r
58 bool WinCallbackManager::AddIdleCallback(CallbackBase* callback, bool hasReturnValue)
\r
65 mCallbacks.insert(callback);
\r
67 WindowsPlatform::PostWinThreadMessage(WIN_CALLBACK_EVENT, reinterpret_cast<uint64_t>(callback), 0);
\r
72 void WinCallbackManager::RemoveIdleCallback(CallbackBase* callback)
\r
77 bool WinCallbackManager::ProcessIdle()
\r
79 const bool idleProcessed = !mCallbacks.empty();
\r
81 // @todo : Need to consider callback with return & don't erase callback when it return true.
\r
82 for(CallbackBase* cb : mCallbacks)
\r
84 Dali::CallbackBase::Execute(*cb);
\r
88 return idleProcessed;
\r
91 void WinCallbackManager::ClearIdleCallbacks()
\r
96 bool WinCallbackManager::AddIdleEntererCallback(CallbackBase* callback)
\r
98 return AddIdleCallback(callback, true);
\r
101 void WinCallbackManager::RemoveIdleEntererCallback(CallbackBase* callback)
\r
105 } // namespace Adaptor
\r
107 } // namespace Internal
\r
109 } // namespace Dali
\r