2 * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
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.
21 #include <glib-object.h>
26 #include <Elementary.h>
28 #include "appcore-internal.h"
29 #include "appcore-efl.h"
30 #include "appcore_ui_base.h"
31 #include <system_info.h>
33 struct appcore_efl_context {
34 struct appcore_ops ops;
37 static struct appcore_efl_context __context;
39 static int __ui_app_create(void *data)
41 appcore_ui_base_on_create();
43 if (__context.ops.create) {
44 if (__context.ops.create(__context.ops.data) < 0)
51 static int __ui_app_terminate(void *data)
53 appcore_ui_base_on_terminate();
55 if (__context.ops.terminate)
56 __context.ops.terminate(__context.ops.data);
61 static int __ui_app_control(bundle *b, void *data)
63 appcore_ui_base_on_control(b);
65 if (__context.ops.reset)
66 __context.ops.reset(b, __context.ops.data);
71 static int __ui_app_pause(void *data)
73 appcore_ui_base_on_pause();
75 if (__context.ops.pause)
76 __context.ops.pause(__context.ops.data);
80 static int __ui_app_resume(void *data)
82 appcore_ui_base_on_resume();
84 if (__context.ops.resume)
85 __context.ops.resume(__context.ops.data);
89 EXPORT_API int appcore_efl_init(const char *name, int *argc, char ***argv,
90 struct appcore_ops *ops)
93 appcore_ui_base_ops ui_ops = appcore_ui_base_get_default_ops();
95 /* override methods */
96 ui_ops.base.create = __ui_app_create;
97 ui_ops.base.control = __ui_app_control;
98 ui_ops.base.terminate = __ui_app_terminate;
99 ui_ops.pause = __ui_app_pause;
100 ui_ops.resume = __ui_app_resume;
101 ui_ops.base.run = NULL;
103 __context.ops = *ops;
105 ret = appcore_ui_base_init(ui_ops, *argc, *argv, NULL,
106 APPCORE_UI_BASE_HINT_WINDOW_GROUP_CONTROL |
107 APPCORE_UI_BASE_HINT_WINDOW_STACK_CONTROL |
108 APPCORE_UI_BASE_HINT_BG_LAUNCH_CONTROL |
109 APPCORE_UI_BASE_HINT_HW_ACC_CONTROL);
114 EXPORT_API void appcore_efl_fini(void)
116 appcore_ui_base_fini();
119 EXPORT_API int appcore_efl_main(const char *name, int *argc, char ***argv,
120 struct appcore_ops *ops)
124 r = appcore_efl_init(name, argc, argv, ops);
134 EXPORT_API void appcore_group_attach()
136 appcore_ui_base_group_add();
139 EXPORT_API void appcore_group_lower()
141 appcore_ui_base_group_remove();
144 EXPORT_API unsigned int appcore_get_main_window(void)
146 return appcore_ui_base_get_main_window();
149 EXPORT_API unsigned int appcore_get_main_surface(void)
151 return appcore_get_main_surface();
154 EXPORT_API int appcore_set_system_resource_reclaiming(bool enable)