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.
22 #include "appcore-internal.h"
23 #include "appcore-efl.h"
24 #include "appcore_efl_base.h"
26 struct appcore_efl_context {
27 struct appcore_ops ops;
30 static struct appcore_efl_context __context;
32 static int __ui_app_create(void *data)
34 appcore_efl_base_on_create();
36 if (__context.ops.create) {
37 if (__context.ops.create(__context.ops.data) < 0)
44 static int __ui_app_terminate(void *data)
46 appcore_efl_base_on_terminate();
48 if (__context.ops.terminate)
49 __context.ops.terminate(__context.ops.data);
54 static int __ui_app_control(bundle *b, void *data)
56 appcore_efl_base_on_control(b);
58 if (__context.ops.reset)
59 __context.ops.reset(b, __context.ops.data);
64 static int __ui_app_pause(void *data)
66 appcore_efl_base_on_pause();
68 if (__context.ops.pause)
69 __context.ops.pause(__context.ops.data);
73 static int __ui_app_resume(void *data)
75 appcore_efl_base_on_resume();
77 if (__context.ops.resume)
78 __context.ops.resume(__context.ops.data);
82 EXPORT_API int appcore_efl_init(const char *name, int *argc, char ***argv,
83 struct appcore_ops *ops)
86 appcore_efl_base_ops efl_ops = appcore_efl_base_get_default_ops();
88 /* override methods */
89 efl_ops.ui_base.base.create = __ui_app_create;
90 efl_ops.ui_base.base.control = __ui_app_control;
91 efl_ops.ui_base.base.terminate = __ui_app_terminate;
92 efl_ops.ui_base.pause = __ui_app_pause;
93 efl_ops.ui_base.resume = __ui_app_resume;
97 ret = appcore_efl_base_init(efl_ops, *argc, *argv, NULL,
98 APPCORE_EFL_BASE_HINT_WINDOW_GROUP_CONTROL |
99 APPCORE_EFL_BASE_HINT_WINDOW_STACK_CONTROL |
100 APPCORE_EFL_BASE_HINT_BG_LAUNCH_CONTROL |
101 APPCORE_EFL_BASE_HINT_HW_ACC_CONTROL |
102 APPCORE_EFL_BASE_HINT_WINDOW_AUTO_CONTROL |
103 APPCORE_EFL_BASE_HINT_LEGACY_CONTROL);
108 EXPORT_API void appcore_efl_fini(void)
110 appcore_efl_base_fini();
113 EXPORT_API int appcore_efl_main(const char *name, int *argc, char ***argv,
114 struct appcore_ops *ops)
118 r = appcore_efl_init(name, argc, argv, ops);
127 EXPORT_API void appcore_group_attach()
129 appcore_efl_base_group_add();
132 EXPORT_API void appcore_group_lower()
134 appcore_efl_base_group_remove();
137 EXPORT_API unsigned int appcore_get_main_window(void)
139 return appcore_efl_base_get_main_window();
142 EXPORT_API unsigned int appcore_get_main_surface(void)
144 return appcore_get_main_surface();
147 EXPORT_API int appcore_set_system_resource_reclaiming(bool enable)
149 appcore_efl_base_set_system_resource_reclaiming(enable);