4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
33 #include "menu_db_util.h"
34 #include "simple_util.h"
40 static int (*_aul_key_handler) (bundle *kb, void *data) = NULL;
41 static void *_aul_key_data = NULL;
43 extern GSourceFuncs funcs;
45 int app_key_event(bundle *kb)
48 _aul_key_handler(kb, _aul_key_data);
52 int aul_register_key_init_callback(
53 int (*aul_handler) (bundle *, void *), void *data)
55 /* Save start handler function in static var */
56 _aul_key_handler = aul_handler;
61 SLPAPI int aul_key_init(int (*aul_handler) (bundle *, void *), void *data)
68 if (aul_handler != NULL)
69 aul_register_key_init_callback(aul_handler, data);
71 fd = aul_initialize();
75 src = g_source_new(&funcs, sizeof(GSource));
77 gpollfd = (GPollFD *) g_malloc(sizeof(GPollFD));
78 if (gpollfd == NULL) {
85 gpollfd->events = POLLIN;
88 g_source_add_poll(src, gpollfd);
89 g_source_set_callback(src, (GSourceFunc) __aul_glib_handler,
90 (gpointer) gpollfd, NULL);
91 g_source_set_priority(src, G_PRIORITY_LOW);
93 ret = g_source_attach(src, NULL);
102 SLPAPI int aul_key_reserve()
107 kb = bundle_create();
108 ret = app_send_cmd(AUL_UTIL_PID, APP_KEY_RESERVE, kb);
114 SLPAPI int aul_key_release()
119 kb = bundle_create();
120 ret = app_send_cmd(AUL_UTIL_PID, APP_KEY_RELEASE, kb);