2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali/internal/adaptor/glib/framework-glib.h>
31 thread_local GMainLoop* gMainLoop{nullptr};
33 GMainContext* GetMainLoopContext()
35 if(gMainLoop != nullptr)
37 return g_main_loop_get_context(gMainLoop);
43 * Impl to hide GLib data members
45 struct FrameworkGlib::Impl
50 // In future, may need to change this to have own context or use Tizen context
51 gMainLoop = mMainLoop = g_main_loop_new(nullptr, false);
56 g_main_loop_unref(mMainLoop);
62 g_main_loop_run(mMainLoop);
67 g_main_loop_quit(mMainLoop);
71 GMainLoop* mMainLoop{nullptr};
72 GMainContext* mContext{nullptr};
75 Impl(const Impl& impl) = delete;
76 Impl& operator=(const Impl& impl) = delete;
79 FrameworkGlib::FrameworkGlib(Framework::Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
80 : Framework(observer, taskObserver, argc, argv, type, useUiThread),
83 mImpl = new Impl(this);
86 FrameworkGlib::~FrameworkGlib()
96 void FrameworkGlib::Run()
105 void FrameworkGlib::Quit()
107 mObserver.OnTerminate();
111 } // namespace Adaptor
113 } // namespace Internal